Bugzilla – Attachment 133295 Details for
Bug 30518
StockRotationItems crossing DST boundary throw invalid local time exception
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 30518: Unit test
Bug-30518-Unit-test.patch (text/plain), 2.17 KB, created by
Nick Clemens (kidclamp)
on 2022-04-14 10:44:30 UTC
(
hide
)
Description:
Bug 30518: Unit test
Filename:
MIME Type:
Creator:
Nick Clemens (kidclamp)
Created:
2022-04-14 10:44:30 UTC
Size:
2.17 KB
patch
obsolete
>From 66634756a576e1cc8b7b310f4caebedef427a143 Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Wed, 13 Apr 2022 08:52:02 +0100 >Subject: [PATCH] Bug 30518: Unit test > >This patch adds tests for checking the needs_advancing method against >a timezone and datetime that would cause an Invalid local time failure > >To test: >1. Apply this patch >2. Run: > $ kshell > k$ prove t/db_dependent/StockRotationItems.t >=> FAIL: The feature is not implemented, tests fail to complete > >Signed-off-by: Nick Clemens <nick@bywatersolutions.com> >--- > t/db_dependent/StockRotationItems.t | 17 ++++++++++++++++- > 1 file changed, 16 insertions(+), 1 deletion(-) > >diff --git a/t/db_dependent/StockRotationItems.t b/t/db_dependent/StockRotationItems.t >index 8c21a3675f..c6b3afee25 100755 >--- a/t/db_dependent/StockRotationItems.t >+++ b/t/db_dependent/StockRotationItems.t >@@ -202,7 +202,7 @@ subtest "Tests for repatriate." => sub { > }; > > subtest "Tests for needs_advancing." => sub { >- plan tests => 7; >+ plan tests => 8; > $schema->storage->txn_begin; > > # Test behaviour of item freshly added to rota. >@@ -266,6 +266,21 @@ subtest "Tests for needs_advancing." => sub { > dt_from_string() - DateTime::Duration->new( days => 75 ) > )->store; > is($dbitem->needs_advancing, 1, "Ready to be advanced."); >+ >+ # Bug 30518: Confirm that DST boundaries do not explode. >+ # mock_config does not work here, because of tz vs timezone subroutines >+ my $context = Test::MockModule->new('C4::Context'); >+ $context->mock( 'tz', sub { >+ 'Europe/London'; >+ }); >+ my $bad_date = dt_from_string("2020-09-29T01:15:30", 'iso'); >+ $dbtransfer->datesent($bad_date)->store; >+ $dbtransfer->datearrived($bad_date)->store; >+ $dbitem->stage->duration(180)->store; >+ is( $dbitem->needs_advancing, 1, "DST boundary doesn't cause failure." ); >+ $context->unmock('tz'); >+ >+ # Test that missing historical branch transfers do not crash > $dbtransfer->delete; > warning_is {$dbitem->needs_advancing} "We have no historical branch transfer for item " . $dbitem->item->itemnumber . "; This should not have happened!", "Missing transfer is warned."; > >-- >2.30.2
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 30518
:
133233
|
133234
| 133295 |
133296