| @@ 56-66 (lines=11) @@ | ||
| 53 | $this->assertInstanceOf($repository->getEntityName(), $findBy[0]); |
|
| 54 | } |
|
| 55 | ||
| 56 | public function testFindOneBy() |
|
| 57 | { |
|
| 58 | $entity = $this->getFlushedMockObject(); |
|
| 59 | ||
| 60 | $repository = $this->getRepository(); |
|
| 61 | ||
| 62 | $findOneBy = $repository->findOneBy(['id' => $entity->getId()]); |
|
| 63 | ||
| 64 | $this->assertInstanceOf($repository->getEntityName(), $findOneBy); |
|
| 65 | $this->assertEquals($entity->getId(), $findOneBy->getId()); |
|
| 66 | } |
|
| 67 | ||
| 68 | public function testFind() |
|
| 69 | { |
|
| @@ 68-78 (lines=11) @@ | ||
| 65 | $this->assertEquals($entity->getId(), $findOneBy->getId()); |
|
| 66 | } |
|
| 67 | ||
| 68 | public function testFind() |
|
| 69 | { |
|
| 70 | $entity = $this->getFlushedMockObject(); |
|
| 71 | ||
| 72 | $repository = $this->getRepository(); |
|
| 73 | ||
| 74 | $find = $repository->find($entity->getId()); |
|
| 75 | ||
| 76 | $this->assertInstanceOf($repository->getEntityName(), $find); |
|
| 77 | $this->assertEquals($entity->getId(), $find->getId()); |
|
| 78 | } |
|
| 79 | ||
| 80 | /** |
|
| 81 | * @expectedException Symfony\Component\HttpKernel\Exception\NotFoundHttpException |
|
| @@ 7-19 (lines=13) @@ | ||
| 4 | ||
| 5 | trait CreateTrait |
|
| 6 | { |
|
| 7 | public function testStore() |
|
| 8 | { |
|
| 9 | $entity = $this->getRepositoryTest() |
|
| 10 | ->getFlushedMockObject(); |
|
| 11 | ||
| 12 | $repository = $this->getService() |
|
| 13 | ->getMainRepository(); |
|
| 14 | ||
| 15 | $find = $repository->find($entity->getId()); |
|
| 16 | ||
| 17 | $this->assertInstanceOf($repository->getEntityName(), $entity); |
|
| 18 | $this->assertEquals($entity->getId(), $find->getId()); |
|
| 19 | } |
|
| 20 | } |
|
| 21 | ||