public function testEncodeJsonProxiesToJsonActionHelper() { $dojo = new AutoCompleteDojo(); $dojo->setBroker($this->broker); $data = array('foo', 'bar', 'baz'); $encoded = $dojo->prepareAutoCompletion($data); $decoded = Json::decode($encoded); $test = array(); foreach ($decoded['items'] as $item) { $test[] = $item['name']; } $this->assertSame($data, $test); $this->assertFalse($this->layout->isEnabled()); $headers = $this->response->getHeaders(); $found = false; foreach ($headers as $header) { if ('Content-Type' == $header['name']) { if ('application/json' == $header['value']) { $found = true; } break; } } $this->assertTrue($found, "JSON content-type header not found"); }