| @@ 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 | { |
|
| @@ 166-181 (lines=16) @@ | ||
| 163 | /** |
|
| 164 | * @group DDC-1163 |
|
| 165 | */ |
|
| 166 | public function testInitializeChangeAndFlushProxy() |
|
| 167 | { |
|
| 168 | $id = $this->createProduct(); |
|
| 169 | ||
| 170 | /* @var $entity ECommerceProduct|GhostObjectInterface */ |
|
| 171 | $entity = $this->em->getReference(ECommerceProduct::class , $id); |
|
| 172 | ||
| 173 | $entity->setName('Doctrine 2 Cookbook'); |
|
| 174 | ||
| 175 | $this->em->flush(); |
|
| 176 | $this->em->clear(); |
|
| 177 | ||
| 178 | /* @var $entity ECommerceProduct|GhostObjectInterface */ |
|
| 179 | $entity = $this->em->getReference(ECommerceProduct::class , $id); |
|
| 180 | ||
| 181 | self::assertEquals('Doctrine 2 Cookbook', $entity->getName()); |
|
| 182 | } |
|
| 183 | ||
| 184 | public function testDoNotInitializeProxyOnGettingTheIdentifier() |
|