You are here

public function GraphvizDumperTest::testDump 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/GraphvizDumperTest.php \Symfony\Component\DependencyInjection\Tests\Dumper\GraphvizDumperTest::testDump()

File

modules/providers/service_container_symfony/lib/Symfony/Component/DependencyInjection/Tests/Dumper/GraphvizDumperTest.php, line 38

Class

GraphvizDumperTest

Namespace

Symfony\Component\DependencyInjection\Tests\Dumper

Code

public function testDump() {
  $dumper = new GraphvizDumper($container = new ContainerBuilder());
  $this
    ->assertStringEqualsFile(self::$fixturesPath . '/graphviz/services1.dot', $dumper
    ->dump(), '->dump() dumps an empty container as an empty dot file');
  $container = (include self::$fixturesPath . '/containers/container9.php');
  $dumper = new GraphvizDumper($container);
  $this
    ->assertEquals(str_replace('%path%', __DIR__, file_get_contents(self::$fixturesPath . '/graphviz/services9.dot')), $dumper
    ->dump(), '->dump() dumps services');
  $container = (include self::$fixturesPath . '/containers/container10.php');
  $dumper = new GraphvizDumper($container);
  $this
    ->assertEquals(str_replace('%path%', __DIR__, file_get_contents(self::$fixturesPath . '/graphviz/services10.dot')), $dumper
    ->dump(), '->dump() dumps services');
  $container = (include self::$fixturesPath . '/containers/container10.php');
  $dumper = new GraphvizDumper($container);
  $this
    ->assertEquals($dumper
    ->dump(array(
    'graph' => array(
      'ratio' => 'normal',
    ),
    'node' => array(
      'fontsize' => 13,
      'fontname' => 'Verdana',
      'shape' => 'square',
    ),
    'edge' => array(
      'fontsize' => 12,
      'fontname' => 'Verdana',
      'color' => 'white',
      'arrowhead' => 'closed',
      'arrowsize' => 1,
    ),
    'node.instance' => array(
      'fillcolor' => 'green',
      'style' => 'empty',
    ),
    'node.definition' => array(
      'fillcolor' => 'grey',
    ),
    'node.missing' => array(
      'fillcolor' => 'red',
      'style' => 'empty',
    ),
  )), str_replace('%path%', __DIR__, file_get_contents(self::$fixturesPath . '/graphviz/services10-1.dot')), '->dump() dumps services');
}