DomainRepositoryTest::testGetFullNames()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 15
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 10
c 1
b 0
f 0
dl 0
loc 15
rs 9.9332
cc 1
nc 1
nop 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace ApplicationTest\Repository;
6
7
use Application\Enum\Site;
8
use Application\Model\Domain;
9
use Application\Repository\DomainRepository;
10
11
class DomainRepositoryTest extends AbstractRepositoryTest
12
{
13
    private DomainRepository $repository;
14
15
    protected function setUp(): void
16
    {
17
        parent::setUp();
18
        $this->repository = _em()->getRepository(Domain::class);
19
    }
20
21
    public function testGetFullNames(): void
22
    {
23
        $actual = $this->repository->getFullNames(Site::Tiresias);
24
        $expected = [
25
            'Test domain 9000' => 9000,
26
            'Test domain 9001' => 9001,
27
        ];
28
        self::assertSame($expected, $actual);
29
30
        $actual = $this->repository->getFullNames(Site::Dilps);
31
        $expected = [
32
            'Test domain 9002' => 9002,
33
            'Test domain 9003' => 9003,
34
        ];
35
        self::assertSame($expected, $actual);
36
    }
37
38
    public function testGetSelfAndDescendantsSubQuery(): void
39
    {
40
        $expected = [
41
            ['id' => 9000],
42
        ];
43
44
        $sql = $this->repository->getSelfAndDescendantsSubQuery(9000);
45
        $actual = _em()->getConnection()->fetchAllAssociative($sql);
46
        self::assertSame($expected, $actual);
47
    }
48
}
49