示例#1
0
 public function testClone()
 {
     $filePath0 = CFile::createTemporary();
     $filePath1 = CFile::createTemporary();
     $filePath2 = CFile::createTemporary();
     $filePath3 = CFile::createTemporary();
     CFile::write($filePath0, "The quick");
     CFile::write($filePath1, " brown fox");
     CFile::write($filePath2, " jumps over");
     CFile::write($filePath3, " the lazy dog.");
     $hash0 = new CHash(CHash::SHA256);
     $hash0->computeMoreFromFile($filePath0);
     $hash0->computeMoreFromFile($filePath1);
     $hash0->computeMoreFromFile($filePath2);
     $hash0->computeMoreFromFile($filePath3);
     $hash1 = clone $hash0;
     $hash1->computeMoreFromFile($filePath0);
     $this->assertTrue($hash0->finalize()->equals("ef537f25c895bfa782526529a9b63d97aa631564d5d789c2b765448c8635fb6c"));
     $this->assertTrue($hash1->finalize()->equals("14dc40e99be202c4e59a0c6d1a8854bb50253624080435ed8c65bd6e5e880c95"));
     CFile::delete($filePath0);
     CFile::delete($filePath1);
     CFile::delete($filePath2);
     CFile::delete($filePath3);
 }