/** * @covers Navinator\Collection::getNodeFromVar * @covers Navinator\Collection::getPathFromVar */ public function testGetFromVar() { $nodeData = array('alpha/beta/gamma/delta', 'alpha/beta', 'alpha', 'alpha/beta/gamma'); $nodes = array(); $c = new Collection(); foreach ($nodeData as $path) { $n = new Node($path); $nodes[$path] = $n; $c->addNode($n); } foreach ($nodeData as $path) { $node = $nodes[$path]; $this->assertSame($c->getNodeFromVar($path), $nodes[$path]); $this->assertSame($c->getNodeFromVar($node), $nodes[$path]); $this->assertSame($c->getPathFromVar($path), $path); $this->assertSame($c->getPathFromVar($node), $path); } }