Пример #1
0
 public function testEncryptionWithDecryption()
 {
     $filter = new Zend_Filter_File_Encrypt();
     $filter->setFilename(dirname(__FILE__) . '/../_files/newencryption.txt');
     $filter->setVector('testvect');
     $this->assertEquals(dirname(__FILE__) . '/../_files/newencryption.txt', $filter->filter(dirname(__FILE__) . '/../_files/encryption.txt'));
     $this->assertNotEquals('Encryption', file_get_contents(dirname(__FILE__) . '/../_files/newencryption.txt'));
     $filter = new Zend_Filter_File_Decrypt();
     $filter->setVector('testvect');
     $input = $filter->filter(dirname(__FILE__) . '/../_files/newencryption.txt');
     $this->assertEquals(dirname(__FILE__) . '/../_files/newencryption.txt', $input);
     $this->assertEquals('Encryption', trim(file_get_contents(dirname(__FILE__) . '/../_files/newencryption.txt')));
 }
 /**
  * @return void
  */
 public function testNonExistingFile()
 {
     $filter = new Zend_Filter_File_Decrypt();
     $filter->setVector('testvect');
     try {
         $filter->filter(dirname(__FILE__) . '/../_files/nofile.txt');
         $this->fail();
     } catch (Zend_Filter_Exception $e) {
         $this->assertContains('not found', $e->getMessage());
     }
 }