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:
parent
b40cc9d7ac
commit
ef92de033d
3 changed files with 15 additions and 4 deletions
|
@ -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' );
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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' );
|
||||
|
|
Loading…
Reference in a new issue