Exemple #1
0
 /**
  * @return void
  */
 public function testSettingAdapterManually()
 {
     if (!extension_loaded('mcrypt') or !extension_loaded('openssl')) {
         $this->markTestSkipped('Mcrypt or Openssl extension not installed');
     }
     $filter = new DecryptFilter();
     $filter->setAdapter('Openssl');
     $this->assertEquals('Openssl', $filter->getAdapter());
     $filter->setAdapter('Mcrypt');
     $this->assertEquals('Mcrypt', $filter->getAdapter());
     $this->setExpectedException('\\Zend\\Filter\\Exception\\InvalidArgumentException', 'does not implement');
     $filter->setAdapter('\\ZendTest\\Filter\\TestAdapter');
 }
Exemple #2
0
 /**
  * @return void
  */
 public function testSettingAdapterManually()
 {
     if (!extension_loaded('mcrypt') or !extension_loaded('openssl')) {
         $this->markTestSkipped('Mcrypt or Openssl extension not installed');
     }
     $filter = new DecryptFilter();
     $filter->setAdapter('Openssl');
     $this->assertEquals('Openssl', $filter->getAdapter());
     $filter->setAdapter('Mcrypt');
     $this->assertEquals('Mcrypt', $filter->getAdapter());
     try {
         $filter->setAdapter('\\ZendTest\\Filter\\TestAdapter');
         $this->fail('Exception expected on setting a non adapter');
     } catch (\Zend\Filter\Exception $e) {
         $this->assertContains('does not implement Zend\\Filter\\Encrypt\\EncryptionAlgorithm', $e->getMessage());
     }
 }