Koha/t/db_dependent/sysprefs.t
Kyle M Hall 6882949b1b Bug 13967 - System preferences need a package
System preferences should have a package based on Koha::Object to remove
the need for direct manipulation via SQL.

Test Plan:
1) Apply this patch
2) prove t/db_dependent/sysprefs.t

Signed-off-by: Chris Nighswonger <cnighswonger@foundations.edu>

Signed-off-by: Jonathan Druart <jonathan.druart@koha-community.org>
Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
2015-06-04 10:39:11 -03:00

48 lines
1.6 KiB
Perl
Executable file

#!/usr/bin/perl
# This file is part of Koha.
#
# Copyright (C) 2012 BibLibre SARL
# Copyright (C) 2013 Equinox Software, Inc.
#
# Koha is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# Koha is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Koha; if not, see <http://www.gnu.org/licenses>.
use Modern::Perl;
use Test::More tests => 4;
use C4::Context;
# Start transaction
my $dbh = C4::Context->dbh;
$dbh->{RaiseError} = 1;
$dbh->{AutoCommit} = 0;
my $opacheader = C4::Context->preference('opacheader');
my $newopacheader = "newopacheader";
C4::Context->set_preference( 'OPACHEADER', $newopacheader );
is( C4::Context->preference('opacheader'), $newopacheader );
C4::Context->set_preference( 'opacheader', $opacheader );
is( C4::Context->preference('OPACHEADER'), $opacheader );
$ENV{OVERRIDE_SYSPREF_opacheader} = 'this is an override';
C4::Context->clear_syspref_cache();
is(
C4::Context->preference('opacheader'),
'this is an override',
'system preference value overridden from environment'
);
C4::Context->set_preference( 'IDoNotExist', 'NonExistent' );
is( C4::Context->preference('IDoNotExist'), 'NonExistent', 'Test creation of non-existant system preferencer' );