From e9154d0b0e39504cd5f01be400ab1aae58424c64 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 (cherry picked from commit 8ee0bc049a183e795fc37608a4b3790d4aef2267) Signed-off-by: Fridolin Somers Conflicts: t/Context.t --- t/Context.t | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/t/Context.t b/t/Context.t index 9c561cb215..98203a2571 100755 --- a/t/Context.t +++ b/t/Context.t @@ -2,7 +2,7 @@ use Modern::Perl; use DBI; -use Test::More tests => 6; +use Test::More tests => 8; use Test::MockModule; BEGIN { @@ -30,3 +30,8 @@ $userenv->{flags} = 421; $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" ); -- 2.39.5