/**
  * tx_dam::meta_findDataForFile()
  */
 public function test_meta_findDataForFile()
 {
     $fixture = $this->getFixtureRandomIndexedFilename();
     $filename = $fixture['filename'];
     $meta = $fixture['meta'];
     $data = tx_dam::meta_findDataForFile($filename);
     self::assertEquals($data[$meta['uid']]['uid'], $meta['uid'], 'Wrong index for ' . $filename);
     // todo: test hash
 }
 /**
  * Tries to find a lost index entry for a lost file and reconnect these items
  *
  * @param	mixed		$fileInfo Is a file path or an array containing a file info from tx_dam::file_compileInfo().
  * @param	string		$hash The hash value will be used to identify the file if the file name was not found. That can happen if the file was renamed or moved without index update.
  * @return	array		status: array('__status' => TXDAM_file_notfound,'meta' => array(...));
  */
 function index_reconnect($fileInfo, $hash = '')
 {
     if (!is_array($fileInfo)) {
         $fileInfo = tx_dam::file_compileInfo($fileInfo, true);
     }
     $status = array('__status' => TXDAM_file_unknown, 'meta' => array());
     $metaArr = tx_dam::meta_findDataForFile($fileInfo, $hash, 'uid,file_name,file_path,deleted');
     foreach ($metaArr as $meta) {
         $srcInfo = tx_dam::file_compileInfo($meta, true);
         if (!$srcInfo['__exists']) {
             if ($meta['deleted']) {
                 // setting the record undeleted right away ...
                 $GLOBALS['TYPO3_DB']->exec_UPDATEquery('tx_dam', 'tx_dam.uid=' . $meta['uid'], array('deleted' => 0));
             }
             tx_dam::notify_fileMoved(tx_dam::file_absolutePath($srcInfo), tx_dam::file_absolutePath($fileInfo));
             $meta = tx_dam::meta_getDataByUid($meta['uid']);
             $status['meta'] = $meta;
             $status['__status'] = TXDAM_file_changed;
             break;
         }
     }
     return $status;
 }