zoe Thu Apr 30 08:12:32 2009 UTC
Added files:
/phpruntests/tests/testcase/sections/configurationsections
rtGzipPostSectionTest.php
Modified files:
/phpruntests/src/testcase/sections/configurationsections
rtGzipPostSection.php
/phpruntests/src rtClassMap.php
Log:
fixes to gzip_post section and a test case
http://cvs.php.net/viewvc.cgi/phpruntests/src/testcase/sections/configurationsections/rtGzipPostSection.php?r1=1.1&r2=1.2&diff_format=u
Index:
phpruntests/src/testcase/sections/configurationsections/rtGzipPostSection.php
diff -u
phpruntests/src/testcase/sections/configurationsections/rtGzipPostSection.php:1.1
phpruntests/src/testcase/sections/configurationsections/rtGzipPostSection.php:1.2
---
phpruntests/src/testcase/sections/configurationsections/rtGzipPostSection.php:1.1
Wed Apr 29 18:51:33 2009
+++
phpruntests/src/testcase/sections/configurationsections/rtGzipPostSection.php
Thu Apr 30 08:12:32 2009
@@ -12,7 +12,7 @@
* @license http://www.php.net/license/3_01.txt PHP License 3.01
* @link http://qa.php.net/
*/
-class rtPostSection extends rtConfigurationSection
+class rtGzipPostSection extends rtConfigurationSection
{
private $postVariables = array();
private $postFileName;
@@ -21,13 +21,14 @@
{
$postString = implode('\n', $this->sectionContents);
$gzipPostString = gzencode($postString);
+
$this->postVariables['CONTENT_TYPE'] =
'application/x-www-form-urlencoded';
$this->postVariables['CONTENT_LENGTH'] = strlen($gzipPostString);
$this->postVariables['REQUEST_METHOD'] = 'POST';
$this->postFileName = tempnam(sys_get_temp_dir(), 'post');
- file_put_contents($this->postFileName, $postString);
+ file_put_contents($this->postFileName, $gzipPostString);
}
/**
http://cvs.php.net/viewvc.cgi/phpruntests/src/rtClassMap.php?r1=1.3&r2=1.4&diff_format=u
Index: phpruntests/src/rtClassMap.php
diff -u phpruntests/src/rtClassMap.php:1.3 phpruntests/src/rtClassMap.php:1.4
--- phpruntests/src/rtClassMap.php:1.3 Mon Apr 27 21:05:33 2009
+++ phpruntests/src/rtClassMap.php Thu Apr 30 08:12:32 2009
@@ -58,6 +58,7 @@
'rtArgsSection' =>
'testcase/sections/configurationsections/rtArgsSection.php',
'rtEnvSection' =>
'testcase/sections/configurationsections/rtEnvSection.php',
'rtGetSection' =>
'testcase/sections/configurationsections/rtGetSection.php',
+ 'rtGzipPostSection' =>
'testcase/sections/configurationsections/rtGzipPostSection.php',
'rtIniSection' =>
'testcase/sections/configurationsections/rtIniSection.php',
'rtPostSection' =>
'testcase/sections/configurationsections/rtPostSection.php',
'rtCleanSection' =>
'testcase/sections/executablesections/rtCleanSection.php',
http://cvs.php.net/viewvc.cgi/phpruntests/tests/testcase/sections/configurationsections/rtGzipPostSectionTest.php?view=markup&rev=1.1
Index:
phpruntests/tests/testcase/sections/configurationsections/rtGzipPostSectionTest.php
+++
phpruntests/tests/testcase/sections/configurationsections/rtGzipPostSectionTest.php
<?php
require_once 'PHPUnit/Framework.php';
require_once dirname(__FILE__) . '../../../../../src/rtAutoload.php';
class rtGzipPostSectionTest extends PHPUnit_Framework_TestCase
{
public function testCreateInstance()
{
$postSection = new rtGzipPostSection('GZIP_POST',
array('hello=World&goodbye=MrChips'));
$envVars = $postSection->getPostVariables();
$this->assertEquals('POST', $envVars['REQUEST_METHOD']);
$this->assertEquals('application/x-www-form-urlencoded',$envVars['CONTENT_TYPE']);
$this->assertEquals(strlen(gzencode('hello=World&goodbye=MrChips')),
$envVars['CONTENT_LENGTH']);
$fileName = $postSection->getPostFileName();
$string = file_get_contents($fileName);
$expectedString = gzencode('hello=World&goodbye=MrChips');
$this->assertEquals($expectedString, $string);
}
}
?>
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php