Koha/t/Date.t
Andrew Moore db755a4307 bug 2088: test suite refactoring to deal with t/override_context_prefs.pm
Some minor changes to get the test suite working a bit better:
I removed a superfluous method from t/lib/KohaTest.pm.
I made each barcode for the items added in KohaTest.pm unique so that they would actually get inserted.

Then, I removed t/override_context_prefs.pm. If you need that functionality, you're a database
dependent test and should be a module in t/lib.
So, I deleted all of the trivial .t tests that just 'use'd their modules and had no other
tests and replaced them with lib/KohaTest/*pm modules that do a little bit more checking
on those modules.
I removed the references to override_context_prefs.pm in all of the other .t modules.
They all pass now with no override_context_prefs.pm module.

The database_depenedent.pl test script still does not pass entirely. There's a problem with the zebra index
not being reset each time that the tables are truncated. I'll get to that.

no functional or documentation changes here.

Signed-off-by: Joshua Ferraro <jmf@liblime.com>
2008-05-11 06:48:40 -05:00

48 lines
981 B
Perl
Executable file

print "WARNING: This module (C4::Date) is obsolete.
Developers should use C4::Dates instead!\n";
use strict;
use warnings;
use Test::More tests => 4;
BEGIN {
use FindBin;
use lib $FindBin::Bin;
use_ok('C4::Date');
}
# testing format_date_in_iso
my $format= display_date_format ();
my $date;
my $invaliddate;
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);
is($date, '1973-05-21', 'format_date_in_iso');
# test format date
$date=format_date($date);
if ($format eq 'mm/dd/yyyy'){
is($date, '05/21/1973', 'format_date');
}
elsif ($format eq 'dd/mm/yyyy'){
is($date, '21/05/1973', 'format_date');
}
elsif ($format eq 'yyyy-mm-dd'){
is($date, '1973-05-21', 'format_date');
}
# test 4 fixdate
($date,$invaliddate) = fixdate('2007','06','31');
if ($invaliddate){
ok($invaliddate, 'fixdate');
}