Fhaculty\Graph\Tests\WalkTest::testWalkPath PHP Method

testWalkPath() public method

public testWalkPath ( )
    public function testWalkPath()
    {
        // 1 -- 2 -- 3
        $graph = new Graph();
        $v1 = $graph->createVertex(1);
        $v2 = $graph->createVertex(2);
        $v3 = $graph->createVertex(3);
        $e1 = $v1->createEdgeTo($v2);
        $e2 = $v2->createEdgeTo($v3);
        $walk = Walk::factoryFromEdges(array($e1, $e2), $v1);
        $this->assertEquals(3, count($walk->getVertices()));
        $this->assertEquals(2, count($walk->getEdges()));
        $this->assertSame($v1, $walk->getVertices()->getVertexFirst());
        $this->assertSame($v3, $walk->getVertices()->getVertexLast());
        $this->assertSame(array($v1, $e1, $v2, $e2, $v3), $walk->getAlternatingSequence());
        $this->assertTrue($walk->isValid());
        $graphClone = $walk->createGraph();
        $this->assertGraphEquals($graph, $graphClone);
        return $walk;
    }