Bugzilla – Attachment 107247 Details for
Bug 24446
Stockrotation: Update to use daterequested in branchtransfers
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 24446: Improve StockRotationItem->advance tests
Bug-24446-Improve-StockRotationItem-advance-tests.patch (text/plain), 3.42 KB, created by
Martin Renvoize (ashimema)
on 2020-07-23 13:54:10 UTC
(
hide
)
Description:
Bug 24446: Improve StockRotationItem->advance tests
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2020-07-23 13:54:10 UTC
Size:
3.42 KB
patch
obsolete
>From bda15dbf71653d80b7005060fb43d459908e1106 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Tue, 16 Jun 2020 20:38:58 +0100 >Subject: [PATCH] Bug 24446: Improve StockRotationItem->advance tests > >This patch adds additional checks in the tests for item homebranch >updates and cyclical transfers caused by the StockRotationItem->advance >method. > >It highlights a bug in the original logic whereby a cyclical rotation >would always result in a completed transfer but the physical item would >not have actually been moved between branches. >--- > t/db_dependent/StockRotationItems.t | 36 +++++++++++++++++++++++++++-- > 1 file changed, 34 insertions(+), 2 deletions(-) > >diff --git a/t/db_dependent/StockRotationItems.t b/t/db_dependent/StockRotationItems.t >index 707842e4a5..89f3b7c1bf 100644 >--- a/t/db_dependent/StockRotationItems.t >+++ b/t/db_dependent/StockRotationItems.t >@@ -206,7 +206,7 @@ subtest "Tests for needs_advancing." => sub { > }; > > subtest "Tests for advance." => sub { >- plan tests => 15; >+ plan tests => 23; > $schema->storage->txn_begin; > > my $sritem = $builder->build({ >@@ -259,22 +259,54 @@ subtest "Tests for advance." => sub { > $dbitem = Koha::StockRotationItems->find($sritem->{itemnumber_id}); > ## Test results > is($dbitem->stage->stage_id, $dbstage2->stage_id, "Stage updated."); >+ is( >+ $dbitem->itemnumber->homebranch, >+ $dbstage2->branchcode_id, >+ "Item homebranch updated" >+ ); > my $intransfer = $dbitem->itemnumber->get_transfer; > is($intransfer->frombranch, $dbstage->branchcode_id, "Origin correct."); > is($intransfer->tobranch, $dbstage2->branchcode_id, "Target Correct."); > >+ # Arrive at new branch >+ $intransfer->datearrived(DateTime->now)->store; >+ $dbitem->itemnumber->holdingbranch($srstage->{branchcode_id})->store; >+ >+ # Test a cyclical advance >+ ok($dbitem->advance, "Cyclical advancement done."); >+ ## Refetch dbitem >+ $dbitem = Koha::StockRotationItems->find($sritem->{itemnumber_id}); >+ ## Test results >+ is($dbitem->stage->stage_id, $dbstage->stage_id, "Stage updated."); >+ is( >+ $dbitem->itemnumber->homebranch, >+ $dbstage->branchcode_id, >+ "Item homebranch updated" >+ ); >+ $intransfer = $dbitem->itemnumber->get_transfer; >+ is($intransfer->frombranch, $dbstage2->branchcode_id, "Origin correct."); >+ is($intransfer->tobranch, $dbstage->branchcode_id, "Target correct."); >+ >+ # Arrive at new branch >+ $intransfer->datearrived(DateTime->now)->store; >+ $dbitem->itemnumber->holdingbranch($srstage->{branchcode_id})->store; >+ > $dbstage->rota->cyclical(0)->store; # Set Rota to non-cyclical. > >+ # Advance again, to end of rota. >+ ok($dbitem->advance, "Non-cyclical advance to last stage."); >+ > # Arrive at new branch > $intransfer->datearrived(DateTime->now)->store; > $dbitem->itemnumber->holdingbranch($srstage->{branchcode_id})->store; >- $dbitem->itemnumber->homebranch($srstage->{branchcode_id})->store; > > # Advance again, Remove from rota. > ok($dbitem->advance, "Non-cyclical advance."); > ## Refetch dbitem > $dbitem = Koha::StockRotationItems->find($sritem->{itemnumber_id}); > is($dbitem, undef, "StockRotationItem has been removed."); >+ my $item = Koha::Items->find($sritem->{itemnumber_id}); >+ is($item->homebranch, $srstage->{branchcode_id}, "Item homebranch remains"); > > $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 24446
:
105943
|
105944
|
105945
|
107246
|
107247
|
107248
|
107249
|
107250
|
107252
|
107253
|
107254
|
107255
|
107256
|
107301
|
107302
|
107303
|
107304
|
107305
|
110280
|
110281
|
110282
|
110283
|
110533
|
110534
|
110535
|
110536
|
110537
|
110538
|
110539
|
110540
|
110541
|
110542
|
111322
|
116557
|
116558
|
116559
|
116560
|
116561
|
116562
|
116563
|
116564
|
116565
|
116566
|
116567
|
116568
|
116569
|
116570
|
117589
|
117590
|
117591
|
117592
|
117593
|
117594
|
117595
|
117596
|
117597
|
117598
|
117599
|
117600
|
117601
|
117602
|
117603
|
117604
|
117605
|
117606
|
117607
|
120116