Bugzilla – Attachment 14562 Details for
Bug 7804
Add Koha Plugin System
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 7804 - Add Koha Plugin System - Unit Tests
Bug-7804---Add-Koha-Plugin-System---Unit-Tests.patch (text/plain), 3.07 KB, created by
Kyle M Hall (khall)
on 2013-01-14 13:24:12 UTC
(
hide
)
Description:
Bug 7804 - Add Koha Plugin System - Unit Tests
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2013-01-14 13:24:12 UTC
Size:
3.07 KB
patch
obsolete
>From 838e8e4c2e4f6b777ef3fec5b0a6de36fe26caf8 Mon Sep 17 00:00:00 2001 >From: Kyle M Hall <kyle@bywatersolutions.com> >Date: Mon, 14 Jan 2013 08:23:46 -0500 >Subject: [PATCH] Bug 7804 - Add Koha Plugin System - Unit Tests > >--- > t/Koha/Plugin/Test.pm | 53 +++++++++++++++++++++++++++++++++++++++++++++++++ > t/Plugins.t | 36 +++++++++++++++++++++++++++++++++ > 2 files changed, 89 insertions(+), 0 deletions(-) > create mode 100644 t/Koha/Plugin/Test.pm > create mode 100755 t/Plugins.t > >diff --git a/t/Koha/Plugin/Test.pm b/t/Koha/Plugin/Test.pm >new file mode 100644 >index 0000000..d34a6eb >--- /dev/null >+++ b/t/Koha/Plugin/Test.pm >@@ -0,0 +1,53 @@ >+package Koha::Plugin::Test; >+ >+## It's good practive to use Modern::Perl >+use Modern::Perl; >+ >+## Required for all plugins >+use base qw(Koha::Plugins::Base); >+ >+our $VERSION = 1.01; >+our $metadata = { >+ name => 'Test Plugin', >+ author => 'Kyle M Hall', >+ description => 'Test plugin', >+ date_authored => '2013-01-14', >+ date_updated => '2013-01-14', >+ minimum_version => '3.11', >+ maximum_version => undef, >+ version => $VERSION, >+}; >+ >+## This is the minimum code required for a plugin's 'new' method >+## More can be added, but none should be removed >+sub new { >+ my ( $class, $args ) = @_; >+ $args->{'metadata'} = $metadata; >+ my $self = $class->SUPER::new($args); >+ return $self; >+} >+ >+sub report { >+ my ( $self, $args ) = @_; >+ return 1; >+} >+ >+sub tool { >+ my ( $self, $args ) = @_; >+ return 1; >+} >+ >+sub configure { >+ my ( $self, $args ) = @_; >+ return 1; >+} >+ >+sub install { >+ my ( $self, $args ) = @_; >+ return 1; >+} >+ >+sub uninstall { >+ my ( $self, $args ) = @_; >+ return 1; >+} >diff --git a/t/Plugins.t b/t/Plugins.t >new file mode 100755 >index 0000000..718846d >--- /dev/null >+++ b/t/Plugins.t >@@ -0,0 +1,36 @@ >+#!/usr/bin/perl >+ >+use strict; >+use warnings; >+ >+use Test::More tests => 15; >+ >+use Module::Load::Conditional qw(can_load); >+ >+BEGIN { >+ push( @INC, '.' ); >+ use_ok('Koha::Plugins'); >+ use_ok('Koha::Plugins::Handler'); >+ use_ok('Koha::Plugins::Base'); >+ use_ok('Koha::Plugin::Test'); >+} >+ >+ >+ok( can_load( modules => { "Koha::Plugin::Test" => undef } ), 'Test can_load' ); >+ >+my $plugin = Koha::Plugin::Test->new(); >+ >+isa_ok( $plugin, "Koha::Plugin::Test", 'Test plugin class' ); >+isa_ok( $plugin, "Koha::Plugins::Base", 'Test plugin parent class' ); >+ >+ok( $plugin->can('report'), 'Test plugin can report' ); >+ok( $plugin->can('tool'), 'Test plugin can tool' ); >+ok( $plugin->can('configure'), 'Test plugin can configure' ); >+ok( $plugin->can('install'), 'Test plugin can install' ); >+ok( $plugin->can('uninstall'), 'Test plugin can install' ); >+ >+my $metadata = $plugin->get_metadata(); >+ok( $metadata->{'name'} eq 'Test Plugin', 'Test $plugin->get_metadata()' ); >+ >+ok( $plugin->get_qualified_table_name('mytable') eq 'koha_plugin_test_mytable', 'Test $plugin->get_qualified_table_name()' ); >+ok( $plugin->get_plugin_http_path() eq '/plugin/Koha/Plugin/Test', 'Test $plugin->get_plugin_http_path()' ); >\ No newline at end of file >-- >1.7.2.5
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 7804
:
8525
|
8528
|
8545
|
8546
|
8591
|
8595
|
8596
|
8597
|
8607
|
8608
|
8609
|
9565
|
9636
|
9637
|
9644
|
9755
|
11606
|
14506
|
14508
|
14509
|
14510
|
14511
|
14512
|
14513
|
14514
|
14530
|
14531
|
14538
|
14539
|
14540
|
14541
|
14542
|
14543
|
14545
|
14562
|
14563
|
14632
|
14633
|
14731
|
15166
|
15167
|
15168
|
15531
|
15532
|
15533
|
15570
|
15571
|
15572
|
15653
|
15654
|
15655
|
15656
|
16220
|
16221
|
16222
|
16223
|
16297
|
16298
|
16299