| Conditions | 3 |
| Paths | 4 |
| Total Lines | 20 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 21 | public function testGetAccessibleSubQuery(?string $login, array $expected): void |
||
| 22 | { |
||
| 23 | /** @var UserRepository $userRepository */ |
||
| 24 | $userRepository = $this->getEntityManager()->getRepository(User::class); |
||
| 25 | $user = $userRepository->getOneByEmail($login . '@example.com'); |
||
| 26 | $subQuery = $this->repository->getAccessibleSubQuery($user); |
||
| 27 | |||
| 28 | if (!$subQuery) { |
||
| 29 | $subQuery = $this->repository->getAllIdsQuery(); |
||
| 30 | } |
||
| 31 | |||
| 32 | if ($subQuery === '-1') { |
||
| 33 | $ids = []; |
||
| 34 | } else { |
||
| 35 | $ids = $this->getEntityManager()->getConnection()->executeQuery($subQuery)->fetchFirstColumn(); |
||
| 36 | } |
||
| 37 | |||
| 38 | sort($ids); |
||
| 39 | |||
| 40 | self::assertEquals($expected, $ids); |
||
| 41 | } |
||
| 43 |