public function testSetConnectionMethod() { // Mock actions $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->setConnection($this->connection); $this->assertSame($response, $return); }