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