getImagePath() public method

public getImagePath ( )
Exemplo n.º 1
0
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $graph = new GraphComposer($input->getArgument('dir'));
     $target = $input->getArgument('output');
     if ($target !== null) {
         if (is_dir($target)) {
             $target = rtrim($target, '/') . '/graph-composer.svg';
         }
         $filename = basename($target);
         $pos = strrpos($filename, '.');
         if ($pos !== false && isset($filename[$pos + 1])) {
             // extension found and not empty
             $graph->setFormat(substr($filename, $pos + 1));
         }
     }
     $format = $input->getOption('format');
     if ($format !== null) {
         $graph->setFormat($format);
     }
     $path = $graph->getImagePath();
     if ($target !== null) {
         rename($path, $target);
     } else {
         readfile($path);
     }
 }
Exemplo n.º 2
0
 public function testWillWriteTemporaryGraph()
 {
     $dir = __DIR__ . '/../';
     $graphviz = $this->getMock('Graphp\\GraphViz\\GraphViz');
     $graphviz->expects($this->once())->method('createImageFile')->will($this->returnValue('test.png'));
     $graphComposer = new GraphComposer($dir, $graphviz);
     $ret = $graphComposer->getImagePath();
     $this->assertEquals('test.png', $ret);
 }