Bugzilla – Attachment 84180 Details for
Bug 19832
SIP checkout removes extra hold on same biblio
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 19832: Unit tests
Bug-19832-Unit-tests.patch (text/plain), 3.93 KB, created by
Martin Renvoize
on 2019-01-18 10:28:49 UTC
(
hide
)
Description:
Bug 19832: Unit tests
Filename:
MIME Type:
Creator:
Martin Renvoize
Created:
2019-01-18 10:28:49 UTC
Size:
3.93 KB
patch
obsolete
>From 714aa93dd38792af77c18795b089efff3e14bb5d Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Wed, 16 Jan 2019 13:19:31 +0000 >Subject: [PATCH] Bug 19832: Unit tests > >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > t/db_dependent/SIP/Transaction.t | 68 +++++++++++++++++++++++++++++++- > 1 file changed, 67 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/SIP/Transaction.t b/t/db_dependent/SIP/Transaction.t >index 01889b42db..7379d4a8df 100755 >--- a/t/db_dependent/SIP/Transaction.t >+++ b/t/db_dependent/SIP/Transaction.t >@@ -4,12 +4,17 @@ > # Current state is very rudimentary. Please help to extend it! > > use Modern::Perl; >-use Test::More tests => 3; >+use Test::More tests => 4; > > use Koha::Database; > use t::lib::TestBuilder; >+use t::lib::Mocks; > use C4::SIP::ILS::Patron; > use C4::SIP::ILS::Transaction::RenewAll; >+use C4::SIP::ILS::Transaction::Checkout; >+ >+use C4::Reserves; >+use Koha::IssuingRules; > > my $schema = Koha::Database->new->schema; > $schema->storage->txn_begin; >@@ -25,4 +30,65 @@ is( ref $transaction, "C4::SIP::ILS::Transaction::RenewAll", "New transaction cr > is( $transaction->patron( $sip_patron ), $sip_patron, "Patron assigned to transaction" ); > isnt( $transaction->do_renew_all, undef, "RenewAll on zero items" ); > >+subtest fill_holds_at_checkout => sub { >+ plan tests => 5; >+ >+ >+ my $category = $builder->build({ source => 'Category' }); >+ my $branch = $builder->build({ source => 'Branch' }); >+ my $borrower = $builder->build({ source => 'Borrower', value =>{ >+ branchcode => $branch->{branchcode}, >+ categorycode=>$category->{categorycode} >+ } >+ }); >+ t::lib::Mocks::mock_userenv({ branchcode => $branch->{branchcode}, flags => 1 }); >+ >+ my $itype = $builder->build({ source => 'Itemtype', value =>{notforloan=>0} }); >+ my $biblio = $builder->build({ source => 'Biblio' }); >+ my $biblioitem = $builder->build({ source => 'Biblioitem', value=>{biblionumber=>$biblio->{biblionumber}} }); >+ my $item1 = $builder->build({ source => 'Item', value => { >+ homebranch => $branch->{branchcode}, >+ holdingbranch => $branch->{branchcode}, >+ biblionumber => $biblio->{biblionumber}, >+ itype => $itype->{itemtype}, >+ notforloan => 0, >+ } >+ }); >+ my $item2 = $builder->build({ source => 'Item', value => { >+ homebranch => $branch->{branchcode}, >+ holdingbranch => $branch->{branchcode}, >+ biblionumber => $biblio->{biblionumber}, >+ itype => $itype->{itemtype}, >+ notforloan => 0, >+ } >+ }); >+ >+ Koha::IssuingRule->new({ >+ categorycode => $borrower->{categorycode}, >+ itemtype => $itype->{itemtype}, >+ branchcode => $branch->{branchcode}, >+ onshelfholds => 1, >+ reservesallowed => 3, >+ holds_per_record => 3, >+ issuelength => 5, >+ lengthunit => 'days', >+ maxissueqty => 10. >+ })->store; >+ >+ my $reserve1 = AddReserve($branch->{branchcode},$borrower->{borrowernumber},$biblio->{biblionumber}); >+ my $reserve2 = AddReserve($branch->{branchcode},$borrower->{borrowernumber},$biblio->{biblionumber}); >+ my $bib = Koha::Biblios->find( $biblio->{biblionumber} ); >+ is( $bib->holds->count(), 2, "Bib has 2 holds"); >+ >+ my $sip_patron = C4::SIP::ILS::Patron->new( $borrower->{cardnumber} ); >+ my $sip_item = C4::SIP::ILS::Item->new( $item1->{barcode} ); >+ my $transaction = C4::SIP::ILS::Transaction::Checkout->new(); >+ is( ref $transaction, "C4::SIP::ILS::Transaction::Checkout", "New transaction created" ); >+ is( $transaction->patron( $sip_patron ), $sip_patron, "Patron assigned to transaction" ); >+ is( $transaction->item( $sip_item ), $sip_item, "Item assigned to transaction" ); >+ $transaction->do_checkout(); >+ is( $bib->holds->count(), 1, "Bib has 1 holds remaining"); >+ >+ >+}; > $schema->storage->txn_rollback; >-- >2.20.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 19832
:
84070
|
84071
|
84180
|
84181
|
85149
|
85150
|
85151