Passed
Pull Request — master (#3)
by Alex
03:31
created

EntityRepositoryTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 51
Duplicated Lines 0 %

Importance

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

2 Methods

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