X-Git-Url: https://git.m6w6.name/?a=blobdiff_plain;f=phpunit%2FMessageBodyTest.php;h=cc0f421efd9f92c31d2d9d7cd76999773b563a20;hb=2769c041b77a0aaba7acbee4ae469571eaeb2b0a;hp=eda54b0b9e416562e4ce0fc47ef585d9a73af03e;hpb=4407379af8d886b627c88572e9da69c38cdbda58;p=m6w6%2Fext-http diff --git a/phpunit/MessageBodyTest.php b/phpunit/MessageBodyTest.php index eda54b0..cc0f421 100644 --- a/phpunit/MessageBodyTest.php +++ b/phpunit/MessageBodyTest.php @@ -29,9 +29,9 @@ class MessageBodyTest extends PHPUnit_Framework_TestCase { $this->assertEquals(3, $this->temp->append("yes")); } - function testAdd() { + function testAddForm() { $this->assertTrue( - $this->temp->add( + $this->temp->addForm( array( "foo" => "bar", "more" => array( @@ -67,7 +67,7 @@ class MessageBodyTest extends PHPUnit_Framework_TestCase { "\r\n". "fuz\r\n". "--%x.%x\r\n". - "Content-Disposition: attachment; name=\"upload\"; filename=\"MessageBodyTest.php\"\r\n". + "Content-Disposition: form-data; name=\"upload\"; filename=\"MessageBodyTest.php\"\r\n". "Content-Transfer-Encoding: binary\r\n". "Content-Type: text/plain\r\n". "\r\n". @@ -78,6 +78,20 @@ class MessageBodyTest extends PHPUnit_Framework_TestCase { ); } + function testAddPart() { + $this->temp->addPart(new http\Message("This: is a header\n\nand this is the data\n")); + $this->assertStringMatchesFormat( + "--%x.%x\r\n". + "This: is a header\r\n". + "Content-Length: 21\r\n". + "\r\n". + "and this is the data\n\r\n". + "--%x.%x--\r\n". + "", + str_replace("\r", "", $this->temp) + ); + } + function testEtag() { $s = stat(__FILE__); $this->assertEquals( @@ -106,4 +120,8 @@ class MessageBodyTest extends PHPUnit_Framework_TestCase { ); $this->assertEquals($s, (string) $this->file); } + + function testClone() { + $this->assertEquals((string) $this->file, (string) clone $this->file); + } }