Ejemplo n.º 1
0
 /**
  * Tests the JApplicationWeb::setHeader method.
  *
  * @return  void
  *
  * @since   11.3
  */
 public function testSetHeader()
 {
     // Fill the header body with an arbitrary value.
     TestReflection::setValue($this->class, 'response', (object) array('cachable' => null, 'headers' => array(array('name' => 'foo', 'value' => 'bar')), 'body' => null));
     $this->class->setHeader('foo', 'car');
     $this->assertEquals(array(array('name' => 'foo', 'value' => 'bar'), array('name' => 'foo', 'value' => 'car')), TestReflection::getValue($this->class, 'response')->headers);
     $this->class->setHeader('foo', 'car', true);
     $this->assertEquals(array(array('name' => 'foo', 'value' => 'car')), TestReflection::getValue($this->class, 'response')->headers);
 }
Ejemplo n.º 2
0
 /**
  * Tests the JApplicationWeb::setHeader method.
  *
  * @return  void
  *
  * @since   11.3
  */
 public function testSetHeader()
 {
     // Fill the header body with an arbitrary value.
     TestReflection::setValue($this->class, 'response', (object) array('cachable' => null, 'headers' => array(array('name' => 'foo', 'value' => 'bar')), 'body' => null));
     $this->class->setHeader('foo', 'car');
     $this->assertThat(TestReflection::getValue($this->class, 'response')->headers, $this->equalTo(array(array('name' => 'foo', 'value' => 'bar'), array('name' => 'foo', 'value' => 'car'))), 'Tests that a header is added.');
     $this->class->setHeader('foo', 'car', true);
     $this->assertThat(TestReflection::getValue($this->class, 'response')->headers, $this->equalTo(array(array('name' => 'foo', 'value' => 'car'))), 'Tests that headers of the same name are replaced.');
 }