Bugzilla – Attachment 95999 Details for
Bug 24175
Cannot cancel holds - wrong parameter passed for itemnumber
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 24175: Unit tests
Bug-24175-Unit-tests.patch (text/plain), 3.32 KB, created by
Nick Clemens (kidclamp)
on 2019-12-04 18:54:41 UTC
(
hide
)
Description:
Bug 24175: Unit tests
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2019-12-04 18:54:41 UTC
Size:
3.32 KB
patch
obsolete
>From d26bd9e85fc273a349839e89629afb9b9602b834 Mon Sep 17 00:00:00 2001 >From: Nick Clemens <nick@bywatersolutions.com> >Date: Wed, 4 Dec 2019 18:38:22 +0000 >Subject: [PATCH] Bug 24175: Unit tests > >--- > t/db_dependent/SIP/Transaction.t | 51 +++++++++++++++++++++++++++++++++++++++- > 1 file changed, 50 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/SIP/Transaction.t b/t/db_dependent/SIP/Transaction.t >index 53d59d8011..321e5c7cde 100755 >--- a/t/db_dependent/SIP/Transaction.t >+++ b/t/db_dependent/SIP/Transaction.t >@@ -4,7 +4,7 @@ > # Current state is very rudimentary. Please help to extend it! > > use Modern::Perl; >-use Test::More tests => 5; >+use Test::More tests => 6; > > use Koha::Database; > use t::lib::TestBuilder; >@@ -13,6 +13,7 @@ use C4::SIP::ILS::Patron; > use C4::SIP::ILS::Transaction::RenewAll; > use C4::SIP::ILS::Transaction::Checkout; > use C4::SIP::ILS::Transaction::FeePayment; >+use C4::SIP::ILS::Transaction::Hold; > > use C4::Reserves; > use Koha::IssuingRules; >@@ -136,4 +137,52 @@ subtest "FeePayment->pay tests" => sub { > is( $credit->payment_type, 'SIP00', "Payment type was set correctly" ); > }; > >+subtest cancel_hold => sub { >+ plan tests => 7; >+ >+ my $category = $builder->build({ source => 'Category', value => { category_type => 'A' }}); >+ 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_sample_biblio(); >+ my $item = $builder->build_sample_item({ >+ 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', >+ })->store; >+ >+ my $reserve1 = AddReserve($branch->{branchcode},$borrower->{borrowernumber},$biblio->biblionumber,undef,undef,undef,undef,undef,undef,$item->itemnumber); >+ is( $biblio->holds->count(), 1, "Hold was placed on bib"); >+ is( $item->holds->count(),1,"Hold was placed on specific item"); >+ >+ my $sip_patron = C4::SIP::ILS::Patron->new( $borrower->{cardnumber} ); >+ my $sip_item = C4::SIP::ILS::Item->new( $item->barcode ); >+ my $transaction = C4::SIP::ILS::Transaction::Hold->new(); >+ is( ref $transaction, "C4::SIP::ILS::Transaction::Hold", "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" ); >+ my $hold = $transaction->drop_hold(); >+ is( $biblio->holds->count(), 0, "Bib has 0 holds remaining"); >+ is( $item->holds->count(), 0, "Item has 0 holds remaining"); >+}; >+ > $schema->storage->txn_rollback; >-- >2.11.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 24175
:
95999
|
96000
|
96372
|
96375
|
96376
|
96377
|
96378
|
96527
|
96528
|
96529
|
96530
|
96534
|
96535
|
96536
|
96537
|
96680
|
96681