Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Octocat-spinner-32-eaf2f5

Cannot retrieve contributors at this time

executable file 58 lines (51 sloc) 1.397 kb
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';
}
Something went wrong with that request. Please try again.