Beispiel #1
0
 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $dic = $this->rebuild->rebuildDIC(false);
     $dumper = new GraphvizDumper($dic);
     $content = $dumper->dump();
     file_put_contents(ROOT . 'cache/dic.gv', $content);
     exec('dot -Tpng cache/dic.gv -o cache/graph.png; rm cache/dic.gv');
     $output->writeln('PNG: <info>cache/graph.png</info>');
     $output->writeln('GV:  <info>cache/dic.gv</info>');
 }
 public function dump()
 {
     $this->initializeBundles();
     $container = $this->initializeContainer();
     $dumper = new GraphvizDumper($container);
     $content = $dumper->dump(array('graph' => array('rankdir' => 'RL')));
     if (!$this->debug) {
         $content = static::stripComments($content);
     }
     echo $content;
 }
 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');
 }
 public function testDumpWithFrozenCustomClassContainer()
 {
     $container = (include self::$fixturesPath . '/containers/container14.php');
     $dumper = new GraphvizDumper($container);
     $this->assertEquals(str_replace('%path%', __DIR__, file_get_contents(self::$fixturesPath . '/graphviz/services14.dot')), $dumper->dump(), '->dump() dumps services');
 }
 /**
  * Generate DI scheme for custom Bundle
  * @param bool $convertIntoImg
  * @param null $expectedBundleName
  * @throws \Exception
  */
 private function dumpBundleDI($convertIntoImg = false, $expectedBundleName = null)
 {
     foreach ($this->servicePathList as $bundleName => $servicePath) {
         if (!is_null($expectedBundleName) && $expectedBundleName != $bundleName) {
             continue;
         }
         $serviceContainer = new ContainerBuilder();
         $this->loadServicesByPath($serviceContainer, $servicePath);
         $dumper = new GraphvizDumper($serviceContainer);
         $this->saveToDotFile($bundleName, $dumper->dump());
         if ($convertIntoImg) {
             $this->convertGraphvizIntoImage($bundleName);
         }
     }
 }