MaterialRepositoryTest   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 10
dl 0
loc 20
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 4 1
A testGetSelfAndDescendantsSubQuery() 0 10 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace ApplicationTest\Repository;
6
7
use Application\Model\Material;
8
use Application\Repository\MaterialRepository;
9
10
class MaterialRepositoryTest extends AbstractRepositoryTest
11
{
12
    private MaterialRepository $repository;
13
14
    protected function setUp(): void
15
    {
16
        parent::setUp();
17
        $this->repository = _em()->getRepository(Material::class);
18
    }
19
20
    public function testGetSelfAndDescendantsSubQuery(): void
21
    {
22
        $expected = [
23
            ['id' => 8000],
24
            ['id' => 8001],
25
        ];
26
27
        $sql = $this->repository->getSelfAndDescendantsSubQuery(8000);
28
        $actual = _em()->getConnection()->fetchAllAssociative($sql);
29
        self::assertSame($expected, $actual);
30
    }
31
}
32