Bugzilla – Attachment 71567 Details for
Bug 20181
Allow plugins to add CSS and Javascript to OPAC
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 20181 - Unit Tests
Bug-20181---Unit-Tests.patch (text/plain), 3.51 KB, created by
Mark Tompsett
on 2018-02-13 19:16:16 UTC
(
hide
)
Description:
Bug 20181 - Unit Tests
Filename:
MIME Type:
Creator:
Mark Tompsett
Created:
2018-02-13 19:16:16 UTC
Size:
3.51 KB
patch
obsolete
>From 22fa650217d5c2aca57b233ac1c850170b0e0e59 Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatetsolutions.com> >Date: Mon, 12 Feb 2018 11:15:47 -0500 >Subject: [PATCH] Bug 20181 - Unit Tests > >Signed-off-by: Mark Tompsett <mtompset@hotmail.com> >--- > t/Koha/Plugin/Test.pm | 10 +++++++++ > t/Koha_Template_Plugin_KohaPlugins.t | 41 ++++++++++++++++++++++++++++++++++++ > t/db_dependent/Plugins.t | 4 +++- > 3 files changed, 54 insertions(+), 1 deletion(-) > create mode 100755 t/Koha_Template_Plugin_KohaPlugins.t > >diff --git a/t/Koha/Plugin/Test.pm b/t/Koha/Plugin/Test.pm >index 636554d..9244714 100644 >--- a/t/Koha/Plugin/Test.pm >+++ b/t/Koha/Plugin/Test.pm >@@ -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";; >diff --git a/t/Koha_Template_Plugin_KohaPlugins.t b/t/Koha_Template_Plugin_KohaPlugins.t >new file mode 100755 >index 0000000..8100a63 >--- /dev/null >+++ b/t/Koha_Template_Plugin_KohaPlugins.t >@@ -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' ); >diff --git a/t/db_dependent/Plugins.t b/t/db_dependent/Plugins.t >index 4fa327f..107742d 100755 >--- a/t/db_dependent/Plugins.t >+++ b/t/db_dependent/Plugins.t >@@ -2,7 +2,7 @@ > > use Modern::Perl; > >-use Test::More tests => 32; >+use Test::More tests => 34; > 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' ); >-- >2.1.4
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 20181
:
71481
|
71483
|
71563
|
71565
|
71566
|
71567
|
71568
|
71569
|
73264
|
73265
|
73266
|
73267
|
73417