Skip to content
This repository has been archived by the owner on Jan 30, 2020. It is now read-only.

Commit

Permalink
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Server/Response.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,10 +118,10 @@ public function getResult()
/**
* Set result error
*
* @param Error $error
* @param mixed $error
* @return Response
*/
public function setError(Error $error)
public function setError(Error $error = null)
{
$this->error = $error;
return $this;
Expand Down
7 changes: 7 additions & 0 deletions test/Server/ResponseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,13 @@ public function testShouldBeAbleToRetrieveErrorObject()
$this->assertSame($error, $this->response->getError());
}

public function testErrorAccesorsShouldWorkWithNullInput()
{
$this->response->setError(null);
$this->assertNull($this->response->getError());
$this->assertFalse($this->response->isError());
}

public function testIdShouldBeNullByDefault()
{
$this->assertNull($this->response->getId());
Expand Down

0 comments on commit 8aa284d

Please sign in to comment.