com phpruntests: test for post raw section: tests/testcase/sections/configurationsections/rtPostRawSectionTest.php
| From: | David Soria Parra | Date: | Mon, 04 May 2009 15:45:54 +0000 |
| Subject: | com phpruntests: test for post raw section: tests/testcase/sections/configurationsections/rtPostRawSectionTest.php | ||
| Groups: | php.qa | ||
| Request: | Send a blank email to php-qa+get-66499@lists.php.net to get a copy of this message | ||
Commit: 64fefb318e4152a121055d7001ea6df814b776bf
Author: Zoe Slattery <zoe@php.net> Mon, 4 May 2009 15:45:54 +0000
Parents: c5b428d51bcf5ed96fdb49adde8f46a4ea550c86
Branches: master
Link: http://git.php.net/?p=phpruntests.git;a=commitdiff;h=64fefb318e4152a121055d7001ea6df814b776bf
Log:
test for post raw section
Changed paths:
A tests/testcase/sections/configurationsections/rtPostRawSectionTest.php
Diff:
diff --git a/tests/testcase/sections/configurationsections/rtPostRawSectionTest.php
b/tests/testcase/sections/configurationsections/rtPostRawSectionTest.php
new file mode 100644
index 0000000..ae1e12b
--- /dev/null
+++ b/tests/testcase/sections/configurationsections/rtPostRawSectionTest.php
@@ -0,0 +1,26 @@
+<?php
+require_once 'PHPUnit/Framework.php';
+require_once dirname(__FILE__) . '../../../../../src/rtAutoload.php';
+
+class rtPostRawSectionTest extends PHPUnit_Framework_TestCase
+{
+ public function testCreateInstance()
+ {
+ $post_array = array( 'fred',
+ 'Content-Type:the first',
+ 'joe',
+ 'Content-Type:the second',
+ 'mary',
+ );
+ $postSection = new rtPostRawSection('POST', $post_array);
+
+ $envVars = $postSection->getPostVariables();
+ $this->assertEquals('POST', $envVars['REQUEST_METHOD']);
+ $this->assertEquals('the first',$envVars['CONTENT_TYPE']);
+
+ $fileName = $postSection->getPostFileName();
+ $string = file_get_contents($fileName);
+ $this->assertEquals('fred\njoe\nContent-Type:the second\nmary', $string);
+ }
+}
+?>
\ No newline at end of file