zoe Mon May 4 17:02:37 2009 UTC
Added files:
/phpruntests/tests/testcase/sections/configurationsections
rtCookieSectionTest.php
/phpruntests/tests/testcase rtCookieExecutionTest.php
/phpruntests/src/testcase/sections/configurationsections
rtCookieSection.php
Modified files:
/phpruntests/src/testcase/preconditions rtIsSectionImplemented.php
/phpruntests/src/testcase rtTestConfiguration.php
/phpruntests/src/testcase/sections rtSection.php
Log:
cookie section
http://cvs.php.net/viewvc.cgi/phpruntests/src/testcase/preconditions/rtIsSectionImplemented.php?r1=1.6&r2=1.7&diff_format=u
Index: phpruntests/src/testcase/preconditions/rtIsSectionImplemented.php
diff -u phpruntests/src/testcase/preconditions/rtIsSectionImplemented.php:1.6
phpruntests/src/testcase/preconditions/rtIsSectionImplemented.php:1.7
--- phpruntests/src/testcase/preconditions/rtIsSectionImplemented.php:1.6
Mon May 4 16:28:17 2009
+++ phpruntests/src/testcase/preconditions/rtIsSectionImplemented.php Mon May
4 17:02:37 2009
@@ -22,6 +22,7 @@
'GZIP_POST' => 'rtGzipPostSection',
'DEFLATE_POST' => 'rtDeflatePostSection',
'POST_RAW' => 'rtPostRawSection',
+ 'COOKIE' => 'rtCookieSection',
);
/** Return the message associated with an unimplemented test section
http://cvs.php.net/viewvc.cgi/phpruntests/src/testcase/rtTestConfiguration.php?r1=1.12&r2=1.13&diff_format=u
Index: phpruntests/src/testcase/rtTestConfiguration.php
diff -u phpruntests/src/testcase/rtTestConfiguration.php:1.12
phpruntests/src/testcase/rtTestConfiguration.php:1.13
--- phpruntests/src/testcase/rtTestConfiguration.php:1.12 Mon May 4
16:27:12 2009
+++ phpruntests/src/testcase/rtTestConfiguration.php Mon May 4 17:02:37 2009
@@ -48,12 +48,6 @@
$this->setPhpExecutable($runConfiguration, $sectionHeadings);
$this->setInputFileString($runConfiguration, $sections,
$sectionHeadings);
- if($this->cgiTest) {
- $this->environmentVariables['SCRIPT_FILENAME'] =
$fileSection->getFileName();
- $this->environmentVariables['PATH_TRANSLATED'] =
$fileSection->getFileName();
- //Required by when the cgi has been compiled with
force-cgi-redirect.
- $this->environmentVariables['REDIRECT_STATUS'] = '1';
- }
}
private function setEnvironmentVariables(rtRuntestsConfiguration
$runConfiguration, $sections, $fileSection)
@@ -63,20 +57,33 @@
if (array_key_exists('ENV', $sections)) {
$this->environmentVariables =
array_merge($this->environmentVariables,
$sections['ENV']->getTestEnvironmentVariables());
}
- if (array_key_exists('GET', $sections)) {
- $this->environmentVariables =
array_merge($this->environmentVariables, $sections['GET']->getGetVariables());
- }
- 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());
- }
- if (array_key_exists('DEFLATE_POST', $sections)) {
- $this->environmentVariables =
array_merge($this->environmentVariables,
$sections['DEFLATE_POST']->getPostVariables());
- }
- if (array_key_exists('POST_RAW', $sections)) {
- $this->environmentVariables =
array_merge($this->environmentVariables,
$sections['POST_RAW']->getPostVariables());
+
+ if($this->cgiTest) {
+ $this->environmentVariables['SCRIPT_FILENAME'] =
$fileSection->getFileName();
+ $this->environmentVariables['PATH_TRANSLATED'] =
$fileSection->getFileName();
+ //Required by when the cgi has been compiled with
force-cgi-redirect.
+ $this->environmentVariables['REDIRECT_STATUS'] = '1';
+ //Default is GET
+ $this->environmentVariables['REQUEST_METHOD'] = 'GET';
+
+ if (array_key_exists('GET', $sections)) {
+ $this->environmentVariables =
array_merge($this->environmentVariables, $sections['GET']->getGetVariables());
+ }
+ 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());
+ }
+ if (array_key_exists('DEFLATE_POST', $sections)) {
+ $this->environmentVariables =
array_merge($this->environmentVariables,
$sections['DEFLATE_POST']->getPostVariables());
+ }
+ if (array_key_exists('POST_RAW', $sections)) {
+ $this->environmentVariables =
array_merge($this->environmentVariables,
$sections['POST_RAW']->getPostVariables());
+ }
+ if (array_key_exists('COOKIE', $sections)) {
+ $this->environmentVariables =
array_merge($this->environmentVariables,
$sections['COOKIE']->getCookieVariables());
+ }
}
}
http://cvs.php.net/viewvc.cgi/phpruntests/src/testcase/sections/rtSection.php?r1=1.7&r2=1.8&diff_format=u
Index: phpruntests/src/testcase/sections/rtSection.php
diff -u phpruntests/src/testcase/sections/rtSection.php:1.7
phpruntests/src/testcase/sections/rtSection.php:1.8
--- phpruntests/src/testcase/sections/rtSection.php:1.7 Mon May 4 16:27:12 2009
+++ phpruntests/src/testcase/sections/rtSection.php Mon May 4 17:02:37 2009
@@ -23,6 +23,7 @@
'GZIP_POST' => 'rtGzipPostSection',
'DEFLATE_POST' => 'rtDeflatePostSection',
'POST_RAW' => 'rtPostRawSection',
+ 'COOKIE' => 'rtCookieSection',
);
protected $sectionName;
http://cvs.php.net/viewvc.cgi/phpruntests/tests/testcase/sections/configurationsections/rtCookieSectionTest.php?view=markup&rev=1.1
Index:
phpruntests/tests/testcase/sections/configurationsections/rtCookieSectionTest.php
+++
phpruntests/tests/testcase/sections/configurationsections/rtCookieSectionTest.php
<?php
require_once 'PHPUnit/Framework.php';
require_once dirname(__FILE__) . '../../../../../src/rtAutoload.php';
class rtCookieSectionTest extends PHPUnit_Framework_TestCase
{
public function testCreateInstance()
{
$cookieSection = new rtCookieSection('COOKIE',
array('hello=World&goodbye=MrChips'));
$envlist = $cookieSection->getCookieVariables();
$this->assertEquals('hello=World&goodbye=MrChips',
$envlist['HTTP_COOKIE']);
}
}
?>
http://cvs.php.net/viewvc.cgi/phpruntests/tests/testcase/rtCookieExecutionTest.php?view=markup&rev=1.1
Index: phpruntests/tests/testcase/rtCookieExecutionTest.php
+++ phpruntests/tests/testcase/rtCookieExecutionTest.php
<?php
require_once 'PHPUnit/Framework.php';
require_once dirname(__FILE__) . '../../../src/rtAutoload.php';
class rtCookieExecutionTest extends PHPUnit_Framework_TestCase
{
private $path_to_tests;
private $sample_test;
private $sample_fail;
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_cookie.phpt';
}
public function tearDown()
{
@unlink($this->path-to_tests . '/sample_cookie.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);
$status = $testCase->getStatus();
$this->assertEquals('', $status['pass']);
}
}
?>
?>
http://cvs.php.net/viewvc.cgi/phpruntests/src/testcase/sections/configurationsections/rtCookieSection.php?view=markup&rev=1.1
Index:
phpruntests/src/testcase/sections/configurationsections/rtCookieSection.php
+++ phpruntests/src/testcase/sections/configurationsections/rtCookieSection.php
<?php
/**
* rtGetSection
* Sets environment variables for COOKIE section
*
*
* @category Testing
* @package RUNTESTS
* @author Zoe Slattery <[email protected]>
* @author Stefan Priebsch <[email protected]>
* @copyright 2009 The PHP Group
* @license http://www.php.net/license/3_01.txt PHP License 3.01
* @link http://qa.php.net/
*/
class rtCookieSection extends rtConfigurationSection
{
private $cookieVariables = array();
protected function init()
{
$this->cookieVariables['HTTP_COOKIE'] = $this->sectionContents[0];
}
/**
* Additional GET environment variables required by the test
*
* @return array
*/
public function getCookieVariables()
{
return $this->cookieVariables;
}
}
?>
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php