4 use Test::More tests => 5;
8 my $request = Test::MockObject->new;
9 $request->mock( 'base', sub { URI->new('http://127.0.0.1/foo') } );
10 $request->mock( 'match', sub { '/yada' } );
12 my $context = Test::MockObject->new;
13 $context->mock( 'request', sub { $request } );
18 Catalyst::uri_for( $context, '/bar/baz' )->as_string,
19 'http://127.0.0.1/foo/bar/baz',
20 'URI for absolute path'
24 Catalyst::uri_for( $context, 'bar/baz' )->as_string,
25 'http://127.0.0.1/foo/yada/bar/baz',
26 'URI for relative path'
29 is( Catalyst::uri_for( $context, '../quux' )->as_string,
30 'http://127.0.0.1/foo/quux', 'URI for relative dot path' );
32 # bug found by drewbie
33 $request->mock('base', sub { URI->new('http://localhost:3000/') } );
34 $request->mock('match', sub { 'orderentry/contract' } );
36 Catalyst::uri_for( $context, '/Orderentry/saveContract' )->as_string,
37 'http://localhost:3000/Orderentry/saveContract',
38 'URI for absolute path'