当前位置: 首页>>代码示例>>PHP>>正文


PHP FileBackend::directoryExists方法代码示例

本文整理汇总了PHP中FileBackend::directoryExists方法的典型用法代码示例。如果您正苦于以下问题:PHP FileBackend::directoryExists方法的具体用法?PHP FileBackend::directoryExists怎么用?PHP FileBackend::directoryExists使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在FileBackend的用法示例。


在下文中一共展示了FileBackend::directoryExists方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: directoryExists

 public function directoryExists(array $params)
 {
     return $this->backend->directoryExists($params);
 }
开发者ID:nanasess,项目名称:mediawiki,代码行数:4,代码来源:FileBackendDBRepoWrapper.php

示例2: doTestGetDirectoryList

 private function doTestGetDirectoryList()
 {
     $backendName = $this->backendClass();
     $base = self::baseStorePath();
     $files = array("{$base}/unittest-cont1/e/test1.txt", "{$base}/unittest-cont1/e/test2.txt", "{$base}/unittest-cont1/e/test3.txt", "{$base}/unittest-cont1/e/subdir1/test1.txt", "{$base}/unittest-cont1/e/subdir1/test2.txt", "{$base}/unittest-cont1/e/subdir2/test3.txt", "{$base}/unittest-cont1/e/subdir2/test4.txt", "{$base}/unittest-cont1/e/subdir2/subdir/test1.txt", "{$base}/unittest-cont1/e/subdir3/subdir/test2.txt", "{$base}/unittest-cont1/e/subdir4/subdir/test3.txt", "{$base}/unittest-cont1/e/subdir4/subdir/test4.txt", "{$base}/unittest-cont1/e/subdir4/subdir/test5.txt", "{$base}/unittest-cont1/e/subdir4/subdir/sub/test0.txt", "{$base}/unittest-cont1/e/subdir4/subdir/sub/120-px-file.txt");
     // Add the files
     $ops = array();
     foreach ($files as $file) {
         $this->prepare(array('dir' => dirname($file)));
         $ops[] = array('op' => 'create', 'content' => 'xxy', 'dst' => $file);
     }
     $status = $this->backend->doQuickOperations($ops);
     $this->assertGoodStatus($status, "Creation of files succeeded ({$backendName}).");
     $this->assertEquals(true, $status->isOK(), "Creation of files succeeded with OK status ({$backendName}).");
     $this->assertEquals(true, $this->backend->directoryExists(array('dir' => "{$base}/unittest-cont1/e/subdir1")), "Directory exists in ({$backendName}).");
     $this->assertEquals(true, $this->backend->directoryExists(array('dir' => "{$base}/unittest-cont1/e/subdir2/subdir")), "Directory exists in ({$backendName}).");
     $this->assertEquals(false, $this->backend->directoryExists(array('dir' => "{$base}/unittest-cont1/e/subdir2/test1.txt")), "Directory does not exists in ({$backendName}).");
     // Expected listing
     $expected = array("e");
     sort($expected);
     // Actual listing (no trailing slash)
     $list = array();
     $iter = $this->backend->getTopDirectoryList(array('dir' => "{$base}/unittest-cont1"));
     foreach ($iter as $file) {
         $list[] = $file;
     }
     sort($list);
     $this->assertEquals($expected, $list, "Correct top dir listing ({$backendName}).");
     // Expected listing
     $expected = array("subdir1", "subdir2", "subdir3", "subdir4");
     sort($expected);
     // Actual listing (no trailing slash)
     $list = array();
     $iter = $this->backend->getTopDirectoryList(array('dir' => "{$base}/unittest-cont1/e"));
     foreach ($iter as $file) {
         $list[] = $file;
     }
     sort($list);
     $this->assertEquals($expected, $list, "Correct top dir listing ({$backendName}).");
     // Actual listing (with trailing slash)
     $list = array();
     $iter = $this->backend->getTopDirectoryList(array('dir' => "{$base}/unittest-cont1/e/"));
     foreach ($iter as $file) {
         $list[] = $file;
     }
     sort($list);
     $this->assertEquals($expected, $list, "Correct top dir listing ({$backendName}).");
     // Expected listing
     $expected = array("subdir");
     sort($expected);
     // Actual listing (no trailing slash)
     $list = array();
     $iter = $this->backend->getTopDirectoryList(array('dir' => "{$base}/unittest-cont1/e/subdir2"));
     foreach ($iter as $file) {
         $list[] = $file;
     }
     sort($list);
     $this->assertEquals($expected, $list, "Correct top dir listing ({$backendName}).");
     // Actual listing (with trailing slash)
     $list = array();
     $iter = $this->backend->getTopDirectoryList(array('dir' => "{$base}/unittest-cont1/e/subdir2/"));
     foreach ($iter as $file) {
         $list[] = $file;
     }
     sort($list);
     $this->assertEquals($expected, $list, "Correct top dir listing ({$backendName}).");
     // Actual listing (using iterator second time)
     $list = array();
     foreach ($iter as $file) {
         $list[] = $file;
     }
     sort($list);
     $this->assertEquals($expected, $list, "Correct top dir listing ({$backendName}), second iteration.");
     // Expected listing (recursive)
     $expected = array("e", "e/subdir1", "e/subdir2", "e/subdir3", "e/subdir4", "e/subdir2/subdir", "e/subdir3/subdir", "e/subdir4/subdir", "e/subdir4/subdir/sub");
     sort($expected);
     // Actual listing (recursive)
     $list = array();
     $iter = $this->backend->getDirectoryList(array('dir' => "{$base}/unittest-cont1/"));
     foreach ($iter as $file) {
         $list[] = $file;
     }
     sort($list);
     $this->assertEquals($expected, $list, "Correct dir listing ({$backendName}).");
     // Expected listing (recursive)
     $expected = array("subdir", "subdir/sub");
     sort($expected);
     // Actual listing (recursive)
     $list = array();
     $iter = $this->backend->getDirectoryList(array('dir' => "{$base}/unittest-cont1/e/subdir4"));
     foreach ($iter as $file) {
         $list[] = $file;
     }
     sort($list);
     $this->assertEquals($expected, $list, "Correct dir listing ({$backendName}).");
     // Actual listing (recursive, second time)
     $list = array();
     foreach ($iter as $file) {
         $list[] = $file;
     }
//.........这里部分代码省略.........
开发者ID:biribogos,项目名称:wikihow-src,代码行数:101,代码来源:FileBackendTest.php


注:本文中的FileBackend::directoryExists方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。