You are here

public function PhpDumperTest::testDumpRelativeDir in Service Container 7

Same name and namespace in other branches
  1. 7.2 modules/providers/service_container_symfony/lib/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php \Symfony\Component\DependencyInjection\Tests\Dumper\PhpDumperTest::testDumpRelativeDir()

File

modules/providers/service_container_symfony/lib/Symfony/Component/DependencyInjection/Tests/Dumper/PhpDumperTest.php, line 68

Class

PhpDumperTest

Namespace

Symfony\Component\DependencyInjection\Tests\Dumper

Code

public function testDumpRelativeDir() {
  $definition = new Definition();
  $definition
    ->setClass('stdClass');
  $definition
    ->addArgument('%foo%');
  $definition
    ->addArgument(array(
    '%foo%' => '%buz%/',
  ));
  $container = new ContainerBuilder();
  $container
    ->setDefinition('test', $definition);
  $container
    ->setParameter('foo', 'wiz' . dirname(__DIR__));
  $container
    ->setParameter('bar', __DIR__);
  $container
    ->setParameter('baz', '%bar%/PhpDumperTest.php');
  $container
    ->setParameter('buz', dirname(dirname(__DIR__)));
  $container
    ->compile();
  $dumper = new PhpDumper($container);
  $this
    ->assertStringEqualsFile(self::$fixturesPath . '/php/services12.php', $dumper
    ->dump(array(
    'file' => __FILE__,
  )), '->dump() dumps __DIR__ relative strings');
}