public function testGetConfigWithBrokenSystem() { $slideshow = true; $exceptionMessage = 'Aïe!'; $this->configService->expects($this->any())->method('getFeaturesList')->willThrowException(new ServiceException($exceptionMessage)); $errorMessage = ['message' => $exceptionMessage, 'success' => false]; /** @type JSONResponse $response */ $response = $this->controller->get($slideshow); $this->assertEquals($errorMessage, $response->getData()); }
public function testGetConfigWithBrokenSystem() { $slideshow = true; $exceptionMessage = 'Aïe!'; $this->configService->expects($this->any())->method('getFeaturesList')->willThrowException(new ServiceException($exceptionMessage)); // Default status code when something breaks $status = Http::STATUS_INTERNAL_SERVER_ERROR; $errorMessage = ['message' => $exceptionMessage . ' (' . $status . ')', 'success' => false]; /** @type JSONResponse $response */ $response = $this->controller->get($slideshow); $this->assertEquals($errorMessage, $response->getData()); }