Bug 22008: Add tests for new constraints
[koha.git] / t / Koha.t
index 500dcb5..b8d4346 100755 (executable)
--- a/t/Koha.t
+++ b/t/Koha.t
@@ -25,7 +25,7 @@ use Module::Load::Conditional qw/check_install/;
 
 BEGIN {
     if ( check_install( module => 'Test::DBIx::Class' ) ) {
-        plan tests => 37;
+        plan tests => 38;
     } else {
         plan skip_all => "Need Test::DBIx::Class"
     }
@@ -33,12 +33,7 @@ BEGIN {
 
 use_ok('C4::Koha');
 
-use Test::DBIx::Class {
-    schema_class => 'Koha::Schema',
-    connect_info => ['dbi:SQLite:dbname=:memory:','',''],
-    connect_opts => { name_sep => '.', quote_char => '`', },
-    fixture_class => '::Populate',
-}, 'Branch' ;
+use Test::DBIx::Class;
 
 sub fixtures {
     my ( $libraries ) = @_;
@@ -52,6 +47,7 @@ sub fixtures {
 
 my $db = Test::MockModule->new('Koha::Database');
 $db->mock( _new_schema => sub { return Schema(); } );
+Koha::Database::flush_schema_cache();
 
 my $libraries = [
     ['XXX_test', 'my branchname XXX'],
@@ -152,6 +148,6 @@ eval {
 ok($@ eq '', 'NormalizeISSN does not throw exception when parsing invalid ISSN');
 
 @issns = GetVariationsOfISSNs('abc');
-is(scalar(@issns), 0, 'zero variations returned of invalid ISSN');
+is($issns[0], 'abc', 'Original ISSN passed through even if invalid');
+is(scalar(@issns), 1, 'zero additional variations returned of invalid ISSN');
 
-1;