Bug 12178: Fix tests not to depend on dateformat syspref

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
(cherry picked from commit e75d9befca)
Signed-off-by: Frédéric Demians <f.demians@tamil.fr>
(cherry picked from commit 008f50fccb)
Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
This commit is contained in:
Jonathan Druart 2016-06-21 12:31:40 +01:00 committed by Julian Maurice
parent a672593999
commit e028a28923
1 changed files with 6 additions and 4 deletions

View File

@ -15,6 +15,7 @@ use C4::Bookseller;
use C4::Biblio;
use C4::Budgets;
use Koha::DateUtils;
use t::lib::Mocks;
use t::lib::TestBuilder;
use Test::More tests => 48;
@ -190,6 +191,7 @@ subtest 'test_updateClaim' => sub {
plan tests => 11;
my $builder = t::lib::TestBuilder->new();
my $today = output_pref({ dt => dt_from_string, dateonly => 1 });
# Given ... nothing much
# When ... Then ...
my $result_0 = C4::Serials::updateClaim(undef);
@ -197,7 +199,7 @@ subtest 'test_updateClaim' => sub {
# Given ... 3 serial. 2 of them updated.
my $serialids_1 = [90980, 90981];
my $claimdate_1 = '2001/01/13'; # arbitrary date some time in the past.
my $claimdate_1 = dt_from_string('2001-01-13'); # arbitrary date some time in the past.
my $claim_count_1 = 5;
$builder->build({
@ -220,17 +222,17 @@ subtest 'test_updateClaim' => sub {
is($result_1, 2, 'Got the expected 2 from update claim with 2 serial ids');
my @late_or_missing_issues_1_0 = C4::Serials::GetLateOrMissingIssues(undef, $serialids_1->[0]);
isnt($late_or_missing_issues_1_0[0]->{claimdate}, $claimdate_1, 'Got the expected first different claim date from update claim');
is($late_or_missing_issues_1_0[0]->{claimdate}, $today, 'Got the expected first different claim date from update claim');
is($late_or_missing_issues_1_0[0]->{claims_count}, $claim_count_1+1, 'Got the expected first claim count from update claim');
is($late_or_missing_issues_1_0[0]->{status}, 7, 'Got the expected first claim status from update claim');
my @late_or_missing_issues_1_1 = C4::Serials::GetLateOrMissingIssues(undef, $serialids_1->[1]);
isnt($late_or_missing_issues_1_1[0]->{claimdate}, $claimdate_1, 'Got the expected second different claim date from update claim');
is($late_or_missing_issues_1_1[0]->{claimdate}, $today, 'Got the expected second different claim date from update claim');
is($late_or_missing_issues_1_1[0]->{claims_count}, $claim_count_1+1, 'Got the expected second claim count from update claim');
is($late_or_missing_issues_1_1[0]->{status}, 7, 'Got the expected second claim status from update claim');
my @late_or_missing_issues_1_2 = C4::Serials::GetLateOrMissingIssues(undef, 90982);
is($late_or_missing_issues_1_2[0]->{claimdate}, '13/01/2001', 'Got the expected unchanged claim date from update claim');
is($late_or_missing_issues_1_2[0]->{claimdate}, output_pref({ dt => $claimdate_1, dateonly => 1}), 'Got the expected unchanged claim date from update claim');
is($late_or_missing_issues_1_2[0]->{claims_count}, $claim_count_1, 'Got the expected unchanged claim count from update claim');
is($late_or_missing_issues_1_2[0]->{status}, 3, 'Got the expected unchanged claim status from update claim');
};