Line 0
Link Here
|
0 |
- |
1 |
#!/usr/bin/perl |
|
|
2 |
|
3 |
use strict; |
4 |
use warnings; |
5 |
|
6 |
use Test::More tests => 15; |
7 |
use File::Basename; |
8 |
|
9 |
use Module::Load::Conditional qw(can_load); |
10 |
|
11 |
use C4::Context; |
12 |
|
13 |
BEGIN { |
14 |
die('Plugins not enabled in config') unless ( C4::Context->config("enable_plugins") ); |
15 |
|
16 |
push( @INC, dirname(__FILE__) . '/..' ); |
17 |
|
18 |
use_ok('Koha::Plugins'); |
19 |
use_ok('Koha::Plugins::Handler'); |
20 |
use_ok('Koha::Plugins::Base'); |
21 |
use_ok('Koha::Plugin::Test'); |
22 |
} |
23 |
|
24 |
ok( can_load( modules => { "Koha::Plugin::Test" => undef } ), 'Test can_load' ); |
25 |
|
26 |
my $plugin = Koha::Plugin::Test->new(); |
27 |
|
28 |
isa_ok( $plugin, "Koha::Plugin::Test", 'Test plugin class' ); |
29 |
isa_ok( $plugin, "Koha::Plugins::Base", 'Test plugin parent class' ); |
30 |
|
31 |
ok( $plugin->can('report'), 'Test plugin can report' ); |
32 |
ok( $plugin->can('tool'), 'Test plugin can tool' ); |
33 |
ok( $plugin->can('configure'), 'Test plugin can configure' ); |
34 |
ok( $plugin->can('install'), 'Test plugin can install' ); |
35 |
ok( $plugin->can('uninstall'), 'Test plugin can install' ); |
36 |
|
37 |
my $metadata = $plugin->get_metadata(); |
38 |
ok( $metadata->{'name'} eq 'Test Plugin', 'Test $plugin->get_metadata()' ); |
39 |
|
40 |
ok( $plugin->get_qualified_table_name('mytable') eq 'koha_plugin_test_mytable', 'Test $plugin->get_qualified_table_name()' ); |
41 |
ok( $plugin->get_plugin_http_path() eq '/plugin/Koha/Plugin/Test', 'Test $plugin->get_plugin_http_path()' ); |