Bug 14285: Bengali locale needs to be re-defined
[koha.git] / t / db_dependent / Koha_template_plugin_Branches.t
blob414a3114f6f274183133fe029480f26bca76f44a
1 #!/usr/bin/perl
3 # Copyright 2013-2014 Equinox Software, Inc.
5 # This file is part of Koha.
7 # Koha is free software; you can redistribute it and/or modify it under the
8 # terms of the GNU General Public License as published by the Free Software
9 # Foundation; either version 3 of the License, or (at your option) any later
10 # version.
12 # Koha is distributed in the hope that it will be useful, but WITHOUT ANY
13 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
14 # A PARTICULAR PURPOSE. See the GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License along
17 # with Koha; if not, see <http://www.gnu.org/licenses>.
19 use Modern::Perl;
21 use Test::More tests => 7;
23 use C4::Context;
24 BEGIN {
25 use_ok('Koha::Template::Plugin::Branches');
28 my $plugin = Koha::Template::Plugin::Branches->new();
29 ok($plugin, "initialized Branches plugin");
31 my $name = $plugin->GetName('CPL');
32 is($name, 'Centerville', 'retrieved expected name for CPL');
34 $name = $plugin->GetName('__ANY__');
35 is($name, '', 'received empty string as name of the "__ANY__" placeholder library code');
37 $name = $plugin->GetName(undef);
38 is($name, '', 'received empty string as name of NULL/undefined library code');
40 my $library = $plugin->GetLoggedInBranchcode();
41 is($library, '', 'no active library if there is no active user session');
43 C4::Context->_new_userenv('DUMMY_SESSION_ID');
44 C4::Context->set_userenv(123, 'userid', 'usercnum', 'First name', 'Surname', 'MYLIBRARY', 'My Library', 0);
45 $library = $plugin->GetLoggedInBranchcode();
46 is($library, 'MYLIBRARY', 'GetLoggedInBranchcode() returns active library');