Bugzilla – Attachment 57777 Details for
Bug 17678
C4::Acquisition - Replace GetIssues with Koha::Checkouts
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
[SIGNED-OFF] Bug 17678: Add tests for CanBookBeIssued + AllowMultipleIssuesOnABiblio
SIGNED-OFF-Bug-17678-Add-tests-for-CanBookBeIssued.patch (text/plain), 3.94 KB, created by
Josef Moravec
on 2016-11-26 08:51:34 UTC
(
hide
)
Description:
[SIGNED-OFF] Bug 17678: Add tests for CanBookBeIssued + AllowMultipleIssuesOnABiblio
Filename:
MIME Type:
Creator:
Josef Moravec
Created:
2016-11-26 08:51:34 UTC
Size:
3.94 KB
patch
obsolete
>From 6209f53ad2d58b4493cf86fa3f01dea13e3ee47d Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Fri, 25 Nov 2016 11:06:25 +0100 >Subject: [PATCH] [SIGNED-OFF] Bug 17678: Add tests for CanBookBeIssued + > AllowMultipleIssuesOnABiblio > >Signed-off-by: Josef Moravec <josef.moravec@gmail.com> >--- > t/db_dependent/Circulation.t | 60 +++++++++++++++++++++++++++++++++++++++++++- > 1 file changed, 59 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/Circulation.t b/t/db_dependent/Circulation.t >index f29dcd0..5ba718d 100755 >--- a/t/db_dependent/Circulation.t >+++ b/t/db_dependent/Circulation.t >@@ -17,7 +17,7 @@ > > use Modern::Perl; > >-use Test::More tests => 90; >+use Test::More tests => 91; > > BEGIN { > require_ok('C4::Circulation'); >@@ -36,6 +36,7 @@ use C4::Reserves; > use C4::Overdues qw(UpdateFine CalcFine); > use Koha::DateUtils; > use Koha::Database; >+use Koha::Subscriptions; > > my $schema = Koha::Database->schema; > $schema->storage->txn_begin; >@@ -1248,6 +1249,63 @@ subtest 'CanBookBeIssued + Koha::Patron->is_debarred|has_overdues' => sub { > is( $error->{USERBLOCKEDNOENDDATE}, '9999-12-31' ); > }; > >+subtest 'CanBookBeIssued + AllowMultipleIssuesOnABiblio' => sub { >+ plan tests => 5; >+ >+ my $library = $builder->build( { source => 'Branch' } ); >+ my $patron = $builder->build( { source => 'Borrower' } ); >+ >+ my $biblioitem = $builder->build( { source => 'Biblioitem' } ); >+ my $biblionumber = $biblioitem->{biblionumber}; >+ my $item_1 = $builder->build( >+ { source => 'Item', >+ value => { >+ homebranch => $library->{branchcode}, >+ holdingbranch => $library->{branchcode}, >+ notforloan => 0, >+ itemlost => 0, >+ withdrawn => 0, >+ biblionumber => $biblionumber, >+ } >+ } >+ ); >+ my $item_2 = $builder->build( >+ { source => 'Item', >+ value => { >+ homebranch => $library->{branchcode}, >+ holdingbranch => $library->{branchcode}, >+ notforloan => 0, >+ itemlost => 0, >+ withdrawn => 0, >+ biblionumber => $biblionumber, >+ } >+ } >+ ); >+ >+ my ( $error, $question, $alerts ); >+ my $issue = AddIssue( $patron, $item_1->{barcode}, dt_from_string->add( days => 1 ) ); >+ >+ t::lib::Mocks::mock_preference('AllowMultipleIssuesOnABiblio', 0); >+ ( $error, $question, $alerts ) = CanBookBeIssued( $patron, $item_2->{barcode} ); >+ is( keys(%$error) + keys(%$alerts), 0, 'No error or alert should be raised' ); >+ is( $question->{BIBLIO_ALREADY_ISSUED}, 1, 'BIBLIO_ALREADY_ISSUED question flag should be set if AllowMultipleIssuesOnABiblio=0 and issue already exists' ); >+ >+ t::lib::Mocks::mock_preference('AllowMultipleIssuesOnABiblio', 1); >+ ( $error, $question, $alerts ) = CanBookBeIssued( $patron, $item_2->{barcode} ); >+ is( keys(%$error) + keys(%$question) + keys(%$alerts), 0, 'No BIBLIO_ALREADY_ISSUED flag should be set if AllowMultipleIssuesOnABiblio=1' ); >+ >+ # Add a subscription >+ Koha::Subscription->new({ biblionumber => $biblionumber })->store; >+ >+ t::lib::Mocks::mock_preference('AllowMultipleIssuesOnABiblio', 0); >+ ( $error, $question, $alerts ) = CanBookBeIssued( $patron, $item_2->{barcode} ); >+ is( keys(%$error) + keys(%$question) + keys(%$alerts), 0, 'No BIBLIO_ALREADY_ISSUED flag should be set if it iss a subscription' ); >+ >+ t::lib::Mocks::mock_preference('AllowMultipleIssuesOnABiblio', 1); >+ ( $error, $question, $alerts ) = CanBookBeIssued( $patron, $item_2->{barcode} ); >+ is( keys(%$error) + keys(%$question) + keys(%$alerts), 0, 'No BIBLIO_ALREADY_ISSUED flag should be set if it iss a subscription' ); >+}; >+ > sub set_userenv { > my ( $library ) = @_; > C4::Context->set_userenv(0,0,0,'firstname','surname', $library->{branchcode}, $library->{branchname}, '', '', ''); >-- >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 17678
:
57767
|
57768
|
57777
|
57778
|
57903
|
57904
|
57905
|
58294