Stop the request needing the context, just pass in the logger instead
[catagits/Catalyst-Runtime.git] / t / aggregate / unit_core_uri_for_action.t
index c8925d8..9b34229 100644 (file)
@@ -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;
+