Lines 25-31
use File::Temp qw( tempdir tempfile );
Link Here
|
25 |
use FindBin qw($Bin); |
25 |
use FindBin qw($Bin); |
26 |
use Module::Load::Conditional qw(can_load); |
26 |
use Module::Load::Conditional qw(can_load); |
27 |
use Test::MockModule; |
27 |
use Test::MockModule; |
28 |
use Test::More tests => 53; |
28 |
use Test::More tests => 54; |
29 |
|
29 |
|
30 |
use C4::Context; |
30 |
use C4::Context; |
31 |
use Koha::Database; |
31 |
use Koha::Database; |
Lines 78-83
subtest 'call() tests' => sub {
Link Here
|
78 |
$schema->storage->txn_rollback; |
78 |
$schema->storage->txn_rollback; |
79 |
}; |
79 |
}; |
80 |
|
80 |
|
|
|
81 |
subtest 'call_recursive() tests' => sub { |
82 |
plan tests => 6; |
83 |
|
84 |
$schema->storage->txn_begin; |
85 |
# Temporarily remove any installed plugins data |
86 |
Koha::Plugins::Methods->delete; |
87 |
|
88 |
t::lib::Mocks::mock_config('enable_plugins', 1); |
89 |
my $plugins = Koha::Plugins->new({ enable_plugins => 1 }); |
90 |
my @plugins = $plugins->InstallPlugins; |
91 |
foreach my $plugin (@plugins) { |
92 |
$plugin->enable(); |
93 |
} |
94 |
|
95 |
my (@responses) = Koha::Plugins->call_recursive('item_barcode_transform', 1); |
96 |
is( scalar @responses, 1, "Got back one element" ); |
97 |
is( $responses[0], 4, "Got expected response" ); |
98 |
|
99 |
(@responses) = Koha::Plugins->call_recursive('item_barcode_transform', 'abcd'); |
100 |
is( scalar @responses, 1, "Got back one element" ); |
101 |
is( $responses[0], 'abcd', "Got expected response" ); |
102 |
|
103 |
t::lib::Mocks::mock_config('enable_plugins', 0); |
104 |
(@responses) = Koha::Plugins->call_recursive('item_barcode_transform', 1); |
105 |
is( scalar @responses, 1, "Got back one element" ); |
106 |
is( $responses[0], 1, "call_recursive should return the original arguments if plugins are disabled" ); |
107 |
|
108 |
$schema->storage->txn_rollback; |
109 |
}; |
110 |
|
81 |
subtest 'GetPlugins() tests' => sub { |
111 |
subtest 'GetPlugins() tests' => sub { |
82 |
|
112 |
|
83 |
plan tests => 2; |
113 |
plan tests => 2; |
84 |
- |
|
|