/** * @test */ public function getDepthReturnsThePathDepthOfTheNode() { $node = new NodeData('/', $this->mockWorkspace); $this->assertEquals(0, $node->getDepth()); $node = new NodeData('/foo', $this->mockWorkspace); $this->assertEquals(1, $node->getDepth()); $node = new NodeData('/foo/bar', $this->mockWorkspace); $this->assertEquals(2, $node->getDepth()); $node = new NodeData('/foo/bar/baz/quux', $this->mockWorkspace); $this->assertEquals(4, $node->getDepth()); }
/** * Returns the level at which this node is located. * Counting starts with 0 for "/", 1 for "/foo", 2 for "/foo/bar" etc. * * @return integer * @api */ public function getDepth() { return $this->nodeData->getDepth(); }