From e2b444d7beb4def68f99a339d45dce988bac4e46 Mon Sep 17 00:00:00 2001 From: Nick Clemens Date: Mon, 25 Mar 2019 19:38:40 +0000 Subject: [PATCH] Bug 22008: Fix failing tests --- acqui/ordered.pl | 2 +- t/db_dependent/Accounts.t | 9 ++++++++- t/db_dependent/Circulation.t | 4 ++++ 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/acqui/ordered.pl b/acqui/ordered.pl index 3eb0519c65..d26a977827 100755 --- a/acqui/ordered.pl +++ b/acqui/ordered.pl @@ -99,7 +99,7 @@ while ( my $data = $sth->fetchrow_hashref ) { $left = $data->{'quantity'}; } if ( $left && $left > 0 ) { - my $subtotal = get_rounded_price( $left * $data->{'ecost_tax_included'} ); + my $subtotal = get_rounded_price( $data->{'ecost_tax_included'} ) * $left; $data->{subtotal} = sprintf( "%.2f", $subtotal ); $data->{'left'} = $left; push @ordered, $data; diff --git a/t/db_dependent/Accounts.t b/t/db_dependent/Accounts.t index 6af3a3d1c0..8822ea8bec 100644 --- a/t/db_dependent/Accounts.t +++ b/t/db_dependent/Accounts.t @@ -1093,6 +1093,14 @@ subtest "Payment notice tests" => sub { } )->store(); + my $manager = $builder->build_object({ class => "Koha::Patrons" }); + my $context = new Test::MockModule('C4::Context'); + $context->mock( 'userenv', sub { + return { + number => $manager->borrowernumber, + branch => $manager->branchcode, + }; + }); my $account = Koha::Account->new({ patron_id => $borrower->id }); my $line = Koha::Account::Line->new({ borrowernumber => $borrower->borrowernumber, amountoutstanding => 27 })->store(); @@ -1102,7 +1110,6 @@ subtest "Payment notice tests" => sub { $letter->store(); t::lib::Mocks::mock_preference('UseEmailReceipts', '0'); - my $id = $account->pay( { amount => 1 } ); is( Koha::Notice::Messages->search()->count(), 0, 'Notice for payment not sent if UseEmailReceipts is disabled' ); diff --git a/t/db_dependent/Circulation.t b/t/db_dependent/Circulation.t index 134921269a..6c5e6e9566 100755 --- a/t/db_dependent/Circulation.t +++ b/t/db_dependent/Circulation.t @@ -916,6 +916,8 @@ my ( $reused_itemnumber_1, $reused_itemnumber_2 ); ( $renewokay, $error ) = CanBookBeRenewed($renewing_borrowernumber, $item_7->itemnumber); is( $renewokay, 0, '(Bug 8236), Cannot renew, one of the items is overdue'); + my $manager = $builder->build_object({ class => "Koha::Patrons" }); + t::lib::Mocks::mock_userenv({ patron => $manager,branchcode => $manager->branchcode }); t::lib::Mocks::mock_preference('WhenLostChargeReplacementFee','1'); $checkout = Koha::Checkouts->find( { itemnumber => $item_3->itemnumber } ); LostItem( $item_3->itemnumber, 'test', 0 ); @@ -2004,6 +2006,8 @@ subtest '_FixAccountForLostAndReturned' => sub { plan tests => 10; my $patron = $builder->build_object( { class => 'Koha::Patrons' } ); + my manager = $builder->build_object({ class => "Koha::Patrons" }); + t::lib::Mocks::mock_userenv({ patron => $manager,branchcode => $manager->branchcode }); my $item = $builder->build_sample_item( { -- 2.11.0