本文整理汇总了PHP中tao_helpers_File::isIdentical方法的典型用法代码示例。如果您正苦于以下问题:PHP tao_helpers_File::isIdentical方法的具体用法?PHP tao_helpers_File::isIdentical怎么用?PHP tao_helpers_File::isIdentical使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类tao_helpers_File
的用法示例。
在下文中一共展示了tao_helpers_File::isIdentical方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: import
public function import($id, $directoryPath)
{
$directory = $this->getDirectoryById($id);
if (file_exists($directory->getPath())) {
if (tao_helpers_File::isDirEmpty($directory->getPath())) {
common_Logger::d('Directory already found but content is empty');
helpers_File::copy($directoryPath, $directory->getPath(), true);
} else {
if (tao_helpers_File::isIdentical($directory->getPath(), $directoryPath)) {
common_Logger::d('Directory already found but content is identical');
} else {
throw new common_Exception('Duplicate dir ' . $id . ' with different content');
}
}
} else {
mkdir($directory->getPath(), 0700, true);
helpers_File::copy($directoryPath, $directory->getPath(), true);
}
}
示例2: testIsIdentical
public function testIsIdentical()
{
$testfolder = tao_helpers_File::createTempDir();
$this->assertTrue(is_dir($testfolder));
$zip = new ZipArchive();
$this->assertTrue($zip->open(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'samples' . DIRECTORY_SEPARATOR . 'fileHelper.zip'));
$this->assertTrue($zip->extractTo($testfolder));
$zip->close();
$reference = $testfolder . 'reference';
$this->assertTrue(is_dir($reference));
$testContent = $testfolder . DIRECTORY_SEPARATOR . 'testContent';
$testEmptyDir = $testfolder . DIRECTORY_SEPARATOR . 'testEmptyDir';
$testIdent = $testfolder . DIRECTORY_SEPARATOR . 'testIdent';
$testMissingDir = $testfolder . DIRECTORY_SEPARATOR . 'testMissingDir';
$testRenamedFile = $testfolder . DIRECTORY_SEPARATOR . 'testRenamedFile';
$testRenamedEmptyDir = $testfolder . DIRECTORY_SEPARATOR . 'testRenamedEmptyDir';
$this->assertTrue(tao_helpers_File::isIdentical($reference, $reference));
$this->assertTrue(tao_helpers_File::isIdentical($reference, $testIdent));
$this->assertFalse(tao_helpers_File::isIdentical($reference, $testContent));
$this->assertFalse(tao_helpers_File::isIdentical($reference, $testEmptyDir));
$this->assertFalse(tao_helpers_File::isIdentical($reference, $testMissingDir));
$this->assertFalse(tao_helpers_File::isIdentical($reference, $testRenamedFile));
$this->assertFalse(tao_helpers_File::isIdentical($reference, $testRenamedEmptyDir));
$this->assertTrue(tao_helpers_File::delTree($testfolder));
$this->assertFalse(is_dir($testfolder));
}