예제 #1
0
 /**
  * @covers phpDocumentor\GraphViz\Graph::hasGraph
  */
 public function testHasGraph()
 {
     $mock = $this->getMock('phpDocumentor\\GraphViz\\Graph');
     $mock->expects($this->any())->method('getName')->will($this->returnValue('MyName'));
     $this->assertFalse($this->fixture->hasGraph('MyName'));
     $this->fixture->addGraph($mock);
     $this->assertTrue($this->fixture->hasGraph('MyName'));
 }
예제 #2
0
 /**
  * @param string $name
  *
  * @return \phpDocumentor\GraphViz\Graph
  */
 private function getGraphByName($name)
 {
     $name = 'cluster_' . $name;
     if (!$this->graph->hasGraph($name)) {
         $graph = $this->graph->create($name);
         $this->graph->addGraph($graph);
     }
     return $this->graph->getGraph($name);
 }
 /**
  * Add a cluster to a graph
  *
  * If the cluster already exists on the graph, then the cluster graph is returned
  *
  * @param Graph $graph
  * @param string $name
  * @param string $label
  * @return Graph $clusterGraph
  */
 protected function _addCluster($graph, $name, $label = null, $attributes = array())
 {
     if ($label === null) {
         $label = $name;
     }
     if (!$graph->hasGraph('cluster_' . $name)) {
         $clusterGraph = Graph::create('cluster_' . $name);
         $this->_addAttributes($clusterGraph, $attributes);
         $this->graph->addGraph($clusterGraph->setLabel($label));
     } else {
         $clusterGraph = $this->graph->getGraph('cluster_' . $name);
     }
     return $clusterGraph;
 }