cvs: phpruntests /src/testcase/sections/configurationsections rtPostRawSection.php

From: Date: Mon, 04 May 2009 15:45:26 +0000
Subject: cvs: phpruntests /src/testcase/sections/configurationsections rtPostRawSection.php
Groups: php.cvs 
Request: Send a blank email to php-cvs+get-57512@lists.php.net to get a copy of this message
zoe Mon May 4 15:45:26 2009 UTC Added files: /phpruntests/src/testcase/sections/configurationsections rtPostRawSection.php Log: PostRaw section http://cvs.php.net/viewvc.cgi/phpruntests/src/testcase/sections/configurationsections/rtPostRawSection.php?view=markup&rev=1.1 Index: phpruntests/src/testcase/sections/configurationsections/rtPostRawSection.php +++ phpruntests/src/testcase/sections/configurationsections/rtPostRawSection.php <?php /** * rtPostSection * Sets environment variables for POST_RAW 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 rtPostRawSection extends rtConfigurationSection { private $postVariables = array(); private $postFileName; protected function init() { $postContents = array(); $isContentSet= false; foreach($this->sectionContents as $line) { //get the first - and only the first - Content-Type line if (!$isContentSet && preg_match('/^Content-Type:(.*)/i', $line, $matches)) { $this->postVariables['CONTENT_TYPE'] = trim(str_replace("\r", '', $matches[1])); $isContentSet = true; } else { $postContents[] = $line; } } $postString = implode('\n', $postContents); $this->postVariables['CONTENT_LENGTH'] = strlen($postString); $this->postVariables['REQUEST_METHOD'] = 'POST'; $this->postFileName = tempnam(sys_get_temp_dir(), 'post'); file_put_contents($this->postFileName, $postString); } /** * Additional POST environment variables required by the test * * @return array */ public function getPostVariables() { return $this->postVariables; } /** * return the name of teh file containing post data * */ public function getPostFileName() { return $this->postFileName; } } ?>

« previous php.cvs (#57512) next »