Bugzilla – Attachment 39980 Details for
Bug 14362
PEGI 15 Circulation/AgeRestrictionMarkers test fails
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 14362: Regression tests
Bug-14362-Regression-tests.patch (text/plain), 3.55 KB, created by
Mark Tompsett
on 2015-06-08 04:43:44 UTC
(
hide
)
Description:
Bug 14362: Regression tests
Filename:
MIME Type:
Creator:
Mark Tompsett
Created:
2015-06-08 04:43:44 UTC
Size:
3.55 KB
patch
obsolete
>From 1533de1a120a4b95443c55780187238fe247e44e Mon Sep 17 00:00:00 2001 >From: Mark Tompsett <mtompset@hotmail.com> >Date: Sun, 7 Jun 2015 23:40:50 -0400 >Subject: [PATCH] Bug 14362: Regression tests > >This should trigger the error. Attempting shifting system >time zones did not make sense as to the number of failures. > >TEST PLAN >--------- >1) sudo apt-get install libtime-fake-perl >2) apply test patch >3) prove t/Circulation/AgeRestrictionMarkers.t > -- should fail some times. >4) apply fix patch >5) prove t/Circulation/AgeRestrictionMarkers.t > -- should work all the time. >6) koha qa test tools. >--- > t/Circulation/AgeRestrictionMarkers.t | 39 +++++++++++++++++++++-------------- > 1 file changed, 23 insertions(+), 16 deletions(-) > >diff --git a/t/Circulation/AgeRestrictionMarkers.t b/t/Circulation/AgeRestrictionMarkers.t >index 750bf9b..c46f99e 100644 >--- a/t/Circulation/AgeRestrictionMarkers.t >+++ b/t/Circulation/AgeRestrictionMarkers.t >@@ -1,8 +1,10 @@ > #!/usr/bin/perl > > use Modern::Perl; >+use Time::Fake; >+ > use DateTime; >-use Test::More tests => 10; >+use Test::More tests => 125; > > use t::lib::Mocks; > >@@ -17,18 +19,23 @@ is ( C4::Circulation::GetAgeRestriction('Age 16'), '16', 'Age 16 returns 16' ); > is ( C4::Circulation::GetAgeRestriction('K16'), '16', 'K16 returns 16' ); > > >-##Testing age restriction for a borrower. >-my $now = DateTime->now(); >-my $borrower = {}; >-C4::Members::SetAge( $borrower, '0015-00-00' ); >- >-my ($restriction_age, $daysToAgeRestriction) = C4::Circulation::GetAgeRestriction('FSK 16', $borrower); >-is ( ($daysToAgeRestriction > 0), 1, 'FSK 16 blocked for a 15 year old' ); >-($restriction_age, $daysToAgeRestriction) = C4::Circulation::GetAgeRestriction('PEGI 15', $borrower); >-is ( ($daysToAgeRestriction <= 0), 1, 'PEGI 15 allowed for a 15 year old' ); >-($restriction_age, $daysToAgeRestriction) = C4::Circulation::GetAgeRestriction('PEGI14', $borrower); >-is ( ($daysToAgeRestriction <= 0), 1, 'PEGI14 allowed for a 15 year old' ); >-($restriction_age, $daysToAgeRestriction) = C4::Circulation::GetAgeRestriction('Age 10', $borrower); >-is ( ($daysToAgeRestriction <= 0), 1, 'Age 10 allowed for a 15 year old' ); >-($restriction_age, $daysToAgeRestriction) = C4::Circulation::GetAgeRestriction('K18', $borrower); >-is ( ($daysToAgeRestriction > 0), 1, 'K18 blocked for a 15 year old' ); >\ No newline at end of file >+my $offset = 0; >+while ($offset<24) { >+ Time::Fake->offset("+${offset}h"); >+ ##Testing age restriction for a borrower. >+ my $now = DateTime->now(); >+ my $borrower = {}; >+ C4::Members::SetAge( $borrower, '0015-00-00' ); >+ >+ my ($restriction_age, $daysToAgeRestriction) = C4::Circulation::GetAgeRestriction('FSK 16', $borrower); >+ is ( ($daysToAgeRestriction > 0), 1, 'FSK 16 blocked for a 15 year old - $offset hours' ); >+ ($restriction_age, $daysToAgeRestriction) = C4::Circulation::GetAgeRestriction('PEGI 15', $borrower); >+ is ( ($daysToAgeRestriction <= 0), 1, 'PEGI 15 allowed for a 15 year old - $offset hours' ); >+ ($restriction_age, $daysToAgeRestriction) = C4::Circulation::GetAgeRestriction('PEGI14', $borrower); >+ is ( ($daysToAgeRestriction <= 0), 1, 'PEGI14 allowed for a 15 year old - $offset hours' ); >+ ($restriction_age, $daysToAgeRestriction) = C4::Circulation::GetAgeRestriction('Age 10', $borrower); >+ is ( ($daysToAgeRestriction <= 0), 1, 'Age 10 allowed for a 15 year old - $offset hours' ); >+ ($restriction_age, $daysToAgeRestriction) = C4::Circulation::GetAgeRestriction('K18', $borrower); >+ is ( ($daysToAgeRestriction > 0), 1, 'K18 blocked for a 15 year old - $offset hours' ); >+ $offset++; >+} >-- >2.1.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 14362
:
39969
|
39977
|
39978
|
39979
|
39980
|
40111
|
40112
|
40325
|
40326
|
42163
|
42164
|
42172
|
42173
|
42174
|
50555
|
50556
|
50593
|
50594
|
50595