Bugzilla – Attachment 146424 Details for
Bug 32539
UI hooks can break the UI
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 32539: Add tests
Bug-32539-Add-tests.patch (text/plain), 2.42 KB, created by
Jonathan Druart
on 2023-02-09 10:45:46 UTC
(
hide
)
Description:
Bug 32539: Add tests
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2023-02-09 10:45:46 UTC
Size:
2.42 KB
patch
obsolete
>From d35ef0ec9da16f1fd477b1d0b2604ec022cfc0f0 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Thu, 9 Feb 2023 11:45:02 +0100 >Subject: [PATCH] Bug 32539: Add tests > >Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >--- > .../Koha/Template/Plugin/KohaPlugins.t | 16 +++++++++++++++- > 1 file changed, 15 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/Koha/Template/Plugin/KohaPlugins.t b/t/db_dependent/Koha/Template/Plugin/KohaPlugins.t >index 04763b2f25f..4e34e602884 100755 >--- a/t/db_dependent/Koha/Template/Plugin/KohaPlugins.t >+++ b/t/db_dependent/Koha/Template/Plugin/KohaPlugins.t >@@ -2,7 +2,8 @@ > > use Modern::Perl; > >-use Test::More tests => 14; >+use Test::More tests => 18; >+use Test::Warn; > use CGI; > use File::Basename; > use File::Spec; >@@ -52,6 +53,19 @@ ok( index( $plugin->get_plugins_opac_head, 'Koha::Plugin::Test::opac_head' ) != > ok( index( $plugin->get_plugins_intranet_js, 'Koha::Plugin::Test::intranet_js' ) != -1, 'Test plugin intranet_js return value is part of code returned by get_plugins_intranet_js' ); > ok( index( $plugin->get_plugins_intranet_head, 'Koha::Plugin::Test::intranet_head' ) != -1, 'Test plugin intranet_head return value is part of code returned by get_plugins_intranet_head' ); > >+sub boom { >+ my ( $self, $file ) = @_; >+ die "Something wrong is happening in this hook"; >+} >+$mock_plugin->mock( 'opac_head', \&boom ); >+$mock_plugin->mock( 'opac_js', \&boom ); >+$mock_plugin->mock( 'intranet_head', \&boom ); >+$mock_plugin->mock( 'intranet_js', \&boom ); >+warning_like { $plugin->get_plugins_opac_head } qr{Error calling 'opac_head' on the Koha::Plugin::Testplugin \(Something wrong is happening in this hook}; >+warning_like { $plugin->get_plugins_opac_js } qr{Error calling 'opac_js' on the Koha::Plugin::Testplugin \(Something wrong is happening in this hook}; >+warning_like { $plugin->get_plugins_intranet_head } qr{Error calling 'intranet_head' on the Koha::Plugin::Testplugin \(Something wrong is happening in this hook}; >+warning_like { $plugin->get_plugins_intranet_js } qr{Error calling 'intranet_js' on the Koha::Plugin::Testplugin \(Something wrong is happening in this hook}; >+ > t::lib::Mocks::mock_config('enable_plugins',0); > is( $plugin->get_plugins_opac_js, q{}, 'Test plugin opac_js return value is empty' ); > is( $plugin->get_plugins_opac_head, q{}, 'Test plugin opac_head return value is empty' ); >-- >2.25.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 32539
:
145328
|
145329
|
145366
|
146423
| 146424