8000 Marked the ResolveParameterPlaceHoldersPassTest as legacy · symfony/symfony@11e8632 · GitHub
[go: up one dir, main page]

Skip to content

Commit 11e8632

Browse files
committed
Marked the ResolveParameterPlaceHoldersPassTest as legacy
1 parent 9b1eee1 commit 11e8632

File tree

3 files changed

+59
-9
lines changed

3 files changed

+59
-9
lines changed
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
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+
private $compilerPass;
23+
private $container;
24+
private $fooDefinition;
25+
26+
protected function setUp()
27+
{
28+
$this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
29+
$this->compilerPass = new ResolveParameterPlaceHoldersPass();
30+
$this->container = $this->createContainerBuilder();
31+
$this->compilerPass->process($this->container);
32+
$this->fooDefinition = $this->container->getDefinition('foo');
33+
}
34+
35+
private function createContainerBuilder()
36+
{
37+
$containerBuilder = new ContainerBuilder();
38+
$containerBuilder->setParameter('foo.class', 'Foo');
39+
$containerBuilder->setParameter('foo.factory.class', 'FooFactory');
40+
$fooDefinition = $containerBuilder->register('foo', '%foo.class%');
41+
$fooDefinition->setFactoryClass('%foo.factory.class%');
42+
43+
return $containerBuilder;
44+
}
45+
46+
public function testFactoryClassParametersShouldBeResolved()
47+
{
48+
$this->assertSame('FooFactory', $this->fooDefinition->getFactoryClass());
49+
}
50+
}

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+
* Be careful here: this class is included in Tests\Dumper\GraphvizDumperTest::testDumpWithFrozenCustomClassContainer
9+
* and Tests\Dumper\XmlDumper::TesttestCompiledContainerCanBeDumped.
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)
0