2010-08-01 06:46:32 +02:00
|
|
|
<?php
|
|
|
|
/**
|
2012-04-08 11:36:16 +02:00
|
|
|
* @package docsviewer
|
2012-04-08 11:23:49 +02:00
|
|
|
* @subpackage tests
|
2010-08-01 06:46:32 +02:00
|
|
|
*/
|
|
|
|
class DocumentationEntityTest extends SapphireTest {
|
|
|
|
|
|
|
|
function testDocumentationEntityAccessing() {
|
2012-04-08 11:36:16 +02:00
|
|
|
$entity = new DocumentationEntity('docs', '1.0', DOCSVIEWER_PATH .'/tests/docs/', 'My Test');
|
2010-08-01 06:46:32 +02:00
|
|
|
|
|
|
|
$this->assertEquals($entity->getTitle(), 'My Test');
|
|
|
|
$this->assertEquals($entity->getVersions(), array('1.0'));
|
|
|
|
$this->assertEquals($entity->getLanguages(), array('en', 'de'));
|
2011-07-01 08:49:31 +02:00
|
|
|
$this->assertEquals($entity->getFolder(), 'docs');
|
2010-08-01 06:46:32 +02:00
|
|
|
|
|
|
|
$this->assertTrue($entity->hasVersion('1.0'));
|
|
|
|
$this->assertFalse($entity->hasVersion('2.0'));
|
|
|
|
|
|
|
|
$this->assertTrue($entity->hasLanguage('en'));
|
|
|
|
$this->assertFalse($entity->hasLanguage('fr'));
|
|
|
|
}
|
2010-08-01 09:03:48 +02:00
|
|
|
|
2011-07-08 04:42:52 +02:00
|
|
|
function testgetStableVersion() {
|
2012-04-08 11:36:16 +02:00
|
|
|
$entity = new DocumentationEntity('docs', '1.0', DOCSVIEWER_PATH. '/tests/docs/', 'My Test');
|
|
|
|
$entity->addVersion('1.1', DOCSVIEWER_PATH. '/tests/docs-v2.4/');
|
|
|
|
$entity->addVersion('0.0', DOCSVIEWER_PATH. '/tests/docs-v3.0/');
|
2011-07-08 04:42:52 +02:00
|
|
|
$this->assertEquals('1.1', $entity->getStableVersion(), 'Automatic version sorting');
|
2010-08-01 09:03:48 +02:00
|
|
|
|
2012-04-08 11:36:16 +02:00
|
|
|
$entity = new DocumentationEntity('docs', '1.0', DOCSVIEWER_PATH. '/tests/docs/', 'My Test');
|
|
|
|
$entity->addVersion('1.1.', DOCSVIEWER_PATH .'/tests/docs-v2.4/');
|
2011-07-08 04:42:52 +02:00
|
|
|
$entity->setStableVersion('1.0');
|
|
|
|
$this->assertEquals('1.0', $entity->getStableVersion(), 'Manual setting');
|
2010-08-01 09:03:48 +02:00
|
|
|
}
|
2010-08-01 06:46:32 +02:00
|
|
|
}
|