Bugzilla – Attachment 129181 Details for
Bug 29759
Refund credit when cancelling an article request
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 29759: Unit tests
Bug-29759-Unit-tests.patch (text/plain), 2.53 KB, created by
Martin Renvoize (ashimema)
on 2022-01-07 14:38:33 UTC
(
hide
)
Description:
Bug 29759: Unit tests
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2022-01-07 14:38:33 UTC
Size:
2.53 KB
patch
obsolete
>From 64c532bdb6e52cd679ea56ff617a72854b41ee0a Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Wed, 22 Dec 2021 18:17:10 -0300 >Subject: [PATCH] Bug 29759: Unit tests > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > t/db_dependent/Koha/ArticleRequest.t | 31 ++++++++++++++++++++++++---- > 1 file changed, 27 insertions(+), 4 deletions(-) > >diff --git a/t/db_dependent/Koha/ArticleRequest.t b/t/db_dependent/Koha/ArticleRequest.t >index dfa5ec3f6c..b7bceb382e 100755 >--- a/t/db_dependent/Koha/ArticleRequest.t >+++ b/t/db_dependent/Koha/ArticleRequest.t >@@ -156,19 +156,40 @@ subtest 'complete() tests' => sub { > > subtest 'cancel() tests' => sub { > >- plan tests => 4; >+ plan tests => 11; > > $schema->storage->txn_begin; > >+ my $amount = 11; >+ >+ my $patron_mock = Test::MockModule->new('Koha::Patron'); >+ $patron_mock->mock( 'article_request_fee', sub { return $amount; } ); >+ >+ my $patron = $builder->build_object({ class => 'Koha::Patrons' }); >+ my $item = $builder->build_sample_item; >+ > my $ar_mock = Test::MockModule->new('Koha::ArticleRequest'); > $ar_mock->mock( 'notify', sub { ok( 1, '->notify() called' ); } ); > >- my $ar = $builder->build_object( >- { class => 'Koha::ArticleRequests', >- value => { status => Koha::ArticleRequest::Status::Requested } >+ my $ar = Koha::ArticleRequest->new( >+ { >+ borrowernumber => $patron->id, >+ biblionumber => $item->biblionumber, >+ itemnumber => $item->id, > } > ); > >+ $ar->request()->discard_changes; >+ >+ is( $ar->status, Koha::ArticleRequest::Status::Requested ); >+ is( $ar->itemnumber, $item->id, 'itemnumber set' ); >+ ok( defined $ar->debit_id, 'Fee linked' ); >+ is( $patron->account->balance, $amount, 'Outstanding fees with the right value' ); >+ >+ my $payed_amount = 5; >+ $patron->account->pay({ amount => $payed_amount, interface => 'intranet', lines => [ $ar->debit ] }); >+ is( $patron->account->balance, $amount - $payed_amount, 'Outstanding fees with the right value' ); >+ > my $reason = "Hey, ho"; > my $notes = "Let's go!"; > >@@ -178,5 +199,7 @@ subtest 'cancel() tests' => sub { > is( $ar->cancellation_reason, $reason, 'Cancellation reason stored correctly' ); > is( $ar->notes, $notes, 'Notes stored correctly' ); > >+ is( abs $patron->account->balance, $payed_amount, 'The patron has been refunded the right value' ); >+ > $schema->storage->txn_rollback; > }; >-- >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 29759
:
128874
|
128875
|
129162
|
129163
|
129181
|
129182
|
129297
|
129298
|
129302
|
129303
|
129304
|
130093
|
130094
|
130095
|
130096