From a0f2208503760ace4d2b3df47f93fe4d2e0a5bc1 Mon Sep 17 00:00:00 2001 From: uckelman Date: Sun, 9 May 2010 16:14:23 +0000 Subject: Added test for buildFilePart. git-svn-id: https://vassalengine.svn.sourceforge.net/svnroot/vassalengine/site-src/trunk@6819 67b53d14-2c14-4ace-a08f-0dab2b34000c --- test/HTTP_POST_multipartTest.php | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'test/HTTP_POST_multipartTest.php') diff --git a/test/HTTP_POST_multipartTest.php b/test/HTTP_POST_multipartTest.php index b61e9cb..309eccb 100644 --- a/test/HTTP_POST_multipartTest.php +++ b/test/HTTP_POST_multipartTest.php @@ -35,7 +35,35 @@ class HTTP_POST_multipartTest extends PHPUnit_Framework_TestCase { ); } + /** + * @dataProvider providerBuildFilePart + */ + public function testBuildFilePart($part, $expected, $ex) { + if ($ex) $this->setExpectedException($ex); + + $this->assertEquals( + $expected, + self::getMethod('buildFilePart')->invokeArgs(null, array($part)) + ); + } + public function providerBuildFilePart() { + return array( + array(null, null, 'Exception'), + array( + array( + 'name' => 'foo', + 'filename' => 'somename.txt', + 'mimetype' => 'text/plain', + 'charset' => 'utf-8', + 'encoding' => null, + 'data' => "blah blah blah\nblah blah blah" + ), + "Content-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", + null + ) + ); + } } ?> -- cgit v1.2.3