Bugzilla – Attachment 86371 Details for
Bug 18837
Add an unmediated Interlibrary Loans workflow
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 18837: (follow-up) Add additional tests
Bug-18837-follow-up-Add-additional-tests.patch (text/plain), 3.48 KB, created by
Andrew Isherwood
on 2019-03-08 11:30:12 UTC
(
hide
)
Description:
Bug 18837: (follow-up) Add additional tests
Filename:
MIME Type:
Creator:
Andrew Isherwood
Created:
2019-03-08 11:30:12 UTC
Size:
3.48 KB
patch
obsolete
>From d01121a3dca696c49b1eb90f1ed31bca24f1cb75 Mon Sep 17 00:00:00 2001 >From: Andrew Isherwood <andrew.isherwood@ptfs-europe.com> >Date: Fri, 8 Mar 2019 11:28:09 +0000 >Subject: [PATCH] Bug 18837: (follow-up) Add additional tests > >As requested by Josef on IRC, we now mock the unmediated_ill backend >method and ensure it is called when the ILLModuleUnmediated syspref is >enabled and ensure it is not called when the syspref is disabled >--- > t/db_dependent/Illrequests.t | 44 +++++++++++++++++++++++++++++++++++++++++++- > 1 file changed, 43 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/Illrequests.t b/t/db_dependent/Illrequests.t >index 9046852b45..d3a68084bc 100644 >--- a/t/db_dependent/Illrequests.t >+++ b/t/db_dependent/Illrequests.t >@@ -376,7 +376,7 @@ subtest 'Backend testing (mocks)' => sub { > > subtest 'Backend core methods' => sub { > >- plan tests => 17; >+ plan tests => 19; > > $schema->storage->txn_begin; > >@@ -384,6 +384,7 @@ subtest 'Backend core methods' => sub { > my $backend = Test::MockObject->new; > $backend->set_isa('Koha::Illbackends::Mock'); > $backend->set_always('name', 'Mock'); >+ $backend->mock('capabilities', sub { return 'Mock'; }); > > my $config = Test::MockObject->new; > $config->set_always('backend_dir', "/tmp"); >@@ -423,6 +424,8 @@ subtest 'Backend core methods' => sub { > $backend->set_series('create', > { stage => 'bar', method => 'create' }, > { stage => 'commit', method => 'create' }, >+ { stage => 'commit', method => 'create' }, >+ { stage => 'commit', method => 'create' }, > { stage => 'commit', method => 'create' }); > # Test non-commit > is_deeply($illrq->backend_create({test => 1}), >@@ -452,6 +455,45 @@ subtest 'Backend core methods' => sub { > "Backend create: arbitrary stage, permitted."); > is($illrq->status, "NEW", "Backend create: not-queued."); > >+ # Test that enabling the unmediated workflow causes the backend's >+ # 'unmediated_ill' method to be called >+ t::lib::Mocks::mock_preference('ILLModuleUnmediated', '1'); >+ $backend->mock( >+ 'capabilities', >+ sub { >+ my ($self, $name) = @_; >+ if ($name eq 'unmediated_ill') { >+ return sub { >+ return { unmediated_ill => 1 }; >+ }; >+ } >+ } >+ ); >+ $illrq->status('NEW'); >+ is_deeply( >+ $illrq->backend_create({test => 1}), >+ { >+ 'opac_template' => '/tmp/Mock/opac-includes/.inc', >+ 'template' => '/tmp/Mock/intra-includes/.inc', >+ 'unmediated_ill' => 1 >+ }, >+ "Backend create: commit stage, permitted, ILLModuleUnmediated enabled." >+ ); >+ >+ # Test that disabling the unmediated workflow causes the backend's >+ # 'unmediated_ill' method to be NOT called >+ t::lib::Mocks::mock_preference('ILLModuleUnmediated', '0'); >+ $illrq->status('NEW'); >+ is_deeply( >+ $illrq->backend_create({test => 1}), >+ { >+ stage => 'commit', method => 'create', permitted => 1, >+ template => "/tmp/Mock/intra-includes/create.inc", >+ opac_template => "/tmp/Mock/opac-includes/create.inc", >+ }, >+ "Backend create: commit stage, permitted, ILLModuleUnmediated disabled." >+ ); >+ > # backend_renew > $backend->set_series('renew', { stage => 'bar', method => 'renew' }); > is_deeply($illrq->backend_renew({test => 1}), >-- >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 18837
:
66628
|
66629
|
74874
|
74875
|
79542
|
79543
|
82158
|
82159
|
82508
|
82509
|
86188
|
86189
|
86236
|
86237
|
86238
|
86371
|
86372
|
86373
|
86374
|
86375
|
86422
|
86423
|
86424
|
86425
|
86426