/** * @covers Navinator\Collection::validateNodes */ public function testValidateNodes() { $nodeData = array('alpha', 'alpha/a', 'alpha/a/b', 'alpha/a/b/c', 'beta', 'beta/a', 'beta/a/b', 'beta/a/b/c', 'gama', 'gama/a', 'gama/a/b', 'gama/a/b/c'); $nodes = array(); $c = new Collection(); foreach ($nodeData as $path) { $n = new Node($path); $nodes[$path] = $n; $c->addNode($n); } $c->validateNodes(); $nodeData = array('alpha/beta', 'alpha/beta/gama', 'alpha/beta-2/gama', 'test', 'test/beta', 'test/beta/gama'); $nodes = array(); $c = new Collection(); foreach ($nodeData as $path) { $n = new Node($path); $nodes[$path] = $n; $c->addNode($n); } $this->setExpectedException('Navinator\\Exception', "The following node(s) do not have a parent node in this collection : 'alpha/beta', 'alpha/beta-2/gama'"); $c->validateNodes(); }