Bug 929 : Follow up, shifting test
authorChris Cormack <chrisc@catalyst.net.nz>
Mon, 30 Jan 2012 23:37:43 +0000 (12:37 +1300)
committerPaul Poulain <paul.poulain@biblibre.com>
Tue, 7 Feb 2012 15:42:22 +0000 (16:42 +0100)
t/Koha_template_plugin_KohaDates.t [deleted file]
t/db_dependent/Koha_template_plugin_KohaDates.t [new file with mode: 0644]

diff --git a/t/Koha_template_plugin_KohaDates.t b/t/Koha_template_plugin_KohaDates.t
deleted file mode 100644 (file)
index f9a0e72..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-#!/usr/bin/perl
-#
-
-use strict;
-use warnings;
-use C4::Context;
-use C4::Dates;
-use Test::More tests => 5;
-
-BEGIN {
-        use_ok('Koha::Template::Plugin::KohaDates');
-}
-
-my $date = "1973-05-21";
-my $context = C4::Context->new();
-my $dateobj = C4::Dates->new();
-
-my $filter = Koha::Template::Plugin::KohaDates->new();
-ok ($filter, "new()");
-
-
-$context->set_preference( "dateformat", 'iso' );
-$context->clear_syspref_cache();
-$dateobj->reset_prefformat;
-
-my $filtered_date = $filter->filter($date);
-is ($filtered_date,$date, "iso conversion") or diag ("iso conversion fails");
-
-#$filter = Koha::Template::Plugin::KohaDates->new();
-$context->set_preference( "dateformat", 'us' );
-$context->clear_syspref_cache();
-$dateobj->reset_prefformat;
-
-$filtered_date = $filter->filter($date);
-is ($filtered_date,'05/21/1973', "us conversion") or diag ("us conversion fails $filtered_date");
-
-$context->set_preference( "dateformat", 'metric' );
-$context->clear_syspref_cache();
-$dateobj->reset_prefformat;
-
-$filtered_date = $filter->filter($date);
-is ($filtered_date,'21/05/1973', "metric conversion") or diag ("metric conversion fails $filtered_date");
diff --git a/t/db_dependent/Koha_template_plugin_KohaDates.t b/t/db_dependent/Koha_template_plugin_KohaDates.t
new file mode 100644 (file)
index 0000000..f9a0e72
--- /dev/null
@@ -0,0 +1,42 @@
+#!/usr/bin/perl
+#
+
+use strict;
+use warnings;
+use C4::Context;
+use C4::Dates;
+use Test::More tests => 5;
+
+BEGIN {
+        use_ok('Koha::Template::Plugin::KohaDates');
+}
+
+my $date = "1973-05-21";
+my $context = C4::Context->new();
+my $dateobj = C4::Dates->new();
+
+my $filter = Koha::Template::Plugin::KohaDates->new();
+ok ($filter, "new()");
+
+
+$context->set_preference( "dateformat", 'iso' );
+$context->clear_syspref_cache();
+$dateobj->reset_prefformat;
+
+my $filtered_date = $filter->filter($date);
+is ($filtered_date,$date, "iso conversion") or diag ("iso conversion fails");
+
+#$filter = Koha::Template::Plugin::KohaDates->new();
+$context->set_preference( "dateformat", 'us' );
+$context->clear_syspref_cache();
+$dateobj->reset_prefformat;
+
+$filtered_date = $filter->filter($date);
+is ($filtered_date,'05/21/1973', "us conversion") or diag ("us conversion fails $filtered_date");
+
+$context->set_preference( "dateformat", 'metric' );
+$context->clear_syspref_cache();
+$dateobj->reset_prefformat;
+
+$filtered_date = $filter->filter($date);
+is ($filtered_date,'21/05/1973', "metric conversion") or diag ("metric conversion fails $filtered_date");