Bugzilla – Attachment 71982 Details for
Bug 12001
GetMemberAccountRecords slows down display of patron details and checkout pages
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 12001: Prove that result are the same \o/
Bug-12001-Prove-that-result-are-the-same-o.patch (text/plain), 6.03 KB, created by
Josef Moravec
on 2018-02-20 05:08:58 UTC
(
hide
)
Description:
Bug 12001: Prove that result are the same \o/
Filename:
MIME Type:
Creator:
Josef Moravec
Created:
2018-02-20 05:08:58 UTC
Size:
6.03 KB
patch
obsolete
>From bb647663837d09dcc00e8ab7022ae51b92fdd77a Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Fri, 5 Jan 2018 18:00:24 -0300 >Subject: [PATCH] Bug 12001: Prove that result are the same \o/ > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> > >Signed-off-by: Josef Moravec <josef.moravec@gmail.com> >--- > t/db_dependent/Accounts.t | 37 +++++++++++++++++++------------------ > 1 file changed, 19 insertions(+), 18 deletions(-) > >diff --git a/t/db_dependent/Accounts.t b/t/db_dependent/Accounts.t >index 2c276c8..affaacd 100644 >--- a/t/db_dependent/Accounts.t >+++ b/t/db_dependent/Accounts.t >@@ -25,7 +25,6 @@ use Test::Warn; > use t::lib::TestBuilder; > use t::lib::Mocks; > >-use C4::Members; > use Koha::Account; > use Koha::Account::Lines; > use Koha::Account::Offsets; >@@ -284,7 +283,7 @@ subtest "Koha::Account::pay particular line tests" => sub { > my $line3 = Koha::Account::Line->new({ borrowernumber => $borrower->borrowernumber, amountoutstanding => 3 })->store(); > my $line4 = Koha::Account::Line->new({ borrowernumber => $borrower->borrowernumber, amountoutstanding => 4 })->store(); > >- is( $account->balance(), "10.000000", "Account balance is 10" ); >+ is( $account->balance(), 10, "Account balance is 10" ); > > $account->pay( > { >@@ -326,7 +325,7 @@ subtest "Koha::Account::pay writeoff tests" => sub { > > my $line = Koha::Account::Line->new({ borrowernumber => $borrower->borrowernumber, amountoutstanding => 42 })->store(); > >- is( $account->balance(), "42.000000", "Account balance is 42" ); >+ is( $account->balance(), 42, "Account balance is 42" ); > > my $id = $account->pay( > { >@@ -675,13 +674,15 @@ subtest "Koha::Account::non_issues_charges tests" => sub { > } > )->store; > >+ my $account = $patron->account; >+ > t::lib::Mocks::mock_preference( 'HoldsInNoissuesCharge', 0 ); > t::lib::Mocks::mock_preference( 'RentalsInNoissuesCharge', 0 ); > t::lib::Mocks::mock_preference( 'ManInvInNoissuesCharge', 0 ); >- my ( $total, $non_issues_charges, $other_charges ) = >- C4::Members::GetMemberAccountBalance( $patron->borrowernumber ); >+ my ( $total, $non_issues_charges ) = ( $account->balance, $account->non_issues_charges ); >+ my $other_charges = $total - $non_issues_charges; > is( >- $total, >+ $account->balance, > $res + $rent + $manual, > 'Total charges should be Res + Rent + Manual' > ); >@@ -692,8 +693,8 @@ subtest "Koha::Account::non_issues_charges tests" => sub { > t::lib::Mocks::mock_preference( 'HoldsInNoissuesCharge', 0 ); > t::lib::Mocks::mock_preference( 'RentalsInNoissuesCharge', 0 ); > t::lib::Mocks::mock_preference( 'ManInvInNoissuesCharge', 1 ); >- ( $total, $non_issues_charges, $other_charges ) = >- C4::Members::GetMemberAccountBalance( $patron->borrowernumber ); >+ ( $total, $non_issues_charges ) = ( $account->balance, $account->non_issues_charges ); >+ $other_charges = $total - $non_issues_charges; > is( > $total, > $res + $rent + $manual, >@@ -710,8 +711,8 @@ subtest "Koha::Account::non_issues_charges tests" => sub { > t::lib::Mocks::mock_preference( 'HoldsInNoissuesCharge', 0 ); > t::lib::Mocks::mock_preference( 'RentalsInNoissuesCharge', 1 ); > t::lib::Mocks::mock_preference( 'ManInvInNoissuesCharge', 0 ); >- ( $total, $non_issues_charges, $other_charges ) = >- C4::Members::GetMemberAccountBalance( $patron->borrowernumber ); >+ ( $total, $non_issues_charges ) = ( $account->balance, $account->non_issues_charges ); >+ $other_charges = $total - $non_issues_charges; > is( > $total, > $res + $rent + $manual, >@@ -728,8 +729,8 @@ subtest "Koha::Account::non_issues_charges tests" => sub { > t::lib::Mocks::mock_preference( 'HoldsInNoissuesCharge', 0 ); > t::lib::Mocks::mock_preference( 'RentalsInNoissuesCharge', 1 ); > t::lib::Mocks::mock_preference( 'ManInvInNoissuesCharge', 1 ); >- ( $total, $non_issues_charges, $other_charges ) = >- C4::Members::GetMemberAccountBalance( $patron->borrowernumber ); >+ ( $total, $non_issues_charges ) = ( $account->balance, $account->non_issues_charges ); >+ $other_charges = $total - $non_issues_charges; > is( > $total, > $res + $rent + $manual, >@@ -745,8 +746,8 @@ subtest "Koha::Account::non_issues_charges tests" => sub { > t::lib::Mocks::mock_preference( 'HoldsInNoissuesCharge', 1 ); > t::lib::Mocks::mock_preference( 'RentalsInNoissuesCharge', 0 ); > t::lib::Mocks::mock_preference( 'ManInvInNoissuesCharge', 0 ); >- ( $total, $non_issues_charges, $other_charges ) = >- C4::Members::GetMemberAccountBalance( $patron->borrowernumber ); >+ ( $total, $non_issues_charges ) = ( $account->balance, $account->non_issues_charges ); >+ $other_charges = $total - $non_issues_charges; > is( > $total, > $res + $rent + $manual, >@@ -763,8 +764,8 @@ subtest "Koha::Account::non_issues_charges tests" => sub { > t::lib::Mocks::mock_preference( 'HoldsInNoissuesCharge', 1 ); > t::lib::Mocks::mock_preference( 'RentalsInNoissuesCharge', 1 ); > t::lib::Mocks::mock_preference( 'ManInvInNoissuesCharge', 0 ); >- ( $total, $non_issues_charges, $other_charges ) = >- C4::Members::GetMemberAccountBalance( $patron->borrowernumber ); >+ ( $total, $non_issues_charges ) = ( $account->balance, $account->non_issues_charges ); >+ $other_charges = $total - $non_issues_charges; > is( > $total, > $res + $rent + $manual, >@@ -781,8 +782,8 @@ subtest "Koha::Account::non_issues_charges tests" => sub { > t::lib::Mocks::mock_preference( 'HoldsInNoissuesCharge', 1 ); > t::lib::Mocks::mock_preference( 'RentalsInNoissuesCharge', 1 ); > t::lib::Mocks::mock_preference( 'ManInvInNoissuesCharge', 1 ); >- ( $total, $non_issues_charges, $other_charges ) = >- C4::Members::GetMemberAccountBalance( $patron->borrowernumber ); >+ ( $total, $non_issues_charges ) = ( $account->balance, $account->non_issues_charges ); >+ $other_charges = $total - $non_issues_charges; > is( > $total, > $res + $rent + $manual, >-- >2.1.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 12001
:
70314
|
70342
|
70343
|
70344
|
70345
|
70346
|
71798
|
71799
|
71800
|
71801
|
71802
|
71852
|
71853
|
71854
|
71855
|
71856
|
71857
|
71979
|
71980
|
71981
| 71982 |
71983
|
71984
|
71985
|
71986
|
71987
|
71988
|
77066
|
77136
|
77278
|
77279