Exemple #1
0
 public function testChainability()
 {
     $params = array('hi', 'yo');
     $this->json->setData($params)->setStatus(Http::STATUS_NOT_FOUND);
     $this->assertEquals(Http::STATUS_NOT_FOUND, $this->json->getStatus());
     $this->assertEquals(array('hi', 'yo'), $this->json->getData());
 }
 public function testGetPreviewWithWrongId()
 {
     $fileId = 99999;
     $width = 1024;
     $height = 768;
     $this->mockGetResourceFromId($fileId, false);
     $errorResponse = new JSONResponse(['message' => "I'm truly sorry, but we were unable to generate a preview for this file", 'success' => false], Http::STATUS_INTERNAL_SERVER_ERROR);
     $response = $this->controller->getPreview($fileId, $width, $height);
     $this->assertEquals($errorResponse->getStatus(), $response->getStatus());
     $this->assertEquals($errorResponse->getData()['success'], $response->getData()['success']);
 }