From 8ee0bc049a183e795fc37608a4b3790d4aef2267 Mon Sep 17 00:00:00 2001 From: Mark Tompsett Date: Tue, 21 Jan 2014 00:34:43 -0500 Subject: [PATCH] Bug 11587 - IsSuperLibrarian generates warnings (UT) Simply viewing OPAC detail triggers a modulus warning entry. This first patch adds two test cases to t/Context.t to test for this situation. TEST PLAN --------- 1) Apply this patch (to upgrade t/Context.t) 2) prove -v t/Context.t -- Tests 7 and 8 will fail 3) Apply main patch (to amend C4/Context.pm) 4) prove -v t/Context.t -- All tests will succeed Signed-off-by: Chris Cormack Signed-off-by: Jonathan Druart Signed-off-by: Galen Charlton --- t/Context.t | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/t/Context.t b/t/Context.t index 446e2544f1..46e353eeb6 100755 --- a/t/Context.t +++ b/t/Context.t @@ -2,7 +2,7 @@ use Modern::Perl; use DBI; -use Test::More tests => 10; +use Test::More tests => 12; use Test::MockModule; BEGIN { @@ -31,6 +31,11 @@ $is_super_librarian = eval{ C4::Context::IsSuperLibrarian() }; is ( $@, q||, "IsSuperLibrarian does not log an error if userenv is defined" ); is ( $is_super_librarian, 1, "With flag=1, it is a super librarian" ); +$userenv->{flags} = undef; +$is_super_librarian = eval{ C4::Context::IsSuperLibrarian() }; +is ( $@, q||, "IsSuperLibrarian does not log an error if \$userenv->{flags} is undefined" ); +is ( $is_super_librarian, 0, "With flag=0, it is not a super librarian" ); + is(C4::Context::db_scheme2dbi('mysql'), 'mysql', 'ask for mysql, get mysql'); is(C4::Context::db_scheme2dbi('Pg'), 'Pg', 'ask for Pg, get Pg'); is(C4::Context::db_scheme2dbi('xxx'), 'mysql', 'ask for unsupported DBMS, get mysql'); -- 2.39.5