コード例 #1
0
ファイル: BlockCipherTest.php プロジェクト: haoyanfei/zf2
 /**
  * Ensures that the filter allows de/encryption with compression
  *
  * @return void
  */
 public function testEncryptionWithDecryptionAndCompressionMcrypt()
 {
     if (version_compare(phpversion(), '5.4', '>=')) {
         $this->markTestIncomplete('Code to test is not compatible with PHP 5.4 ');
     }
     if (!extension_loaded('bz2')) {
         $this->markTestSkipped('This adapter needs the bz2 extension');
     }
     $filter = new BlockCipherEncryption(array('key' => 'testkey'));
     $filter->setVector('1234567890123456');
     $filter->setCompression('bz2');
     $output = $filter->encrypt('teststring');
     $this->assertNotEquals('teststring', $output);
     $input = $filter->decrypt($output);
     $this->assertEquals('teststring', trim($input));
 }
コード例 #2
0
ファイル: BlockCipherTest.php プロジェクト: pnaq57/zf2demo
 /**
  * Ensures that the filter allows de/encryption with compression
  *
  * @return void
  */
 public function testEncryptionWithDecryptionAndCompressionMcrypt()
 {
     if (!extension_loaded('bz2')) {
         $this->markTestSkipped('This adapter needs the bz2 extension');
     }
     $filter = new BlockCipherEncryption(array('key' => 'testkey'));
     $filter->setVector('1234567890123456');
     $filter->setCompression('bz2');
     $output = $filter->encrypt('teststring');
     $this->assertNotEquals('teststring', $output);
     $input = $filter->decrypt($output);
     $this->assertEquals('teststring', trim($input));
 }