Bugzilla – Attachment 107644 Details for
Bug 26114
ILL should mark status=RET only if a return happened
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 26114: Regression tests
Bug-26114-Regression-tests.patch (text/plain), 2.71 KB, created by
Tomás Cohen Arazi (tcohen)
on 2020-07-31 14:18:31 UTC
(
hide
)
Description:
Bug 26114: Regression tests
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2020-07-31 14:18:31 UTC
Size:
2.71 KB
patch
obsolete
>From 56fcfc3e9a144c5a108f0824075d5e5bf2072d23 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Fri, 31 Jul 2020 11:14:09 -0300 >Subject: [PATCH] Bug 26114: Regression tests > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >--- > t/db_dependent/Illrequests.t | 64 +++++++++++++++++++++++++++++++++++- > 1 file changed, 63 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/Illrequests.t b/t/db_dependent/Illrequests.t >index be59d1ae86..f6d6fa76cd 100644 >--- a/t/db_dependent/Illrequests.t >+++ b/t/db_dependent/Illrequests.t >@@ -18,6 +18,9 @@ > use Modern::Perl; > > use File::Basename qw/basename/; >+ >+use C4::Circulation qw(AddIssue AddReturn); >+ > use Koha::Database; > use Koha::Illrequestattributes; > use Koha::Illrequest::Config; >@@ -36,7 +39,7 @@ use Test::Exception; > use Test::Deep qw/ cmp_deeply ignore /; > use Test::Warn; > >-use Test::More tests => 12; >+use Test::More tests => 13; > > my $schema = Koha::Database->new->schema; > my $builder = t::lib::TestBuilder->new; >@@ -1160,3 +1163,62 @@ subtest 'Custom statuses' => sub { > > $schema->storage->txn_rollback; > }; >+ >+subtest 'Checking in hook' => sub { >+ >+ plan tests => 2; >+ >+ $schema->storage->txn_begin; >+ >+ # Build infrastructure >+ my $backend = Test::MockObject->new; >+ $backend->set_isa('Koha::Illbackends::Mock'); >+ $backend->set_always('name', 'Mock'); >+ >+ my $config = Test::MockObject->new; >+ $config->set_always('backend_dir', "/tmp"); >+ >+ my $item = $builder->build_sample_item(); >+ my $patron = $builder->build_object({ class => 'Koha::Patrons' }); >+ >+ t::lib::Mocks::mock_userenv( >+ { >+ patron => $patron, >+ branchcode => $patron->branchcode >+ } >+ ); >+ >+ my $illrq = $builder->build_object( >+ { >+ class => 'Koha::Illrequests', >+ value => { >+ biblio_id => $item->biblio->biblionumber, >+ status => 'NEW' >+ } >+ } >+ ); >+ >+ $illrq->_config($config); >+ $illrq->_backend($backend); >+ >+ t::lib::Mocks::mock_preference('CirculateILL', 1); >+ >+ # Add an issue >+ AddIssue( $patron->unblessed, $item->barcode ); >+ # Make the item withdrawn so checking-in is rejected >+ t::lib::Mocks::mock_preference('BlockReturnOfWithdrawnItems', 1); >+ $item->set({ withdrawn => 1 })->store; >+ AddReturn( $item->barcode, $patron->branchcode ); >+ # refresh request >+ $illrq->discard_changes; >+ isnt( $illrq->status, 'RET' ); >+ >+ # allow the check-in >+ $item->set({ withdrawn => 0 })->store; >+ AddReturn( $item->barcode, $patron->branchcode ); >+ # refresh request >+ $illrq->discard_changes; >+ is( $illrq->status, 'RET' ); >+ >+ $schema->storage->txn_rollback; >+}; >-- >2.28.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 26114
:
107644
|
107645
|
108144
|
108145
|
108146