| @@ 46-61 (lines=16) @@ | ||
| 43 | $this->addToAssertionCount(1); |
|
| 44 | } |
|
| 45 | ||
| 46 | public function testFind() |
|
| 47 | { |
|
| 48 | $entity = new PersistentEntity(); |
|
| 49 | $entity->setName("test"); |
|
| 50 | ||
| 51 | $this->em->persist($entity); |
|
| 52 | $this->em->flush(); |
|
| 53 | $this->em->clear(); |
|
| 54 | ||
| 55 | $entity = $this->em->find(PersistentEntity::class, $entity->getId()); |
|
| 56 | ||
| 57 | self::assertEquals('test', $entity->getName()); |
|
| 58 | $entity->setName('foobar'); |
|
| 59 | ||
| 60 | $this->em->flush(); |
|
| 61 | } |
|
| 62 | ||
| 63 | public function testGetReference() |
|
| 64 | { |
|
| @@ 63-75 (lines=13) @@ | ||
| 60 | $this->em->flush(); |
|
| 61 | } |
|
| 62 | ||
| 63 | public function testGetReference() |
|
| 64 | { |
|
| 65 | $entity = new PersistentEntity(); |
|
| 66 | $entity->setName("test"); |
|
| 67 | ||
| 68 | $this->em->persist($entity); |
|
| 69 | $this->em->flush(); |
|
| 70 | $this->em->clear(); |
|
| 71 | ||
| 72 | $entity = $this->em->getReference(PersistentEntity::class, $entity->getId()); |
|
| 73 | ||
| 74 | self::assertEquals('test', $entity->getName()); |
|
| 75 | } |
|
| 76 | ||
| 77 | public function testSetAssociation() |
|
| 78 | { |
|
| @@ 153-168 (lines=16) @@ | ||
| 150 | /** |
|
| 151 | * @group DDC-1163 |
|
| 152 | */ |
|
| 153 | public function testInitializeChangeAndFlushProxy() |
|
| 154 | { |
|
| 155 | $id = $this->createProduct(); |
|
| 156 | ||
| 157 | /* @var $entity ECommerceProduct|GhostObjectInterface */ |
|
| 158 | $entity = $this->em->getReference(ECommerceProduct::class , $id); |
|
| 159 | ||
| 160 | $entity->setName('Doctrine 2 Cookbook'); |
|
| 161 | ||
| 162 | $this->em->flush(); |
|
| 163 | $this->em->clear(); |
|
| 164 | ||
| 165 | /* @var $entity ECommerceProduct|GhostObjectInterface */ |
|
| 166 | $entity = $this->em->getReference(ECommerceProduct::class , $id); |
|
| 167 | ||
| 168 | self::assertEquals('Doctrine 2 Cookbook', $entity->getName()); |
|
| 169 | } |
|
| 170 | ||
| 171 | public function testDoNotInitializeProxyOnGettingTheIdentifier() |
|