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> |
|
|
|
|
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
|
|
|
|