Ejemplo n.º 1
0
 public function testDelete()
 {
     $safe = new Safe();
     $keyPair = $safe->generateKeyPair();
     $safe->setName(__CLASS__ . __METHOD__);
     $safe->setPublicKey($keyPair->getPublicKey());
     $safe->setCreated();
     $safe->setUpdated();
     parent::remove($safe, array('name' => __CLASS__ . __METHOD__));
 }
Ejemplo n.º 2
0
 public function testLongSecret()
 {
     $safe = new Safe();
     $keyPair = $safe->generateKeyPair();
     $safe->setName('TestSafeName');
     $safe->setPublicKey($keyPair->getPublicKey());
     $safe->setCreated();
     $safe->setUpdated();
     $this->getEntityManager()->persist($safe);
     $this->getEntityManager()->flush();
     $secret = new Secret();
     $secret->setCreated();
     $secret->setUpdated();
     $secret->setKey(__CLASS__ . __METHOD__);
     // generate enough text to require chunked data
     $value = str_repeat('a', $keyPair->getPublicKey()->getKeySize() / 8 * 2);
     $secret->setValue($keyPair->getPublicKey(), $value);
     $this->assertNotEquals($secret->getValue(), $value);
     $this->assertEquals($secret->getValue($keyPair->getPrivateKey()), $value);
     $safeRef = $this->getEntityManager()->getReference(get_class($safe), $safe->getId());
     $secret->setSafe($safeRef);
     parent::remove($secret, array('key' => __CLASS__ . __METHOD__));
 }