/**
  * Setup test folders and files
  *
  * @return void
  */
 public function setUp()
 {
     parent::setUp();
     $this->_setupListeners();
     $this->testPath = TMP . 'file-storage-test' . DS;
     $this->fileFixtures = Plugin::path('Burzum/FileStorage') . 'tests' . DS . 'Fixture' . DS . 'File' . DS;
     if (!is_dir($this->testPath)) {
         mkdir($this->testPath);
     }
     Configure::write('FileStorage.basePath', $this->testPath);
     Configure::write('FileStorage.imageSizes', array('Test' => array('t50' => array('thumbnail' => array('mode' => 'outbound', 'width' => 50, 'height' => 50)), 't150' => array('thumbnail' => array('mode' => 'outbound', 'width' => 150, 'height' => 150))), 'UserAvatar' => ['small' => array('thumbnail' => array('mode' => 'inbound', 'width' => 80, 'height' => 80))]));
     StorageUtils::generateHashes();
     StorageManager::config('Local', array('adapterOptions' => [$this->testPath, true], 'adapterClass' => '\\Gaufrette\\Adapter\\Local', 'class' => '\\Gaufrette\\Filesystem'));
     $this->FileStorage = TableRegistry::get('Burzum/FileStorage.FileStorage');
     $this->ImageStorage = TableRegistry::get('Burzum/FileStorage.ImageStorage');
 }
 /**
  * testGenerateHashesRuntimeException
  *
  * @expectedException \RuntimeException
  */
 public function testGenerateHashesRuntimeException()
 {
     Configure::write('FileStorage.imageSizes', null);
     StorageUtils::generateHashes();
 }
 /**
  * testGetImageVersions
  *
  * @return void
  */
 public function testGetImageVersions()
 {
     Configure::write('FileStorage.imageSizes', ['Item' => ['t100' => ['thumbnail' => ['width' => 300, 'height' => 300]], 'crop50' => ['centercrop' => ['width' => 300, 'height' => 300]]]]);
     StorageUtils::generateHashes();
     $entity = $this->Image->get('file-storage-2');
     $entity->path = 'images' . DS . '30' . DS . '20' . DS . '10' . DS;
     $result = $this->Image->getImageVersions($entity);
     $expected = ['t100' => '/images/30/20/10/filestorage2.ead9ceef.jpg', 'crop50' => '/images/30/20/10/filestorage2.9aade7aa.jpg', 'original' => '/images/30/20/10/filestorage2.jpg'];
     $this->assertEquals($result, $expected);
 }
 /**
  * Generates the hashes for the different image version configurations.
  *
  * @param string|array $configPath
  * @return array
  */
 public static function generateHashes($configPath = 'FileStorage')
 {
     return StorageUtils::generateHashes($configPath);
 }