Bugzilla – Attachment 100623 Details for
Bug 24298
Record if a transfer was triggered by 'return to homebranch'
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 24298: Add tests for ModItemTransfer
Bug-24298-Add-tests-for-ModItemTransfer.patch (text/plain), 3.25 KB, created by
Nick Clemens (kidclamp)
on 2020-03-12 12:15:56 UTC
(
hide
)
Description:
Bug 24298: Add tests for ModItemTransfer
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2020-03-12 12:15:56 UTC
Size:
3.25 KB
patch
obsolete
>From a75791b96d131571d7523bafe9e06437016cfc21 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Mon, 3 Feb 2020 13:21:18 +0000 >Subject: [PATCH] Bug 24298: Add tests for ModItemTransfer > >Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com> >All 8 tests in 'ModItemTransfer tests' pass > >Signed-off-by: Nick Clemens <nick@bywatersolutions.com> >--- > t/db_dependent/Items.t | 75 ++++++++++++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 75 insertions(+) > >diff --git a/t/db_dependent/Items.t b/t/db_dependent/Items.t >index 369935eebc..f72315dd83 100755 >--- a/t/db_dependent/Items.t >+++ b/t/db_dependent/Items.t >@@ -146,6 +146,81 @@ subtest 'ModItem tests' => sub { > > }; > >+subtest 'ModItemTransfer tests' => sub { >+ plan tests => 8; >+ >+ $schema->storage->txn_begin; >+ >+ my $builder = t::lib::TestBuilder->new; >+ my $item = $builder->build_object( >+ { >+ class => 'Koha::Items', >+ value => { >+ itemlost => 0, >+ damaged => 0, >+ withdrawn => 0, >+ itemlost_on => undef, >+ damaged_on => undef, >+ withdrawn_on => undef, >+ } >+ } >+ )->store; >+ >+ my $library1 = $builder->build( >+ { >+ source => 'Branch', >+ } >+ ); >+ my $library2 = $builder->build( >+ { >+ source => 'Branch', >+ } >+ ); >+ >+ ModItemTransfer( $item->itemnumber, $library1->{branchcode}, >+ $library2->{branchcode} ); >+ >+ my $transfers = Koha::Item::Transfers->search( >+ { >+ itemnumber => $item->itemnumber >+ } >+ ); >+ >+ is( $transfers->count, 1, "One transfer created with ModItemTransfer" ); >+ $item->discard_changes; >+ is($item->holdingbranch, $library1->{branchcode}, "Items holding branch was updated to frombranch"); >+ >+ ModItemTransfer( $item->itemnumber, $library2->{branchcode}, >+ $library1->{branchcode} ); >+ $transfers = Koha::Item::Transfers->search( >+ { itemnumber => $item->itemnumber, }, >+ { order_by => { '-asc' => 'branchtransfer_id' } } >+ ); >+ >+ is($transfers->count, 2, "Second transfer recorded on second call of ModItemTransfer"); >+ my $transfer1 = $transfers->next; >+ my $transfer2 = $transfers->next; >+ isnt($transfer1->datearrived, undef, "First transfer marked as completed by ModItemTransfer"); >+ like($transfer1->comments,qr/^Canceled/, "First transfer contains 'Canceled' comment"); >+ is($transfer2->datearrived, undef, "Second transfer is now the active transfer"); >+ $item->discard_changes; >+ is($item->holdingbranch, $library2->{branchcode}, "Items holding branch was updated to frombranch"); >+ >+ # Check 'reason' is populated when passed >+ ModItemTransfer( $item->itemnumber, $library2->{branchcode}, >+ $library1->{branchcode}, "Manual" ); >+ >+ $transfers = Koha::Item::Transfers->search( >+ { itemnumber => $item->itemnumber, }, >+ { order_by => { '-desc' => 'branchtransfer_id' } } >+ ); >+ >+ my $transfer3 = $transfers->next; >+ is($transfer3->reason, 'Manual', "Reason set via ModItemTransfer"); >+ >+ $schema->storage->txn_rollback; >+}; >+ > subtest 'GetHiddenItemnumbers tests' => sub { > > plan tests => 11; >-- >2.11.0
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 24298
:
97450
|
97451
|
97506
|
97507
|
97535
|
97536
|
98292
|
98293
|
98294
|
99774
|
99775
|
99776
|
99777
|
99781
|
99782
|
99783
|
99784
|
100621
|
100622
| 100623 |
100624
|
100625
|
103792