Bug 16134: t::lib::Mocks::mock_preference should be case-insensitive
authorJulian Maurice <julian.maurice@biblibre.com>
Wed, 23 Mar 2016 13:07:09 +0000 (14:07 +0100)
committerBrendan A Gallagher <brendan@bywatersolutions.com>
Thu, 24 Mar 2016 15:36:40 +0000 (15:36 +0000)
Test plan:
1. prove t/db_dependent/Auth_with_cas.t => FAIL
2. Apply patch
3. prove t/db_dependent/Auth_with_cas.t => SUCCESS

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Brendan A Gallagher <brendan@bywatersolutions.com>
t/lib/Mocks.pm

index 22ac659..46a87cb 100644 (file)
@@ -24,11 +24,14 @@ sub mock_config {
 
 my %preferences;
 sub mock_preference {
-    my $context = new Test::MockModule('C4::Context');
     my ( $pref, $value ) = @_;
-    $preferences{$pref} = $value;
+
+    $preferences{lc($pref)} = $value;
+
+    my $context = new Test::MockModule('C4::Context');
     $context->mock('preference', sub {
         my ( $self, $pref ) = @_;
+        $pref = lc($pref);
         if ( exists $preferences{$pref} ) {
             return $preferences{$pref}
         } else {