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


PHP FileBackend::getFileContents方法代码示例

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


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

示例1: doTestDoOperationsFailing

 private function doTestDoOperationsFailing()
 {
     $base = self::baseStorePath();
     $fileA = "{$base}/unittest-cont2/a/b/fileA.txt";
     $fileAContents = '3tqtmoeatmn4wg4qe-mg3qt3 tq';
     $fileB = "{$base}/unittest-cont2/a/b/fileB.txt";
     $fileBContents = 'g-jmq3gpqgt3qtg q3GT ';
     $fileC = "{$base}/unittest-cont2/a/b/fileC.txt";
     $fileCContents = 'eigna[ogmewt 3qt g3qg flew[ag';
     $fileD = "{$base}/unittest-cont2/a/b/fileD.txt";
     $this->prepare(array('dir' => dirname($fileA)));
     $this->create(array('dst' => $fileA, 'content' => $fileAContents));
     $this->prepare(array('dir' => dirname($fileB)));
     $this->create(array('dst' => $fileB, 'content' => $fileBContents));
     $this->prepare(array('dir' => dirname($fileC)));
     $this->create(array('dst' => $fileC, 'content' => $fileCContents));
     $status = $this->backend->doOperations(array(array('op' => 'copy', 'src' => $fileA, 'dst' => $fileC, 'overwrite' => 1), array('op' => 'copy', 'src' => $fileC, 'dst' => $fileA, 'overwriteSame' => 1), array('op' => 'copy', 'src' => $fileB, 'dst' => $fileD, 'overwrite' => 1), array('op' => 'move', 'src' => $fileC, 'dst' => $fileD), array('op' => 'move', 'src' => $fileB, 'dst' => $fileC, 'overwriteSame' => 1), array('op' => 'move', 'src' => $fileB, 'dst' => $fileA, 'overwrite' => 1), array('op' => 'delete', 'src' => $fileD), array('op' => 'null')), array('force' => 1));
     $this->assertNotEquals(array(), $status->errors, "Operation had warnings");
     $this->assertEquals(true, $status->isOK(), "Operation batch succeeded");
     $this->assertEquals(8, count($status->success), "Operation batch has correct success array");
     $this->assertEquals(false, $this->backend->fileExists(array('src' => $fileB)), "File does not exist at {$fileB}");
     $this->assertEquals(false, $this->backend->fileExists(array('src' => $fileD)), "File does not exist at {$fileD}");
     $this->assertEquals(true, $this->backend->fileExists(array('src' => $fileA)), "File does not exist at {$fileA}");
     $this->assertEquals(true, $this->backend->fileExists(array('src' => $fileC)), "File exists at {$fileC}");
     $this->assertEquals($fileBContents, $this->backend->getFileContents(array('src' => $fileA)), "Correct file contents of {$fileA}");
     $this->assertEquals(strlen($fileBContents), $this->backend->getFileSize(array('src' => $fileA)), "Correct file size of {$fileA}");
     $this->assertEquals(wfBaseConvert(sha1($fileBContents), 16, 36, 31), $this->backend->getFileSha1Base36(array('src' => $fileA)), "Correct file SHA-1 of {$fileA}");
 }
开发者ID:biribogos,项目名称:wikihow-src,代码行数:28,代码来源:FileBackendTest.php


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