You are here

public function PhpDumperTest::testDumpOptimizationString in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/symfony/dependency-injection/Tests/Dumper/PhpDumperTest.php \Symfony\Component\DependencyInjection\Tests\Dumper\PhpDumperTest::testDumpOptimizationString()

File

vendor/symfony/dependency-injection/Tests/Dumper/PhpDumperTest.php, line 40

Class

PhpDumperTest

Namespace

Symfony\Component\DependencyInjection\Tests\Dumper

Code

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');
}