mirror of
https://github.com/silverstripe/silverstripe-docsviewer
synced 2024-10-22 11:05:56 +02:00
33 lines
1.1 KiB
PHP
33 lines
1.1 KiB
PHP
<?php
|
|
class DocumentationPageTest extends SapphireTest {
|
|
|
|
function testGetRelativePath() {
|
|
$page = new DocumentationPage();
|
|
$page->setRelativePath('test.md');
|
|
$page->setEntity(new DocumentationEntity('mymodule', null, BASE_PATH . '/sapphiredocs/tests/docs/'));
|
|
|
|
$this->assertEquals('test.md', $page->getRelativePath());
|
|
|
|
$page = new DocumentationPage();
|
|
$page->setRelativePath('subfolder/subpage.md');
|
|
$page->setEntity(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();
|
|
$page->setRelativePath('test.md');
|
|
$page->setEntity(new DocumentationEntity('mymodule', null, $absPath));
|
|
|
|
$this->assertEquals($absPath . 'en/test.md', $page->getPath());
|
|
|
|
$page = new DocumentationPage();
|
|
$page->setRelativePath('subfolder/subpage.md');
|
|
$page->setEntity(new DocumentationEntity('mymodule', null, $absPath));
|
|
|
|
$this->assertEquals($absPath . 'en/subfolder/subpage.md', $page->getPath());
|
|
}
|
|
|
|
} |