Bugzilla – Attachment 154917 Details for
Bug 34639
Item shown in transit on detail.pl even if marked as arrived or cancelled
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 34639: Add tests
Bug-34639-Add-tests.patch (text/plain), 3.18 KB, created by
Lari Taskula
on 2023-08-29 18:57:12 UTC
(
hide
)
Description:
Bug 34639: Add tests
Filename:
MIME Type:
Creator:
Lari Taskula
Created:
2023-08-29 18:57:12 UTC
Size:
3.18 KB
patch
obsolete
>From 0bcf36d0d626d2613197197bfc7af7c4f8d601c7 Mon Sep 17 00:00:00 2001 >From: Lari Taskula <lari.taskula@hypernova.fi> >Date: Tue, 29 Aug 2023 09:34:04 +0000 >Subject: [PATCH] Bug 34639: Add tests > >To reproduce: > >1. Add an item to library A >2. Go to Circulation -> Transfer >3. Transfer the item from library A to another library B >4. Set your currently logged in library to library B >5. Check-in the item >6. Observe message "Item received from A" >7. View the bibliographic record of the item (catalogue/detail.pl) >8. Observe item in "In transit from A to B since xx/xx/xxxx Available" > >To test: >1. prove t/db_dependent/Koha/Item.t >--- > t/db_dependent/Koha/Item.t | 61 +++++++++++++++++++++++++++++++++++++- > 1 file changed, 60 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/Koha/Item.t b/t/db_dependent/Koha/Item.t >index 819f897e0e..3068f4ab89 100755 >--- a/t/db_dependent/Koha/Item.t >+++ b/t/db_dependent/Koha/Item.t >@@ -20,7 +20,7 @@ > use Modern::Perl; > use utf8; > >-use Test::More tests => 29; >+use Test::More tests => 30; > use Test::Exception; > use Test::MockModule; > >@@ -1176,6 +1176,65 @@ subtest 'get_transfers' => sub { > $schema->storage->txn_rollback; > }; > >+subtest 'Test for relationship between item and current_branchtransfers' => sub { >+ plan tests => 4; >+ >+ $schema->storage->txn_begin; >+ >+ my $item = $builder->build_sample_item(); >+ my $transfer = $builder->build_object( >+ { >+ class => 'Koha::Item::Transfers', >+ value => { >+ itemnumber => $item->itemnumber, >+ datesent => dt_from_string, >+ datearrived => dt_from_string, >+ } >+ } >+ ); >+ >+ my $transfer_item = $transfer->item; >+ my $biblio = Koha::Biblios->find($transfer_item->biblionumber); >+ >+ my $current_branchtransfers = Koha::Items->search( { >+ 'me.itemnumber' => $transfer_item->itemnumber >+ }, { >+ prefetch => ['current_branchtransfers'] >+ } >+ ); >+ >+ my $item_with_branchtransfers = $current_branchtransfers->next; >+ >+ is($transfer_item->itemnumber, $item_with_branchtransfers->itemnumber, >+ 'following two items are the same'); >+ >+ # following two tests should produce the same result >+ is($transfer_item->get_transfer, undef, >+ 'Koha::Item->get_transfer returns undef with no active transfers'); >+ is($item_with_branchtransfers->get_transfer, undef, >+ 'prefetched result->get_transfer returns undef with no active transfers'); >+ >+ $transfer->set({ >+ datesent => undef, >+ datearrived => undef, >+ })->store; >+ >+ $current_branchtransfers = Koha::Items->search( { >+ 'me.itemnumber' => $transfer_item->itemnumber >+ }, { >+ prefetch => ['current_branchtransfers'] >+ } >+ ); >+ >+ $item_with_branchtransfers = $current_branchtransfers->next; >+ >+ is($transfer_item->get_transfer->branchtransfer_id, >+ $item_with_branchtransfers->get_transfer->branchtransfer_id, >+ 'an active transfer produces same branchtransfer_id for both methods'); >+ >+ $schema->storage->txn_rollback; >+}; >+ > subtest 'Tests for relationship between item and item_orders via aqorders_item' => sub { > plan tests => 3; > >-- >2.34.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 34639
:
154895
|
154896
|
154900
|
154917
|
154918
|
154919
|
154939
|
154940
|
154941
|
155127
|
155128
|
155129
|
155211
|
155212
|
155213
|
155236
|
155237
|
155238