|
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); |
|
|
|
|
|
|
41
|
|
|
$this->annotationReader = $this->createMock(Reader::class); |
|
|
|
|
|
|
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
|
|
|
|
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..