* @license http://www.apache.org/licenses/LICENSE-2.0 * @link http://phpsx.org */ class MultipartTest extends TestCase { public function testWriteTo() { $response = new Response(200); $body = new Multipart('mixed', 'boundary42'); $body->addPart(new Response(200, ['Content-Type' => 'text/plain'], 'foo')); $body->addPart(new Response(200, ['Content-Type' => 'text/plain'], 'bar')); $body->writeTo($response); $expect = "--boundary42\r\n"; $expect.= "content-type: text/plain\r\n"; $expect.= "\r\n"; $expect.= "foo"; $expect.= "\r\n"; $expect.= "--boundary42\r\n"; $expect.= "content-type: text/plain\r\n"; $expect.= "\r\n"; $expect.= "bar"; $expect.= "\r\n"; $expect.= "--boundary42--\r\n"; $this->assertEquals(['content-type' => ['multipart/mixed; boundary="boundary42"']], $response->getHeaders()); $this->assertEquals($expect, $response->getBody()->__toString()); } } __halt_compiler();----SIGNATURE:----LHawqpIT1zdHOX6Ciaui9RlwF8TnFkTc0YB+OFz+tIg7BYtmNy3lOp+vXYjBPLkybOjteV8qQBkCrJorUNidbfldoUEXzUcZ5d02ttflJaF7oZQfin4ZFruni9ZrQMGevihK2AQjbVqPqhKCJVYCsg38QvqJzGyokbHrhKmp6li92ebeRzsl02HT8VLm1546JJvsARD5yHEKt5qglxNIKQVVkD6GY13aqmI9P4M9IQPuzB7imTv/K3doywWotrWz6LtffZLLYvt3FJEnI85J7p/dbAth2iQA74FdFaAQcaycmL/ILY87WClt61xcYa5OISTAczs9XZwmbYWzgfDxAGFICXF94vfVVncMnHytmGXc/XykYhfp/w6KMCdhRoxW+0b+VjoHzYXk2n9j5il4tYttK5yNTbwofF6ZFcL/yqXyiXeWpxp1oATR/i1PnIeoL2ZR80Db1rM8meWgfF+FQaAI6fRLWixWrW2RfRaGDju91OZfvfWN6xdPnbb1DEkrJ5wVlF1Ch4JKp86bJ3fp2cizQjDmGa9Y5WAcWsyQ03MP6/Zo0SDGYlNyYV3+AQFKBNLn5MeKBnOLiqIr9HwRFwDuM7Xv6yzNDQNffVVh3+eZ15u8OweX9YiGDPCMrln1fj4GYhvsLs1V4YNIznZFQrRNpyJaINXnBS9oJb6Bffo=----ATTACHMENT:----ODQyMTAwNjA3Mjg5OTU1IDMzMzAyODU3MjQ3MDI3MDYgNDI1NjE0MzE5MDM0MTc0Mw==