Bugzilla – Attachment 122497 Details for
Bug 28615
Add a simple way to mock Koha::Logger
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 28615: (follow-up) Disable strict mode explicitly
Bug-28615-follow-up-Disable-strict-mode-explicitly.patch (text/plain), 1.63 KB, created by
Tomás Cohen Arazi (tcohen)
on 2021-06-29 15:30:11 UTC
(
hide
)
Description:
Bug 28615: (follow-up) Disable strict mode explicitly
Filename:
MIME Type:
Creator:
Tomás Cohen Arazi (tcohen)
Created:
2021-06-29 15:30:11 UTC
Size:
1.63 KB
patch
obsolete
>From d5a792ddf5970205b38cf20231f1a249318730f3 Mon Sep 17 00:00:00 2001 >From: Tomas Cohen Arazi <tomascohen@theke.io> >Date: Tue, 29 Jun 2021 12:24:52 -0300 >Subject: [PATCH] Bug 28615: (follow-up) Disable strict mode explicitly > >So Debian 9's version of Test::MockModule doens't have ->redefine, and >Ubuntu 20.04's doesn't recognise qw(nostrict). So the only solution is >to just remove the keywords use completely and move back to using >->mock, as the rest of the codebase. > >FIXME: using ->mock might be hiding some errors (like a method not being >defined/removed) and should be avoided. ->redefine will explode if the >method doesn't already exist, which is what we want, to catch this kind >of errors. That's why ->mock in strict mode is forbidden. We should try >packaging a newer Test::MockModule ourselves. > >Tested on master-buster, master-stretch and master-focal. > >Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> >--- > t/lib/Mocks/Logger.pm | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > >diff --git a/t/lib/Mocks/Logger.pm b/t/lib/Mocks/Logger.pm >index ff4bdb3ea9..22c967a58c 100644 >--- a/t/lib/Mocks/Logger.pm >+++ b/t/lib/Mocks/Logger.pm >@@ -20,7 +20,7 @@ use Modern::Perl; > use base 'Test::Builder::Module'; > use base qw(Class::Accessor); > >-use Test::MockModule qw(strict); >+use Test::MockModule; > use Test::MockObject; > > my $CLASS = __PACKAGE__; >@@ -48,7 +48,7 @@ sub new { > my $mocked_logger_class = Test::MockModule->new("Koha::Logger"); > my $mocked_logger = Test::MockObject->new(); > >- $mocked_logger_class->redefine( >+ $mocked_logger_class->mock( > 'get', > sub { > return $mocked_logger; >-- >2.32.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 28615
:
122306
|
122307
|
122480
|
122481
|
122484
|
122485
|
122488
|
122489
|
122496
| 122497