Bugzilla – Attachment 107300 Details for
Bug 25767
Add Koha::Item::Transfer->receive method
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 25767: Add unit tests for Koha::Item::Transfer->receipt
Bug-25767-Add-unit-tests-for-KohaItemTransfer-rece.patch (text/plain), 2.56 KB, created by
Martin Renvoize (ashimema)
on 2020-07-24 10:09:03 UTC
(
hide
)
Description:
Bug 25767: Add unit tests for Koha::Item::Transfer->receipt
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2020-07-24 10:09:03 UTC
Size:
2.56 KB
patch
obsolete
>From 2d5d53acf418c8263928245a12fa57ec0e4317db Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Tue, 16 Jun 2020 12:20:58 +0100 >Subject: [PATCH] Bug 25767: Add unit tests for Koha::Item::Transfer->receipt > >--- > 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 602a2b9e06..485c57038a 100644 >--- a/t/db_dependent/Koha/Item/Transfer.t >+++ b/t/db_dependent/Koha/Item/Transfer.t >@@ -23,7 +23,7 @@ use Koha::Database; > > use t::lib::TestBuilder; > >-use Test::More tests => 2; >+use Test::More tests => 3; > use Test::Exception; > > my $schema = Koha::Database->new->schema; >@@ -112,3 +112,60 @@ subtest 'transit tests' => sub { > > $schema->storage->txn_rollback; > }; >+ >+subtest 'receipt tests' => sub { >+ plan tests => 5; >+ >+ $schema->storage->txn_begin; >+ >+ my $library1 = $builder->build_object( { class => 'Koha::Libraries' } ); >+ my $library2 = $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, >+ datearrived => undef, >+ reason => 'Manual' >+ } >+ } >+ ); >+ is( ref($transfer), 'Koha::Item::Transfer', 'Mock transfer added' ); >+ >+ # Item checked out should result in failure >+ my $checkout = $builder->build_object( >+ { >+ class => 'Koha::Checkouts', >+ value => { >+ itemnumber => $item->itemnumber >+ } >+ } >+ ); >+ is( ref($checkout), 'Koha::Checkout', 'Mock checkout added' ); >+ >+ throws_ok { $transfer->receipt() } >+ 'Koha::Exceptions::Item::Transfer::Out', >+ 'Exception thrown if item is checked out'; >+ >+ $checkout->delete; >+ >+ # Transit state set >+ $transfer->discard_changes; >+ $transfer->receipt(); >+ ok( $transfer->datearrived, 'Receipt set the datearrived for the transfer' ); >+ >+ # Last seen >+ ok( $item->datelastseen, 'Receipt set item datelastseen date' ); >+ >+ $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 25767
:
105905
|
105906
|
107244
|
107245
|
107299
|
107300
|
110277
|
110278
|
110299
|
110300
|
110397
|
110398
|
110399
|
110510
|
110511
|
110512
|
116550
|
116551
|
116552
|
117571
|
117583