/** * @test */ public function convertObjectsToIdentityArraysConvertsObjectsInIterators() { $object1 = new \stdClass(); $object2 = new \stdClass(); $this->abstractPersistenceManager->expects($this->at(0))->method('getIdentifierByObject')->with($object1)->will($this->returnValue('identifier1')); $this->abstractPersistenceManager->expects($this->at(1))->method('getIdentifierByObject')->with($object2)->will($this->returnValue('identifier2')); $originalArray = array('foo' => 'bar', 'object1' => $object1, 'baz' => new \ArrayObject(array('object2' => $object2))); $expectedResult = array('foo' => 'bar', 'object1' => array('__identity' => 'identifier1'), 'baz' => array('object2' => array('__identity' => 'identifier2'))); $actualResult = $this->abstractPersistenceManager->convertObjectsToIdentityArrays($originalArray); $this->assertEquals($expectedResult, $actualResult); }
/** * Clears the in-memory state of the persistence. * * Managed instances become detached, any fetches will * return data directly from the persistence "backend". * It will also forget about new objects. * * @return void */ public function clearState() { parent::clearState(); $this->addedObjects = new \SplObjectStorage(); $this->removedObjects = new \SplObjectStorage(); $this->changedObjects = new \SplObjectStorage(); $this->persistenceSession->destroy(); $this->hasUnpersistedChanges = false; }
/** * Clears the in-memory state of the persistence. * * Managed instances become detached, any fetches will * return data directly from the persistence "backend". * * @return void */ public function clearState() { parent::clearState(); $this->entityManager->clear(); }