Bugzilla – Attachment 43218 Details for
Bug 14977
Remove C4::Dates from files t/db_dependent/*.t
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 14977 - Remove C4::Dates from files t/db_dependent/*.t
Bug-14977---Remove-C4Dates-from-files-tdbdependent.patch (text/plain), 5.56 KB, created by
Marc Véron
on 2015-10-07 22:17:29 UTC
(
hide
)
Description:
Bug 14977 - Remove C4::Dates from files t/db_dependent/*.t
Filename:
MIME Type:
Creator:
Marc Véron
Created:
2015-10-07 22:17:29 UTC
Size:
5.56 KB
patch
obsolete
>From 6a87e2c9cfdb5aabb77e928f1ce770fdc2248045 Mon Sep 17 00:00:00 2001 >From: =?UTF-8?q?Marc=20V=C3=A9ron?= <veron@veron.ch> >Date: Thu, 8 Oct 2015 00:13:01 +0200 >Subject: [PATCH] Bug 14977 - Remove C4::Dates from files t/db_dependent/*.t > >This patch removes C4::Dates from following files: > >- t/db_dependent/Budgets.t >- t/db_dependent/Holds.t >- t/db_dependent/Koha_template_plugin_KohaDates.t >- t/db_dependent/Log.t >- t/db_dependent/NewsChannels.t > >To test: >- First run all tests above >- Apply patch >- Then run tests again. The results should be the same. > (Note: I get 2 fails with NewsChannels.t, they are the same with > and without patch). >--- > t/db_dependent/Budgets.t | 1 - > t/db_dependent/Holds.t | 3 ++- > t/db_dependent/Koha_template_plugin_KohaDates.t | 6 +----- > t/db_dependent/Log.t | 8 ++++---- > t/db_dependent/NewsChannels.t | 11 ++++++----- > 5 files changed, 13 insertions(+), 16 deletions(-) > >diff --git a/t/db_dependent/Budgets.t b/t/db_dependent/Budgets.t >index 4e51ecd..5147002 100755 >--- a/t/db_dependent/Budgets.t >+++ b/t/db_dependent/Budgets.t >@@ -8,7 +8,6 @@ use C4::Context; > use C4::Biblio; > use C4::Bookseller; > use C4::Acquisition; >-use C4::Dates; > use C4::Members qw( AddMember ); > > use Koha::Acquisition::Order; >diff --git a/t/db_dependent/Holds.t b/t/db_dependent/Holds.t >index 9a44084..203e715 100755 >--- a/t/db_dependent/Holds.t >+++ b/t/db_dependent/Holds.t >@@ -133,8 +133,9 @@ ModReserve({ > rank => '4', > branchcode => $branch_1, > itemnumber => $itemnumber, >- suspend_until => C4::Dates->new("2013-01-01","iso")->output(), >+ suspend_until => output_pref( { dt => dt_from_string( "2013-01-01", "iso" ), dateonly => 1 } ), > }); >+ > $reserve = GetReserve( $reserve_id ); > ok( $reserve->{'priority'} eq '4', "Test GetReserve(), priority changed correctly" ); > ok( $reserve->{'suspend'}, "Test GetReserve(), suspend hold" ); >diff --git a/t/db_dependent/Koha_template_plugin_KohaDates.t b/t/db_dependent/Koha_template_plugin_KohaDates.t >index e45427e..d48e3c9 100644 >--- a/t/db_dependent/Koha_template_plugin_KohaDates.t >+++ b/t/db_dependent/Koha_template_plugin_KohaDates.t >@@ -2,7 +2,7 @@ > > use Modern::Perl; > use C4::Context; >-use C4::Dates; >+use Koha::DateUtils; > use Test::More tests => 7; > use Test::MockModule; > >@@ -14,14 +14,12 @@ my $module_context = new Test::MockModule('C4::Context'); > > 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"); >@@ -29,14 +27,12 @@ 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/Log.t b/t/db_dependent/Log.t >index cbd8937..e5ef418 100644 >--- a/t/db_dependent/Log.t >+++ b/t/db_dependent/Log.t >@@ -8,9 +8,9 @@ use strict; > use warnings; > use Test::More tests => 7; > >-# We need C4::Dates to handle the dates >-use C4::Dates; > use C4::Context; >+use Koha::DateUtils; >+ > use t::lib::Mocks qw/mock_preference/; # to mock CronjobLog > use Data::Dumper; > >@@ -43,8 +43,8 @@ ok($success, "GetLogs returns results for an open search"); > > eval { > # FIXME: US formatted date hardcoded into test for now >- my $date = C4::Dates->new(); >- $success = scalar(@{GetLogs($date->today(),$date->today(),"",undef,undef,"","")}); >+ my $date = output_pref( { dt => dt_from_string, datenonly => 1, dateformat => 'iso' } ); >+ $success = scalar(@{GetLogs( $date, $date, "", undef, undef, "", "") } ); > } or do { > diag($@); > $success = 0; >diff --git a/t/db_dependent/NewsChannels.t b/t/db_dependent/NewsChannels.t >index f0a86e0..0a523fa 100644 >--- a/t/db_dependent/NewsChannels.t >+++ b/t/db_dependent/NewsChannels.t >@@ -1,8 +1,9 @@ > #!/usr/bin/perl > > use Modern::Perl; >-use C4::Dates qw(format_date); > use C4::Branch qw(GetBranchName); >+use Koha::DateUtils; >+ > use Test::More tests => 10; > > BEGIN { >@@ -81,10 +82,10 @@ $rv = upd_opac_new($href_entry2); > ok( $rv == 1, 'Successfully updated second dummy news item!' ); > > # Test get_opac_new (single news item) >-$timestamp1 = format_date($timestamp1); >-$expirationdate1 = format_date($expirationdate1); >-$timestamp2 = format_date($timestamp2); >-$expirationdate2 = format_date($expirationdate2); >+$timestamp1 = output_pref( { dt => dt_from_string( $timestamp1 ), dateonly => 1, dateformat => 'iso' } ); >+$expirationdate1 = output_pref( { dt => dt_from_string( $expirationdate1 ), dateonly => 1, dateformat => 'iso' } ); >+$timestamp2 = output_pref( { dt => dt_from_string( $timestamp2 ), dateonly => 1, dateformat => 'iso' } ); >+$expirationdate2 = output_pref( { dt => dt_from_string( $expirationdate2) , dateonly => 1, dateformat => 'iso' } ); > > is_deeply( > get_opac_new($idnew1), >-- >1.7.10.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 14977
:
43218
|
44008
|
44009
|
44010
|
44100
|
44121
|
44122