function testCleanPageNames() { $names = array('documentation-Page', 'documentation_Page', 'documentation.md', 'documentation.pdf', 'documentation.file.txt', '.hidden'); $should = array('Documentation Page', 'Documentation Page', 'Documentation', 'Documentation', 'Documentation', '.hidden'); foreach ($names as $key => $value) { $this->assertEquals(DocumentationParser::clean_page_name($value), $should[$key]); } }
/** * Generate a list of breadcrumbs for the user. Based off the remaining params * in the url * * @return DataObjectSet */ function getBreadcrumbs() { $pages = array_merge(array($this->ModuleName), $this->Remaining); $output = new DataObjectSet(); // $output->push(new ArrayData(array( // 'Title' => ($this->Version) ? $this->Version : _t('DocumentationViewer.DOCUMENTATION', 'Documentation'), // 'Link' => $this->Link() // ))); if ($pages) { $path = array(); foreach ($pages as $i => $title) { if ($title) { // Don't add module name, already present in Link() if ($i > 0) { $path[] = $title; } $output->push(new ArrayData(array('Title' => DocumentationParser::clean_page_name($title), 'Link' => $this->Link($path)))); } } } return $output; }