/
Koha.t
executable file
·57 lines (51 loc) · 1.36 KB
/
Koha.t
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/usr/bin/env perl
use strict;
use warnings;
use Test::More tests => 7;
BEGIN {
use_ok 'C4::Koha';
}
#
# test that &slashifyDate returns correct (non-US) date
#
is '01/01/2002', slashifyDate('2002-01-01'), 'slashify';
my $opacname_tests = [
{
env => {
HTTP_X_FORWARDED_HOST => "localhost.x-host.com:5000",
HTTP_X_FORWARDED_SERVER => "localhost.x-server.com:5000,proxy.mydomain.org:1234",
HTTP_HOST => "localhost.host.com:5000",
SERVER_NAME => "localhost.server.com:5000",
},
res => 'localhost.x-host.com',
},
{
env => {
HTTP_X_FORWARDED_SERVER => "localhost.x-server.com:5000",
HTTP_HOST => "localhost.host.com:5000",
SERVER_NAME => "localhost.server.com:5000",
},
res => 'localhost.x-server.com',
},
{
env => {
HTTP_HOST => "localhost.host.com:5000",
SERVER_NAME => "localhost.server.com:5000",
},
res => 'localhost.host.com',
},
{
env => {
SERVER_NAME => "localhost.server.com:5000",
},
res => 'localhost.server.com',
},
{
env => {
},
res => 'koha-opac.default',
},
];
for my $test (@$opacname_tests) {
is C4::Koha::CgiOrPlackHostnameFinder($test->{env}), $test->{res}, 'OPAC hostname resolution';
}