mirror of
https://github.com/silverstripe/doc.silverstripe.org
synced 2024-10-22 17:05:50 +02:00
ec0e4a4b96
git-svn-id: http://svn.silverstripe.com/projects/ss2doc/branches/v2@116279 467b73ca-7a2a-4603-9d3b-597d59a354a9
33 lines
1.3 KiB
PHP
33 lines
1.3 KiB
PHP
<?php
|
|
/**
|
|
* @package sapphiredocs
|
|
*/
|
|
class DocumentationEntityTest extends SapphireTest {
|
|
|
|
function testDocumentationEntityAccessing() {
|
|
$entity = new DocumentationEntity('docs', '1.0', '../sapphiredocs/tests/docs/', 'My Test');
|
|
|
|
$this->assertEquals($entity->getTitle(), 'My Test');
|
|
$this->assertEquals($entity->getVersions(), array('1.0'));
|
|
$this->assertEquals($entity->getLanguages(), array('en', 'de'));
|
|
$this->assertEquals($entity->getModuleFolder(), 'docs');
|
|
|
|
$this->assertTrue($entity->hasVersion('1.0'));
|
|
$this->assertFalse($entity->hasVersion('2.0'));
|
|
|
|
$this->assertTrue($entity->hasLanguage('en'));
|
|
$this->assertFalse($entity->hasLanguage('fr'));
|
|
}
|
|
|
|
function testGetCurrentVersion() {
|
|
$entity = new DocumentationEntity('docs', '1.0', '../sapphiredocs/tests/docs/', 'My Test');
|
|
$entity->addVersion('1.1', '../sapphiredocs/tests/docs-2/');
|
|
$entity->addVersion('0.0', '../sapphiredocs/tests/docs-3/');
|
|
$this->assertEquals('1.1', $entity->getCurrentVersion(), 'Automatic version sorting');
|
|
|
|
$entity = new DocumentationEntity('docs', '1.0', '../sapphiredocs/tests/docs/', 'My Test');
|
|
$entity->addVersion('1.1.', '../sapphiredocs/tests/docs-2/');
|
|
$entity->setCurrentVersion('1.0');
|
|
$this->assertEquals('1.0', $entity->getCurrentVersion(), 'Manual setting');
|
|
}
|
|
} |