/** * Set the status code and text * * @see \sndsgd\http\Code * @param integer $code The http status code * @return \sndsgd\http\Response */ public function setStatus(int $code) : Response { # `Status::getText` will throw an exception for invalid status codes $this->statusText = Status::getText($code); $this->statusCode = $code; return $this; }
public function testGetAndSetText() { $this->status->setText('text'); $this->assertEquals('text', $this->status->getText()); }
/** * Tests Status->getText() */ public function testGetText() { $this->Status = new Status("40", new \DateTime(), new \Model\User(null, "toto", password_hash("toto", PASSWORD_DEFAULT)), "status test"); $this->assertEquals("status test", $this->Status->getText()); }