1
0
mirror of synced 2025-02-02 13:31:45 +03:00

#6174 #5570 renamed entity for better fitting the use-cases it's in

This commit is contained in:
Marco Pivetta 2016-12-18 15:46:34 +01:00
parent e43f5304ef
commit 39ce6f96a0

View File

@ -408,7 +408,7 @@ class UnitOfWorkTest extends \Doctrine\Tests\OrmTestCase
*/
public function testMergeWithNewEntityWillPersistItAndTriggerPrePersistListenersWithMergedEntityData()
{
$entity = new EntityWithListenerPopulatedField();
$entity = new EntityWithRandomlyGeneratedField();
$generatedFieldValue = $entity->generatedField;
@ -426,10 +426,10 @@ class UnitOfWorkTest extends \Doctrine\Tests\OrmTestCase
->with(
self::anything(),
self::callback(function (LifecycleEventArgs $args) use ($entity, $generatedFieldValue) {
/* @var $object EntityWithListenerPopulatedField */
/* @var $object EntityWithRandomlyGeneratedField */
$object = $args->getObject();
self::assertInstanceOf(EntityWithListenerPopulatedField::class, $object);
self::assertInstanceOf(EntityWithRandomlyGeneratedField::class, $object);
self::assertNotSame($entity, $object);
self::assertSame($generatedFieldValue, $object->generatedField);
@ -437,11 +437,11 @@ class UnitOfWorkTest extends \Doctrine\Tests\OrmTestCase
})
);
/* @var $object EntityWithListenerPopulatedField */
/* @var $object EntityWithRandomlyGeneratedField */
$object = $this->_unitOfWork->merge($entity);
self::assertNotSame($object, $entity);
self::assertInstanceOf(EntityWithListenerPopulatedField::class, $object);
self::assertInstanceOf(EntityWithRandomlyGeneratedField::class, $object);
self::assertSame($object->generatedField, $entity->generatedField);
}
@ -452,8 +452,8 @@ class UnitOfWorkTest extends \Doctrine\Tests\OrmTestCase
*/
public function testMergeWithExistingEntityWillNotPersistItNorTriggerPrePersistListeners()
{
$persistedEntity = new EntityWithListenerPopulatedField();
$mergedEntity = new EntityWithListenerPopulatedField();
$persistedEntity = new EntityWithRandomlyGeneratedField();
$mergedEntity = new EntityWithRandomlyGeneratedField();
$mergedEntity->id = $persistedEntity->id;
$mergedEntity->generatedField = mt_rand(
@ -476,7 +476,7 @@ class UnitOfWorkTest extends \Doctrine\Tests\OrmTestCase
['generatedField' => $persistedEntity->generatedField]
);
/* @var $merged EntityWithListenerPopulatedField */
/* @var $merged EntityWithRandomlyGeneratedField */
$merged = $this->_unitOfWork->merge($mergedEntity);
self::assertSame($merged, $persistedEntity);
@ -630,10 +630,8 @@ class EntityWithCompositeStringIdentifier
}
/** @Entity */
class EntityWithListenerPopulatedField
class EntityWithRandomlyGeneratedField
{
const MAX_GENERATED_FIELD_VALUE = 10000;
/** @Id @Column(type="string") */
public $id;
@ -645,6 +643,6 @@ class EntityWithListenerPopulatedField
public function __construct()
{
$this->id = uniqid('id', true);
$this->generatedField = mt_rand(0, self::MAX_GENERATED_FIELD_VALUE);
$this->generatedField = mt_rand(0, 100000);
}
}