From 6f3a55d2a36a37510950b1c4c179cabad79af301 Mon Sep 17 00:00:00 2001 From: Pedro Amorim Date: Tue, 29 Oct 2024 11:12:25 +0000 Subject: [PATCH] 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 Signed-off-by: David Nind Signed-off-by: Martin Renvoize Signed-off-by: Katrin Fischer --- t/db_dependent/Koha/ILL/Request.t | 19 ++++++++++++++++++- t/db_dependent/Koha/ILL/Request/Config.t | 17 ++++++++++++++++- 2 files changed, 34 insertions(+), 2 deletions(-) diff --git a/t/db_dependent/Koha/ILL/Request.t b/t/db_dependent/Koha/ILL/Request.t index 2ec832949e..fe8f1631c9 100755 --- a/t/db_dependent/Koha/ILL/Request.t +++ b/t/db_dependent/Koha/ILL/Request.t @@ -19,11 +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; @@ -130,3 +131,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; +}; diff --git a/t/db_dependent/Koha/ILL/Request/Config.t b/t/db_dependent/Koha/ILL/Request/Config.t index f511726c30..2d4b60f260 100755 --- a/t/db_dependent/Koha/ILL/Request/Config.t +++ b/t/db_dependent/Koha/ILL/Request/Config.t @@ -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; -- 2.39.5