Bugzilla – Attachment 120758 Details for
Bug 24434
C4::Circulation::updateWrongTransfer is never called but should be
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 24434: Unit tests for updateWrongTransfer
Bug-24434-Unit-tests-for-updateWrongTransfer.patch (text/plain), 2.76 KB, created by
Martin Renvoize (ashimema)
on 2021-05-10 09:12:41 UTC
(
hide
)
Description:
Bug 24434: Unit tests for updateWrongTransfer
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2021-05-10 09:12:41 UTC
Size:
2.76 KB
patch
obsolete
>From a3b6a30e792b69736d2d5ea38c6d98cecacc62f6 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Mon, 10 May 2021 10:11:19 +0100 >Subject: [PATCH] Bug 24434: Unit tests for updateWrongTransfer > >Add unit tests to cover updateWrongTransfer >--- > t/db_dependent/Circulation.t | 42 +++++++++++++++++++++++++++++++++++- > 1 file changed, 41 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/Circulation.t b/t/db_dependent/Circulation.t >index 6266d14561..d00d2d86fa 100755 >--- a/t/db_dependent/Circulation.t >+++ b/t/db_dependent/Circulation.t >@@ -18,7 +18,7 @@ > use Modern::Perl; > use utf8; > >-use Test::More tests => 54; >+use Test::More tests => 55; > use Test::Exception; > use Test::MockModule; > use Test::Deep qw( cmp_deeply ); >@@ -4879,6 +4879,46 @@ subtest "Item's onloan value should be set if checked out item is checked out to > ok( $item->get_from_storage->onloan, "Item's onloan column is set after second checkout" ); > }; > >+subtest "updateWrongTransfer tests" => sub { >+ plan tests => 5; >+ >+ 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 $transfer = $builder->build_object( >+ { >+ class => 'Koha::Item::Transfers', >+ value => { >+ itemnumber => $item->itemnumber, >+ frombranch => $library2->branchcode, >+ tobranch => $library1->branchcode, >+ daterequested => dt_from_string, >+ datesent => dt_from_string, >+ datecancelled => undef, >+ datearrived => undef, >+ reason => 'Manual' >+ } >+ } >+ ); >+ is( ref($transfer), 'Koha::Item::Transfer', 'Mock transfer added' ); >+ >+ my $new_transfer = C4::Circulation::updateWrongTransfer($item->itemnumber); >+ is(ref($new_transfer), 'Koha::Item::Transfer', "updateWrongTransfer returns a 'Koha::Item::Transfer' object"); >+ ok( !$new_transfer->in_transit, "New transfer is NOT created as in transit (or cancelled)"); >+ >+ 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; > C4::Context->clear_syspref_cache(); > $branches = Koha::Libraries->search(); >-- >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 24434
:
97449
|
97550
|
99829
|
120625
|
120631
|
120632
|
120657
|
120658
|
120683
|
120684
|
120757
|
120758
|
121029
|
121030
|
121031
|
121032
|
121033
|
121034
|
121057
|
121058
|
121059
|
121060
|
121061
|
121071
|
121072
|
121073
|
121074
|
121075
|
121515
|
121702
|
121703
|
121704
|
121705
|
121706
|
121707
|
121798
|
121799
|
121800
|
121801
|
121802
|
121803
|
121804