Bugzilla – Attachment 131101 Details for
Bug 30180
Deprecate after_hold_create hook
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 30180: Unit tests
Bug-30180-Unit-tests.patch (text/plain), 2.71 KB, created by
Tomás Cohen Arazi (tcohen)
on 2022-02-25 08:57:25 UTC
(
hide
)
Description:
Bug 30180: Unit tests
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2022-02-25 08:57:25 UTC
Size:
2.71 KB
patch
obsolete
>From fffa3ac62f2b462f7c55ffd331fd77aebe9e348c Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Fri, 25 Feb 2022 05:49:56 -0300 >Subject: [PATCH] Bug 30180: Unit tests > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >--- > t/db_dependent/Koha/Plugins/Holds_hooks.t | 47 ++++++++++++++++++++++- > 1 file changed, 46 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/Koha/Plugins/Holds_hooks.t b/t/db_dependent/Koha/Plugins/Holds_hooks.t >index 04d19929ca..d1dd61f033 100755 >--- a/t/db_dependent/Koha/Plugins/Holds_hooks.t >+++ b/t/db_dependent/Koha/Plugins/Holds_hooks.t >@@ -16,7 +16,7 @@ > > use Modern::Perl; > >-use Test::More tests => 5; >+use Test::More tests => 6; > use Test::MockModule; > use Test::Warn; > >@@ -67,6 +67,7 @@ subtest 'after_hold_create() hook tests' => sub { > $test_plugin->mock( 'after_item_action', undef ); > $test_plugin->mock( 'after_biblio_action', undef ); > $test_plugin->mock( 'item_barcode_transform', undef ); >+ $test_plugin->mock( 'after_hold_action', undef ); > > my $biblio = $builder->build_sample_biblio(); > my $item_1 = $builder->build_sample_item( { biblionumber => $biblio->biblionumber } ); >@@ -82,6 +83,50 @@ subtest 'after_hold_create() hook tests' => sub { > Koha::Plugins::Methods->delete; > }; > >+subtest 'after_hold_action (placed) hook tests' => sub { >+ >+ plan tests => 1; >+ >+ $schema->storage->txn_begin; >+ >+ my $plugins = Koha::Plugins->new; >+ $plugins->InstallPlugins; >+ >+ my $plugin = Koha::Plugin::Test->new->enable; >+ >+ my $patron = $builder->build_object( { class => 'Koha::Patrons' } ); >+ >+ t::lib::Mocks::mock_userenv( >+ { >+ patron => $patron, >+ branchcode => $patron->branchcode >+ } >+ ); >+ >+ # Avoid testing useless warnings >+ my $test_plugin = Test::MockModule->new('Koha::Plugin::Test'); >+ $test_plugin->mock( 'after_item_action', undef ); >+ $test_plugin->mock( 'after_biblio_action', undef ); >+ $test_plugin->mock( 'item_barcode_transform', undef ); >+ $test_plugin->mock( 'after_hold_create', undef ); >+ >+ my $biblio = $builder->build_sample_biblio(); >+ my $item_1 = $builder->build_sample_item( { biblionumber => $biblio->biblionumber } ); >+ >+ warning_like { >+ AddReserve( >+ { branchcode => $patron->branchcode, >+ borrowernumber => $patron->borrowernumber, >+ biblionumber => $item_1->biblionumber >+ } >+ ); >+ } >+ qr/after_hold_action called with action: place, ref: Koha::Hold/, 'AddReserve calls the after_hold_action hook'; >+ >+ $schema->storage->txn_rollback; >+ Koha::Plugins::Methods->delete; >+}; >+ > subtest 'Koha::Hold tests' => sub { > > plan tests => 4; >-- >2.35.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 30180
:
131101
|
131102
|
131103
|
133415
|
133416
|
133417
|
133818
|
133819
|
133820