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\MappingDriverFactoryInterface; |
15
|
|
|
use Doctrine\Persistence\Mapping\Driver\MappingDriver; |
16
|
|
|
use Addiks\RDMBundle\Mapping\Drivers\MappingDriverInterface; |
17
|
|
|
use Addiks\RDMBundle\Mapping\DriverFactories\MappingDriverFactoryLazyLoadProxy; |
18
|
|
|
use Symfony\Component\DependencyInjection\ContainerInterface; |
19
|
|
|
|
20
|
|
|
final class MappingDriverFactoryLazyLoadProxyTest extends TestCase |
21
|
|
|
{ |
22
|
|
|
|
23
|
|
|
/** |
24
|
|
|
* @test |
25
|
|
|
*/ |
26
|
|
|
public function shouldCreatedMappingDriver() |
27
|
|
|
{ |
28
|
|
|
/** @var MappingDriver $mappingDriver */ |
29
|
|
|
$mappingDriver = $this->createMock(MappingDriver::class); |
30
|
|
|
|
31
|
|
|
/** @var ContainerInterface $container */ |
32
|
|
|
$container = $this->createMock(ContainerInterface::class); |
33
|
|
|
|
34
|
|
|
/** @var MappingDriverFactoryInterface $service */ |
35
|
|
|
$service = $this->createMock(MappingDriverFactoryInterface::class); |
36
|
|
|
|
37
|
|
|
$container->method('get')->will($this->returnValueMap([ |
|
|
|
|
38
|
|
|
['some_service', ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE, $service], |
39
|
|
|
])); |
40
|
|
|
|
41
|
|
|
$container->method('has')->will($this->returnValueMap([ |
42
|
|
|
['some_service', true], |
43
|
|
|
])); |
44
|
|
|
|
45
|
|
|
/** @var MappingDriverInterface $expectedMappingDriver */ |
46
|
|
|
$expectedMappingDriver = $this->createMock(MappingDriverInterface::class); |
47
|
|
|
|
48
|
|
|
$service->expects($this->once())->method('createRDMMappingDriver')->willReturn( |
|
|
|
|
49
|
|
|
$expectedMappingDriver |
50
|
|
|
); |
51
|
|
|
|
52
|
|
|
$driverFactory = new MappingDriverFactoryLazyLoadProxy($container, "some_service"); |
53
|
|
|
|
54
|
|
|
/** @var MappingDriverInterface $actualMappingDriver */ |
55
|
|
|
$actualMappingDriver = $driverFactory->createRDMMappingDriver($mappingDriver); |
56
|
|
|
|
57
|
|
|
$this->assertSame($expectedMappingDriver, $actualMappingDriver); |
58
|
|
|
} |
59
|
|
|
|
60
|
|
|
} |
61
|
|
|
|
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.