Line 0
Link Here
|
0 |
- |
1 |
#!/usr/bin/perl |
|
|
2 |
|
3 |
# This file is part of Koha. |
4 |
# |
5 |
# Koha is free software; you can redistribute it and/or modify it |
6 |
# under the terms of the GNU General Public License as published by |
7 |
# the Free Software Foundation; either version 3 of the License, or |
8 |
# (at your option) any later version. |
9 |
# |
10 |
# Koha is distributed in the hope that it will be useful, but |
11 |
# WITHOUT ANY WARRANTY; without even the implied warranty of |
12 |
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 |
# GNU General Public License for more details. |
14 |
# |
15 |
# You should have received a copy of the GNU General Public License |
16 |
# along with Koha; if not, see <http://www.gnu.org/licenses>. |
17 |
|
18 |
use Modern::Perl; |
19 |
|
20 |
use CGI; |
21 |
|
22 |
use Test::More tests => 5; |
23 |
use Test::Deep; |
24 |
|
25 |
BEGIN { |
26 |
use_ok( 'C4::Templates' ); |
27 |
can_ok( 'C4::Templates', |
28 |
qw/ GetColumnDefs |
29 |
getlanguagecookie |
30 |
setlanguagecookie |
31 |
themelanguage |
32 |
gettemplate |
33 |
_get_template_file |
34 |
param |
35 |
output /); |
36 |
} |
37 |
|
38 |
my $query = CGI->new(); |
39 |
my $columns = C4::Templates::GetColumnDefs( $query ); |
40 |
|
41 |
is( ref( $columns ) eq 'HASH', 1, 'GetColumnDefs returns a hashref' ); |
42 |
# get the tables names, sorted |
43 |
my @keys = sort keys $columns; |
44 |
is( scalar @keys, 5, "GetColumnDefs correctly returns the 5 tables defined in columns.def" ); |
45 |
my @tables = ( 'biblio', 'biblioitems', 'borrowers', 'items', 'statistics'); |
46 |
cmp_deeply( \@keys, \@tables, "GetColumnDefs returns the expected tables"); |
47 |
|
48 |
|
49 |
1; |