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