Bugzilla – Attachment 99483 Details for
Bug 24705
Holds placed via SIP will be given first priority
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 24705: Add tests
Bug-24705-Add-tests.patch (text/plain), 2.92 KB, created by
Jonathan Druart
on 2020-02-24 09:43:44 UTC
(
hide
)
Description:
Bug 24705: Add tests
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2020-02-24 09:43:44 UTC
Size:
2.92 KB
patch
obsolete
>From 38439cd3147b17d6cb887ae5a31b981988db94e2 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Mon, 24 Feb 2020 10:40:54 +0100 >Subject: [PATCH] Bug 24705: Add tests > >Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >--- > t/db_dependent/SIP/Transaction.t | 62 +++++++++++++++++++++++++++++++++++++++- > 1 file changed, 61 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/SIP/Transaction.t b/t/db_dependent/SIP/Transaction.t >index bc7af8bb4d..c6d2abd65f 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 => 6; >+use Test::More tests => 7; > > use Koha::Database; > use t::lib::TestBuilder; >@@ -209,4 +209,64 @@ subtest cancel_hold => sub { > is( $item->holds->count(), 0, "Item has 0 holds remaining"); > }; > >+subtest do_hold => sub { >+ plan tests => 7; >+ >+ my $library = $builder->build_object( { class => 'Koha::Libraries' } ); >+ my $patron_1 = $builder->build_object( >+ { >+ class => 'Koha::Patrons', >+ value => { >+ branchcode => $library->branchcode, >+ } >+ } >+ ); >+ my $patron_2 = $builder->build_object( >+ { >+ class => 'Koha::Patrons', >+ value => { >+ branchcode => $library->branchcode, >+ categorycode => $patron_1->categorycode, >+ } >+ } >+ ); >+ >+ t::lib::Mocks::mock_userenv( >+ { branchcode => $library->branchcode, flags => 1 } ); >+ >+ my $item = $builder->build_sample_item( >+ { >+ library => $library->branchcode, >+ } >+ ); >+ >+ my $reserve1 = AddReserve( >+ { >+ branchcode => $library->branchcode, >+ borrowernumber => $patron_1->borrowernumber, >+ biblionumber => $item->biblio->biblionumber, >+ itemnumber => $item->itemnumber, >+ } >+ ); >+ is( $item->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( $patron_2->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->do_hold(); >+ is( $item->biblio->holds->count(), 2, "Bib has 2 holds" ); >+ >+ is( $patron_2->holds->next->priority, 2, 'Hold placed from SIP should have a correct priority of 2'); >+}; >+ > $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 24705
:
99386
|
99427
| 99483 |
99484
|
102520