Bug 14637: Fix add patron category under MySQL 5.7 - tests
[koha.git] / t / Koha.t
index 21cbf68..e617146 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 => 31;
+        plan tests => 38;
     } else {
         plan skip_all => "Need Test::DBIx::Class"
     }
@@ -138,4 +138,21 @@ subtest 'getFacets() tests' => sub {
     );
 };
 
+is(C4::Koha::NormalizeISSN({ issn => '0024-9319', strip_hyphen => 1 }), '00249319', 'Test NormalizeISSN with all features enabled' );
+is(C4::Koha::NormalizeISSN({ issn => '0024-9319', strip_hyphen => 0 }), '0024-9319', 'Test NormalizeISSN with all features enabled' );
+
+my @issns = qw/ 0024-9319 00249319 /;
+is( join('|', @issns), join('|', GetVariationsOfISSN('0024-9319')), 'GetVariationsOfISSN returns all variations' );
+is( join('|', @issns), join('|', GetVariationsOfISSNs('0024-9319')), 'GetVariationsOfISSNs returns all variations' );
+
+my $issn;
+eval {
+    $issn = C4::Koha::NormalizeISSN({ issn => '1234-5678', strip_hyphen => 1 });
+};
+ok($@ eq '', 'NormalizeISSN does not throw exception when parsing invalid ISSN');
+
+@issns = GetVariationsOfISSNs('abc');
+is($issns[0], 'abc', 'Original ISSN passed through even if invalid');
+is(scalar(@issns), 1, 'zero additional variations returned of invalid ISSN');
+
 1;