Bug 20181: Unit tests
Signed-off-by: Mark Tompsett <mtompset@hotmail.com> Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
parent
e8fbe51ff3
commit
98164dc432
|
|
@ -58,6 +58,16 @@ sub opac_online_payment_end {
|
|||
return "Koha::Plugin::Test::opac_online_payment_end";
|
||||
}
|
||||
|
||||
sub opac_head {
|
||||
my ( $self, $args ) = @_;
|
||||
return "Koha::Plugin::Test::opac_head";
|
||||
}
|
||||
|
||||
sub opac_js {
|
||||
my ( $self, $args ) = @_;
|
||||
return "Koha::Plugin::Test::opac_js";
|
||||
}
|
||||
|
||||
sub configure {
|
||||
my ( $self, $args ) = @_;
|
||||
return "Koha::Plugin::Test::configure";;
|
||||
|
|
|
|||
|
|
@ -0,0 +1,41 @@
|
|||
#!/usr/bin/perl
|
||||
|
||||
use Modern::Perl;
|
||||
|
||||
use Test::More tests => 8;
|
||||
use CGI;
|
||||
use File::Basename;
|
||||
use File::Spec;
|
||||
use File::Temp qw( tempdir tempfile );
|
||||
use FindBin qw($Bin);
|
||||
use Archive::Extract;
|
||||
use Module::Load::Conditional qw(can_load);
|
||||
use Test::MockModule;
|
||||
|
||||
use C4::Context;
|
||||
use t::lib::Mocks;
|
||||
|
||||
BEGIN {
|
||||
push( @INC, dirname(__FILE__) );
|
||||
|
||||
use_ok('Koha::Plugins');
|
||||
use_ok('Koha::Plugins::Handler');
|
||||
use_ok('Koha::Plugins::Base');
|
||||
use_ok('Koha::Plugin::Test');
|
||||
}
|
||||
|
||||
my $mock_plugin = Test::MockModule->new( 'Koha::Plugin::Test' );
|
||||
$mock_plugin->mock( 'test_template', sub {
|
||||
my ( $self, $file ) = @_;
|
||||
my $template = $self->get_template({ file => $file });
|
||||
$template->param( filename => $file );
|
||||
return $template->output;
|
||||
});
|
||||
|
||||
use_ok( 'Koha::Template::Plugin::KohaPlugins', 'Can use Koha::Template::Plugin::KohaPlugins' );
|
||||
|
||||
ok( my $plugin = Koha::Template::Plugin::KohaPlugins->new(), 'Able to instantiate template plugin' );
|
||||
|
||||
ok( index( $plugin->get_plugins_opac_js, 'Koha::Plugin::Test::opac_js' ) != -1, 'Test plugin opac_js return value is part of code returned by get_plugins_opac_js' );
|
||||
|
||||
ok( index( $plugin->get_plugins_opac_head, 'Koha::Plugin::Test::opac_head' ) != -1, 'Test plugin opac_head return value is part of code returned by get_plugins_opac_head' );
|
||||
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
use Modern::Perl;
|
||||
|
||||
use Test::More tests => 33;
|
||||
use Test::More tests => 35;
|
||||
use CGI;
|
||||
use File::Basename;
|
||||
use File::Spec;
|
||||
|
|
@ -45,6 +45,8 @@ ok( $plugin->can('to_marc'), 'Test plugin can to_marc' );
|
|||
ok( $plugin->can('opac_online_payment'), 'Test plugin can opac_online_payment' );
|
||||
ok( $plugin->can('opac_online_payment_begin'), 'Test plugin can opac_online_payment_begin' );
|
||||
ok( $plugin->can('opac_online_payment_end'), 'Test plugin can opac_online_payment_end' );
|
||||
ok( $plugin->can('opac_head'), 'Test plugin can opac_head' );
|
||||
ok( $plugin->can('opac_js'), 'Test plugin can opac_js' );
|
||||
ok( $plugin->can('configure'), 'Test plugin can configure' );
|
||||
ok( $plugin->can('install'), 'Test plugin can install' );
|
||||
ok( $plugin->can('uninstall'), 'Test plugin can install' );
|
||||
|
|
|
|||
Loading…
Reference in New Issue