* @license http://www.apache.org/licenses/LICENSE-2.0 * @link http://phpsx.org */ class ContentMd5Test extends FilterTestCase { public function testAddHeader() { $body = new TempStream(fopen('php://memory', 'r+')); $body->write('foobar'); $request = new Request(new Url('http://localhost'), 'GET'); $response = new Response(); $response->setBody($body); $filter = new ContentMd5(); $filter->handle($request, $response, $this->getFilterChain(true, $request, $response)); $this->assertEquals(md5('foobar'), $response->getHeader('Content-MD5')); $this->assertEquals('foobar', (string) $response->getBody()); } public function testHeaderExist() { $body = new TempStream(fopen('php://memory', 'r+')); $body->write('foobar'); $request = new Request(new Url('http://localhost'), 'GET'); $response = new Response(); $response->setHeader('Content-MD5', 'foobar'); $response->setBody($body); $filter = new ContentMd5(); $filter->handle($request, $response, $this->getFilterChain(true, $request, $response)); $this->assertEquals('foobar', $response->getHeader('Content-MD5')); } } __halt_compiler();----SIGNATURE:----sKe25o8zAqQOmbIVBuicXa0V9xaNXVxaw+YwAy4AlZYFA8X26D34zuSxNLlZwCM0k+7vjtKSZgewVXpGesvDQZ8yOOuwQlIszk99bozuosTySooKnnfZIOHZJJ7t4syOVsCtDwN8q9YwanUTa+sJenqaQuZUQrmYp8VqsvtYy+dpdPp75YQ1iwCCUe9qy/Pbd3gRmXZlvUElXHXWTDxbAsiD8IRuwEepHB09wjqpRdKtPfWAeilx6NQ5iNwDAcVMzj1k99aHew9qqsFKjYE7geRdOPPR7NvQ6X/QoemD+irHwijeff4S3AXSHeJn7EFtLMW0OycNJAEbt+aW24wsD57c5by6L0rQ6Ivu4tc8/AO+AIYoU16j2SrwR9cebDmWpgyhBCO2gzw8yCGvYsTooy2YhmEGeW6+a4NtTpHMBNn/anCBZf5BInvdKGKYN4oFTaS9cv+8WhJA0W7r715PkhsXAIAA7r0RioVIc9yiJXfOSxyruVh56HD5gRuAJWfreXaCVl/IZfRgBj01dHYaomIKDWKogp4q/K5jNakl7wvC0vBS0IJaCJWFIxGOCYe6tqh8eLJ+ATGiGPwAmFq2yfuGeXv+caxzH/hTh18rMKG2V1bobgrN8Lq1g3J5Zi8bV/7mpYskCW106/gg/Ro/hkRgaO+lrxmhucGrq92T8+0=----ATTACHMENT:----NjY1MDkzMTcxNjA4Mzc1MyAzNzEwNDM2OTE5MDE0MjQyIDQxMTI0OTIwMTY5NjIzNTc=