/**
  * @covers: RI\FileManagerBundle\Model\UploadedFileParametersModel::unserialize
  */
 public function testUnserialize()
 {
     $width = 200;
     $height = 100;
     $size = 51203;
     $mime = 'image/jpg';
     $data = array('width' => $width, 'height' => $height, 'mime' => $mime, 'size' => $size, 'sizeNormalized' => '50 KB');
     $this->uploadedFileParametersModel->unserialize(serialize($data));
     $this->assertEquals($width, $this->uploadedFileParametersModel->getWidth());
     $this->assertEquals($height, $this->uploadedFileParametersModel->getHeight());
     $this->assertEquals($size, $this->uploadedFileParametersModel->getSize());
     $this->assertEquals($mime, $this->uploadedFileParametersModel->getMime());
     $this->assertEquals('50 KB', $this->uploadedFileParametersModel->getSizeNormalize());
 }
Example #2
0
 /**
  * @param string $size
  * @param string $mimeType
  * @param string $path
  *
  * @return UploadedFileParametersModel
  */
 public function createFileParams($size, $mimeType, $path)
 {
     $imageSize = getimagesize($path);
     $fileParams = new UploadedFileParametersModel();
     $fileParams->setSize($size);
     $fileParams->setMime($mimeType);
     $fileParams->setHeight($imageSize[1]);
     $fileParams->setWidth($imageSize[0]);
     return $fileParams;
 }