com phpruntests: execute post raw test: tests/testcase/rtPostRawExecutionTest.php
| From: | David Soria Parra | Date: | Mon, 04 May 2009 16:27:40 +0000 |
| Subject: | com phpruntests: execute post raw test: tests/testcase/rtPostRawExecutionTest.php | ||
| Groups: | php.qa | ||
| Request: | Send a blank email to php-qa+get-66494@lists.php.net to get a copy of this message | ||
Commit: 81192aca7133aa1bae3e927eb4414351176a5871
Author: Zoe Slattery <zoe@php.net> Mon, 4 May 2009 16:27:40 +0000
Parents: 3d038b891e86a11cec4d1793959c9565ecba23ac
Branches: master
Link: http://git.php.net/?p=phpruntests.git;a=commitdiff;h=81192aca7133aa1bae3e927eb4414351176a5871
Log:
execute post raw test
Changed paths:
A tests/testcase/rtPostRawExecutionTest.php
Diff:
diff --git a/tests/testcase/rtPostRawExecutionTest.php b/tests/testcase/rtPostRawExecutionTest.php
new file mode 100644
index 0000000..69a032e
--- /dev/null
+++ b/tests/testcase/rtPostRawExecutionTest.php
@@ -0,0 +1,55 @@
+<?php
+
+require_once 'PHPUnit/Framework.php';
+require_once dirname(__FILE__) . '../../../src/rtAutoload.php';
+
+class rtPostRawExecutionTest extends PHPUnit_Framework_TestCase
+{
+ private $sample_test;
+
+ public function setUp()
+ {
+ $this->php = trim(shell_exec("which php"));
+ $this->php_cgi = trim(shell_exec("which php-cgi"));
+
+ $this->path_to_tests = realpath(dirname(__FILE__) . '/../../phpt-tests');
+ $this->sample_test = $this->path_to_tests . '/sample_postraw.phpt';
+ }
+
+ public function tearDown()
+ {
+ @unlink($this->path-to_tests . '/sample_postraw.php');
+ }
+
+ public function testFileRun()
+ {
+ //Create a new test configuration
+ $config = rtRuntestsConfiguration::getInstance(array('run-tests.php',
'-p', $this->php, $this->sample_test));
+ $config->setEnvironmentVariable('TEST_PHP_CGI_EXECUTABLE',$this->php_cgi);
+ $config->configure();
+
+ //Retrieve the array of test file names
+ $testFiles = $config->getSetting('TestFiles');
+
+ //Read the test file
+ $testFile = new rtPhpTestFile();
+ $testFile->doRead($testFiles[0]);
+ $testFile->normaliseLineEndings();
+
+ //Create a new test case
+ $testCase = new rtPhpTest($testFile->getContents(), $testFile->getTestName(),
$testFile->getSectionHeadings(), $config);
+
+ //Setup and set the local environment for the test case
+ $testCase->executeTest($config);
+
+ $status = $testCase->getStatus();
+
+ //$this->assertEquals('It worked!', trim($output));
+ $this->assertEquals('', $status['pass']);
+
+
+ }
+}
+
+?>
+?>
\ No newline at end of file