Bugzilla – Attachment 100220 Details for
Bug 24815
Koha::Cash::Register relations should return sets not undef
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 24815: Add additional tests
Bug-24815-Add-additional-tests.patch (text/plain), 3.97 KB, created by
Martin Renvoize (ashimema)
on 2020-03-06 09:04:18 UTC
(
hide
)
Description:
Bug 24815: Add additional tests
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2020-03-06 09:04:18 UTC
Size:
3.97 KB
patch
obsolete
>From 8ed8ad20bd1ab788fe09bd832ced160f3adb3e47 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Fri, 6 Mar 2020 09:00:08 +0000 >Subject: [PATCH] Bug 24815: Add additional tests > >--- > t/db_dependent/Koha/Cash/Register.t | 56 +++++++++++++++++++++++++---- > 1 file changed, 49 insertions(+), 7 deletions(-) > >diff --git a/t/db_dependent/Koha/Cash/Register.t b/t/db_dependent/Koha/Cash/Register.t >index e24fb06f1d..2cda77a6c7 100644 >--- a/t/db_dependent/Koha/Cash/Register.t >+++ b/t/db_dependent/Koha/Cash/Register.t >@@ -55,12 +55,21 @@ subtest 'library' => sub { > }; > > subtest 'accountlines' => sub { >- plan tests => 3; >+ plan tests => 5; > > $schema->storage->txn_begin; > > my $register = > $builder->build_object( { class => 'Koha::Cash::Registers' } ); >+ >+ my $accountlines = $register->accountlines; >+ is( ref($accountlines), 'Koha::Account::Lines', >+'Koha::Cash::Register->accountlines should always return a Koha::Account::Lines set' >+ ); >+ is( $accountlines->count, 0, >+'Koha::Cash::Register->accountlines should always return the correct number of accountlines' >+ ); >+ > my $accountline1 = $builder->build_object( > { > class => 'Koha::Account::Lines', >@@ -74,7 +83,7 @@ subtest 'accountlines' => sub { > } > ); > >- my $accountlines = $register->accountlines; >+ $accountlines = $register->accountlines; > is( ref($accountlines), 'Koha::Account::Lines', > 'Koha::Cash::Register->accountlines should return a set of Koha::Account::Lines' > ); >@@ -146,7 +155,7 @@ subtest 'branch_default' => sub { > }; > > subtest 'cashup' => sub { >- plan tests => 3; >+ plan tests => 4; > > $schema->storage->txn_begin; > >@@ -200,9 +209,43 @@ subtest 'cashup' => sub { > is( $last_cashup, undef, 'undef is returned when no cashup exists' ); > }; > >- subtest 'outstanding_accountlines' => sub { >+ subtest 'cashups' => sub { > plan tests => 4; > >+ my $cashups = $register->cashups; >+ is( ref($cashups), 'Koha::Cash::Register::Actions', >+'Koha::Cash::Register->cashups should always return a Koha::Cash::Register::Actions set' >+ ); >+ is( $cashups->count, 0, >+'Koha::Cash::Register->cashups should always return the correct number of cashups' >+ ); >+ >+ my $cashup3 = >+ $register->add_cashup( >+ { manager_id => $patron->id, amount => '6.00' } ); >+ >+ $cashups = $register->cashups; >+ is( ref($cashups), 'Koha::Cash::Register::Actions', >+'Koha::Cash::Register->cashups should return a Koha::Cash::Register::Actions set' >+ ); >+ is( $cashups->count, 1, >+'Koha::Cash::Register->cashups should return the correct number of cashups' >+ ); >+ >+ $cashup3->delete; >+ }; >+ >+ subtest 'outstanding_accountlines' => sub { >+ plan tests => 6; >+ >+ my $accountlines = $register->outstanding_accountlines; >+ is( ref($accountlines), 'Koha::Account::Lines', >+'Koha::Cash::Register->outstanding_accountlines should always return a Koha::Account::Lines set' >+ ); >+ is( $accountlines->count, 0, >+'Koha::Cash::Register->outstanding_accountlines should always return the correct number of accountlines' >+ ); >+ > # add_cashup should not happen simultaneously with any other action > # that results in an accountline attached to the same cash register. > # In testing, we need to sleep for a second after each action that >@@ -222,11 +265,10 @@ subtest 'cashup' => sub { > ); > sleep 1; > >- my $accountlines = $register->outstanding_accountlines; >+ $accountlines = $register->outstanding_accountlines; > is( $accountlines->count, 2, 'No cashup, all accountlines returned' ); > >- my $cashup3 = >- $register->add_cashup( { manager_id => $patron->id, amount => '2.50' } ); >+ my $cashup3 = $register->add_cashup({manager_id => $patron->id, amount => '2.50'}); > sleep 1; > > $accountlines = $register->outstanding_accountlines; >-- >2.20.1
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 24815
:
100203
|
100219
|
100220
|
101907
|
101908
|
103559
|
103560
|
103786
|
103787
|
103788
|
103790
|
103791