Bug 11876 [Unit test] Add a diff view to staged MARC Records
[koha.git] / t / db_dependent / sysprefs.t
1 #!/usr/bin/perl
2
3 # This file is part of Koha.
4 #
5 # Copyright (C) 2012 BibLibre SARL
6 # Copyright (C) 2013 Equinox Software, Inc.
7 #
8 # Koha is free software; you can redistribute it and/or modify it
9 # under the terms of the GNU General Public License as published by
10 # the Free Software Foundation; either version 3 of the License, or
11 # (at your option) any later version.
12 #
13 # Koha is distributed in the hope that it will be useful, but
14 # WITHOUT ANY WARRANTY; without even the implied warranty of
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 # GNU General Public License for more details.
17 #
18 # You should have received a copy of the GNU General Public License
19 # along with Koha; if not, see <http://www.gnu.org/licenses>.
20
21 use Modern::Perl;
22 use Test::More tests => 3;
23 use C4::Context;
24
25 # Start transaction
26 my $dbh = C4::Context->dbh;
27 $dbh->{RaiseError} = 1;
28 $dbh->{AutoCommit} = 0;
29
30 my $opacheader = C4::Context->preference('opacheader');
31 my $newopacheader = "newopacheader";
32
33 C4::Context->set_preference('OPACHEADER', $newopacheader);
34 ok(C4::Context->preference('opacheader') eq $newopacheader);
35
36 C4::Context->set_preference('opacheader', $opacheader);
37 ok(C4::Context->preference('OPACHEADER') eq $opacheader);
38
39 $ENV{OVERRIDE_SYSPREF_opacheader} = 'this is an override';
40 C4::Context->clear_syspref_cache();
41 is(C4::Context->preference('opacheader'),
42    'this is an override',
43    'system preference value overridden from environment'
44 );
45
46 $dbh->rollback;