8 use Test
::More tests
=> 5;
11 use_ok
('Koha::Template::Plugin::KohaDates');
14 my $date = "1973-05-21";
15 my $context = C4
::Context
->new();
16 my $dateobj = C4
::Dates
->new();
18 my $filter = Koha
::Template
::Plugin
::KohaDates
->new();
19 ok
($filter, "new()");
22 $context->set_preference( "dateformat", 'iso' );
23 $context->clear_syspref_cache();
24 $dateobj->reset_prefformat;
26 my $filtered_date = $filter->filter($date);
27 is
($filtered_date,$date, "iso conversion") or diag
("iso conversion fails");
29 #$filter = Koha::Template::Plugin::KohaDates->new();
30 $context->set_preference( "dateformat", 'us' );
31 $context->clear_syspref_cache();
32 $dateobj->reset_prefformat;
34 $filtered_date = $filter->filter($date);
35 is
($filtered_date,'05/21/1973', "us conversion") or diag
("us conversion fails $filtered_date");
37 $context->set_preference( "dateformat", 'metric' );
38 $context->clear_syspref_cache();
39 $dateobj->reset_prefformat;
41 $filtered_date = $filter->filter($date);
42 is
($filtered_date,'21/05/1973', "metric conversion") or diag
("metric conversion fails $filtered_date");