forked from symfony/symfony
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* 2.7: `ResolveParameterPlaceHoldersPass` unit tests Fixing wrong variable name from symfony#13519 [translation][initialize cache] Remove dead code. [DependencyInjection] fixed service resolution for factories [HttpKernel] Throw a LogicException when kernel.exception does not led to a Response [FrameworkBundle] Added domain column when debugging translations [PhpUnitBridge] do not replace but require-dev in symfony/symfony [acl][command][SecurityBundle] Fixed user input option mode to be an Array Conflicts: composer.json
- Loading branch information
Showing
12 changed files
with
163 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
91 changes: 91 additions & 0 deletions
91
...ony/Component/DependencyInjection/Tests/Compiler/ResolveParameterPlaceHoldersPassTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,91 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Symfony package. | ||
* | ||
* (c) Fabien Potencier <fabien@symfony.com> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Symfony\Component\DependencyInjection\Tests\Compiler; | ||
|
||
use Symfony\Component\DependencyInjection\Compiler\ResolveParameterPlaceHoldersPass; | ||
use Symfony\Component\DependencyInjection\ContainerBuilder; | ||
|
||
class ResolveParameterPlaceHoldersPassTest extends \PHPUnit_Framework_TestCase | ||
{ | ||
private $compilerPass; | ||
private $container; | ||
private $fooDefinition; | ||
|
||
protected function setUp() | ||
{ | ||
$this->compilerPass = new ResolveParameterPlaceHoldersPass(); | ||
$this->container = $this->createContainerBuilder(); | ||
$this->compilerPass->process($this->container); | ||
$this->fooDefinition = $this->container->getDefinition('foo'); | ||
} | ||
|
||
public function testClassParametersShouldBeResolved() | ||
{ | ||
$this->assertSame('Foo', $this->fooDefinition->getClass()); | ||
} | ||
|
||
public function testFactoryClassParametersShouldBeResolved() | ||
{ | ||
$this->assertSame('FooFactory', $this->fooDefinition->getFactoryClass()); | ||
} | ||
|
||
public function testArgumentParametersShouldBeResolved() | ||
{ | ||
$this->assertSame(array('bar', 'baz'), $this->fooDefinition->getArguments()); | ||
} | ||
|
||
public function testMethodCallParametersShouldBeResolved() | ||
{ | ||
$this->assertSame(array(array('foobar', array('bar', 'baz'))), $this->fooDefinition->getMethodCalls()); | ||
} | ||
|
||
public function testPropertyParametersShouldBeResolved() | ||
{ | ||
$this->assertSame(array('bar' => 'baz'), $this->fooDefinition->getProperties()); | ||
} | ||
|
||
public function testFileParametersShouldBeResolved() | ||
{ | ||
$this->assertSame('foo.php', $this->fooDefinition->getFile()); | ||
} | ||
|
||
public function testAliasParametersShouldBeResolved() | ||
{ | ||
$this->assertSame('foo', $this->container->getAlias('bar')->__toString()); | ||
} | ||
|
||
private function createContainerBuilder() | ||
{ | ||
$containerBuilder = new ContainerBuilder(); | ||
|
||
$containerBuilder->setParameter('foo.class', 'Foo'); | ||
$containerBuilder->setParameter('foo.factory.class', 'FooFactory'); | ||
$containerBuilder->setParameter('foo.arg1', 'bar'); | ||
$containerBuilder->setParameter('foo.arg2', 'baz'); | ||
$containerBuilder->setParameter('foo.method', 'foobar'); | ||
$containerBuilder->setParameter('foo.property.name', 'bar'); | ||
$containerBuilder->setParameter('foo.property.value', 'baz'); | ||
$containerBuilder->setParameter('foo.file', 'foo.php'); | ||
$containerBuilder->setParameter('alias.id', 'bar'); | ||
|
||
$fooDefinition = $containerBuilder->register('foo', '%foo.class%'); | ||
$fooDefinition->setFactoryClass('%foo.factory.class%'); | ||
$fooDefinition->setArguments(array('%foo.arg1%', '%foo.arg2%')); | ||
$fooDefinition->addMethodCall('%foo.method%', array('%foo.arg1%', '%foo.arg2%')); | ||
$fooDefinition->setProperty('%foo.property.name%', '%foo.property.value%'); | ||
$fooDefinition->setFile('%foo.file%'); | ||
|
||
$containerBuilder->setAlias('%alias.id%', 'foo'); | ||
|
||
return $containerBuilder; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters