芝麻web文件管理V1.00
编辑当前文件:/home/qrafawbu/rentandbuyrealty.com/pay/vendor/hoa/iterator/Test/Unit/FileSystem.php
given( $root = resolve('hoa://Test/Vfs/Root?type=directory'), resolve('hoa://Test/Vfs/Root/.?type=directory'), resolve('hoa://Test/Vfs/Root/..?type=directory'), resolve('hoa://Test/Vfs/Root/A?type=file'), resolve('hoa://Test/Vfs/Root/B?type=file'), $iterator = new LUT\FileSystem($root), $result = [] ) ->when(function () use ($iterator, &$result) { foreach ($iterator as $pathname => $file) { $this ->object($file) ->isInstanceOf('SplFileInfo'); $result[basename($pathname)] = $file->getFilename(); } }) ->array($result) ->isEqualTo([ 'A' => 'A', 'B' => 'B' ]); } public function case_splFileClassInfo() { $this ->given( $splFileInfo = 'Hoa\Iterator\SplFileInfo', $root = resolve('hoa://Test/Vfs/Root?type=directory'), resolve('hoa://Test/Vfs/Root/a?type=file'), resolve('hoa://Test/Vfs/Root/b?type=file'), resolve('hoa://Test/Vfs/Root/c?type=file'), resolve('hoa://Test/Vfs/Root/d?type=file'), resolve('hoa://Test/Vfs/Root/e?type=file'), resolve('hoa://Test/Vfs/Root/f?type=file'), $iterator = new LUT\FileSystem( $root, LUT\FileSystem::CURRENT_AS_FILEINFO, $splFileInfo ), $result = [] ) ->when(function () use ($iterator, $splFileInfo, &$result) { foreach ($iterator as $file) { $this ->object($file) ->isInstanceOf($splFileInfo); $result[] = $file->getFilename(); } }) ->then ->array($result) ->isEqualTo([ 'a', 'b', 'c', 'd', 'e', 'f' ]); } }