Bugzilla – Attachment 65357 Details for
Bug 19009
Circulation.t is still failing randomly
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 19009: Fix random failures from Circulation.t
Bug-19009-Fix-random-failures-from-Circulationt.patch (text/plain), 4.60 KB, created by
Jonathan Druart
on 2017-07-31 15:12:15 UTC
(
hide
)
Description:
Bug 19009: Fix random failures from Circulation.t
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2017-07-31 15:12:15 UTC
Size:
4.60 KB
patch
obsolete
>From 490e91feb6a69480b8a51df7bc4c5ffda2ad334e Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Mon, 31 Jul 2017 11:18:23 -0300 >Subject: [PATCH] Bug 19009: Fix random failures from Circulation.t > >From jenkins output: > Subtest: CanBookBeIssued + Koha::Patron->is_debarred<7c>has_overdues >1..8 >not ok 1 >[SKIP] > >I executed it several times and display the different $error, $alerts and question keys. >GNA and RESTRICTED were sometimes set, which block the issue. >Reading the code it seems that some patron's attributes must be removed to avoid the checkin rejection. > >Test plan: >Execute the tests several times and notice that it fails randomly >With this patch they should always pass. >--- > t/db_dependent/Circulation.t | 20 +++++++++++--------- > 1 file changed, 11 insertions(+), 9 deletions(-) > >diff --git a/t/db_dependent/Circulation.t b/t/db_dependent/Circulation.t >index 9319924..4e8da01 100755 >--- a/t/db_dependent/Circulation.t >+++ b/t/db_dependent/Circulation.t >@@ -1285,7 +1285,7 @@ subtest 'CanBookBeIssued + Koha::Patron->is_debarred|has_overdues' => sub { > plan tests => 8; > > my $library = $builder->build( { source => 'Branch' } ); >- my $patron = $builder->build( { source => 'Borrower' } ); >+ my $patron = $builder->build( { source => 'Borrower', value => { gonenoaddress => undef, lost => undef, debarred => undef, borrowernotes => "" } } ); > > my $biblioitem_1 = $builder->build( { source => 'Biblioitem' } ); > my $item_1 = $builder->build( >@@ -1296,6 +1296,7 @@ subtest 'CanBookBeIssued + Koha::Patron->is_debarred|has_overdues' => sub { > notforloan => 0, > itemlost => 0, > withdrawn => 0, >+ restricted => 0, > biblionumber => $biblioitem_1->{biblionumber} > } > } >@@ -1309,6 +1310,7 @@ subtest 'CanBookBeIssued + Koha::Patron->is_debarred|has_overdues' => sub { > notforloan => 0, > itemlost => 0, > withdrawn => 0, >+ restricted => 0, > biblionumber => $biblioitem_2->{biblionumber} > } > } >@@ -1322,25 +1324,25 @@ subtest 'CanBookBeIssued + Koha::Patron->is_debarred|has_overdues' => sub { > > t::lib::Mocks::mock_preference( 'OverduesBlockCirc', 'confirmation' ); > ( $error, $question, $alerts ) = CanBookBeIssued( $patron, $item_2->{barcode} ); >- is( keys(%$error) + keys(%$alerts), 0 ); >- is( $question->{USERBLOCKEDOVERDUE}, 1 ); >+ is( keys(%$error) + keys(%$alerts), 0, 'No key for error and alert ' . keys(%$error) . ' ' . keys(%$alerts) ); >+ is( $question->{USERBLOCKEDOVERDUE}, 1, 'OverduesBlockCirc=confirmation, USERBLOCKEDOVERDUE should be set for question' ); > > t::lib::Mocks::mock_preference( 'OverduesBlockCirc', 'block' ); > ( $error, $question, $alerts ) = CanBookBeIssued( $patron, $item_2->{barcode} ); >- is( keys(%$question) + keys(%$alerts), 0 ); >- is( $error->{USERBLOCKEDOVERDUE}, 1 ); >+ is( keys(%$question) + keys(%$alerts), 0, 'No key for question and alert ' . keys(%$question) . ' ' . keys(%$alerts) ); >+ is( $error->{USERBLOCKEDOVERDUE}, 1, 'OverduesBlockCirc=block, USERBLOCKEDOVERDUE should be set for error' ); > > # Patron cannot issue item_1, they are debarred > my $tomorrow = DateTime->today( time_zone => C4::Context->tz() )->add( days => 1 ); > Koha::Patron::Debarments::AddDebarment( { borrowernumber => $patron->{borrowernumber}, expiration => $tomorrow } ); > ( $error, $question, $alerts ) = CanBookBeIssued( $patron, $item_2->{barcode} ); >- is( keys(%$question) + keys(%$alerts), 0 ); >- is( $error->{USERBLOCKEDWITHENDDATE}, output_pref( { dt => $tomorrow, dateformat => 'sql', dateonly => 1 } ) ); >+ is( keys(%$question) + keys(%$alerts), 0, 'No key for question and alert ' . keys(%$question) . ' ' . keys(%$alerts) ); >+ is( $error->{USERBLOCKEDWITHENDDATE}, output_pref( { dt => $tomorrow, dateformat => 'sql', dateonly => 1 } ), 'USERBLOCKEDWITHENDDATE should be tomorrow' ); > > Koha::Patron::Debarments::AddDebarment( { borrowernumber => $patron->{borrowernumber} } ); > ( $error, $question, $alerts ) = CanBookBeIssued( $patron, $item_2->{barcode} ); >- is( keys(%$question) + keys(%$alerts), 0 ); >- is( $error->{USERBLOCKEDNOENDDATE}, '9999-12-31' ); >+ is( keys(%$question) + keys(%$alerts), 0, 'No key for question and alert ' . keys(%$question) . ' ' . keys(%$alerts) ); >+ is( $error->{USERBLOCKEDNOENDDATE}, '9999-12-31', 'USERBLOCKEDNOENDDATE should be 9999-12-31 for unlimited debarments' ); > }; > > subtest 'MultipleReserves' => sub { >-- >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 19009
:
65357
|
65373
|
65506
|
65507