cvs: phpruntests /tests/testcase rtPostExecutionTest.php
| From: | Zoe Slattery | Date: | Tue, 28 Apr 2009 20:58:29 +0000 |
| Subject: | cvs: phpruntests /tests/testcase rtPostExecutionTest.php | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-57360@lists.php.net to get a copy of this message | ||
zoe Tue Apr 28 20:58:29 2009 UTC
Added files:
/phpruntests/tests/testcase rtPostExecutionTest.php
Log:
POST implemented
http://cvs.php.net/viewvc.cgi/phpruntests/tests/testcase/rtPostExecutionTest.php?view=markup&rev=1.1
Index: phpruntests/tests/testcase/rtPostExecutionTest.php
+++ phpruntests/tests/testcase/rtPostExecutionTest.php
<?php
require_once 'PHPUnit/Framework.php';
require_once dirname(__FILE__) . '../../../src/rtAutoload.php';
class rtPostExecutionTest 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_post.phpt';
}
public function tearDown()
{
@unlink($this->path-to_tests . '/sample_post.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);
$output = $testCase->getOutput();
$status = $testCase->getStatus();
$this->assertEquals('85', strlen($output));
$this->assertEquals('', $status['pass']);
}
}
?>
?>