Bugzilla – Attachment 132214 Details for
Bug 28294
C4::Circulation::updateWrongTransfer should be moved into Koha::
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 28294: Unit Tests
Bug-28294-Unit-Tests.patch (text/plain), 3.48 KB, created by
Marcel de Rooy
on 2022-03-25 09:41:09 UTC
(
hide
)
Description:
Bug 28294: Unit Tests
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2022-03-25 09:41:09 UTC
Size:
3.48 KB
patch
obsolete
>From 117b1a9880b9762cae0e6ff69c28fac2f552d921 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Tue, 1 Feb 2022 19:23:47 +0000 >Subject: [PATCH] Bug 28294: Unit Tests >Content-Type: text/plain; charset=utf-8 > >This patch adds unit tests for the new 'remedy' method we are >introducing to Koha::Item::Transfer. >--- > t/db_dependent/Koha/Item/Transfer.t | 59 ++++++++++++++++++++++++++++- > 1 file changed, 58 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/Koha/Item/Transfer.t b/t/db_dependent/Koha/Item/Transfer.t >index 2ac3462351..2ba2e1f415 100755 >--- a/t/db_dependent/Koha/Item/Transfer.t >+++ b/t/db_dependent/Koha/Item/Transfer.t >@@ -24,7 +24,7 @@ use Koha::DateUtils qw( dt_from_string ); > > use t::lib::TestBuilder; > >-use Test::More tests => 7; >+use Test::More tests => 8; > use Test::Exception; > > my $schema = Koha::Database->new->schema; >@@ -311,3 +311,60 @@ subtest 'cancel tests' => sub { > > $schema->storage->txn_rollback; > }; >+ >+subtest 'remedy tests' => sub { >+ plan tests => 10; >+ >+ $schema->storage->txn_begin; >+ >+ my $library1 = $builder->build_object( { class => 'Koha::Libraries' } ); >+ my $library2 = $builder->build_object( { class => 'Koha::Libraries' } ); >+ my $library3 = $builder->build_object( { class => 'Koha::Libraries' } ); >+ my $item = $builder->build_sample_item( >+ { >+ homebranch => $library1->branchcode, >+ holdingbranch => $library2->branchcode, >+ datelastseen => undef >+ } >+ ); >+ >+ my $reason = 'WrongTransfer'; >+ my $transfer = $builder->build_object( >+ { >+ class => 'Koha::Item::Transfers', >+ value => { >+ itemnumber => $item->itemnumber, >+ frombranch => $library2->branchcode, >+ tobranch => $library1->branchcode, >+ daterequested => \'NOW()', >+ datesent => \'NOW()', >+ datearrived => undef, >+ datecancelled => undef, >+ reason => 'Manual', >+ cancellation_reason => undef >+ } >+ } >+ ); >+ is( ref($transfer), 'Koha::Item::Transfer', 'Mock transfer added' ); >+ >+ # Item return updates holding branch >+ $item->holdingbranch($library3->branchcode)->store(); >+ >+ # Successful remedy >+ my $remedy_transfer = $transfer->remedy(); >+ is( ref($remedy_transfer), 'Koha::Item::Transfer', >+ 'Koha::Item::Transfer->remedy should return a new Koha::Item::Transfer object' >+ ); >+ ok( !$remedy_transfer->in_transit, "Remedy transfer is NOT created as in transit (or cancelled)"); >+ is( $remedy_transfer->itemnumber, $transfer->itemnumber, "Remedy transfer is for the same item"); >+ is( $remedy_transfer->frombranch, $library3->branchcode, "Remedy transfer is from the items updated holdingbranch"); >+ is( $remedy_transfer->tobranch, $transfer->tobranch, "Remedy transer is to the same to branch"); >+ is( $remedy_transfer->reason, $transfer->reason, "Remedy transfer has the same reason"); >+ is( $remedy_transfer->comments, $transfer->comments, "Remedy transfer has the same comments"); >+ >+ my $original_transfer = $transfer->get_from_storage; >+ ok( defined($original_transfer->datecancelled), "Original transfer was cancelled"); >+ is( $original_transfer->cancellation_reason, 'WrongTransfer', "Original transfer cancellation reason is 'WrongTransfer'"); >+ >+ $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 28294
:
120637
|
121062
|
121063
|
121064
|
121077
|
121078
|
121079
|
121095
|
121096
|
121097
|
121714
|
121715
|
121716
|
130082
|
130083
|
130084
|
130085
|
130086
|
130087
|
132212
|
132213
|
132214
|
132215
|
132216
|
132217
|
160516
|
160517
|
160518
|
160519
|
160520
|
160521
|
160536
|
160692
|
168281
|
172778
|
172781
|
173856
|
174805