Skip to content

Commit 9598ef4

Browse files
committed
fix components tests
Since #12006, the `ContainerBuilder` contains the `addExpressionLanguageProvider()` method which references a class from the ExpressionLanguage component. By default, the PHPUnit mock API tries to mock all methods of the class being doubled. Since the ExpressionLanguage component is not required to run the tests, creating the mock objects fails when the mock API fails to mock the `addExpressionLanguageProvider()` method.
1 parent 6de5e8f commit 9598ef4

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

Tests/DependencyInjection/MergeExtensionConfigurationPassTest.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,10 @@ protected function setUp()
2828

2929
public function testAutoloadMainExtension()
3030
{
31-
$container = $this->getMock('Symfony\\Component\\DependencyInjection\\ContainerBuilder');
31+
$container = $this->getMock(
32+
'Symfony\\Component\\DependencyInjection\\ContainerBuilder',
33+
array('getExtensionConfig', 'loadFromExtension', 'getParameterBag')
34+
);
3235
$params = $this->getMock('Symfony\\Component\\DependencyInjection\\ParameterBag\\ParameterBag');
3336

3437
$container->expects($this->at(0))

Tests/DependencyInjection/RegisterListenersPassTest.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,10 @@ public function testEventSubscriberWithoutInterface()
3737
->method('getClass')
3838
->will($this->returnValue('stdClass'));
3939

40-
$builder = $this->getMock('Symfony\Component\DependencyInjection\ContainerBuilder');
40+
$builder = $this->getMock(
41+
'Symfony\Component\DependencyInjection\ContainerBuilder',
42+
array('hasDefinition', 'findTaggedServiceIds', 'getDefinition')
43+
);
4144
$builder->expects($this->any())
4245
->method('hasDefinition')
4346
->will($this->returnValue(true));
@@ -69,7 +72,10 @@ public function testValidEventSubscriber()
6972
->method('getClass')
7073
->will($this->returnValue('Symfony\Component\HttpKernel\Tests\DependencyInjection\SubscriberService'));
7174

72-
$builder = $this->getMock('Symfony\Component\DependencyInjection\ContainerBuilder');
75+
$builder = $this->getMock(
76+
'Symfony\Component\DependencyInjection\ContainerBuilder',
77+
array('hasDefinition', 'findTaggedServiceIds', 'getDefinition')
78+
);
7379
$builder->expects($this->any())
7480
->method('hasDefinition')
7581
->will($this->returnValue(true));

0 commit comments

Comments
 (0)