Moved some PAR stuff
[catagits/Catalyst-Runtime.git] / t / live / component / controller / action / index.t
index a18871b..cd4f9b0 100644 (file)
@@ -6,13 +6,35 @@ use warnings;
 use FindBin;
 use lib "$FindBin::Bin/../../../lib";
 
-use Test::More tests => 19;
+our $iters;
+
+BEGIN { $iters = $ENV{CAT_BENCH_ITERS} || 2; }
+
+use Test::More tests => 20*$iters;
 use Catalyst::Test 'TestApp';
-    
-for ( 1 .. 1 ) {
+
+if ( $ENV{CAT_BENCHMARK} ) {
+    require Benchmark;
+    Benchmark::timethis( $iters, \&run_tests );
+}
+else {
+    for ( 1 .. $iters ) {
+        run_tests();
+    }
+}
+
+sub run_tests {
     # test root index
     {
+        my @expected = qw[
+          TestApp->index
+          TestApp->end
+        ];
+    
+        my $expected = join( ", ", @expected );
         ok( my $response = request('http://localhost/'), 'root index' );
+        is( $response->header('X-Catalyst-Executed'),
+            $expected, 'Executed actions' );
         is( $response->content, 'root index', 'root index ok' );
         
         ok( $response = request('http://localhost'), 'root index no slash' );
@@ -23,6 +45,7 @@ for ( 1 .. 1 ) {
     {
         my @expected = qw[
           TestApp::Controller::Index->index
+          TestApp->end
         ];
     
         my $expected = join( ", ", @expected );
@@ -43,6 +66,7 @@ for ( 1 .. 1 ) {
         my @expected = qw[
           TestApp::Controller::Action::Index->begin
           TestApp::Controller::Action::Index->index
+          TestApp->end
         ];
     
         my $expected = join( ", ", @expected );
@@ -50,12 +74,12 @@ for ( 1 .. 1 ) {
         ok( my $response = request('http://localhost/action/index/'), 'second-level controller index' );
         is( $response->header('X-Catalyst-Executed'),
             $expected, 'Executed actions' );
-        is( $response->content, 'Action::Index index', 'second-level controller index ok' );
+        is( $response->content, 'Action-Index index', 'second-level controller index ok' );
         
         ok( $response = request('http://localhost/action/index'), 'second-level controller index no slash' );
         is( $response->header('X-Catalyst-Executed'),
             $expected, 'Executed actions' );
-        is( $response->content, 'Action::Index index', 'second-level controller index no slash ok' );        
+        is( $response->content, 'Action-Index index', 'second-level controller index no slash ok' );        
     }
     
     # test controller default when index is present
@@ -63,6 +87,7 @@ for ( 1 .. 1 ) {
         my @expected = qw[
           TestApp::Controller::Action::Index->begin
           TestApp::Controller::Action::Index->default
+         TestApp->end
         ];
     
         my $expected = join( ", ", @expected );