aboutsummaryrefslogtreecommitdiffstats
path: root/t/app/uri_for.t
blob: 9cbcd3767a4645cff5f7b09f5f5d787d26ee6990 (plain)
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
use strict;
use warnings;

use Test::More;

# FIXME Should this be here? A better way? uri_for varies by map.
use Catalyst::Test 'FixMyStreet::App';
FixMyStreet::Map::set_map_class();

# structure of these tests borrowed from '/t/aggregate/unit_core_uri_for.t'

use strict;
use warnings;
use URI;

use_ok('FixMyStreet::App');

my $fms_c = ctx_request('http://www.fixmystreet.com/');
my $fgm_c = ctx_request('http://www.fiksgatami.no/');

is(
    $fms_c->uri_for('/bar/baz') . "",
    'http://www.fixmystreet.com/bar/baz',
    'URI for absolute path'
);

is(
    $fms_c->uri_for('') . "",
    'http://www.fixmystreet.com/',
    'URI for namespace'
);

is(
    $fms_c->uri_for( '/bar/baz', 'boing', { foo => 'bar', } ) . "",
    'http://www.fixmystreet.com/bar/baz/boing?foo=bar',
    'URI with query'
);

# fiksgatami
is(
    $fgm_c->uri_for( '/foo', { lat => 1.23, } ) . "",
    'http://www.fiksgatami.no/foo?lat=1.23&zoom=3',
    'FiksGataMi url with lat not zoom'
);

done_testing();