MappingAnnotationDriverFactoryTest   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 12
c 1
b 0
f 0
dl 0
loc 41
rs 10
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 8 1
A shouldCreatedAnnotationMappingDriver() 0 9 1
1
<?php
2
/**
3
 * Copyright (C) 2018 Gerrit Addiks.
4
 * This package (including this file) was released under the terms of the GPL-3.0.
5
 * You should have received a copy of the GNU General Public License along with this program.
6
 * If not, see <http://www.gnu.org/licenses/> or send me a mail so i can send you a copy.
7
 * @license GPL-3.0
8
 * @author Gerrit Addiks <[email protected]>
9
 */
10
11
namespace Addiks\RDMBundle\Tests\Mapping\DriverFactories;
12
13
use PHPUnit\Framework\TestCase;
14
use Addiks\RDMBundle\Mapping\DriverFactories\MappingAnnotationDriverFactory;
15
use Addiks\RDMBundle\Mapping\Drivers\MappingAnnotationDriver;
16
use Doctrine\ORM\Mapping\Driver\AnnotationDriver;
17
use Doctrine\Common\Annotations\Reader;
18
use Symfony\Component\DependencyInjection\ContainerInterface;
19
20
final class MappingAnnotationDriverFactoryTest extends TestCase
21
{
22
23
    /**
24
     * @var ContainerInterface
25
     */
26
    private $container;
27
28
    /**
29
     * @var MappingAnnotationDriverFactory
30
     */
31
    private $driverFactory;
32
33
    /**
34
     * @var Reader
35
     */
36
    private $annotationReader;
37
38
    public function setUp(): void
39
    {
40
        $this->container = $this->createMock(ContainerInterface::class);
0 ignored issues
show
Documentation Bug introduced by
It seems like $this->createMock(Symfon...tainerInterface::class) of type PHPUnit\Framework\MockObject\MockObject is incompatible with the declared type Symfony\Component\Depend...tion\ContainerInterface of property $container.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
41
        $this->annotationReader = $this->createMock(Reader::class);
0 ignored issues
show
Documentation Bug introduced by
It seems like $this->createMock(Doctri...otations\Reader::class) of type PHPUnit\Framework\MockObject\MockObject is incompatible with the declared type Doctrine\Common\Annotations\Reader of property $annotationReader.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
42
43
        $this->driverFactory = new MappingAnnotationDriverFactory(
44
            $this->container,
45
            $this->annotationReader
46
        );
47
    }
48
49
    /**
50
     * @test
51
     */
52
    public function shouldCreatedAnnotationMappingDriver()
53
    {
54
        /** @var AnnotationDriver $mappingDriver */
55
        $mappingDriver = $this->createMock(AnnotationDriver::class);
56
57
        /** @var MappingAnnotationDriver $rdmMappingDriver */
58
        $rdmMappingDriver = $this->driverFactory->createRDMMappingDriver($mappingDriver);
59
60
        $this->assertInstanceOf(MappingAnnotationDriver::class, $rdmMappingDriver);
61
    }
62
63
}
64