|
Lines 16-21
Link Here
|
| 16 |
# along with Koha; if not, see <http://www.gnu.org/licenses>. |
16 |
# along with Koha; if not, see <http://www.gnu.org/licenses>. |
| 17 |
|
17 |
|
| 18 |
use Modern::Perl; |
18 |
use Modern::Perl; |
|
|
19 |
use File::Basename; |
| 20 |
use File::Path qw(make_path remove_tree); |
| 19 |
|
21 |
|
| 20 |
use Koha::Database; |
22 |
use Koha::Database; |
| 21 |
use t::lib::Mocks; |
23 |
use t::lib::Mocks; |
|
Lines 23-29
use t::lib::TestBuilder;
Link Here
|
| 23 |
use Test::MockObject; |
25 |
use Test::MockObject; |
| 24 |
use Test::Exception; |
26 |
use Test::Exception; |
| 25 |
|
27 |
|
| 26 |
use Test::More tests => 6; |
28 |
use Test::More tests => 9; |
|
|
29 |
|
| 30 |
BEGIN { |
| 31 |
# Mock pluginsdir before loading Plugins module |
| 32 |
my $path = dirname(__FILE__) . '/../../../../lib/plugins'; |
| 33 |
t::lib::Mocks::mock_config( 'pluginsdir', $path ); |
| 34 |
|
| 35 |
use_ok('Koha::Plugins'); |
| 36 |
use_ok('Koha::Plugins::Handler'); |
| 37 |
use_ok('Koha::Plugin::Test'); |
| 38 |
} |
| 27 |
|
39 |
|
| 28 |
my $schema = Koha::Database->new->schema; |
40 |
my $schema = Koha::Database->new->schema; |
| 29 |
my $builder = t::lib::TestBuilder->new; |
41 |
my $builder = t::lib::TestBuilder->new; |
|
Lines 489-495
subtest 'Final tests' => sub {
Link Here
|
| 489 |
|
501 |
|
| 490 |
subtest 'get_backend_plugin_names() tests' => sub { |
502 |
subtest 'get_backend_plugin_names() tests' => sub { |
| 491 |
|
503 |
|
| 492 |
plan tests => 1; |
504 |
plan tests => 3; |
| 493 |
|
505 |
|
| 494 |
$schema->storage->txn_begin; |
506 |
$schema->storage->txn_begin; |
| 495 |
|
507 |
|
|
Lines 500-505
subtest 'get_backend_plugin_names() tests' => sub {
Link Here
|
| 500 |
'get_backend_plugin_names returns empty list if plugins are disabled' |
512 |
'get_backend_plugin_names returns empty list if plugins are disabled' |
| 501 |
); |
513 |
); |
| 502 |
|
514 |
|
|
|
515 |
t::lib::Mocks::mock_config( 'enable_plugins', 1 ); |
| 516 |
my $koha_plugins = Koha::Plugins->new(); |
| 517 |
$koha_plugins->InstallPlugins; |
| 518 |
|
| 519 |
my @backend_plugins = |
| 520 |
$koha_plugins |
| 521 |
? $koha_plugins->GetPlugins( { plugin_class => 'Koha::Plugin::Test' } ) |
| 522 |
: (); |
| 523 |
my $backend_plugin = $backend_plugins[0]; |
| 524 |
|
| 525 |
my @backend_plugin_names = $config->get_backend_plugin_names(); |
| 526 |
my $backend_plugin_name = $backend_plugin_names[0]; |
| 527 |
|
| 528 |
is( |
| 529 |
$backend_plugin_name, $backend_plugin->get_metadata()->{name}, |
| 530 |
'get_backend_plugin_names returns list of backend plugin names' |
| 531 |
); |
| 532 |
|
| 533 |
$backend_plugin->disable; |
| 534 |
my @after_disable_backend_plugin_names = $config->get_backend_plugin_names(); |
| 535 |
my $after_disable_backend_plugin_name = $after_disable_backend_plugin_names[0]; |
| 536 |
|
| 537 |
is( |
| 538 |
$after_disable_backend_plugin_name, undef, |
| 539 |
'get_backend_plugin_names returns empty list if backend plugin is disabled' |
| 540 |
); |
| 541 |
|
| 542 |
#cleanup |
| 543 |
Koha::Plugins::Methods->delete; |
| 503 |
$schema->storage->txn_rollback; |
544 |
$schema->storage->txn_rollback; |
| 504 |
}; |
545 |
}; |
| 505 |
|
546 |
|
| 506 |
- |
|
|