/** * Tests the JWeb::setHeader method. * * @return void * * @since 11.3 */ public function testSetHeader() { // Fill the header body with an arbitrary value. $this->inspector->setClassProperty('response', (object) array('cachable' => null, 'headers' => array(array('name' => 'foo', 'value' => 'bar')), 'body' => null)); $this->inspector->setHeader('foo', 'car'); $this->assertThat($this->inspector->getClassProperty('response')->headers, $this->equalTo(array(array('name' => 'foo', 'value' => 'bar'), array('name' => 'foo', 'value' => 'car'))), 'Tests that a header is added.'); $this->inspector->setHeader('foo', 'car', true); $this->assertThat($this->inspector->getClassProperty('response')->headers, $this->equalTo(array(array('name' => 'foo', 'value' => 'car'))), 'Tests that headers of the same name are replaced.'); }