From b96f731b56ab63d80f423995a275c37eedd59f41 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Fri, 6 Nov 2020 16:19:15 +0000 Subject: [PATCH] Bug 24786: (QA follow-up) Mock UseCashRegister in tests --- t/db_dependent/Koha/Template/Plugin/Registers.t | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/t/db_dependent/Koha/Template/Plugin/Registers.t b/t/db_dependent/Koha/Template/Plugin/Registers.t index 912e5b85f8..8ed14cee52 100755 --- a/t/db_dependent/Koha/Template/Plugin/Registers.t +++ b/t/db_dependent/Koha/Template/Plugin/Registers.t @@ -66,10 +66,12 @@ subtest 'session_register_name' => sub { subtest 'all() tests' => sub { - plan tests => 20; + plan tests => 21; $schema->storage->txn_begin; + t::lib::Mocks::mock_preference( 'UseCashRegisters', 1 ); + my $count = Koha::Cash::Registers->search({ archived => 0 })->count; my $max_register = Koha::Cash::Registers->search( {}, { order_by => { '-desc' => 'id' }, rows => 1 } )->single; @@ -110,8 +112,8 @@ subtest 'all() tests' => sub { { class => 'Koha::Cash::Registers', value => { - branch => $library2->branchcode, - archived => 0 + branch => $library2->branchcode, + archived => 0 } } ); @@ -177,6 +179,10 @@ subtest 'all() tests' => sub { ); } + t::lib::Mocks::mock_preference( 'UseCashRegisters', 0 ); + $result = $plugin->all(); + is( $result, undef, "Return undef when UseCashRegisters is disabled" ); + $schema->storage->txn_rollback; }; -- 2.20.1