public function PhpDumperTest::testDumpOptimizationString in Service Container 7.2
Same name and namespace in other branches
- 7 modules/providers/service_container_symfony/lib/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php \Symfony\Component\DependencyInjection\Tests\Dumper\PhpDumperTest::testDumpOptimizationString()
File
- modules/
providers/ service_container_symfony/ lib/ Symfony/ Component/ DependencyInjection/ Tests/ Dumper/ PhpDumperTest.php, line 40
Class
Namespace
Symfony\Component\DependencyInjection\Tests\DumperCode
public function testDumpOptimizationString() {
$definition = new Definition();
$definition
->setClass('stdClass');
$definition
->addArgument(array(
'only dot' => '.',
'concatenation as value' => '.\'\'.',
'concatenation from the start value' => '\'\'.',
'.' => 'dot as a key',
'.\'\'.' => 'concatenation as a key',
'\'\'.' => 'concatenation from the start key',
'optimize concatenation' => 'string1%some_string%string2',
'optimize concatenation with empty string' => 'string1%empty_value%string2',
'optimize concatenation from the start' => '%empty_value%start',
'optimize concatenation at the end' => 'end%empty_value%',
));
$container = new ContainerBuilder();
$container
->setResourceTracking(false);
$container
->setDefinition('test', $definition);
$container
->setParameter('empty_value', '');
$container
->setParameter('some_string', '-');
$container
->compile();
$dumper = new PhpDumper($container);
$this
->assertStringEqualsFile(self::$fixturesPath . '/php/services10.php', $dumper
->dump(), '->dump() dumps an empty container as an empty PHP class');
}