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