Bug 21073: (QA follow-up) Fix plugin-related tests

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
This commit is contained in:
Tomás Cohen Arazi 2019-06-19 15:38:20 -03:00 committed by Martin Renvoize
parent b40cc9d7ac
commit ef92de033d
Signed by: martin.renvoize
GPG key ID: 422B469130441A0F
3 changed files with 15 additions and 4 deletions

View file

@ -188,7 +188,10 @@ subtest "RecordsFromMarcPlugin" => sub {
t::lib::Mocks::mock_config( 'enable_plugins', 1 );
t::lib::Mocks::mock_preference( 'UseKohaPlugins', 1 );
my ($plugin) = Koha::Plugins->new->GetPlugins({ all => 1, metadata => { name => 'MarcFieldValues' } });
my $plugins = Koha::Plugins->new;
$plugins->InstallPlugins;
my ($plugin) = $plugins->GetPlugins({ all => 1, metadata => { name => 'MarcFieldValues' } });
isnt( $plugin, undef, "Plugin found" );
my $records = C4::ImportBatch::RecordsFromMarcPlugin( $name, ref $plugin, 'UTF-8' );
is( @$records, 2, 'Two results returned' );

View file

@ -50,7 +50,10 @@ subtest 'Bad plugins tests' => sub {
t::lib::Mocks::mock_config( 'enable_plugins', 1 );
t::lib::Mocks::mock_preference( 'UseKohaPlugins', 1 );
my @plugins = Koha::Plugins->new->GetPlugins( { all => 1 } );
my $plugins = Koha::Plugins->new;
$plugins->InstallPlugins;
my @plugins = $plugins->GetPlugins( { all => 1 } );
foreach my $plugin (@plugins) {
$plugin->enable;
}
@ -81,7 +84,10 @@ subtest 'Disabled plugins tests' => sub {
my $good_plugin;
my @plugins = Koha::Plugins->new->GetPlugins( { all => 1 } );
my $plugins = Koha::Plugins->new;
$plugins->InstallPlugins;
my @plugins = $plugins->GetPlugins( { all => 1 } );
foreach my $plugin (@plugins) {
$plugin->disable;
$good_plugin = $plugin

View file

@ -31,7 +31,9 @@ my $schema = Koha::Database->new->schema;
$schema->storage->txn_begin;
# Enable all plugins
my @plugins = Koha::Plugins->new->GetPlugins({ all => 1, class => 'Koha::Plugin::Test' });
my $plugins = Koha::Plugins->new;
$plugins->InstallPlugins;
my @plugins = $plugins->GetPlugins({ all => 1, class => 'Koha::Plugin::Test' });
map { $_->enable; } @plugins;
my $mock_plugin = Test::MockModule->new( 'Koha::Plugin::Test' );