From f8134ff7f3096889063b80fdc400ee007b50f0af Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Tue, 29 Jan 2019 11:51:29 +0000 Subject: [PATCH] Bug 20912: (QA follow-up) Test for distinct accountlines Signed-off-by: Martin Renvoize Signed-off-by: Kyle M Hall Signed-off-by: Tomas Cohen Arazi --- t/db_dependent/Circulation.t | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/t/db_dependent/Circulation.t b/t/db_dependent/Circulation.t index 184cd6dad4..9f9b47230b 100755 --- a/t/db_dependent/Circulation.t +++ b/t/db_dependent/Circulation.t @@ -2837,6 +2837,8 @@ subtest 'AddRenewal and AddIssuingCharge tests' => sub { $schema->storage->txn_begin; + t::lib::Mocks::mock_preference('item-level_itypes', 1); + my $issuing_charges = 15; my $title = 'A title'; my $author = 'Author, An'; @@ -2851,7 +2853,7 @@ subtest 'AddRenewal and AddIssuingCharge tests' => sub { ); my $library = $builder->build_object({ class => 'Koha::Libraries' }); - my $itemtype = $builder->build_object({ class => 'Koha::ItemTypes' }); + my $itemtype = $builder->build_object({ class => 'Koha::ItemTypes', value => { rental_charge_daily => 0.00 }}); my $patron = $builder->build_object({ class => 'Koha::Patrons', value => { branchcode => $library->id } @@ -2991,8 +2993,8 @@ sub test_debarment_on_checkout { { borrowernumber => $patron->{borrowernumber}, type => 'SUSPENSION' } ); }; -subtest 'Koha::ItemType::calc_rental_charge_daily tests' => sub { - plan tests => 8; +subtest 'Incremented fee tests' => sub { + plan tests => 11; t::lib::Mocks::mock_preference('item-level_itypes', 1); @@ -3081,4 +3083,15 @@ subtest 'Koha::ItemType::calc_rental_charge_daily tests' => sub { $accountline->delete(); $issue->delete(); + $itemtype->rentalcharge('2.000000')->store; + is( $itemtype->rentalcharge, '2.000000', 'Rental charge updated and retreived correctly' ); + $issue = AddIssue( $patron->unblessed, $item->barcode, $dt_to, undef, $dt_from); + my $accountlines = Koha::Account::Lines->search({ itemnumber => $item->id }); + is( $accountlines->count, '2', "Fixed charge and accrued charge recorded distinctly"); + $accountlines->delete(); + AddRenewal( $patron->id, $item->id, $library->id, $dt_to_renew, $dt_to ); + $accountlines = Koha::Account::Lines->search({ itemnumber => $item->id }); + is( $accountlines->count, '2', "Fixed charge and accrued charge recorded distinctly, for renewal"); + $accountlines->delete(); + $issue->delete(); }; -- 2.20.1