Skip to content

Commit 8962d5d

Browse files
committed
minor #13941 [2.6] Marked the ResolveParameterPlaceHoldersPassTest as legacy (saro0h)
This PR was merged into the 2.6 branch. Discussion ---------- [2.6] Marked the ResolveParameterPlaceHoldersPassTest as legacy | Q | A | ------------- | --- | Bug fix? | yes | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | ~ | License | MIT | Doc PR | ~ Splitted the ResolveParameterPlaceHoldersPassTest to obtain a legacy test to avoid deprecation rise. Commits ------- 67ca1f4 Marked the ResolveParameterPlaceHoldersPassTest as legacy
2 parents d609e4e + 67ca1f4 commit 8962d5d

File tree

3 files changed

+46
-9
lines changed

3 files changed

+46
-9
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the Symfony package.
5+
*
6+
* (c) Fabien Potencier <fabien@symfony.com>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
12+
namespace Symfony\Component\DependencyInjection\Tests\Compiler;
13+
14+
use Symfony\Component\DependencyInjection\Compiler\ResolveParameterPlaceHoldersPass;
15+
use Symfony\Component\DependencyInjection\ContainerBuilder;
16+
17+
/**
18+
* @group legacy
19+
*/
20+
class LegacyResolveParameterPlaceHoldersPassTest extends \PHPUnit_Framework_TestCase
21+
{
22+
public function testFactoryClassParametersShouldBeResolved()
23+
{
24+
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
25+
26+
$compilerPass = new ResolveParameterPlaceHoldersPass();
27+
28+
$container = new ContainerBuilder();
29+
$container->setParameter('foo.factory.class', 'FooFactory');
30+
$fooDefinition = $container->register('foo', '%foo.factory.class%');
31+
$fooDefinition->setFactoryClass('%foo.factory.class%');
32+
$compilerPass->process($container);
33+
$fooDefinition = $container->getDefinition('foo');
34+
35+
$this->assertSame('FooFactory', $fooDefinition->getFactoryClass());
36+
}
37+
}

src/Symfony/Component/DependencyInjection/Tests/Compiler/ResolveParameterPlaceHoldersPassTest.php

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,7 @@ public function testClassParametersShouldBeResolved()
3333
$this->assertSame('Foo', $this->fooDefinition->getClass());
3434
}
3535

36-
public function testFactoryClassParametersShouldBeResolved()
37-
{
38-
$this->assertSame('FooFactory', $this->fooDefinition->getFactoryClass());
39-
}
40-
41-
public function testClassOfFactoryParametersShouldBeResolved()
36+
public function testFactoryParametersShouldBeResolved()
4237
{
4338
$this->assertSame(array('FooFactory', 'getFoo'), $this->fooDefinition->getFactory());
4439
}
@@ -83,7 +78,6 @@ private function createContainerBuilder()
8378
$containerBuilder->setParameter('alias.id', 'bar');
8479

8580
$fooDefinition = $containerBuilder->register('foo', '%foo.class%');
86-
$fooDefinition->setFactoryClass('%foo.factory.class%');
8781
$fooDefinition->setFactory(array('%foo.factory.class%', 'getFoo'));
8882
$fooDefinition->setArguments(array('%foo.arg1%', '%foo.arg2%'));
8983
$fooDefinition->addMethodCall('%foo.method%', array('%foo.arg1%', '%foo.arg2%'));

src/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container14.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,14 @@
44

55
use Symfony\Component\DependencyInjection\ContainerBuilder;
66

7-
class ProjectServiceContainer extends ContainerBuilder
8-
{
7+
/**
8+
* This file is included in Tests\Dumper\GraphvizDumperTest::testDumpWithFrozenCustomClassContainer
9+
* and Tests\Dumper\XmlDumperTest::testCompiledContainerCanBeDumped.
10+
*/
11+
if (!class_exists('Container14\ProjectServiceContainer')) {
12+
class ProjectServiceContainer extends ContainerBuilder
13+
{
14+
}
915
}
1016

1117
return new ProjectServiceContainer();

0 commit comments

Comments
 (0)