silverstripe-docsviewer/tests/DocumentationPageTest.php
Ingo Schommer 277bca7b11 FEATURE Added parsing support for relative links (relative to module base). Introduced DocumentationPage to encapsulate this information.
ENHANCEMENT Saving $ModuleName in viewer instead of getting it from Remaining[0]
MINOR Don't include version in breadcrumbs, doesn't make sense in this context (e.g. "2.4/en/cms", the "2.4" part is connecte to the cms module, hence an index of all versions regardless of module is not very useful)
2010-08-01 04:46:32 +00:00

33 lines
984 B
PHP

<?php
class DocumentationPageTest extends SapphireTest {
function testGetRelativePath() {
$page = new DocumentationPage(
'test.md',
new DocumentationEntity('mymodule', null, BASE_PATH . '/sapphiredocs/tests/docs/')
);
$this->assertEquals('test.md', $page->getRelativePath());
$page = new DocumentationPage(
'subfolder/subpage.md',
new DocumentationEntity('mymodule', null, BASE_PATH . '/sapphiredocs/tests/docs/')
);
$this->assertEquals('subfolder/subpage.md', $page->getRelativePath());
}
function testGetPath() {
$absPath = BASE_PATH . '/sapphiredocs/tests/docs/';
$page = new DocumentationPage(
'test.md',
new DocumentationEntity('mymodule', null, $absPath)
);
$this->assertEquals($absPath . 'en/test.md', $page->getPath());
$page = new DocumentationPage(
'subfolder/subpage.md',
new DocumentationEntity('mymodule', null, $absPath)
);
$this->assertEquals($absPath . 'en/subfolder/subpage.md', $page->getPath());
}
}