Passed
Pull Request — master (#4)
by Alex
02:54
created

QueryServiceTest   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 11
c 1
b 0
f 0
dl 0
loc 36
rs 10
wmc 3

3 Methods

Rating   Name   Duplication   Size   Complexity  
A testImplementsQueryServiceInterface() 0 5 1
A setUp() 0 5 1
A testGetEntityName() 0 5 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace ArpTest\LaminasDoctrine\Repository\Query;
6
7
use Arp\Entity\EntityInterface;
8
use Arp\LaminasDoctrine\Repository\Query\QueryService;
9
use Arp\LaminasDoctrine\Repository\Query\QueryServiceInterface;
10
use Doctrine\ORM\EntityManagerInterface;
11
use PHPUnit\Framework\MockObject\MockObject;
12
use PHPUnit\Framework\TestCase;
13
use Psr\Log\LoggerInterface;
14
15
/**
16
 * @covers \Arp\LaminasDoctrine\Repository\Query\QueryService
17
 */
18
final class QueryServiceTest extends TestCase
19
{
20
    /**
21
     * @var class-string<EntityInterface>
0 ignored issues
show
Documentation Bug introduced by
The doc comment class-string<EntityInterface> at position 0 could not be parsed: Unknown type name 'class-string' at position 0 in class-string<EntityInterface>.
Loading history...
22
     */
23
    private string $entityName;
24
25
    /**
26
     * @var EntityManagerInterface&MockObject
27
     */
28
    private EntityManagerInterface $entityManager;
29
30
    /**
31
     * @var LoggerInterface&MockObject
32
     */
33
    private LoggerInterface $logger;
34
35
    public function setUp(): void
36
    {
37
        $this->entityName = EntityInterface::class;
38
        $this->entityManager = $this->createMock(EntityManagerInterface::class);
39
        $this->logger = $this->createMock(LoggerInterface::class);
40
    }
41
42
    public function testImplementsQueryServiceInterface(): void
43
    {
44
        $queryService = new QueryService($this->entityName, $this->entityManager, $this->logger);
45
46
        $this->assertInstanceOf(QueryServiceInterface::class, $queryService);
47
    }
48
49
    public function testGetEntityName(): void
50
    {
51
        $queryService = new QueryService($this->entityName, $this->entityManager, $this->logger);
52
53
        $this->assertSame($this->entityName, $queryService->getEntityName());
54
    }
55
}
56