Exemplo n.º 1
0
 /**
  *
  * @dataProvider providerTestGetExtension
  */
 public function testGetExtension($filename, $actual)
 {
     $sourceDir = Miao_PHPUnit::getSourceFolder(__METHOD__);
     $filename = $sourceDir . $filename;
     $expected = Miaox_File::getExtension($filename);
     $this->assertEquals($expected, $actual);
 }
Exemplo n.º 2
0
 public function getAddDirByHash($hash, $cntSubDir = 2, $cntChar = 2)
 {
     $hash = trim($hash);
     if (!is_numeric($hash)) {
         $hash = Miaox_File::convert($hash);
     }
     //add zero
     $len = strlen($hash);
     $len = $len - $cntSubDir * $cntChar;
     if ($len < 0) {
         $hash = str_repeat('0', $len * -1) . $hash;
     }
     $ar = str_split($hash, $cntChar);
     $ar = array_slice($ar, count($ar) - $cntSubDir, $cntSubDir);
     $result = DIRECTORY_SEPARATOR . implode(DIRECTORY_SEPARATOR, $ar);
     return $result;
 }
Exemplo n.º 3
0
 /**
  * @dataProvider providerTestConvert
  */
 public function testConvert($string, $actual)
 {
     $expected = Miaox_File::convert($string);
     $this->assertEquals($expected, $actual);
 }