Bugzilla – Attachment 106571 Details for
Bug 21468
Plugins need hooks for checkin and checkout actions
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 21468: Unit tests for AddIssue
Bug-21468-Unit-tests-for-AddIssue.patch (text/plain), 2.83 KB, created by
Martin Renvoize (ashimema)
on 2020-07-06 10:44:48 UTC
(
hide
)
Description:
Bug 21468: Unit tests for AddIssue
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2020-07-06 10:44:48 UTC
Size:
2.83 KB
patch
obsolete
>From 99f8fa017e6961af64b7dbeca33b0ffc05485d7f Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Mon, 6 Jul 2020 11:43:25 +0100 >Subject: [PATCH] Bug 21468: Unit tests for AddIssue > >This patch adds a unit test for the addition of a call to the >_after_circ_action hook in AddIssue. >--- > .../Koha/Plugins/Circulation_hooks.t | 34 ++++++++++++++----- > 1 file changed, 25 insertions(+), 9 deletions(-) > >diff --git a/t/db_dependent/Koha/Plugins/Circulation_hooks.t b/t/db_dependent/Koha/Plugins/Circulation_hooks.t >index 6b7aecbe81..1e354c8ca1 100755 >--- a/t/db_dependent/Koha/Plugins/Circulation_hooks.t >+++ b/t/db_dependent/Koha/Plugins/Circulation_hooks.t >@@ -42,9 +42,9 @@ my $builder = t::lib::TestBuilder->new; > > t::lib::Mocks::mock_config( 'enable_plugins', 1 ); > >-subtest 'post_renewal_action() hook tests' => sub { >+subtest '_after_circ_action() hook tests' => sub { > >- plan tests => 1; >+ plan tests => 2; > > $schema->storage->txn_begin; > >@@ -53,7 +53,7 @@ subtest 'post_renewal_action() hook tests' => sub { > > my $plugin = Koha::Plugin::Test->new->enable; > >- my $patron = $builder->build_object({ class => 'Koha::Patrons' }); >+ my $patron = $builder->build_object( { class => 'Koha::Patrons' } ); > > t::lib::Mocks::mock_userenv( > { >@@ -64,16 +64,32 @@ subtest 'post_renewal_action() hook tests' => sub { > > # Avoid testing useless warnings > my $test_plugin = Test::MockModule->new('Koha::Plugin::Test'); >- $test_plugin->mock( 'after_item_action', undef ); >+ $test_plugin->mock( 'after_item_action', undef ); > $test_plugin->mock( 'after_biblio_action', undef ); > > my $biblio = $builder->build_sample_biblio(); >- my $item = $builder->build_sample_item({ biblionumber => $biblio->biblionumber }); >- AddIssue( $patron->unblessed, $item->barcode ); >+ my $item = >+ $builder->build_sample_item( { biblionumber => $biblio->biblionumber } ); > >- warning_like { AddRenewal( $patron->borrowernumber, $item->id, $patron->branchcode ); } >- qr/after_circ_action called with action: renewal, ref: DateTime/, >- 'AddRenewal calls the post_renewal_action hook'; >+ subtest 'AddIssue' => sub { >+ plan tests => 1; >+ >+ warning_like { AddIssue( $patron->unblessed, $item->barcode ); } >+ qw/after_circ_action called with action: renewal, ref: DateTime/, >+ 'AddIssue calls the after_circ_action hook'; >+ >+ }; >+ >+ subtest 'AddRenewal' => sub { >+ plan tests => 1; >+ >+ warning_like { >+ AddRenewal( $patron->borrowernumber, $item->id, >+ $patron->branchcode ); >+ } >+ qr/after_circ_action called with action: renewal, ref: DateTime/, >+ 'AddRenewal calls the after_circ_action hook'; >+ }; > > $schema->storage->txn_rollback; > Koha::Plugins::Methods->delete; >-- >2.20.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 21468
:
106571
|
106572
|
106573
|
106574
|
106580
|
106581
|
106582
|
106583
|
106883
|
106884
|
106885
|
106886
|
106887
|
107261
|
107262
|
107263
|
107264
|
107265
|
107266