示例#1
0
 public function testEncryptData()
 {
     if (!extension_loaded('mcrypt')) {
         $this->markTestSkipped('mcrypt extension is required to test encrypt feature.');
     }
     $sm = new CSecurityManager();
     $sm->encryptionKey = '123456';
     $data = 'this is raw data';
     $encryptedData = $sm->encrypt($data);
     $this->assertTrue($data !== $encryptedData);
     $data2 = $sm->decrypt($encryptedData);
     $this->assertEquals($data, $data2);
 }