Commit:    d212f75880adaeb7e08e1b3cb1f58f8fd616e248
Author:    zoe slattery <z...@php.net>         Mon, 6 Aug 2012 11:40:32 +0100
Parents:   c899eb4017fab1c4cb3cc0490ea8f49221b83280
Branches:  master

Link:       
http://git.php.net/?p=phpruntests.git;a=commitdiff;h=d212f75880adaeb7e08e1b3cb1f58f8fd616e248

Log:
Add logic to check redirect skipif before saving the test

Changed paths:
  A  phpt-tests/sample_redirect2.phpt
  M  src/testcase/rtPhpTest.php
  M  src/testgroup/rtPhpTestGroup.php


Diff:
diff --git a/phpt-tests/sample_redirect2.phpt b/phpt-tests/sample_redirect2.phpt
new file mode 100644
index 0000000..9b957be
--- /dev/null
+++ b/phpt-tests/sample_redirect2.phpt
@@ -0,0 +1,13 @@
+--TEST--
+Make sure tests skips OK
+--SKIPIF--
+<?php # vim:ft=php
+ print 'skip'; ?>
+--REDIRECTTEST--
+return array(
+    'ENV' => array(
+            'PDOTEST_DSN' => 'sqlite::memory:'
+        ),
+    'TESTS' => 'ext/pdo/tests'
+    );
+
diff --git a/src/testcase/rtPhpTest.php b/src/testcase/rtPhpTest.php
index f5dacc6..ce2141a 100644
--- a/src/testcase/rtPhpTest.php
+++ b/src/testcase/rtPhpTest.php
@@ -128,6 +128,16 @@ class rtPhpTest
             }
         }
     }
+    /**
+     * 
+     * Just runs teh SKIPIF section - required for redirect test implementation
+     * @param $runConfiguration
+     */
+    
+    public function runSkipif(rtRuntestsConfiguration $runConfiguration) {    
+            $this->testStatus = $this->sections['SKIPIF']->run($this, 
$runConfiguration);
+            
$this->testStatus->setExecutedPhpCommand($this->sections['SKIPIF']->getPhpCommand());
+     }
 
     /**
      * Test the output against the expect section
diff --git a/src/testgroup/rtPhpTestGroup.php b/src/testgroup/rtPhpTestGroup.php
index 1bcd7f7..735d2df 100644
--- a/src/testgroup/rtPhpTestGroup.php
+++ b/src/testgroup/rtPhpTestGroup.php
@@ -1,6 +1,6 @@
 <?php
 /**
- * rtTestGroup
+ * rtPhpTestGroup
  *
  * Runs a 'group of tests'. A 'group' is all or the tests in a single 
directory.
  *
@@ -50,10 +50,20 @@ class rtPhpTestGroup
                 $this->testCases[] = new rtPhpTest($testFile->getContents(), 
$testFile->getTestName(), $testFile->getSectionHeadings(), $runConfiguration, 
$testStatus);
             } elseif 
(in_array("REDIRECTTEST",$testFile->getSectionHeadings())){
                //Redirect handler, save the test case for processing after the 
main groups have finished.
+               //Check to make sure that it shouldn't be skipped, if skipped 
don't save it
                $redirectedTest= new rtPhpTest($testFile->getContents(), 
$testFile->getTestName(), $testFile->getSectionHeadings(), $runConfiguration, 
$testStatus);
-               $testStatus->setTrue('redirected');
-                $testStatus->setMessage('redirected', 
$testFile->getExitMessage());
-                $this->results[] = new rtTestResults($redirectedTest, 
$testStatus);
+               if($redirectedTest->hasSection('SKIPIF')) {
+                       $redirectedTest->runSkipif($runConfiguration);
+                       if($redirectedTest->getStatus()->getValue('skip')) {
+                               $testStatus->setTrue('skip');
+                               $testStatus->setMessage('skip', 
$testFile->getExitMessage());
+                       } else {
+                               $testStatus->setTrue('redirected');
+                               $testStatus->setMessage('redirected', 
$testFile->getExitMessage());
+                       }
+                       $this->results[] = new rtTestResults($redirectedTest, 
$testStatus);
+               }
+               
             }else {
                 $testStatus->setTrue('bork');
                 $testStatus->setMessage('bork', $testFile->getExitMessage());


--
PHP Quality Assurance Mailing List <http://www.php.net/>
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to