Пример #1
0
    /**
     * @test
     * @author Karsten Dambekalns <*****@*****.**>
     */
    public function valueObjectsRemovedFromArrayAreRemovedFromRepository()
    {
        $className = 'SomeClass' . uniqid();
        $fullClassName = 'F3\\FLOW3\\Persistence\\Tests\\' . $className;
        $identifier = \F3\FLOW3\Utility\Algorithms::generateUUID();
        eval('namespace F3\\FLOW3\\Persistence\\Tests; class ' . $className . ' {
			public function FLOW3_Persistence_isNew() { return FALSE; }
			public function FLOW3_Persistence_isDirty($propertyName) { return FALSE; }
			public function FLOW3_Persistence_memorizeCleanState($propertyName = NULL) {}
			public function FLOW3_AOP_Proxy_getProxyTargetClassName() { return \'' . $fullClassName . '\'; }
			public function FLOW3_AOP_Proxy_getProperty($propertyName) {}
		}');
        $object = new $fullClassName();
        $classSchema = new \F3\FLOW3\Reflection\ClassSchema($fullClassName);
        $classSchema->setModelType(\F3\FLOW3\Reflection\ClassSchema::MODELTYPE_VALUEOBJECT);
        $array = array();
        $previousArray = array($object);
        // ... and here we go
        $backend = $this->getMock($this->buildAccessibleProxy('F3\\FLOW3\\Persistence\\Backend\\GenericPdo\\Backend'), array('removeValueObject'));
        $backend->expects($this->once())->method('removeValueObject')->with($object);
        $backend->_set('classSchemata', array($fullClassName => $classSchema));
        $backend->_call('processArray', $array, $identifier, $previousArray);
    }
 /**
  * Stores the given keypair under the returned UUID.
  *
  * @param \F3\FLOW3\Security\Cryptography\OpenSslRsaKey $publicKey The public key
  * @param \F3\FLOW3\Security\Cryptography\OpenSslRsaKey $privateKey The private key
  * @param boolean $usedForPasswords TRUE if this keypair should be used to decrypt passwords. (Decryption won't be allowed!)
  * @return UUID The UUID used for storing
  * @author Andreas Förthner <*****@*****.**>
  */
 private function storeKeyPair($publicKey, $privateKey, $usedForPasswords)
 {
     $keyPairUUID = str_replace('-', '_', \F3\FLOW3\Utility\Algorithms::generateUUID());
     $keyPair = array();
     $keyPair['publicKey'] = $publicKey;
     $keyPair['privateKey'] = $privateKey;
     $keyPair['usedForPasswords'] = $usedForPasswords;
     $this->keystoreCache->set($keyPairUUID, $keyPair);
     return $keyPairUUID;
 }
 /**
  * After returning advice, making sure we have an UUID for each and every entity.
  *
  * @param \F3\FLOW3\AOP\JoinPointInterface $joinPoint The current join point
  * @return void
  * @afterreturning classTaggedWith(entity) && method(.*->__construct())
  * @author Karsten Dambekalns <*****@*****.**>
  */
 public function generateUUID(\F3\FLOW3\AOP\JoinPointInterface $joinPoint)
 {
     $proxy = $joinPoint->getProxy();
     $proxy->FLOW3_Persistence_Entity_UUID = \F3\FLOW3\Utility\Algorithms::generateUUID();
 }