Esempio n. 1
0
 public function testCipherFactory()
 {
     if (!defined('MCRYPT_RIJNDAEL_128')) {
         $this->markTestSkipped('Use of the Zend_InfoCard component requires the mcrypt extension to be enabled in PHP');
     }
     $this->assertTrue(Cipher::getInstanceByURI(Cipher::ENC_AES128CBC) instanceof \Zend\InfoCard\Cipher\Symmetric\Adapter\AES128CBC);
     $this->assertTrue(Cipher::getInstanceByURI(Cipher::ENC_RSA) instanceof Adapter\RSA);
     try {
         Cipher::getInstanceByURI("Broken");
         $this->fail("Exception not thrown as expected");
     } catch (\Exception $e) {
         /* yay */
     }
 }
Esempio n. 2
0
 public function testCipherFactoryThrowsExceptionOnBadInput()
 {
     $this->setExpectedException('Zend\\InfoCard\\Cipher\\Exception\\InvalidArgumentException', 'Unknown Cipher URI');
     Cipher::getInstanceByURI("Broken");
 }