adding a new option, -w, which disables shadow indexing for the current batch (faster...
[koha.git] / t / Date.t
1 print "WARNING: This module (C4::Date) is obsolete.  
2 Developers should use C4::Dates instead!\n";
3
4 BEGIN { $| = 1; print "1..4\n"; }
5 END {print "not ok 1\n" unless $loaded;}
6 use C4::Date;
7 $loaded = 1;
8 print "ok 1\n";
9
10 # testing format_date_in_iso
11 my $format= display_date_format ();
12 my $date;
13 if ($format eq 'mm/dd/yyyy'){
14    $date = '05/21/1973';
15 }
16 elsif ($format eq 'dd/mm/yyyy'){   
17    $date = '21/05/1973';
18 }
19 elsif ($format eq 'yyyy-mm-dd'){
20    $date = '1973-05-21';
21 }
22 $date=format_date_in_iso($date);
23 if ($date eq '1973-05-21'){
24   print "ok 2\n";
25 }
26 else {
27   print "not ok 2\n";
28 }
29
30 # test format date
31 $date=format_date($date);
32 if ($format eq 'mm/dd/yyyy'){
33   if ($date eq '05/21/1973'){
34     print "ok 3\n";
35   }
36   else {
37     print "not ok 3\n";
38   }
39 }
40 elsif ($format eq 'dd/mm/yyyy'){
41   if ($date eq '21/05/1973'){
42     print "ok 3\n";
43   }
44   else {
45     print "not ok 3\n";
46   }
47 }
48 elsif ($format eq 'yyyy-mm-dd'){
49   if ($date eq '1973-05-21'){
50     print "ok 3\n";
51   }
52   else {
53     print "not ok 3\n";
54   }
55 }
56 else {
57   print "not ok3\n";
58 }
59
60 # test 4 fixdate
61
62 ($date,$invaliddate) = fixdate('2007','06','31');
63 if ($invaliddate){
64   print "ok 4\n";
65 } else {
66   print "not ok 4\n";
67 }