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 => 51; |
28 |
use Test::More tests => 52; |
29 |
|
29 |
|
30 |
use C4::Context; |
30 |
use C4::Context; |
31 |
use Koha::Database; |
31 |
use Koha::Database; |
Lines 46-51
BEGIN {
Link Here
|
46 |
|
46 |
|
47 |
my $schema = Koha::Database->new->schema; |
47 |
my $schema = Koha::Database->new->schema; |
48 |
|
48 |
|
|
|
49 |
subtest 'call() tests' => sub { |
50 |
plan tests => 2; |
51 |
|
52 |
$schema->storage->txn_begin; |
53 |
# Temporarily remove any installed plugins data |
54 |
Koha::Plugins::Methods->delete; |
55 |
|
56 |
my $plugins = Koha::Plugins->new({ enable_plugins => 1 }); |
57 |
my @plugins = $plugins->InstallPlugins; |
58 |
foreach my $plugin (@plugins) { |
59 |
$plugin->enable(); |
60 |
} |
61 |
|
62 |
my @responses = Koha::Plugins->call('check_password', { password => 'foo' }); |
63 |
|
64 |
my $expected = [ { error => 1, msg => 'PIN should be four digits' } ]; |
65 |
is_deeply(\@responses, $expected, 'call() should return all responses from plugins'); |
66 |
|
67 |
# Make sure parameters are correctly passed to the plugin method |
68 |
my @responses = Koha::Plugins->call('check_password', { password => '1234' }); |
69 |
|
70 |
my $expected = [ { error => 0 } ]; |
71 |
is_deeply(\@responses, $expected, 'call() should return all responses from plugins'); |
72 |
|
73 |
$schema->storage->txn_rollback; |
74 |
}; |
75 |
|
49 |
subtest 'GetPlugins() tests' => sub { |
76 |
subtest 'GetPlugins() tests' => sub { |
50 |
|
77 |
|
51 |
plan tests => 2; |
78 |
plan tests => 2; |
52 |
- |
|
|