Bugzilla – Attachment 62290 Details for
Bug 18445
Tests in t stumble over Auth's BEGIN block
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 18445: Replace two use C4::Auth statements
Bug-18445-Replace-two-use-C4Auth-statements.patch (text/plain), 2.70 KB, created by
Marcel de Rooy
on 2017-04-18 13:28:33 UTC
(
hide
)
Description:
Bug 18445: Replace two use C4::Auth statements
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2017-04-18 13:28:33 UTC
Size:
2.70 KB
patch
obsolete
>From c601fac2b1b6bbbd9ee442a8bfad2eff1911b649 Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Mon, 17 Apr 2017 18:05:24 +0200 >Subject: [PATCH] Bug 18445: Replace two use C4::Auth statements >Content-Type: text/plain; charset=utf-8 > >Both Serials.pm and Virtualshelf.pm only need haspermission in a specific >sub. Since loading the module at compile-time triggers early execution of >the BEGIN block, this results in database access in the tests that are >assumed to be database independent. > >At the same time we are resolving test failures in Matcher.t and Prices.t >because the schema mock is too late. > >Test plan: >[1] Do not yet apply this patch. Backup your database. >[2] Drop the database and create a new empty one. >[3] Run the tests in t. Look at Matcher.t and Prices.t too. > You will see quite some occurrences of: > DBD::mysql::st execute failed: Table 'koha_master.systempreferences' doesn't exist [for Statement "SELECT `me`.`variable`, `me`.`value`, `me`.`options`, `me`.`explanation`, `me`.`type` FROM `systempreferences` `me` WHERE ( `me`.`variable` = ? )" with ParamValues: 0='casauthentication'] at /usr/share/perl5/DBIx/Class/Storage/DBI.pm line 1832. > >[4] Apply this patch. >[5] Run the tests in t again. Check the results of Matcher.t and Prices.t. >[6] Restore your database. >[7] Run t/db_dependent/Serials_2.t to trigger the change in Serials. >[8] Run t/db_dependent/Virtualshelves.t to test Koha/Virtualshelf. > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >--- > C4/Serials.pm | 2 +- > Koha/Virtualshelf.pm | 3 +-- > 2 files changed, 2 insertions(+), 3 deletions(-) > >diff --git a/C4/Serials.pm b/C4/Serials.pm >index c1316f2..b07984c 100644 >--- a/C4/Serials.pm >+++ b/C4/Serials.pm >@@ -20,7 +20,6 @@ package C4::Serials; > > use Modern::Perl; > >-use C4::Auth qw(haspermission); > use C4::Context; > use DateTime; > use Date::Calc qw(:all); >@@ -2690,6 +2689,7 @@ sub _can_do_on_subscription { > my $flags = C4::Context->userenv->{flags}; > $userid ||= C4::Context->userenv->{'id'}; > >+ require C4::Auth; > if ( C4::Context->preference('IndependentBranches') ) { > return 1 > if C4::Context->IsSuperLibrarian() >diff --git a/Koha/Virtualshelf.pm b/Koha/Virtualshelf.pm >index 4e45c31..582864f 100644 >--- a/Koha/Virtualshelf.pm >+++ b/Koha/Virtualshelf.pm >@@ -19,8 +19,6 @@ use Modern::Perl; > > use Carp; > >-use C4::Auth; >- > use Koha::Patrons; > use Koha::Database; > use Koha::DateUtils qw( dt_from_string ); >@@ -243,6 +241,7 @@ sub can_be_deleted { > > my $patron = Koha::Patrons->find( $borrowernumber ); > >+ require C4::Auth; > return 1 if $self->category == $PUBLIC and C4::Auth::haspermission( $patron->userid, { lists => 'delete_public_lists' } ); > > return 0; >-- >2.1.4
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 18445
: 62290 |
62292
|
62293
|
62299