public function testRunApplication() { $_SERVER['REQUEST_URI'] = '/some/prefix/response/set-body/custom.php?some-params'; $this->application->start(); self::assertTrue($this->response->hasBody()); self::assertEquals('foobar', $this->response->getBody()); }
public function testModifiingBody() { self::assertNull($this->response->getBody()); $this->response->appendToBody('foo'); self::assertEquals('foo', $this->response->getBody()); $this->response->appendToBody('bar'); self::assertEquals('foobar', $this->response->getBody()); $this->response->setBody('baz'); self::assertEquals('baz', $this->response->getBody()); }
public function update(\Nano\Controller\Response $response) { $contents = $response->getBody(); $response->setBody('<h1>Unexpected Error</h1>'); $response->appendToBody($contents); }