Lines 13-18
use Test::More tests => 42;
Link Here
|
13 |
|
13 |
|
14 |
use C4::Context; |
14 |
use C4::Context; |
15 |
use Koha::Database; |
15 |
use Koha::Database; |
|
|
16 |
use Koha::Plugins::Methods; |
16 |
|
17 |
|
17 |
use t::lib::Mocks; |
18 |
use t::lib::Mocks; |
18 |
|
19 |
|
Lines 27-32
BEGIN {
Link Here
|
27 |
|
28 |
|
28 |
my $schema = Koha::Database->new->schema; |
29 |
my $schema = Koha::Database->new->schema; |
29 |
|
30 |
|
|
|
31 |
Koha::Plugins->new( { enable_plugins => 1 } )->InstallPlugins(); |
32 |
|
33 |
ok( Koha::Plugins::Methods->search( { plugin_class => 'Koha::Plugin::Test' } )->count, 'Test plugin methods added to database' ); |
34 |
|
30 |
my $mock_plugin = Test::MockModule->new( 'Koha::Plugin::Test' ); |
35 |
my $mock_plugin = Test::MockModule->new( 'Koha::Plugin::Test' ); |
31 |
$mock_plugin->mock( 'test_template', sub { |
36 |
$mock_plugin->mock( 'test_template', sub { |
32 |
my ( $self, $file ) = @_; |
37 |
my ( $self, $file ) = @_; |
Lines 88-99
is( scalar grep( /^Test Plugin$/, @names), 1, "Koha::Plugins::GetPlugins functio
Link Here
|
88 |
}); |
93 |
}); |
89 |
@names = map { $_->get_metadata()->{'name'} } @plugins; |
94 |
@names = map { $_->get_metadata()->{'name'} } @plugins; |
90 |
is( scalar grep( /^Test Plugin$/, @names), 1, "GetPlugins also found Test Plugin via a metadata tag" ); |
95 |
is( scalar grep( /^Test Plugin$/, @names), 1, "GetPlugins also found Test Plugin via a metadata tag" ); |
91 |
# Test two metadata conditions; one does not exist for Test.pm |
|
|
92 |
# Since it is a required key, we should not find the same results |
93 |
my @plugins2 = Koha::Plugins->new({ enable_plugins => 1 })->GetPlugins({ |
94 |
metadata => { my_example_tag => 'find_me', not_there => '1' }, |
95 |
}); |
96 |
isnt( scalar @plugins2, scalar @plugins, 'GetPlugins with two metadata conditions' ); |
97 |
|
96 |
|
98 |
for my $pass ( 1 .. 2 ) { |
97 |
for my $pass ( 1 .. 2 ) { |
99 |
my $plugins_dir; |
98 |
my $plugins_dir; |
Lines 125-130
for my $pass ( 1 .. 2 ) {
Link Here
|
125 |
|
124 |
|
126 |
ok( -f $plugins_dir . "/Koha/Plugin/Com/ByWaterSolutions/KitchenSink.pm", "KitchenSink plugin installed successfully" ); |
125 |
ok( -f $plugins_dir . "/Koha/Plugin/Com/ByWaterSolutions/KitchenSink.pm", "KitchenSink plugin installed successfully" ); |
127 |
$INC{$pm_path} = $full_pm_path; # FIXME I do not really know why, but if this is moved before the $plugin constructor, it will fail with Can't locate object method "new" via package "Koha::Plugin::Com::ByWaterSolutions::KitchenSink" |
126 |
$INC{$pm_path} = $full_pm_path; # FIXME I do not really know why, but if this is moved before the $plugin constructor, it will fail with Can't locate object method "new" via package "Koha::Plugin::Com::ByWaterSolutions::KitchenSink" |
|
|
127 |
Koha::Plugins->new( { enable_plugins => 1 } )->InstallPlugins(); |
128 |
Koha::Plugins::Handler->delete({ class => "Koha::Plugin::Com::ByWaterSolutions::KitchenSink", enable_plugins => 1 }); |
128 |
Koha::Plugins::Handler->delete({ class => "Koha::Plugin::Com::ByWaterSolutions::KitchenSink", enable_plugins => 1 }); |
129 |
my $sth = C4::Context->dbh->table_info( undef, undef, $table, 'TABLE' ); |
129 |
my $sth = C4::Context->dbh->table_info( undef, undef, $table, 'TABLE' ); |
130 |
my $info = $sth->fetchall_arrayref; |
130 |
my $info = $sth->fetchall_arrayref; |
131 |
- |
|
|