|
@@ 234-243 (lines=10) @@
|
| 231 |
|
$this->assertEquals(array(), $this->_unitOfWork->getEntityChangeSet($entity)); |
| 232 |
|
} |
| 233 |
|
|
| 234 |
|
public function testGetEntityStateOnVersionedEntityWithAssignedIdentifier() |
| 235 |
|
{ |
| 236 |
|
$persister = new EntityPersisterMock($this->_emMock, $this->_emMock->getClassMetadata(VersionedAssignedIdentifierEntity::class)); |
| 237 |
|
$this->_unitOfWork->setEntityPersister(VersionedAssignedIdentifierEntity::class, $persister); |
| 238 |
|
|
| 239 |
|
$e = new VersionedAssignedIdentifierEntity(); |
| 240 |
|
$e->id = 42; |
| 241 |
|
$this->assertEquals(UnitOfWork::STATE_NEW, $this->_unitOfWork->getEntityState($e)); |
| 242 |
|
$this->assertFalse($persister->isExistsCalled()); |
| 243 |
|
} |
| 244 |
|
|
| 245 |
|
public function testGetEntityStateWithAssignedIdentity() |
| 246 |
|
{ |
|
@@ 311-328 (lines=18) @@
|
| 308 |
|
* |
| 309 |
|
* @param mixed $invalidValue |
| 310 |
|
*/ |
| 311 |
|
public function testRejectsPersistenceOfObjectsWithInvalidAssociationValue($invalidValue) |
| 312 |
|
{ |
| 313 |
|
$this->_unitOfWork->setEntityPersister( |
| 314 |
|
ForumUser::class, |
| 315 |
|
new EntityPersisterMock( |
| 316 |
|
$this->_emMock, |
| 317 |
|
$this->_emMock->getClassMetadata(ForumUser::class) |
| 318 |
|
) |
| 319 |
|
); |
| 320 |
|
|
| 321 |
|
$user = new ForumUser(); |
| 322 |
|
$user->username = 'John'; |
| 323 |
|
$user->avatar = $invalidValue; |
| 324 |
|
|
| 325 |
|
$this->expectException(\Doctrine\ORM\ORMInvalidArgumentException::class); |
| 326 |
|
|
| 327 |
|
$this->_unitOfWork->persist($user); |
| 328 |
|
} |
| 329 |
|
|
| 330 |
|
/** |
| 331 |
|
* @group DDC-3490 |