Bug 10298: Mock C4::Context->preference
authorJonathan Druart <jonathan.druart@biblibre.com>
Tue, 21 May 2013 15:13:35 +0000 (17:13 +0200)
committerGalen Charlton <gmc@esilibrary.com>
Fri, 9 Aug 2013 16:34:50 +0000 (16:34 +0000)
commiteb90241c7941760a79c48c745c8fd938780490a8
tree183540168fda6024070070d358753022b48b91e1
parent5cba6457aa00f3f3b2038f70057df300d9c6b9c3
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>
t/lib/Mocks.pm
t/lib/Mocks/Context.pm [deleted file]