1
|
|
|
<?php
|
2
|
|
|
|
3
|
|
|
declare(strict_types=1);
|
4
|
|
|
|
5
|
|
|
namespace ArpTest\DoctrineEntityRepository\Persistence;
|
6
|
|
|
|
7
|
|
|
use Arp\DoctrineEntityRepository\Persistence\PersistService;
|
8
|
|
|
use Arp\DoctrineEntityRepository\Persistence\PersistServiceInterface;
|
9
|
|
|
use Arp\Entity\EntityInterface;
|
10
|
|
|
use Arp\EventDispatcher\EventDispatcher;
|
11
|
|
|
use Doctrine\ORM\EntityManager;
|
12
|
|
|
use Doctrine\ORM\EntityManagerInterface;
|
13
|
|
|
use PHPUnit\Framework\MockObject\MockObject;
|
14
|
|
|
use PHPUnit\Framework\TestCase;
|
15
|
|
|
use Psr\EventDispatcher\EventDispatcherInterface;
|
16
|
|
|
use Psr\Log\LoggerInterface;
|
17
|
|
|
|
18
|
|
|
/**
|
19
|
|
|
* @author Alex Patterson <[email protected]>
|
20
|
|
|
* @package ArpTest\DoctrineEntityRepository\Persistence
|
21
|
|
|
*/
|
22
|
|
|
final class PersistServiceTest extends TestCase
|
23
|
|
|
{
|
24
|
|
|
/**
|
25
|
|
|
* @var string
|
26
|
|
|
*/
|
27
|
|
|
private $entityName;
|
28
|
|
|
|
29
|
|
|
/**
|
30
|
|
|
* @var EntityManager|MockObject
|
31
|
|
|
*/
|
32
|
|
|
private $entityManager;
|
33
|
|
|
|
34
|
|
|
/**
|
35
|
|
|
* @var EventDispatcher|MockObject
|
36
|
|
|
*/
|
37
|
|
|
private $eventDispatcher;
|
38
|
|
|
|
39
|
|
|
/**
|
40
|
|
|
* @var LoggerInterface|MockObject
|
41
|
|
|
*/
|
42
|
|
|
private $logger;
|
43
|
|
|
|
44
|
|
|
/**
|
45
|
|
|
* Set up the test case dependencies.
|
46
|
|
|
*/
|
47
|
|
|
public function setUp(): void
|
48
|
|
|
{
|
49
|
|
|
$this->entityName = EntityInterface::class;
|
50
|
|
|
|
51
|
|
|
$this->entityManager = $this->getMockForAbstractClass(EntityManagerInterface::class);
|
52
|
|
|
|
53
|
|
|
$this->eventDispatcher = $this->getMockForAbstractClass(EventDispatcherInterface::class);
|
54
|
|
|
|
55
|
|
|
$this->logger = $this->getMockForAbstractClass(LoggerInterface::class);
|
56
|
|
|
}
|
57
|
|
|
|
58
|
|
|
/**
|
59
|
|
|
* Assert that the class implements PersistServiceInterface.
|
60
|
|
|
*
|
61
|
|
|
* @covers \Arp\DoctrineEntityRepository\Persistence\PersistService::__construct
|
62
|
|
|
*/
|
63
|
|
|
public function testImplementsPersistServiceInterface(): void
|
64
|
|
|
{
|
65
|
|
|
$persistService = new PersistService(
|
66
|
|
|
$this->entityName,
|
67
|
|
|
$this->entityManager,
|
68
|
|
|
$this->eventDispatcher,
|
69
|
|
|
$this->logger
|
70
|
|
|
);
|
71
|
|
|
|
72
|
|
|
$this->assertInstanceOf(PersistServiceInterface::class, $persistService);
|
73
|
|
|
}
|
74
|
|
|
}
|
75
|
|
|
|