|
@@ 198-207 (lines=10) @@
|
| 195 |
|
$this->assertTrue($updates[0] === $item); |
| 196 |
|
} |
| 197 |
|
|
| 198 |
|
public function testGetEntityStateOnVersionedEntityWithAssignedIdentifier() |
| 199 |
|
{ |
| 200 |
|
$persister = new EntityPersisterMock($this->_emMock, $this->_emMock->getClassMetadata(VersionedAssignedIdentifierEntity::class)); |
| 201 |
|
$this->_unitOfWork->setEntityPersister(VersionedAssignedIdentifierEntity::class, $persister); |
| 202 |
|
|
| 203 |
|
$e = new VersionedAssignedIdentifierEntity(); |
| 204 |
|
$e->id = 42; |
| 205 |
|
$this->assertEquals(UnitOfWork::STATE_NEW, $this->_unitOfWork->getEntityState($e)); |
| 206 |
|
$this->assertFalse($persister->isExistsCalled()); |
| 207 |
|
} |
| 208 |
|
|
| 209 |
|
public function testGetEntityStateWithAssignedIdentity() |
| 210 |
|
{ |
|
@@ 275-292 (lines=18) @@
|
| 272 |
|
* |
| 273 |
|
* @param mixed $invalidValue |
| 274 |
|
*/ |
| 275 |
|
public function testRejectsPersistenceOfObjectsWithInvalidAssociationValue($invalidValue) |
| 276 |
|
{ |
| 277 |
|
$this->_unitOfWork->setEntityPersister( |
| 278 |
|
ForumUser::class, |
| 279 |
|
new EntityPersisterMock( |
| 280 |
|
$this->_emMock, |
| 281 |
|
$this->_emMock->getClassMetadata(ForumUser::class) |
| 282 |
|
) |
| 283 |
|
); |
| 284 |
|
|
| 285 |
|
$user = new ForumUser(); |
| 286 |
|
$user->username = 'John'; |
| 287 |
|
$user->avatar = $invalidValue; |
| 288 |
|
|
| 289 |
|
$this->expectException(\Doctrine\ORM\ORMInvalidArgumentException::class); |
| 290 |
|
|
| 291 |
|
$this->_unitOfWork->persist($user); |
| 292 |
|
} |
| 293 |
|
|
| 294 |
|
/** |
| 295 |
|
* @group DDC-3490 |