Passed
Push — master ( 064bed...d815ea )
by Gerrit
04:18
created

MappingYamlDriverFactoryTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A shouldCreatedAnnotationMappingDriver() 0 11 1
A setUp() 0 6 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 Doctrine\Persistence\Mapping\Driver\FileLocator;
15
use Addiks\RDMBundle\Mapping\DriverFactories\MappingYamlDriverFactory;
16
use Addiks\RDMBundle\Mapping\Drivers\MappingYamlDriver;
17
use Doctrine\ORM\Mapping\Driver\YamlDriver;
18
use Symfony\Component\DependencyInjection\ContainerInterface;
19
20
final class MappingYamlDriverFactoryTest extends TestCase
21
{
22
23
    /**
24
     * @var MappingYamlDriverFactory
25
     */
26
    private $driverFactory;
27
28
    /**
29
     * @var ContainerInterface
30
     */
31
    private $container;
32
33
    public function setUp(): void
34
    {
35
        $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...
36
37
        $this->driverFactory = new MappingYamlDriverFactory(
38
            $this->container
39
        );
40
    }
41
42
    /**
43
     * @test
44
     */
45
    public function shouldCreatedAnnotationMappingDriver()
46
    {
47
        /** @var YamlDriver $mappingDriver */
48
        $mappingDriver = $this->createMock(YamlDriver::class);
49
50
        $mappingDriver->method('getLocator')->willReturn($this->createMock(FileLocator::class));
0 ignored issues
show
Bug introduced by
The method method() does not exist on Doctrine\ORM\Mapping\Driver\YamlDriver. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

50
        $mappingDriver->/** @scrutinizer ignore-call */ 
51
                        method('getLocator')->willReturn($this->createMock(FileLocator::class));

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
51
52
        /** @var MappingYamlDriver $rdmMappingDriver */
53
        $rdmMappingDriver = $this->driverFactory->createRDMMappingDriver($mappingDriver);
54
55
        $this->assertInstanceOf(MappingYamlDriver::class, $rdmMappingDriver);
56
    }
57
58
}
59