Bugzilla – Attachment 83090 Details for
Bug 21727
Add Koha::Account::Line->adjust
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 21727: (QA follow-up) Test lastincrement changes
Bug-21727-QA-follow-up-Test-lastincrement-changes.patch (text/plain), 3.42 KB, created by
Martin Renvoize (ashimema)
on 2018-12-12 09:07:42 UTC
(
hide
)
Description:
Bug 21727: (QA follow-up) Test lastincrement changes
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2018-12-12 09:07:42 UTC
Size:
3.42 KB
patch
obsolete
>From e4924c0e8555ecafe22fa99c22e12c600c67c831 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Tue, 11 Dec 2018 12:35:29 -0300 >Subject: [PATCH] Bug 21727: (QA follow-up) Test lastincrement changes > >'adjust' changes the 'lastincrement column, and this behaviour should be >tested. This patch just adds tests for that. > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > t/db_dependent/Koha/Account/Lines.t | 22 +++++++++++++--------- > 1 file changed, 13 insertions(+), 9 deletions(-) > >diff --git a/t/db_dependent/Koha/Account/Lines.t b/t/db_dependent/Koha/Account/Lines.t >index 64a6242500..7a9f080fc0 100755 >--- a/t/db_dependent/Koha/Account/Lines.t >+++ b/t/db_dependent/Koha/Account/Lines.t >@@ -272,7 +272,7 @@ subtest 'apply() tests' => sub { > > subtest 'adjust() tests' => sub { > >- plan tests => 16; >+ plan tests => 19; > > $schema->storage->txn_begin; > >@@ -311,10 +311,12 @@ subtest 'adjust() tests' => sub { > 'Exception thrown for type conflict'; > > # Increment an unpaid fine >- $debit_2->adjust( { amount => 150, type => 'fine_increment' } ); >+ $debit_2->adjust( { amount => 150, type => 'fine_increment' } )->discard_changes; > >- is( $debit_2->discard_changes->amount * 1, 150, 'Fine amount was updated in full' ); >- is( $debit_2->discard_changes->amountoutstanding * 1, 150, 'Fine amountoutstanding was update in full' ); >+ is( $debit_2->amount * 1, 150, 'Fine amount was updated in full' ); >+ is( $debit_2->amountoutstanding * 1, 150, 'Fine amountoutstanding was update in full' ); >+ isnt( $debit_2->date, undef, 'Date has been set' ); >+ is( $debit_2->lastincrement * 1, 50, 'lastincrement is the to the right value' ); > > my $offsets = Koha::Account::Offsets->search( { debit_id => $debit_2->id } ); > is( $offsets->count, 1, 'An offset is generated for the increment' ); >@@ -328,17 +330,19 @@ subtest 'adjust() tests' => sub { > my $debits = Koha::Account::Lines->search({ accountlines_id => $debit_2->id }); > $credit->apply( { debits => $debits, offset_type => 'Manual Credit' } ); > >- is( $debit_2->discard_changes->amount * 1, 150, 'Fine amount unaffected by partial payment' ); >- is( $debit_2->discard_changes->amountoutstanding * 1, 110, 'Fine amountoutstanding updated by partial payment' ); >+ $debit_2->discard_changes; >+ is( $debit_2->amount * 1, 150, 'Fine amount unaffected by partial payment' ); >+ is( $debit_2->amountoutstanding * 1, 110, 'Fine amountoutstanding updated by partial payment' ); > > # Enable logs > t::lib::Mocks::mock_preference( 'FinesLog', 1 ); > > # Increment the partially paid fine >- $debit_2->adjust( { amount => 160, type => 'fine_increment' } ); >+ $debit_2->adjust( { amount => 160, type => 'fine_increment' } )->discard_changes; > >- is( $debit_2->discard_changes->amount * 1, 160, 'Fine amount was updated in full' ); >- is( $debit_2->discard_changes->amountoutstanding * 1, 120, 'Fine amountoutstanding was updated by difference' ); >+ is( $debit_2->amount * 1, 160, 'Fine amount was updated in full' ); >+ is( $debit_2->amountoutstanding * 1, 120, 'Fine amountoutstanding was updated by difference' ); >+ is( $debit_2->lastincrement * 1, 10, 'lastincrement is the to the right value' ); > > $offsets = Koha::Account::Offsets->search( { debit_id => $debit_2->id } ); > is( $offsets->count, 3, 'An offset is generated for the increment' ); >-- >2.19.2
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 21727
:
81879
|
82777
|
82778
|
83054
|
83055
|
83056
|
83058
|
83088
|
83089
|
83090
|
83091
|
83095
|
83096
|
83097
|
83098
|
83101
|
83117
|
83118
|
83121
|
83122
|
83818