Exemplo n.º 1
0
 public function getFilename($file)
 {
     $hash = Miaox_File::hash($file);
     $ext = Miaox_File::getExtension($file);
     $addDir = $this->getAddDirByHash($hash);
     $result = array();
     $result[] = $this->_baseDir . $addDir;
     $result[] = $hash . '.' . $ext;
     $result = implode(DIRECTORY_SEPARATOR, $result);
     return $result;
 }
Exemplo n.º 2
0
 public function testGetHash()
 {
     $baseSharedDir = Miao_PHPUnit::getSourceFolder(__CLASS__);
     $filename = $baseSharedDir . '/test_get_hash.txt';
     file_put_contents($filename, '1');
     $hash1 = Miaox_File::hash($filename);
     $hash2 = file_put_contents($filename, '22');
     $hash2 = Miaox_File::hash($filename);
     $this->assertFalse($hash1 == $hash2);
     unlink($filename);
 }