/** * Tests the JApplicationWeb::getBody method. * * @return void * * @since 11.3 */ public function testGetBody() { // Fill the header body with an arbitrary value. TestReflection::setValue( $this->class, 'response', (object) array( 'cachable' => null, 'headers' => null, 'body' => array('foo', 'bar'), ) ); $this->assertThat( $this->class->getBody(), $this->equalTo('foobar'), 'Checks the default state returns the body as a string.' ); $this->assertThat( $this->class->getBody(), $this->equalTo($this->class->getBody(false)), 'Checks the default state is $asArray = false.' ); $this->assertThat( $this->class->getBody(true), $this->equalTo(array('foo', 'bar')), 'Checks that the body is returned as an array.' ); }
/** * Tests the JApplicationWeb::getBody method. * * @return void * * @since 11.3 */ public function testGetBody() { // Fill the header body with an arbitrary value. TestReflection::setValue($this->class, 'response', (object) array('cachable' => null, 'headers' => null, 'body' => array('foo', 'bar'))); $this->assertEquals('foobar', $this->class->getBody()); $this->assertEquals($this->class->getBody(false), $this->class->getBody()); $this->assertEquals(array('foo', 'bar'), $this->class->getBody(true)); }