com phpruntests: Change to the way POST section files are created: src/testcase/rtPhpTest.php src/testcase/rtTestResults.php
src/testcase/sections/configurationsections/rtDeflatePostSection.php src/testcase/sections/configurationsections/rtGzipPostSection.php
src/testcase/sections/configurationsections/rtPostRawSection.php src/testcase/sections/configurationsections/rtPostSection.php
src/testcase/sections/rtSection.php
| From: | David Soria Parra | Date: | Tue, 04 Aug 2009 21:46:19 +0000 |
| Subject: | com phpruntests: Change to the way POST section files are created: src/testcase/rtPhpTest.php src/testcase/rtTestResults.php src/testcase/sections/configurationsections/rtDeflatePostSection.php src/testcase/sections/configurationsections/rtGzipPostSection.php src/testcase/sections/configurationsections/rtPostRawSection.php src/testcase/sections/configurationsections/rtPostSection.php src/testcase/sections/rtSection.php |
||
| Groups: | php.qa | ||
| Request: | Send a blank email to php-qa+get-66301@lists.php.net to get a copy of this message | ||
Commit: 897e5bfd07356bbc67d93af4a1adb99625514a0c
Author: Zoe Slattery <zoe@php.net> Tue, 4 Aug 2009 21:46:19 +0000
Parents: 9de3a866f2c2cdddd82a25c6ea672efe8a7374f2
Branches: master
Link: http://git.php.net/?p=phpruntests.git;a=commitdiff;h=897e5bfd07356bbc67d93af4a1adb99625514a0c
Log:
Change to the way POST section files are created
Changed paths:
M src/testcase/rtPhpTest.php
M src/testcase/rtTestResults.php
M src/testcase/sections/configurationsections/rtDeflatePostSection.php
M src/testcase/sections/configurationsections/rtGzipPostSection.php
M src/testcase/sections/configurationsections/rtPostRawSection.php
M src/testcase/sections/configurationsections/rtPostSection.php
M src/testcase/sections/rtSection.php
Diff:
diff --git a/src/testcase/rtPhpTest.php b/src/testcase/rtPhpTest.php
index c18cc4a..0acb168 100644
--- a/src/testcase/rtPhpTest.php
+++ b/src/testcase/rtPhpTest.php
@@ -62,7 +62,7 @@ class rtPhpTest
if($this->isFileSection($sectionKey)) {
$tempArray = $this->removeDone($tempArray);
}
- $testSection = rtSection::getInstance($sectionKey, $tempArray);
+ $testSection = rtSection::getInstance($sectionKey, $tempArray,
$this->testName);
$this->sections[$sectionKey] = $testSection;
break;
} else {
@@ -72,7 +72,7 @@ class rtPhpTest
}
}
- $testSection = rtSection::getInstance($lastSection, $tempArray);
+ $testSection = rtSection::getInstance($lastSection, $tempArray, $this->testName);
$this->sections[$lastSection] = $testSection;
diff --git a/src/testcase/rtTestResults.php b/src/testcase/rtTestResults.php
index b058e24..ca6fe3d 100644
--- a/src/testcase/rtTestResults.php
+++ b/src/testcase/rtTestResults.php
@@ -64,6 +64,13 @@ class rtTestResults
@unlink($this->testName . '.mem');
}
}
+
+ //always delete temporary files used in POST sections
+ if(file_exists($this->testName . '.post')) {
+ @unlink($this->testName . '.post');
+ }
+
+
}
/**
diff --git a/src/testcase/sections/configurationsections/rtDeflatePostSection.php
b/src/testcase/sections/configurationsections/rtDeflatePostSection.php
index 21aca2f..c944fb2 100644
--- a/src/testcase/sections/configurationsections/rtDeflatePostSection.php
+++ b/src/testcase/sections/configurationsections/rtDeflatePostSection.php
@@ -26,7 +26,7 @@ class rtDeflatePostSection extends rtConfigurationSection
$this->postVariables['CONTENT_LENGTH'] = strlen($compressedPostString);
$this->postVariables['REQUEST_METHOD'] = 'POST';
- $this->postFileName = tempnam(sys_get_temp_dir(), 'post');
+ $this->postFileName = $this->testName . ".post";
file_put_contents($this->postFileName, $compressedPostString);
}
diff --git a/src/testcase/sections/configurationsections/rtGzipPostSection.php
b/src/testcase/sections/configurationsections/rtGzipPostSection.php
index 463aedb..bbe015d 100644
--- a/src/testcase/sections/configurationsections/rtGzipPostSection.php
+++ b/src/testcase/sections/configurationsections/rtGzipPostSection.php
@@ -26,7 +26,7 @@ class rtGzipPostSection extends rtConfigurationSection
$this->postVariables['CONTENT_LENGTH'] = strlen($gzipPostString);
$this->postVariables['REQUEST_METHOD'] = 'POST';
- $this->postFileName = tempnam(sys_get_temp_dir(), 'post');
+ $this->postFileName = $this->testName . ".post";
file_put_contents($this->postFileName, $gzipPostString);
}
diff --git a/src/testcase/sections/configurationsections/rtPostRawSection.php
b/src/testcase/sections/configurationsections/rtPostRawSection.php
index 3631227..00faca2 100644
--- a/src/testcase/sections/configurationsections/rtPostRawSection.php
+++ b/src/testcase/sections/configurationsections/rtPostRawSection.php
@@ -36,8 +36,8 @@ class rtPostRawSection extends rtConfigurationSection
$this->postVariables['CONTENT_LENGTH'] = strlen($postString);
$this->postVariables['REQUEST_METHOD'] = 'POST';
- $this->postFileName = tempnam(sys_get_temp_dir(), 'post');
-
+ $this->postFileName = $this->testName . ".post";
+
file_put_contents($this->postFileName, $postString);
}
diff --git a/src/testcase/sections/configurationsections/rtPostSection.php
b/src/testcase/sections/configurationsections/rtPostSection.php
index a119ccc..6766860 100644
--- a/src/testcase/sections/configurationsections/rtPostSection.php
+++ b/src/testcase/sections/configurationsections/rtPostSection.php
@@ -24,7 +24,7 @@ class rtPostSection extends rtConfigurationSection
$this->postVariables['CONTENT_LENGTH'] = strlen($postString);
$this->postVariables['REQUEST_METHOD'] = 'POST';
- $this->postFileName = tempnam(sys_get_temp_dir(), 'post');
+ $this->postFileName = $this->testName . ".post";
file_put_contents($this->postFileName, $postString);
}
diff --git a/src/testcase/sections/rtSection.php b/src/testcase/sections/rtSection.php
index 91c9952..9537930 100644
--- a/src/testcase/sections/rtSection.php
+++ b/src/testcase/sections/rtSection.php
@@ -1,7 +1,7 @@
<?php
/**
* rtSection
- *
+ *
* Parent class for all test sections
*
*
@@ -42,12 +42,14 @@ abstract class rtSection
protected $sectionName;
protected $sectionContents;
+ protected $testName;
protected $carriageReturnLineFeed = "\r\n";
protected $lineFeed = "\n";
- protected function __construct($sectionName, $contents)
+ protected function __construct($sectionName, $contents, $testName)
{
+ $this->testName = $testName;
$this->sectionName = $sectionName;
$this->sectionContents = $contents;
$this->init();
@@ -55,13 +57,14 @@ abstract class rtSection
abstract protected function init();
- public static function getInstance($sectionName, $contents)
+ public static function getInstance($sectionName, $contents, $testName)
{
+
if (!isset(self::$sectionMap[$sectionName])) {
throw new rtException('Unknown section type ' . $sectionName);
}
- return new rtSection::$sectionMap[$sectionName]($sectionName, $contents);
+ return new rtSection::$sectionMap[$sectionName]($sectionName, $contents, $testName);
}
public function getName()
@@ -73,5 +76,6 @@ abstract class rtSection
{
return $this->sectionContents;
}
+
}
?>