]> git.koha-community.org Git - koha.git/commit
Bug 10298: Mock C4::Context->preference
authorJonathan Druart <jonathan.druart@biblibre.com>
Tue, 21 May 2013 15:13:35 +0000 (17:13 +0200)
committerTomas Cohen Arazi <tomascohen@gmail.com>
Tue, 3 Dec 2013 18:35:18 +0000 (15:35 -0300)
commit58d58510d04c58a9b918838d96e1562be16f81ea
tree85a091d001611521c3ab11b128259d2536674c16
parent9ffad2ccda0a4e704f33539356f1cb207c0232cc
Bug 10298: Mock C4::Context->preference

t::lib::Mocks::Context tried to deal with preferences but did not manage
to.

This patch removes this module and add 2 routines in t::lib::Mocks in
order to mock C4::context->preference and C4::Context->config.

To test:

===START t/test.pl===

use Modern::Perl;
use t::lib::Mocks;
use C4::Context;

say "initial value for version: " . C4::Context->preference('Version');
say "initial value for language: " . C4::Context->preference('language');
t::lib::Mocks::mock_preference('Version', "new version for testing");
say "version is mocked with: " . C4::Context->preference('Version');
say "language is not yet mocked: " . C4::Context->preference('language');
t::lib::Mocks::mock_preference('language', 'new langage for testing');
t::lib::Mocks::mock_preference('Version', 'another version for testing');
say "version is mocked with another value: " . C4::Context->preference('Version');
say "language is finally mocked: " . C4::Context->preference('language');
===END===

Try to execute this file and check that the output is consistent.

Signed-off-by: Julian Maurice <julian.maurice@biblibre.com>
Signed-off-by: Chris Cormack <chrisc@catalyst.net.nz>
Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
(cherry picked from commit eb90241c7941760a79c48c745c8fd938780490a8)
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
t/lib/Mocks.pm
t/lib/Mocks/Context.pm [deleted file]