|
|
@@ -98,9 +98,12 @@ class Zend_View_Helper_JsonTest extends PHPUnit_Framework_TestCase
|
|
|
$found = false;
|
|
|
foreach ($headers as $header) {
|
|
|
if ('Content-Type' == $header['name']) {
|
|
|
+ if ($found) {
|
|
|
+ $this->fail('Content-Type header has been set twice.');
|
|
|
+ return null;
|
|
|
+ }
|
|
|
$found = true;
|
|
|
$value = $header['value'];
|
|
|
- break;
|
|
|
}
|
|
|
}
|
|
|
$this->assertTrue($found);
|
|
|
@@ -113,6 +116,16 @@ class Zend_View_Helper_JsonTest extends PHPUnit_Framework_TestCase
|
|
|
$this->verifyJsonHeader();
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * @group ZF-10675
|
|
|
+ */
|
|
|
+ public function testJsonHelperReplacesContentTypeReponseHeaderIfAlreadySet()
|
|
|
+ {
|
|
|
+ $this->response->setHeader('Content-Type', 'text/html');
|
|
|
+ $this->helper->json('foobar');
|
|
|
+ $this->verifyJsonHeader();
|
|
|
+ }
|
|
|
+
|
|
|
public function testJsonHelperReturnsJsonEncodedString()
|
|
|
{
|
|
|
$data = $this->helper->json(array('foobar'));
|