createMock(ResponseInterface::class); $response->method('getStatusCode')->will($this->returnValue($code)); $controller = $this->getController(['getResponse']); $controller->method('getResponse')->willReturn($response); $this->assertSame($type === 'informational', $controller->isInformational(), 'isInformational'); $this->assertSame($type === 'successful', $controller->isSuccessful(), 'isSuccessful'); $this->assertSame($type === 'redirect', $controller->isRedirection(), 'isRedirection'); $this->assertSame($type === 'client error', $controller->isClientError(), 'isClientError'); $this->assertSame($type === 'server error', $controller->isServerError(), 'isServerError'); $this->assertSame(in_array($type, ['client error', 'server error']), $controller->isError(), 'isError'); } }