Bugzilla – Attachment 56235 Details for
Bug 16850
Move IsMemberBlocked to Koha::Patron
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 16850: Add test coverage for CanBookBeIssued
Bug-16850-Add-test-coverage-for-CanBookBeIssued.patch (text/plain), 3.58 KB, created by
Tomás Cohen Arazi (tcohen)
on 2016-10-12 09:06:48 UTC
(
hide
)
Description:
Bug 16850: Add test coverage for CanBookBeIssued
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2016-10-12 09:06:48 UTC
Size:
3.58 KB
patch
obsolete
>From 2cc7f9c548401ce1419f9be85f6a11bde6276f5d Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Mon, 4 Jul 2016 12:19:46 +0100 >Subject: [PATCH] Bug 16850: Add test coverage for CanBookBeIssued > >Signed-off-by: Owen Leonard <oleonard@myacpl.org> >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >--- > t/db_dependent/Circulation.t | 61 ++++++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 61 insertions(+) > >diff --git a/t/db_dependent/Circulation.t b/t/db_dependent/Circulation.t >index 1433f4e..86cbcba 100755 >--- a/t/db_dependent/Circulation.t >+++ b/t/db_dependent/Circulation.t >@@ -1088,6 +1088,67 @@ subtest 'AddIssue & AllowReturnToBranch' => sub { > # TODO t::lib::Mocks::mock_preference('AllowReturnToBranch', 'homeorholdingbranch'); > }; > >+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 $biblioitem_1 = $builder->build( { source => 'Biblioitem' } ); >+ my $item_1 = $builder->build( >+ { source => 'Item', >+ value => { >+ homebranch => $library->{branchcode}, >+ holdingbranch => $library->{branchcode}, >+ notforloan => 0, >+ itemlost => 0, >+ withdrawn => 0, >+ biblionumber => $biblioitem_1->{biblionumber} >+ } >+ } >+ ); >+ my $biblioitem_2 = $builder->build( { source => 'Biblioitem' } ); >+ my $item_2 = $builder->build( >+ { source => 'Item', >+ value => { >+ homebranch => $library->{branchcode}, >+ holdingbranch => $library->{branchcode}, >+ notforloan => 0, >+ itemlost => 0, >+ withdrawn => 0, >+ biblionumber => $biblioitem_2->{biblionumber} >+ } >+ } >+ ); >+ >+ my ( $error, $question, $alerts ); >+ >+ # Patron cannot issue item_1, he has overdues >+ my $yesterday = DateTime->today( time_zone => C4::Context->tz() )->add( days => -1 ); >+ my $issue = AddIssue( $patron, $item_1->{barcode}, $yesterday ); # Add an overdue >+ >+ 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 ); >+ >+ 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 ); >+ >+ # Patron cannot issue item_1, he is 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 } ) ); >+ >+ 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' ); >+}; > > sub set_userenv { > my ( $library ) = @_; >-- >2.10.1
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 16850
:
53095
|
53096
|
53247
|
53512
|
53513
|
54005
|
54006
|
55686
|
55687
| 56235 |
56236
|
56743