- Additional tests for setup_stats method. (t0m)
- Fix log levels in Catalyst::Log to be properly additive. (t0m)
- Fix RT#43375 by sorting results before testing them (t0m)
+ - Fixes for uri_for_action when using Catalyst::DispatchType::Regex
+ + tests from RT#39369 (norbi)
5.80002 2009-04-22 01:28:36
- Fix CATALYST_DEBUG and MYAPP_DEBUG environment variables
my $final = '/';
my @captures = @$captures;
while (my ($front, $rest) = split(/\(/, $re, 2)) {
+ last unless defined $rest;
($rest, $re) =
Text::Balanced::extract_bracketed("(${rest}", '(');
next REGEX unless @captures;
$final .= $front.shift(@captures);
}
+ $final .= $re;
next REGEX if @captures;
return $final;
}
BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 1; }
-use Test::More tests => 33*$iters;
+use Test::More tests => 38*$iters;
use Catalyst::Test 'TestApp';
use Catalyst::Request;
'Test Class'
);
}
+
+ {
+ my $url = 'http://localhost/action/regexp/redirect/life/universe/42/everything';
+ ok( my $response = request($url),
+ 'Request' );
+ ok( $response->is_redirect, 'Response is redirect' );
+ is( $response->header('X-Catalyst-Action'),
+ '^action/regexp/redirect/(\w+)/universe/(\d+)/everything$', 'Test Action' );
+ is(
+ $response->header('X-Test-Class'),
+ 'TestApp::Controller::Action::Regexp',
+ 'Test Class'
+ );
+ is(
+ $response->header('location'),
+ $url,
+ 'Redirect URI is the same as the request URI'
+ );
+ }
}
+
$c->forward('TestApp::View::Dump::Request');
}
+sub four : Action Regex('^action/regexp/redirect/(\w+)/universe/(\d+)/everything$') {
+ my ( $self, $c ) = @_;
+ $c->res->redirect(
+ $c->uri_for($c->action, $c->req->captures,
+ @{$c->req->arguments}, $c->req->params
+ )
+ );
+}
+
1;