|
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 => 61; |
28 |
use Test::More tests => 62; |
| 29 |
use Test::Warn; |
29 |
use Test::Warn; |
| 30 |
|
30 |
|
| 31 |
use C4::Context; |
31 |
use C4::Context; |
|
Lines 129-134
subtest 'more call() tests' => sub {
Link Here
|
| 129 |
$schema->storage->txn_rollback; |
129 |
$schema->storage->txn_rollback; |
| 130 |
}; |
130 |
}; |
| 131 |
|
131 |
|
|
|
132 |
subtest 'feature_enabled tests' => sub { |
| 133 |
plan tests => 4; |
| 134 |
|
| 135 |
$schema->storage->txn_begin; |
| 136 |
# Temporarily remove any installed plugins data |
| 137 |
Koha::Plugins::Methods->delete; |
| 138 |
$schema->resultset('PluginData')->delete(); |
| 139 |
|
| 140 |
t::lib::Mocks::mock_config('enable_plugins', 0); |
| 141 |
my $enabled = Koha::Plugins->feature_enabled('check_password'); |
| 142 |
ok( !$enabled, "check_password not available when plugins are disabled"); |
| 143 |
|
| 144 |
t::lib::Mocks::mock_config('enable_plugins', 1); |
| 145 |
my $plugins = Koha::Plugins->new({ enable_plugins => 1 }); |
| 146 |
|
| 147 |
my @plugins; |
| 148 |
warning_is { @plugins = $plugins->InstallPlugins; } undef; |
| 149 |
|
| 150 |
$enabled = Koha::Plugins->feature_enabled('check_password'); |
| 151 |
ok( !$enabled, "check_password not available when plugins are installed but not enabled"); |
| 152 |
|
| 153 |
foreach my $plugin (@plugins) { |
| 154 |
$plugin->enable(); |
| 155 |
} |
| 156 |
|
| 157 |
$enabled = Koha::Plugins->feature_enabled('check_password'); |
| 158 |
ok( $enabled, "check_password is available when at least one enabled plugin supports it"); |
| 159 |
|
| 160 |
$schema->storage->txn_rollback; |
| 161 |
}; |
| 162 |
|
| 132 |
subtest 'GetPlugins() tests' => sub { |
163 |
subtest 'GetPlugins() tests' => sub { |
| 133 |
|
164 |
|
| 134 |
plan tests => 3; |
165 |
plan tests => 3; |
| 135 |
- |
|
|