public function testTOC() { $devhelp = new Devhelp(@file_get_contents('adg.devhelp2')); $this->assertEquals($devhelp->getTOC(), array()); $this->assertEmpty($devhelp->getTOC(), array()); $this->assertTrue($devhelp->process()); $this->assertNotEmpty($devhelp->getTOC()); $toc = $devhelp->getTOC(); $this->assertEquals($toc['Introduction.html']['parent']['link'], ''); $this->assertEquals($toc['']['name'], ''); $this->assertArrayNotHasKey('parent', $toc['']); $this->assertArrayHasKey('sub', $toc['']); $this->assertEquals($toc['NEWS.html']['name'], 'News archive'); $this->assertEquals($toc['NEWS.html']['parent']['link'], 'Introduction.html'); $this->assertEquals($toc['Matrix.html']['parent']['link'], 'Core-gboxed.html'); $this->assertArrayNotHasKey('sub', $toc['NEWS.html']); $this->assertArrayHasKey('sub', $toc['Introduction.html']); $this->assertArrayNotHasKey('sub', $toc['Matrix.html']); $this->assertArrayHasKey('sub', $toc['Core.html']); }
/** * Get the TOC from the DevhelpFile * * The returned array will be cached in lookupNode(). * * @return Array The table of contents parsed from $DevhelpFile */ public function getTOC() { $devhelp = new Devhelp(@file_get_contents($this->DevhelpFile)); return $devhelp->process() ? $devhelp->getTOC() : array(); }