Esempio n. 1
0
 /**
  * Verify that a new raw signature can be generated for a file manager.
  */
 public function testGenerateNewSignatureForAFileManager()
 {
     $file = new File('php://memory', 'w+');
     $file->write('test');
     $hash = hash('sha1', 'test', true);
     $signature = new Signature();
     self::assertEquals($hash, $signature->generate($file), 'The new signature was not generated properly.');
     $file->write($hash);
     self::assertEquals($hash, $signature->generate($file, true), 'The new signature was not generated properly.');
 }
Esempio n. 2
0
File: Sqon.php Progetto: sqon/sqon
 /**
  * {@inheritdoc}
  */
 public static function isValid($path)
 {
     $file = new File($path, 'r');
     $reader = new Reader($file);
     $signature = new Signature();
     return $reader->getSignature() === $signature->generate($file, true);
 }