Bugzilla – Attachment 95930 Details for
Bug 24145
Auth.t is failing because of wrong mocked ->param
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 24145: (bug 22543 follow-up) Fix Auth.t
Bug-24145-bug-22543-follow-up-Fix-Autht.patch (text/plain), 2.45 KB, created by
Jonathan Druart
on 2019-12-02 16:52:38 UTC
(
hide
)
Description:
Bug 24145: (bug 22543 follow-up) Fix Auth.t
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2019-12-02 16:52:38 UTC
Size:
2.45 KB
patch
obsolete
>From 5d1d6be4ca99c49a56f3d2aa12cdf4196ea01e5d Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Mon, 2 Dec 2019 17:50:40 +0100 >Subject: [PATCH] Bug 24145: (bug 22543 follow-up) Fix Auth.t > >Auth.t is failing because of: 1. recent changes from bug 22543 and 2. wrong mocked CGI->param in tests >Without this patch we hit the exit statement that breaks the tests with the following error: > >t/db_dependent/Auth.t .. 1/22 Un-mocked method 'url()' called at /kohadevbox/koha/C4/Auth.pm line 1223. >Un-mocked method 'redirect()' called at /kohadevbox/koha/C4/Auth.pm line 1227. >A context appears to have been destroyed without first calling release(). >Based on $@ it does not look like an exception was thrown (this is not always >a reliable test) > >This is a problem because the global error variables ($!, $@, and $?) will >not be restored. In addition some release callbacks will not work properly from >inside a DESTROY method. > >Here are the context creation details, just in case a tool forgot to call >release(): > File: t/db_dependent/Auth.t > Line: 74 > Tool: Test::More::subtest > >Cleaning up the CONTEXT stack... > # Looks like you planned 22 tests but ran 1. >t/db_dependent/Auth.t .. Dubious, test returned 255 (wstat 65280, 0xff00) >Failed 21/22 subtests > >Test Summary Report >------------------- >t/db_dependent/Auth.t (Wstat: 65280 Tests: 1 Failed: 0) > Non-zero exit status: 255 > Parse errors: Bad plan. You planned 22 tests but ran 1. >Files=1, Tests=1, 2 wallclock secs ( 0.02 usr 0.00 sys + 1.54 cusr 0.24 csys = 1.80 CPU) >Result: FAIL >--- > t/db_dependent/Auth.t | 10 ++++++++-- > 1 file changed, 8 insertions(+), 2 deletions(-) > >diff --git a/t/db_dependent/Auth.t b/t/db_dependent/Auth.t >index 25a77d3d65..e149aec867 100644 >--- a/t/db_dependent/Auth.t >+++ b/t/db_dependent/Auth.t >@@ -40,11 +40,17 @@ subtest 'checkauth() tests' => sub { > > plan tests => 3; > >- my $patron = $builder->build({ source => 'Borrower', value => { flags => undef } })->{userid}; >+ my $patron = $builder->build_object({ class => 'Koha::Patrons', value => { flags => undef } }); > > # Mock a CGI object with real userid param > my $cgi = Test::MockObject->new(); >- $cgi->mock( 'param', sub { return $patron; } ); >+ $cgi->mock( >+ 'param', >+ sub { >+ my $var = shift; >+ if ( $var eq 'userid' ) { return $patron->userid; } >+ } >+ ); > $cgi->mock( 'cookie', sub { return; } ); > > my $authnotrequired = 1; >-- >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 24145
:
95930
|
95932