Koha/t/override_context_prefs.pm
Galen Charlton 5290ec5596 test suite cleanup
Many of the tests were failing or putting warnings
because a valid systempreferences table is
usaully absent by the time 'make test' is run.

Fortunately, only a few modules try to invoke
C4::Context->preference during module initialization,
so added to the test suite override_context_prefs.pm,
which replaces preference() with a sub to return
testing values for three variables: 'dateformat',
'marcflavour', and 'LibraryName'.

Also fixed bug in t/Boolean.t

With this patch and the patch to move the DB-dependent
tests off to the side for the moment, 'make test'
now runs cleanly, at least on Debian.

Signed-off-by: Chris Cormack <crc@liblime.com>
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
2008-01-08 14:08:02 -06:00

23 lines
530 B
Perl

use strict;
use warnings;
# This stub module is used to override
# the C4::Context sub preference for the
# purpose of the test suite. This allows
# non-DB-dependent tests of most modules,
# particularly the ones that include C4::Dates.
use C4::Context;
package C4::Context;
no warnings;
sub preference {
my $self = shift;
my $pref = shift;
return 'us' if $pref eq 'dateformat';
return 'MARC21' if $pref eq 'marcflavour';
return 'Test Library' if $pref eq 'LibraryName';
return;
}
1;