[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Koha-cvs] koha/t Date.t
From: |
Chris Cormack |
Subject: |
[Koha-cvs] koha/t Date.t |
Date: |
Sun, 24 Jun 2007 22:48:51 +0000 |
CVSROOT: /sources/koha
Module name: koha
Changes by: Chris Cormack <rangi> 07/06/24 22:48:51
Modified files:
t : Date.t
Log message:
Adding more tests, it now tests the exported functions
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/koha/t/Date.t?cvsroot=koha&r1=1.1&r2=1.2
Patches:
Index: Date.t
===================================================================
RCS file: /sources/koha/koha/t/Date.t,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- Date.t 18 Jun 2007 03:20:19 -0000 1.1
+++ Date.t 24 Jun 2007 22:48:50 -0000 1.2
@@ -1,5 +1,64 @@
-BEGIN { $| = 1; print "1..1\n"; }
+BEGIN { $| = 1; print "1..4\n"; }
END {print "not ok 1\n" unless $loaded;}
use C4::Date;
$loaded = 1;
print "ok 1\n";
+
+# testing format_date_in_iso
+my $format= display_date_format ();
+my $date;
+if ($format eq 'mm/dd/yyyy'){
+ $date = '05/21/1973';
+}
+elsif ($format eq 'dd/mm/yyyy'){
+ $date = '21/05/1973';
+}
+elsif ($format eq 'yyyy-mm-dd'){
+ $date = '1973-05-21';
+}
+$date=format_date_in_iso($date);
+if ($date eq '1973-05-21'){
+ print "ok 2\n";
+}
+else {
+ print "not ok 2\n";
+}
+
+# test format date
+$date=format_date($date);
+if ($format eq 'mm/dd/yyyy'){
+ if ($date eq '05/21/1973'){
+ print "ok 3\n";
+ }
+ else {
+ print "not ok 3\n";
+ }
+}
+elsif ($format eq 'dd/mm/yyyy'){
+ if ($date eq '21/05/1973'){
+ print "ok 3\n";
+ }
+ else {
+ print "not ok 3\n";
+ }
+}
+elsif ($format eq 'yyyy-mm-dd'){
+ if ($date eq '1973-05-21'){
+ print "ok 3\n";
+ }
+ else {
+ print "not ok 3\n";
+ }
+}
+else {
+ print "not ok3\n";
+}
+
+# test 4 fixdate
+
+($date,$invaliddate) = fixdate('2007','06','31');
+if ($invaliddate){
+ print "ok 4\n";
+} else {
+ print "not ok 4\n";
+}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Koha-cvs] koha/t Date.t,
Chris Cormack <=