Created
August 9, 2014 19:35
-
-
Save ircmaxell/d5925f42dcaedab78ee6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* @covers ::generateText | |
*/ | |
public function testGenerateText() { | |
$a = p::mock(Vertex::class); | |
p::when($a)->__toString()->thenReturn('a'); | |
$b = p::mock(Vertex::class); | |
p::when($b)->__toString()->thenReturn('b'); | |
$c = p::mock(Vertex::class); | |
p::when($c)->__toString()->thenReturn('c'); | |
$graph = p::mock(DirectedAdjacencyList::class); | |
p::when($graph)->eachVertex()->thenReturn(call_user_func(function() use ($a, $b, $c) { | |
yield $a => []; | |
yield $b => []; | |
yield $c => []; | |
})); | |
p::when($graph)->eachEdge()->thenReturn([[$a, $b], [$b, $c], [$c, $a]]); | |
$printer = new GraphPrinter; | |
$this->assertContains('node_0', $printer->generateText($graph)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment