summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authoruckelman <uckelman@nomic.net>2010-05-09 16:34:04 +0000
committeruckelman <uckelman@nomic.net>2010-05-09 16:34:04 +0000
commit82a88b6cb111d8288f5d0cda74058a90534a068e (patch)
tree8d9355cfd14f31df78085ae0d280973c35edba25 /test
parent72c110b4ae3628ba20cfc3a39f81fbfd2239f532 (diff)
Added buildPost test.
git-svn-id: https://vassalengine.svn.sourceforge.net/svnroot/vassalengine/site-src/trunk@6824 67b53d14-2c14-4ace-a08f-0dab2b34000c
Diffstat (limited to 'test')
-rw-r--r--test/HTTP_POST_multipartTest.php36
1 files changed, 36 insertions, 0 deletions
diff --git a/test/HTTP_POST_multipartTest.php b/test/HTTP_POST_multipartTest.php
index af974ce..d4db17b 100644
--- a/test/HTTP_POST_multipartTest.php
+++ b/test/HTTP_POST_multipartTest.php
@@ -88,6 +88,42 @@ class HTTP_POST_multipartTest extends PHPUnit_Framework_TestCase {
)
);
}
+
+ /**
+ * @dataProvider providerBuildPost
+ */
+ public function testBuildPost($parts, $expected, $ex) {
+ if ($ex) $this->setExpectedException($ex);
+
+ list($boundary, $content) =
+ self::getMethod('buildPost')->invokeArgs(null, array($parts));
+
+ $actual = str_replace('boundary', $boundary, $content);
+ $this->assertEquals($expected, $actual);
+ }
+
+ public function providerBuildPost() {
+ return array(
+ array(null, null, 'Exception'),
+ array(
+ array(
+ array(
+ 'name' => 'foo',
+ 'data' => 1
+ ),
+ array(
+ 'name' => 'foo',
+ 'filename' => 'somename.txt',
+ 'mimetype' => 'text/plain',
+ 'charset' => 'utf-8',
+ 'encoding' => null,
+ 'data' => "blah blah blah\nblah blah blah"
+ )
+ ),
+ "--boundary\r\nContent-Disposition: form-data; name=\"foo\"\r\n\r\n1\r\n--boundary\r\nContent-Disposition: form-data; name=\"foo\"; filename=\"somename.txt\"\r\nContent-Type: text/plain; charset=\"utf-8\"\r\n\r\nblah blah blah\nblah blah blah\r\n--boundary--\r\n"
+ )
+ );
+ }
}
?>