本文整理汇总了PHP中FileBackend::quickMove方法的典型用法代码示例。如果您正苦于以下问题:PHP FileBackend::quickMove方法的具体用法?PHP FileBackend::quickMove怎么用?PHP FileBackend::quickMove使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileBackend
的用法示例。
在下文中一共展示了FileBackend::quickMove方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: doTestDoQuickOperations
private function doTestDoQuickOperations()
{
$backendName = $this->backendClass();
$base = self::baseStorePath();
$files = array("{$base}/unittest-cont1/e/fileA.a", "{$base}/unittest-cont1/e/fileB.a", "{$base}/unittest-cont1/e/fileC.a");
$createOps = array();
$purgeOps = array();
foreach ($files as $path) {
$status = $this->prepare(array('dir' => dirname($path)));
$this->assertGoodStatus($status, "Preparing {$path} succeeded without warnings ({$backendName}).");
$createOps[] = array('op' => 'create', 'dst' => $path, 'content' => mt_rand(0, 50000));
$copyOps[] = array('op' => 'copy', 'src' => $path, 'dst' => "{$path}-2");
$moveOps[] = array('op' => 'move', 'src' => "{$path}-2", 'dst' => "{$path}-3");
$purgeOps[] = array('op' => 'delete', 'src' => $path);
$purgeOps[] = array('op' => 'delete', 'src' => "{$path}-3");
}
$purgeOps[] = array('op' => 'null');
$this->assertGoodStatus($this->backend->doQuickOperations($createOps), "Creation of source files succeeded ({$backendName}).");
foreach ($files as $file) {
$this->assertTrue($this->backend->fileExists(array('src' => $file)), "File {$file} exists.");
}
$this->assertGoodStatus($this->backend->doQuickOperations($copyOps), "Quick copy of source files succeeded ({$backendName}).");
foreach ($files as $file) {
$this->assertTrue($this->backend->fileExists(array('src' => "{$file}-2")), "File {$file}-2 exists.");
}
$this->assertGoodStatus($this->backend->doQuickOperations($moveOps), "Quick move of source files succeeded ({$backendName}).");
foreach ($files as $file) {
$this->assertTrue($this->backend->fileExists(array('src' => "{$file}-3")), "File {$file}-3 move in.");
$this->assertFalse($this->backend->fileExists(array('src' => "{$file}-2")), "File {$file}-2 moved away.");
}
$this->assertGoodStatus($this->backend->quickCopy(array('src' => $files[0], 'dst' => $files[0])), "Copy of file {$files[0]} over itself succeeded ({$backendName}).");
$this->assertTrue($this->backend->fileExists(array('src' => $files[0])), "File {$files[0]} still exists.");
$this->assertGoodStatus($this->backend->quickMove(array('src' => $files[0], 'dst' => $files[0])), "Move of file {$files[0]} over itself succeeded ({$backendName}).");
$this->assertTrue($this->backend->fileExists(array('src' => $files[0])), "File {$files[0]} still exists.");
$this->assertGoodStatus($this->backend->doQuickOperations($purgeOps), "Quick deletion of source files succeeded ({$backendName}).");
foreach ($files as $file) {
$this->assertFalse($this->backend->fileExists(array('src' => $file)), "File {$file} purged.");
$this->assertFalse($this->backend->fileExists(array('src' => "{$file}-3")), "File {$file}-3 purged.");
}
}