1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace UniGen\Bundle\UniGenBundle\Tests\DependencyInjection; |
4
|
|
|
|
5
|
|
|
use Mockery; |
6
|
|
|
use Mockery\MockInterface; |
7
|
|
|
use PHPUnit\Framework\TestCase; |
8
|
|
|
use Mockery\Adapter\Phpunit\MockeryPHPUnitIntegration; |
9
|
|
|
use Symfony\Component\DependencyInjection\ContainerBuilder; |
10
|
|
|
use UniGen\Bundle\UniGenBundle\DependencyInjection\UniGenExtension; |
11
|
|
|
|
12
|
|
|
class UniGenExtensionTest extends TestCase |
13
|
|
|
{ |
14
|
|
|
use MockeryPHPUnitIntegration; |
15
|
|
|
|
16
|
|
|
/** @var UniGenExtension */ |
17
|
|
|
private $sut; |
18
|
|
|
|
19
|
|
|
/** @var ContainerBuilder|MockInterface */ |
20
|
|
|
private $containerBuilderMock; |
21
|
|
|
|
22
|
|
|
/** |
23
|
|
|
* {@inheritdoc} |
24
|
|
|
*/ |
25
|
|
|
protected function setUp() |
26
|
|
|
{ |
27
|
|
|
$this->containerBuilderMock = Mockery::mock(ContainerBuilder::class)->makePartial(); |
28
|
|
|
|
29
|
|
|
$this->sut = new UniGenExtension(); |
30
|
|
|
} |
31
|
|
|
|
32
|
|
|
public function testLoadShouldLoadCorrectContainerParameters() |
33
|
|
|
{ |
34
|
|
|
$this->containerBuilderMock |
35
|
|
|
->shouldReceive('setParameter') |
|
|
|
|
36
|
|
|
->with('unigen.test_case', 'TestCase'); |
37
|
|
|
|
38
|
|
|
$this->containerBuilderMock |
39
|
|
|
->shouldReceive('setParameter') |
40
|
|
|
->with('unigen.mock_framework', 'mockery'); |
41
|
|
|
|
42
|
|
|
$this->containerBuilderMock |
43
|
|
|
->shouldReceive('setParameter') |
44
|
|
|
->with('unigen.path_pattern', '/src\/([a-zA-Z\/]+)/'); |
45
|
|
|
|
46
|
|
|
$this->containerBuilderMock |
47
|
|
|
->shouldReceive('setParameter') |
48
|
|
|
->with('unigen.path_replacement_pattern', 'tests/${1}Test'); |
49
|
|
|
|
50
|
|
|
$this->containerBuilderMock |
51
|
|
|
->shouldReceive('setParameter') |
52
|
|
|
->with('unigen.namespace_pattern', '/namespace ([a-zA-Z]+\\\\)(.*);/'); |
53
|
|
|
|
54
|
|
|
$this->containerBuilderMock |
55
|
|
|
->shouldReceive('setParameter') |
56
|
|
|
->with('unigen.namespace_replacement_pattern', 'namespace ${1}Test\\\\${2};'); |
57
|
|
|
|
58
|
|
|
$this->containerBuilderMock |
59
|
|
|
->shouldReceive('setParameter') |
60
|
|
|
->with('unigen.render.twig.template', 'sut_template.php.twig'); |
61
|
|
|
|
62
|
|
|
$this->containerBuilderMock |
63
|
|
|
->shouldReceive('setParameter') |
64
|
|
|
->with('unigen.render.twig.template_dir', '%kernel.project_dir%/vendor/unigen/unigen/src/Resources/views'); |
65
|
|
|
|
66
|
|
|
$this->sut->load([], $this->containerBuilderMock); |
|
|
|
|
67
|
|
|
} |
68
|
|
|
} |
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.