com phpruntests: gzip_post modifications: phpt-tests/sa mple_gzippost.phpt src/testcase/rtTestConfiguration.php src/testcase/sections/rtSection.php
tests/testcase/rtGzi pPostExecutionTest.php
| From: | David Soria Parra | Date: | Thu, 30 Apr 2009 19:08:20 +0000 |
| Subject: | com phpruntests: gzip_post modifications: phpt-tests/sa mple_gzippost.phpt src/testcase/rtTestConfiguration.php src/testcase/sections/rtSection.php tests/testcase/rtGzi pPostExecutionTest.php |
||
| Groups: | php.qa | ||
| Request: | Send a blank email to php-qa+get-66502@lists.php.net to get a copy of this message | ||
Commit: 9f26e0ca3e8fffed931300153e2b195584c06902
Author: Zoe Slattery <zoe@php.net> Thu, 30 Apr 2009 19:08:20 +0000
Parents: 00fa073e28855950797419c07422b5774919c920
Branches: master
Link: http://git.php.net/?p=phpruntests.git;a=commitdiff;h=9f26e0ca3e8fffed931300153e2b195584c06902
Log:
gzip_post modifications
Changed paths:
M phpt-tests/sample_gzippost.phpt
M src/testcase/rtTestConfiguration.php
M src/testcase/sections/rtSection.php
A tests/testcase/rtGzipPostExecutionTest.php
Diff:
diff --git a/phpt-tests/sample_gzippost.phpt b/phpt-tests/sample_gzippost.phpt
index bf2b355..3dbe67c 100644
--- a/phpt-tests/sample_gzippost.phpt
+++ b/phpt-tests/sample_gzippost.phpt
@@ -1,9 +1,7 @@
--TEST--
Sample test for GZIP_POST
---POST--
-blahblah=blah
--GZIP_POST--
-1
+blahblah=blah
--FILE--
<?php
$content = file_get_contents('php://input');
diff --git a/src/testcase/rtTestConfiguration.php b/src/testcase/rtTestConfiguration..php
index 1951373..8e0f52e 100644
--- a/src/testcase/rtTestConfiguration.php
+++ b/src/testcase/rtTestConfiguration.php
@@ -69,6 +69,9 @@ class rtTestConfiguration
if (array_key_exists('POST', $sections)) {
$this->environmentVariables = array_merge($this->environmentVariables,
$sections['POST']->getPostVariables());
}
+ if (array_key_exists('GZIP_POST', $sections)) {
+ $this->environmentVariables = array_merge($this->environmentVariables,
$sections['GZIP_POST']->getPostVariables());
+ }
}
@@ -106,6 +109,9 @@ class rtTestConfiguration
if(in_array('POST', $sectionHeadings)) {
$this->inputFileString = '<
'.$sections['POST']->getPostFileName();
}
+ if(in_array('GZIP_POST', $sectionHeadings)) {
+ $this->inputFileString = '<
'.$sections['GZIP_POST']->getPostFileName();
+ }
}
private function isCgiTest($sectionHeadings)
diff --git a/src/testcase/sections/rtSection.php b/src/testcase/sections/rtSection.php
index c1714cd..413528c 100644
--- a/src/testcase/sections/rtSection.php
+++ b/src/testcase/sections/rtSection.php
@@ -19,7 +19,8 @@ abstract class rtSection
'CLEAN' => 'rtCleanSection',
'XFAIL' => 'rtXfailSection',
'GET' => 'rtGetSection',
- 'POST' => 'rtPostSection',
+ 'POST' => 'rtPostSection',
+ 'GZIP_POST' => 'rtGzipPostSection',
);
protected $sectionName;
diff --git a/tests/testcase/rtGzipPostExecutionTest.php b/tests/testcase/rtGzipPostExecutionTest.php
new file mode 100644
index 0000000..c24fc0a
--- /dev/null
+++ b/tests/testcase/rtGzipPostExecutionTest.php
@@ -0,0 +1,55 @@
+<?php
+
+require_once 'PHPUnit/Framework.php';
+require_once dirname(__FILE__) . '../../../src/rtAutoload.php';
+
+class rtGzipPostExecutionTest 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_gzippost.phpt';
+ }
+
+ public function tearDown()
+ {
+ @unlink($this->path-to_tests . '/sample_gzippost.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('It worked!', trim($output));
+ $this->assertEquals('', $status['pass']);
+
+
+ }
+}
+
+?>
+?>
\ No newline at end of file