X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=catagits%2FCatalyst-Runtime.git;a=blobdiff_plain;f=t%2Faggregate%2Funit_core_uri_for_action.t;h=9b34229366a773c7063d7bd2249635b52c97ffe1;hp=c8925d8c684cf94398e8a1eebf06892ca7f965e5;hb=7c1c4dc69062bd372f6611c5a2d3e054cf777d79;hpb=76988362a96b1563e101d599eb962b759ecc8cdf diff --git a/t/aggregate/unit_core_uri_for_action.t b/t/aggregate/unit_core_uri_for_action.t index c8925d8..9b34229 100644 --- a/t/aggregate/unit_core_uri_for_action.t +++ b/t/aggregate/unit_core_uri_for_action.t @@ -8,8 +8,6 @@ use lib "$FindBin::Bin/../lib"; use Test::More; -plan tests => 39; - use_ok('TestApp'); my $dispatcher = TestApp->dispatcher; @@ -21,8 +19,6 @@ my $private_action = $dispatcher->get_action_by_path( '/class_forward_test_method' ); -warn $dispatcher->uri_for_action($private_action); - ok(!defined($dispatcher->uri_for_action($private_action)), "Private action returns undef for URI"); @@ -56,6 +52,21 @@ is($dispatcher->uri_for_action($regex_action, [ 'foo', 123 ]), "/action/regexp/foo/123", "Regex action interpolates captures correctly"); +my $regex_action_bs = $dispatcher->get_action_by_path( + '/action/regexp/one_backslashes' + ); + +ok(!defined($dispatcher->uri_for_action($regex_action_bs)), + "Regex action without captures returns undef"); + +ok(!defined($dispatcher->uri_for_action($regex_action_bs, [ 1, 2, 3 ])), + "Regex action with too many captures returns undef"); + +is($dispatcher->uri_for_action($regex_action_bs, [ 'foo', 123 ]), + "/action/regexp/foo/123.html", + "Regex action interpolates captures correctly"); + + # # Index Action # @@ -91,6 +102,7 @@ is($dispatcher->uri_for_action($chained_action, [ 1 ]), # Tests with Context # my $request = Catalyst::Request->new( { + _log => Catalyst::Log->new, base => URI->new('http://127.0.0.1/foo') } ); @@ -212,3 +224,5 @@ is($context->uri_for($chained_action, [ 1 ], 2, { q => 1 }), } +done_testing; +