Bug 11221: (follow-up) add unit test to test handling empty strings as dates
[koha.git] / t / db_dependent / Members.t
index 58c0d37..4cc0a3e 100755 (executable)
@@ -6,7 +6,7 @@
 use strict;
 use warnings;
 
-use Test::More tests => 22;
+use Test::More tests => 23;
 use Data::Dumper;
 
 BEGIN {
@@ -29,7 +29,7 @@ my $PHONE             = "555-12123";
 # XXX should be randomised and checked against the database
 my $IMPOSSIBLE_CARDNUMBER = "XYZZZ999";
 
-my $INDEPENDENT_BRANCHES_PREF = 'IndependantBranches';
+my $INDEPENDENT_BRANCHES_PREF = 'IndependentBranches';
 
 # XXX make a non-commit transaction and rollback rather than insert/delete
 
@@ -59,6 +59,7 @@ my %data = (
     surname => $SURNAME,
     categorycode => $CATEGORYCODE,
     branchcode => $BRANCHCODE,
+    dateofbirth => ''
 );
 
 my $addmem=AddMember(%data);
@@ -74,6 +75,8 @@ ok ( $member->{firstname}    eq $FIRSTNAME    &&
      , "Got member")
   or diag("Mismatching member details: ".Dumper(\%data, $member));
 
+ok($member->{dateofbirth} eq '', "Empty dates handled correctly");
+
 $member->{firstname} = $CHANGED_FIRSTNAME;
 $member->{email}     = $EMAIL;
 $member->{ethnicity} = $ETHNICITY;
@@ -166,7 +169,7 @@ is ($notice_email, $EMAIL, "GetNoticeEmailAddress returns correct value when Aut
 C4::Context->set_preference( 'AutoEmailPrimaryAddress', 'emailpro' );
 C4::Context->clear_syspref_cache();
 
-my $notice_email = GetNoticeEmailAddress($member->{'borrowernumber'});
+$notice_email = GetNoticeEmailAddress($member->{'borrowernumber'});
 is ($notice_email, $EMAILPRO, "GetNoticeEmailAddress returns correct value when AutoEmailPrimaryAddress is emailpro");