Browse Source

Bug 32539: Add tests

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
23.05.x
Jonathan Druart 1 year ago
committed by Tomas Cohen Arazi
parent
commit
7bb4aeba9f
Signed by: tomascohen GPG Key ID: 0A272EA1B2F3C15F
  1. 16
      t/db_dependent/Koha/Template/Plugin/KohaPlugins.t

16
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' );

Loading…
Cancel
Save