Bug 12916 - Missing Test to demonstrate warnings.
authorMark Tompsett <mtompset@hotmail.com>
Wed, 22 Oct 2014 19:50:08 +0000 (15:50 -0400)
committerTomas Cohen Arazi <tomascohen@gmail.com>
Thu, 30 Oct 2014 03:31:26 +0000 (00:31 -0300)
Modifying C4/Tags.pm should have tests.

TEST PLAN
---------
1) Apply this test patch only.
2) prove -v t/db_dependent/Tags.t
   -- should see two warnings.
3) Apply the first patch.
4) prove -v t/db_dependent/Tags.t
   -- no warnings.

Signed-off-by: Chris <chris@bigballofwax.co.nz>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
t/db_dependent/Tags.t

index 5359e30..5612d3a 100755 (executable)
@@ -6,16 +6,23 @@
 use strict;
 use warnings;
 
-use Test::More tests => 30;
+use Test::More tests => 32;
 
 BEGIN {
         use_ok('C4::Tags');
 }
 
+# Check no tags case.
+my @tagsarray;
+my $tags = \@tagsarray;
+my ($min, $max) = C4::Tags::stratify_tags(0, $tags);
+is($min, 0, 'Empty array min');
+is($max, 0, 'Empty array max');
+
 # Simple 'sequential 5' test
-my $tags = make_tags(1,2,3,4,5);
+$tags = make_tags(1,2,3,4,5);
 my @strata = (0,1,2,3,4);
-my ($min, $max) = C4::Tags::stratify_tags(5, $tags);
+($min, $max) = C4::Tags::stratify_tags(5, $tags);
 check_tag_strata($tags, \@strata, 'Sequential 5');
 is($min, 0, 'Sequential 5 min');
 is($max, 4, 'Sequential 5 max');