Bugzilla – Attachment 41682 Details for
Bug 14693
t/db_dependent/Contract.t fails do to fixed date
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 14693: Contract.t should generate dates based on current date
Bug-14693-Contractt-should-generate-dates-based-on.patch (text/plain), 2.09 KB, created by
Tomás Cohen Arazi (tcohen)
on 2015-08-19 17:25:05 UTC
(
hide
)
Description:
Bug 14693: Contract.t should generate dates based on current date
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2015-08-19 17:25:05 UTC
Size:
2.09 KB
patch
obsolete
>From 9434b651377bfbf9608675e4a347ea4e61a66a4e Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@unc.edu.ar> >Date: Wed, 19 Aug 2015 11:01:32 -0300 >Subject: [PATCH] Bug 14693: Contract.t should generate dates based on current > date > >The current test for still-active contracts fails because it was written >with fixed dates, which already passed :-D > >This patch calculates the current date, and uses it to generate a future >one, so the tests serve their purpose no matter what the current date is. > >To test: >- Run: > $ prove t/db_dependent/Contract.t >=> FAIL: activeonly compares contractenddate with now(), and fails > because a fixed 2015-07-31 is writteng on the test data >- Apply the patch >- Run: > $ prove t/db_dependent/Contract.t >=> SUCCESS: the sample data has been calculated using the current date > and the tests pass. >- Sign off :-D >--- > t/db_dependent/Contract.t | 8 ++++++-- > 1 file changed, 6 insertions(+), 2 deletions(-) > >diff --git a/t/db_dependent/Contract.t b/t/db_dependent/Contract.t >index 7439873..3fa3b48 100644 >--- a/t/db_dependent/Contract.t >+++ b/t/db_dependent/Contract.t >@@ -18,8 +18,10 @@ > # along with Koha; if not, see <http://www.gnu.org/licenses>. > > use Modern::Perl; >+ > use C4::Context; > use C4::Bookseller; >+use Koha::DateUtils; > > use Test::More tests => 43; > >@@ -70,10 +72,12 @@ is( $contract->{contractname}, $my_contract1->{contractname}, 'AddContract store > is( $contract->{contractdescription}, $my_contract1->{contractdescription}, 'AddContract stores the contract description correctly.' ); > is( $contract->{booksellerid}, $my_contract1->{booksellerid}, 'AddContract stores the bookseller id correctly.' ); > >+my $now = dt_from_string; >+my $three_more_days = $now + DateTime::Duration->new( days => 3 ); > > $my_contract1 = { >- contractstartdate => '2015-07-02', >- contractenddate => '2015-07-31', >+ contractstartdate => $now->ymd, >+ contractenddate => $three_more_days->ymd, > contractname => 'My modified contract name', > contractdescription => 'My modified contract description', > booksellerid => $bookseller_id2, >-- >2.5.0
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 14693
:
41682
|
41715
|
41785
|
41786