|
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-30
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::NoWarnings; |
28 |
use Test::More tests => 9; |
| 27 |
use Test::More tests => 7; |
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 |
} |
| 28 |
|
39 |
|
| 29 |
my $schema = Koha::Database->new->schema; |
40 |
my $schema = Koha::Database->new->schema; |
| 30 |
my $builder = t::lib::TestBuilder->new; |
41 |
my $builder = t::lib::TestBuilder->new; |
|
Lines 538-544
subtest 'Final tests' => sub {
Link Here
|
| 538 |
|
549 |
|
| 539 |
subtest 'get_backend_plugin_names() tests' => sub { |
550 |
subtest 'get_backend_plugin_names() tests' => sub { |
| 540 |
|
551 |
|
| 541 |
plan tests => 1; |
552 |
plan tests => 3; |
| 542 |
|
553 |
|
| 543 |
$schema->storage->txn_begin; |
554 |
$schema->storage->txn_begin; |
| 544 |
|
555 |
|
|
Lines 549-554
subtest 'get_backend_plugin_names() tests' => sub {
Link Here
|
| 549 |
'get_backend_plugin_names returns empty list if plugins are disabled' |
560 |
'get_backend_plugin_names returns empty list if plugins are disabled' |
| 550 |
); |
561 |
); |
| 551 |
|
562 |
|
|
|
563 |
t::lib::Mocks::mock_config( 'enable_plugins', 1 ); |
| 564 |
my $koha_plugins = Koha::Plugins->new(); |
| 565 |
$koha_plugins->InstallPlugins; |
| 566 |
|
| 567 |
my @backend_plugins = |
| 568 |
$koha_plugins |
| 569 |
? $koha_plugins->GetPlugins( { plugin_class => 'Koha::Plugin::Test' } ) |
| 570 |
: (); |
| 571 |
my $backend_plugin = $backend_plugins[0]; |
| 572 |
|
| 573 |
my @backend_plugin_names = $config->get_backend_plugin_names(); |
| 574 |
my $backend_plugin_name = $backend_plugin_names[0]; |
| 575 |
|
| 576 |
is( |
| 577 |
$backend_plugin_name, $backend_plugin->get_metadata()->{name}, |
| 578 |
'get_backend_plugin_names returns list of backend plugin names' |
| 579 |
); |
| 580 |
|
| 581 |
$backend_plugin->disable; |
| 582 |
my @after_disable_backend_plugin_names = $config->get_backend_plugin_names(); |
| 583 |
my $after_disable_backend_plugin_name = $after_disable_backend_plugin_names[0]; |
| 584 |
|
| 585 |
is( |
| 586 |
$after_disable_backend_plugin_name, undef, |
| 587 |
'get_backend_plugin_names returns empty list if backend plugin is disabled' |
| 588 |
); |
| 589 |
|
| 590 |
#cleanup |
| 591 |
Koha::Plugins::Methods->delete; |
| 552 |
$schema->storage->txn_rollback; |
592 |
$schema->storage->txn_rollback; |
| 553 |
}; |
593 |
}; |
| 554 |
|
594 |
|
| 555 |
- |
|
|