3 # Copyright 2013 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
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>.
24 use Test::More tests => 6;
30 use lib $FindBin::Bin;
35 my $dbh = C4::Context->dbh;
36 $dbh->{AutoCommit} = 0;
37 $dbh->{RaiseError} = 1;
40 $dbh->do('DELETE FROM branchcategories');
42 my @category_types = GetCategoryTypes();
43 is_deeply(\@category_types, [ 'searchdomain', 'properties' ], 'received expected library category types');
46 categorycode => 'LIBCATCODE',
47 categoryname => 'library category name',
48 codedescription => 'library category code description',
49 categorytype => 'searchdomain',
50 show_in_pulldown => 1,
52 ModBranchCategoryInfo({
57 my $category = GetBranchCategory('LIBCATCODE');
58 is_deeply($category, \%new_category, 'fetched newly added library category');
60 $category = GetBranchCategory();
61 is($category, undef, 'retrieve library category only if code is supplied (bug 10515)');
63 my $categories = GetBranchCategories();
64 is_deeply($categories, [ \%new_category ], 'retrieve all expected library categories (bug 10515)');
66 $categories = GetBranchCategories(undef, undef, 'LIBCATCODE');
67 is_deeply($categories, [ { %new_category, selected => 1 } ], 'retrieve expected, eselected library category (bug 10515)');