Bug 37872: Add tests

$ prove t/db_dependent/Koha/ILL/Request.t
$ prove t/db_dependent/Koha/ILL/Request/Config.t

Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com>
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Katrin Fischer <katrin.fischer@bsz-bw.de>
(cherry picked from commit 6f3a55d2a3)
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
This commit is contained in:
Pedro Amorim 2024-10-29 11:12:25 +00:00 committed by Lucas Gass
parent 57a4503192
commit 264c2ad2f0
2 changed files with 35 additions and 2 deletions

View File

@ -19,10 +19,12 @@
use Modern::Perl;
use Test::More tests => 3;
use Test::More tests => 4;
use Test::MockModule;
use Koha::ILL::Requests;
use t::lib::Mocks;
use t::lib::TestBuilder;
my $builder = t::lib::TestBuilder->new;
@ -112,3 +114,19 @@ subtest 'get_type_disclaimer_date() tests' => sub {
$schema->storage->txn_rollback;
};
subtest 'get_backend_plugin() tests' => sub {
plan tests => 1;
$schema->storage->txn_begin;
my $request = $builder->build_object( { class => 'Koha::ILL::Requests' } );
t::lib::Mocks::mock_config( 'enable_plugins', 0 );
is(
$request->get_backend_plugin, undef,
'get_backend_plugin returns undef if plugins are disabled'
);
$schema->storage->txn_rollback;
};

View File

@ -23,7 +23,7 @@ use t::lib::TestBuilder;
use Test::MockObject;
use Test::Exception;
use Test::More tests => 5;
use Test::More tests => 6;
my $schema = Koha::Database->new->schema;
my $builder = t::lib::TestBuilder->new;
@ -487,5 +487,20 @@ subtest 'Final tests' => sub {
$schema->storage->txn_rollback;
};
subtest 'get_backend_plugin_names() tests' => sub {
plan tests => 1;
$schema->storage->txn_begin;
my $config = Koha::ILL::Request::Config->new;
t::lib::Mocks::mock_config( 'enable_plugins', 0 );
is(
$config->get_backend_plugin_names(), 0,
'get_backend_plugin_names returns empty list if plugins are disabled'
);
$schema->storage->txn_rollback;
};
1;