View | Details | Raw Unified | Return to bug 32539
Collapse All | Expand All

(-)a/t/db_dependent/Koha/Template/Plugin/KohaPlugins.t (-2 / +15 lines)
Lines 2-8 Link Here
2
2
3
use Modern::Perl;
3
use Modern::Perl;
4
4
5
use Test::More tests => 14;
5
use Test::More tests => 18;
6
use Test::Warn;
6
use CGI;
7
use CGI;
7
use File::Basename;
8
use File::Basename;
8
use File::Spec;
9
use File::Spec;
Lines 52-57 ok( index( $plugin->get_plugins_opac_head, 'Koha::Plugin::Test::opac_head' ) != Link Here
52
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' );
53
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' );
53
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' );
54
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' );
54
55
56
sub boom {
57
    my ( $self, $file ) = @_;
58
    die "Something wrong is happening in this hook";
59
}
60
$mock_plugin->mock( 'opac_head',     \&boom );
61
$mock_plugin->mock( 'opac_js',       \&boom );
62
$mock_plugin->mock( 'intranet_head', \&boom );
63
$mock_plugin->mock( 'intranet_js',   \&boom );
64
warning_like { $plugin->get_plugins_opac_head } qr{Error calling 'opac_head' on the Koha::Plugin::Testplugin \(Something wrong is happening in this hook};
65
warning_like { $plugin->get_plugins_opac_js } qr{Error calling 'opac_js' on the Koha::Plugin::Testplugin \(Something wrong is happening in this hook};
66
warning_like { $plugin->get_plugins_intranet_head } qr{Error calling 'intranet_head' on the Koha::Plugin::Testplugin \(Something wrong is happening in this hook};
67
warning_like { $plugin->get_plugins_intranet_js } qr{Error calling 'intranet_js' on the Koha::Plugin::Testplugin \(Something wrong is happening in this hook};
68
55
t::lib::Mocks::mock_config('enable_plugins',0);
69
t::lib::Mocks::mock_config('enable_plugins',0);
56
is( $plugin->get_plugins_opac_js, q{}, 'Test plugin opac_js return value is empty' );
70
is( $plugin->get_plugins_opac_js, q{}, 'Test plugin opac_js return value is empty' );
57
is( $plugin->get_plugins_opac_head, q{}, 'Test plugin opac_head return value is empty' );
71
is( $plugin->get_plugins_opac_head, q{}, 'Test plugin opac_head return value is empty' );
58
- 

Return to bug 32539