public function testGetFilesWithBrokenSetup() { $location = ''; $features = ''; $etag = 1111222233334444; $mediatypes = 'image/png'; $exceptionMessage = 'Aïe!'; $this->searchFolderService->expects($this->once())->method('getCurrentFolder')->with($location, [$features])->willThrowException(new ServiceException($exceptionMessage)); $errorMessage = ['message' => $exceptionMessage, 'success' => false]; /** @type JSONResponse $response */ $response = $this->controller->getList($location, $features, $etag, $mediatypes); $this->assertEquals($errorMessage, $response->getData()); }
public function testGetFilesWithBrokenSetup() { $location = ''; $features = ''; $etag = 1111222233334444; $mediatypes = 'image/png'; $exceptionMessage = 'Aïe!'; $this->searchFolderService->expects($this->once())->method('getCurrentFolder')->with($location, [$features])->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->getList($location, $features, $etag, $mediatypes); $this->assertEquals($errorMessage, $response->getData()); }