Bugzilla – Attachment 109125 Details for
Bug 22789
Establish non-priority holds
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 22789: Add tests
Bug-22789-Add-tests.patch (text/plain), 3.42 KB, created by
Agustín Moyano
on 2020-08-25 18:14:11 UTC
(
hide
)
Description:
Bug 22789: Add tests
Filename:
MIME Type:
Creator:
Agustín Moyano
Created:
2020-08-25 18:14:11 UTC
Size:
3.42 KB
patch
obsolete
>From 1cfd335e028114157384812f8fb1a6eff39e79d0 Mon Sep 17 00:00:00 2001 >From: Agustin Moyano <agustinmoyano@theke.io> >Date: Wed, 19 Aug 2020 15:50:22 -0300 >Subject: [PATCH] Bug 22789: Add tests > >Signed-off-by: Lisette Scheer <lisettes@latahlibrary.org> >--- > t/db_dependent/Holds.t | 77 +++++++++++++++++++++++++++++++++++++++++- > t/lib/TestBuilder.pm | 3 ++ > 2 files changed, 79 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/Holds.t b/t/db_dependent/Holds.t >index 37da7b05f7..25793192e3 100755 >--- a/t/db_dependent/Holds.t >+++ b/t/db_dependent/Holds.t >@@ -7,19 +7,21 @@ use t::lib::TestBuilder; > > use C4::Context; > >-use Test::More tests => 66; >+use Test::More tests => 67; > use MARC::Record; > > use C4::Biblio; > use C4::Calendar; > use C4::Items; > use C4::Reserves; >+use C4::Circulation; > > use Koha::Biblios; > use Koha::CirculationRules; > use Koha::Database; > use Koha::DateUtils qw( dt_from_string output_pref ); > use Koha::Holds; >+use Koha::Checkout; > use Koha::Item::Transfer::Limits; > use Koha::Items; > use Koha::Libraries; >@@ -1251,3 +1253,76 @@ subtest 'CanItemBeReserved / pickup_not_in_hold_group' => sub { > > $schema->storage->txn_rollback; > }; >+ >+subtest 'non priority holds' => sub { >+ >+ plan tests => 4; >+ >+ $schema->storage->txn_begin; >+ >+ # Cleanup database >+ Koha::Holds->search->delete; >+ $dbh->do('DELETE FROM issues'); >+ Koha::CirculationRules->set_rules( >+ { >+ branchcode => undef, >+ categorycode => undef, >+ itemtype => undef, >+ rules => { >+ renewalsallowed => 5, >+ reservesallowed => 5, >+ } >+ } >+ ); >+ >+ my $item = $builder->build_sample_item; >+ >+ my $patron1 = $builder->build_object( >+ { >+ class => 'Koha::Patrons', >+ value => { branchcode => $item->homebranch } >+ } >+ ); >+ my $patron2 = $builder->build_object( >+ { >+ class => 'Koha::Patrons', >+ value => { branchcode => $item->homebranch } >+ } >+ ); >+ >+ Koha::Checkout->new( >+ { >+ borrowernumber => $patron1->borrowernumber, >+ itemnumber => $item->itemnumber, >+ branchcode => $item->homebranch >+ } >+ )->store; >+ >+ my $hid = AddReserve( >+ { >+ branchcode => $item->homebranch, >+ borrowernumber => $patron2->borrowernumber, >+ biblionumber => $item->biblionumber, >+ priority => 1, >+ itemnumber => $item->itemnumber, >+ } >+ ); >+ >+ my ( $ok, $err ) = >+ CanBookBeRenewed( $patron1->borrowernumber, $item->itemnumber ); >+ >+ ok( !$ok, 'Cannot renew' ); >+ is( $err, 'on_reserve', 'Item is on hold' ); >+ >+ my $hold = Koha::Holds->find($hid); >+ $hold->non_priority(1)->store; >+ >+ ( $ok, $err ) = >+ CanBookBeRenewed( $patron1->borrowernumber, $item->itemnumber ); >+ >+ ok( $ok, 'Can renew' ); >+ is( $err, undef, 'Item is on non priority hold' ); >+ >+ $schema->storage->txn_rollback; >+ >+}; >diff --git a/t/lib/TestBuilder.pm b/t/lib/TestBuilder.pm >index 45646206ba..065af37563 100644 >--- a/t/lib/TestBuilder.pm >+++ b/t/lib/TestBuilder.pm >@@ -563,6 +563,9 @@ sub _gen_default_values { > Branch => { > pickup_location => 0, > }, >+ Reserve => { >+ non_priority => 0, >+ }, > Itemtype => { > rentalcharge => 0, > rentalcharge_daily => 0, >-- >2.25.0
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 22789
:
108703
|
108704
|
108705
|
108706
|
108707
|
108708
|
108709
|
108710
|
109123
|
109124
|
109125
|
109126
|
109127
|
109128
|
109129
|
109200
|
109201
|
109202
|
109203
|
109204
|
109205