com phpruntests: gzip post section class: src/testcase/sections/configurationsections/rtGzipPostSection.php
| From: | David Soria Parra | Date: | Wed, 29 Apr 2009 18:51:33 +0000 |
| Subject: | com phpruntests: gzip post section class: src/testcase/sections/configurationsections/rtGzipPostSection.php | ||
| Groups: | php.qa | ||
| Request: | Send a blank email to php-qa+get-66504@lists.php.net to get a copy of this message | ||
Commit: 4d0e02564f6f7b2951fde29d1b93158ccb70bfb7
Author: Zoe Slattery <zoe@php.net> Wed, 29 Apr 2009 18:51:33 +0000
Parents: 92d0f98b985c672726e1b1708d5b9a53726dfe4b
Branches: master
Link: http://git.php.net/?p=phpruntests.git;a=commitdiff;h=4d0e02564f6f7b2951fde29d1b93158ccb70bfb7
Log:
gzip post section class
Changed paths:
A src/testcase/sections/configurationsections/rtGzipPostSection.php
Diff:
diff --git a/src/testcase/sections/configurationsections/rtGzipPostSection.php
b/src/testcase/sections/configurationsections/rtGzipPostSection.php
new file mode 100644
index 0000000..cead7f8
--- /dev/null
+++ b/src/testcase/sections/configurationsections/rtGzipPostSection.php
@@ -0,0 +1,48 @@
+<?php
+/**
+ * rtPostSection
+ * Sets environment variables for GZIP_POST section
+ *
+ *
+ * @category Testing
+ * @package RUNTESTS
+ * @author Zoe Slattery <zoe@php.net>
+ * @author Stefan Priebsch <spriebsch@php.net>
+ * @copyright 2009 The PHP Group
+ * @license http://www.php.net/license/3_01.txt
PHP License 3.01
+ * @link http://qa.php.net/
+ */
+class rtPostSection extends rtConfigurationSection
+{
+ private $postVariables = array();
+ private $postFileName;
+
+ protected function init()
+ {
+ $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);
+ }
+
+ /**
+ * Additional GET environment variables required by the test
+ *
+ * @return array
+ */
+ public function getPostVariables()
+ {
+ return $this->postVariables;
+ }
+
+ public function getPostFileName()
+ {
+ return $this->postFileName;
+ }
+}
+?>
\ No newline at end of file