public function testSetIdMethod() { $this->connection->shouldReceive('createErrors')->once()->andReturn($this->errors); $this->request->shouldReceive('setResponse')->once()->andReturn($this->request); // Test start here $response = new Response($this->connection, $this->request, $this->responseArray, $this->id); $return = $response->setId($this->id); $this->assertSame($response, $return); }