bd769213eb
Booksellers.t and Koha_template_plugin_Branches.t both had function calls to ::set_userenv added to them. This patch handles those additions. TEST PLAN --------- 1) Branch a new git branch 2) prove -v t/db_dependent/Bookseller.t -- It should work. 3) prove -v t/db_dependent/Koha_template_plugin_Branches.t -- It should work. 4) Apply only the first patch. 5) Repeat steps 2 and 3. -- They should both FAIL! 6) Apply the second patch as well. 7) Repeat steps 2 and 3. -- The should both work. Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com> Signed-off-by: Jonathan Druart <jonathan.druart@biblibre.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Tomas Cohen Arazi <tomascohen@gmail.com>
46 lines
1.6 KiB
Perl
46 lines
1.6 KiB
Perl
#!/usr/bin/perl
|
|
|
|
# Copyright 2013-2014 Equinox Software, Inc.
|
|
#
|
|
# This file is part of Koha.
|
|
#
|
|
# 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 => 7;
|
|
|
|
use C4::Context;
|
|
BEGIN {
|
|
use_ok('Koha::Template::Plugin::Branches');
|
|
}
|
|
|
|
my $plugin = Koha::Template::Plugin::Branches->new();
|
|
ok($plugin, "initialized Branches plugin");
|
|
|
|
my $name = $plugin->GetName('CPL');
|
|
is($name, 'Centerville', 'retrieved expected name for CPL');
|
|
|
|
$name = $plugin->GetName('__ANY__');
|
|
is($name, '', 'received empty string as name of the "__ANY__" placeholder library code');
|
|
|
|
$name = $plugin->GetName(undef);
|
|
is($name, '', 'received empty string as name of NULL/undefined library code');
|
|
|
|
my $library = $plugin->GetLoggedInBranchcode();
|
|
is($library, '', 'no active library if there is no active user session');
|
|
|
|
C4::Context->_new_userenv('DUMMY_SESSION_ID');
|
|
C4::Context->set_userenv(123, 'userid', 'usercnum', 'First name', 'Surname', 'MYLIBRARY', 'My Library', 0);
|
|
$library = $plugin->GetLoggedInBranchcode();
|
|
is($library, 'MYLIBRARY', 'GetLoggedInBranchcode() returns active library');
|