public function ensureArc($tail, $head)
{
$this->ensureVertex($tail)->ensureVertex($head);
if (!$this->vertices[$tail]->contains($head)) {
$this->size++;
}
$this->vertices[$tail]->attach($head);
}
/** * @covers ::generateText * @covers ::convertGraph */ public function testGenerateText() { $a = new DummyVertex('a'); $b = new DummyVertex('b'); $c = new DummyVertex('c'); $graph = new DirectedAdjacencyList(); $graph->ensureArc($a, $b); $graph->ensureArc($b, $c); $graph->ensureArc($c, $b); $printer = new GraphPrinter(); $this->assertContains('node_0', $printer->generateText($graph)); }