[Koha-bugs] [Bug 10298] t::lib::Mocks tries to deal with syspref but doesn not manage to

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Thu May 30 11:27:33 CEST 2013


http://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=10298

Jonathan Druart <jonathan.druart at biblibre.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #18301|0                           |1
        is obsolete|                            |

--- Comment #4 from Jonathan Druart <jonathan.druart at biblibre.com> ---
Created attachment 18504
  -->
http://bugs.koha-community.org/bugzilla3/attachment.cgi?id=18504&action=edit
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.

-- 
You are receiving this mail because:
You are watching all bug changes.


More information about the Koha-bugs mailing list