Exemplo n.º 1
0
 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());
 }
Exemplo n.º 2
0
 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());
 }