Merge pull request #137 from creative-commoners/pulls/2.0/psr2

Apply PSR-2 coding conventions
This commit is contained in:
Franco Springveldt 2017-09-07 15:38:53 +12:00 committed by GitHub
commit 7d22660989
19 changed files with 141 additions and 86 deletions

View File

@ -8,7 +8,7 @@
class DocumentationHelper class DocumentationHelper
{ {
/** /**
* String helper for cleaning a file name to a readable version. * String helper for cleaning a file name to a readable version.
* *
* @param string $name to convert * @param string $name to convert
* *
@ -95,9 +95,9 @@ class DocumentationHelper
/** /**
* Helper function to normalize paths to unix style directory separators * Helper function to normalize paths to unix style directory separators
* *
* @param string * @param string
* *
* @return string * @return string
*/ */
public static function normalizePath($path) public static function normalizePath($path)
@ -111,9 +111,9 @@ class DocumentationHelper
/** /**
* Helper function to make normalized paths relative * Helper function to make normalized paths relative
* *
* @param string * @param string
* *
* @return string * @return string
*/ */
public static function relativePath($path) public static function relativePath($path)

View File

@ -90,7 +90,9 @@ class DocumentationManifest
$this->registeredEntities = new ArrayList(); $this->registeredEntities = new ArrayList();
$this->cache = SS_Cache::factory( $this->cache = SS_Cache::factory(
'DocumentationManifest', 'Core', array( 'DocumentationManifest',
'Core',
array(
'automatic_serialization' => true, 'automatic_serialization' => true,
'lifetime' => null 'lifetime' => null
) )
@ -159,7 +161,8 @@ class DocumentationManifest
* @var DocumentationEntity $entity * @var DocumentationEntity $entity
*/ */
$entity = Injector::inst()->create( $entity = Injector::inst()->create(
'DocumentationEntity', $key 'DocumentationEntity',
$key
); );
$entity->setPath(DocumentationHelper::normalizePath(Controller::join_links($path, $lang, '/'))); $entity->setPath(DocumentationHelper::normalizePath(Controller::join_links($path, $lang, '/')));
@ -242,7 +245,9 @@ class DocumentationManifest
} }
Config::inst()->update( Config::inst()->update(
'DocumentationManifest', 'register_entities', $entities 'DocumentationManifest',
'register_entities',
$entities
); );
$this->automaticallyPopulated = true; $this->automaticallyPopulated = true;
@ -371,7 +376,8 @@ class DocumentationManifest
foreach ($grouped as $entity) { foreach ($grouped as $entity) {
uasort( uasort(
$entity, function ($a, $b) { $entity,
function ($a, $b) {
// ensure parent directories are first // ensure parent directories are first
$a['filepath'] = str_replace('index.md', '', $a['filepath']); $a['filepath'] = str_replace('index.md', '', $a['filepath']);
$b['filepath'] = str_replace('index.md', '', $b['filepath']); $b['filepath'] = str_replace('index.md', '', $b['filepath']);
@ -417,7 +423,8 @@ class DocumentationManifest
Config::inst()->get('DocumentationViewer', 'link_base'), Config::inst()->get('DocumentationViewer', 'link_base'),
'', '',
$link $link
), '/' ),
'/'
); );
} }
@ -461,7 +468,10 @@ class DocumentationManifest
public function handleFolder($basename, $path, $depth) public function handleFolder($basename, $path, $depth)
{ {
$folder = Injector::inst()->create( $folder = Injector::inst()->create(
'DocumentationFolder', $this->entity, $basename, $path 'DocumentationFolder',
$this->entity,
$basename,
$path
); );
// Add main folder link // Add main folder link
@ -491,7 +501,9 @@ class DocumentationManifest
{ {
$page = Injector::inst()->create( $page = Injector::inst()->create(
'DocumentationPage', 'DocumentationPage',
$this->entity, $basename, $path $this->entity,
$basename,
$path
); );
// populate any meta data // populate any meta data

View File

@ -21,7 +21,7 @@ class DocumentationManifestFileFinder extends SS_FileFinder
); );
/** /**
* *
*/ */
public function acceptDir($basename, $pathname, $depth) public function acceptDir($basename, $pathname, $depth)
{ {

View File

@ -125,7 +125,6 @@ class DocumentationParser
$inner = true; $inner = true;
} }
} elseif (preg_match('/^[\ ]{0,3}?[\t](.*)/', $line, $matches)) { } elseif (preg_match('/^[\ ]{0,3}?[\t](.*)/', $line, $matches)) {
// inner line of block, or first line of standard markdown code block // inner line of block, or first line of standard markdown code block
// regex removes first tab (any following tabs are part of the code). // regex removes first tab (any following tabs are part of the code).
if (!$started) { if (!$started) {
@ -248,7 +247,9 @@ class DocumentationParser
if (substr($url, 0, 1) == '/') { if (substr($url, 0, 1) == '/') {
$relativeUrl = DocumentationHelper::normalizePath( $relativeUrl = DocumentationHelper::normalizePath(
str_replace( str_replace(
BASE_PATH, '', Controller::join_links( BASE_PATH,
'',
Controller::join_links(
$page->getEntity()->getPath(), $page->getEntity()->getPath(),
$url $url
) )
@ -326,11 +327,11 @@ class DocumentationParser
$html_format = '<a href="http://api.silverstripe.org/search/lookup/?q=%s&version=%s&module=%s">%s</a>'; $html_format = '<a href="http://api.silverstripe.org/search/lookup/?q=%s&version=%s&module=%s">%s</a>';
// parse api links without backticks into html // parse api links without backticks into html
foreach($regexs as $type => $regex) { foreach ($regexs as $type => $regex) {
preg_match_all($regex, $markdown, $links); preg_match_all($regex, $markdown, $links);
if($links) { if ($links) {
foreach($links[0] as $i => $match) { foreach ($links[0] as $i => $match) {
if($type === 'no_title') { if ($type === 'no_title') {
$title = $links[1][$i]; $title = $links[1][$i];
$link = $links[1][$i]; $link = $links[1][$i];
// change backticked links to avoid being parsed in the same way as non-backticked links // change backticked links to avoid being parsed in the same way as non-backticked links
@ -349,8 +350,8 @@ class DocumentationParser
// recover backticked links with no titles // recover backticked links with no titles
preg_match_all('#XYZ(.*)?XYZ#', $markdown, $links); preg_match_all('#XYZ(.*)?XYZ#', $markdown, $links);
if($links) { if ($links) {
foreach($links[0] as $i => $match) { foreach ($links[0] as $i => $match) {
$link = $links[1][$i]; $link = $links[1][$i];
$markdown = str_replace($match, '`[api:'.$link.']`', $markdown); $markdown = str_replace($match, '`[api:'.$link.']`', $markdown);
} }
@ -358,8 +359,8 @@ class DocumentationParser
// recover backticked links with titles // recover backticked links with titles
preg_match_all('#XX(.*)?YY(.*)?ZZ#', $markdown, $links); preg_match_all('#XX(.*)?YY(.*)?ZZ#', $markdown, $links);
if($links) { if ($links) {
foreach($links[0] as $i => $match) { foreach ($links[0] as $i => $match) {
$title = $links[1][$i]; $title = $links[1][$i];
$link = $links[2][$i]; $link = $links[2][$i];
$markdown = str_replace($match, '`['.$title.'](api:'.$link.')`', $markdown); $markdown = str_replace($match, '`['.$title.'](api:'.$link.')`', $markdown);
@ -367,7 +368,6 @@ class DocumentationParser
} }
return $markdown; return $markdown;
} }
/** /**
@ -488,7 +488,7 @@ class DocumentationParser
$fileBaseLink, $fileBaseLink,
$url $url
); );
} else if (preg_match('/^#/', $url)) { } elseif (preg_match('/^#/', $url)) {
// for relative links begining with a hash use the current page link // for relative links begining with a hash use the current page link
$relativeUrl = Controller::join_links($baselink, $page->getRelativeLink(), $url); $relativeUrl = Controller::join_links($baselink, $page->getRelativeLink(), $url);
} else { } else {
@ -521,5 +521,4 @@ class DocumentationParser
return $md; return $md;
} }
} }

View File

@ -1,7 +1,7 @@
<?php <?php
/** /**
* A mapping store of given permalinks to the full documentation path or useful * A mapping store of given permalinks to the full documentation path or useful
* for customizing the shortcut URLs used in the viewer. * for customizing the shortcut URLs used in the viewer.
* *
* Redirects the user from example.com/foo to example.com/en/module/foo * Redirects the user from example.com/foo to example.com/en/module/foo
@ -25,7 +25,7 @@ class DocumentationPermalinks
* )); * ));
* </code> * </code>
* *
* Do not need to include the language or the version current as it * Do not need to include the language or the version current as it
* will add it based off the language or version in the session * will add it based off the language or version in the session
* *
* @param array * @param array

View File

@ -8,20 +8,20 @@ set_include_path(
require_once 'Zend/Search/Lucene.php'; require_once 'Zend/Search/Lucene.php';
/** /**
* Documentation Search powered by Lucene. You will need Zend_Lucene installed * Documentation Search powered by Lucene. You will need Zend_Lucene installed
* on your path. * on your path.
* *
* To rebuild the indexes run the {@link RebuildLuceneDocsIndex} task. You may * To rebuild the indexes run the {@link RebuildLuceneDocsIndex} task. You may
* wish to setup a cron job to remake the indexes on a regular basis. * wish to setup a cron job to remake the indexes on a regular basis.
* *
* This class has the ability to generate an OpenSearch RSS formatted feeds * This class has the ability to generate an OpenSearch RSS formatted feeds
* simply by using the URL: * simply by using the URL:
* *
* <code> * <code>
* yoursite.com/search/?q=Foo&format=rss. // Format can either be specified as rss or left off. * yoursite.com/search/?q=Foo&format=rss. // Format can either be specified as rss or left off.
* </code> * </code>
* *
* To get a specific amount of results you can also use the modifiers start and * To get a specific amount of results you can also use the modifiers start and
* limit: * limit:
* *
* <code> * <code>
@ -127,7 +127,7 @@ class DocumentationSearch
* Folder name for indexes (in the temp folder). * Folder name for indexes (in the temp folder).
* *
* @config * @config
* @var string * @var string
*/ */
private static $index_location; private static $index_location;
@ -363,7 +363,7 @@ class DocumentationSearch
} }
/** /**
* OpenSearch MetaData fields. For a list of fields consult * OpenSearch MetaData fields. For a list of fields consult
* {@link self::get_meta_data()} * {@link self::get_meta_data()}
* *
* @param array * @param array
@ -406,7 +406,7 @@ class DocumentationSearch
} }
/** /**
* Renders the search results into a template. Either the search results * Renders the search results into a template. Either the search results
* template or the Atom feed. * template or the Atom feed.
*/ */
public function renderResults() public function renderResults()
@ -428,7 +428,8 @@ class DocumentationSearch
$title = ($title = $this->getTitle()) ? ' - '. $title : ""; $title = ($title = $this->getTitle()) ? ' - '. $title : "";
$link = Controller::join_links( $link = Controller::join_links(
$this->outputController->Link(), 'DocumentationOpenSearchController/description/' $this->outputController->Link(),
'DocumentationOpenSearchController/description/'
); );
$data->setField('Title', $data->Title . $title); $data->setField('Title', $data->Title . $title);

View File

@ -110,7 +110,7 @@ class DocumentationViewer extends Controller implements PermissionProvider
) )
); );
Requirements::combine_files( Requirements::combine_files(
'docs.css', 'docs.css',
array( array(
DOCSVIEWER_DIR .'/css/highlight.css', DOCSVIEWER_DIR .'/css/highlight.css',
DOCSVIEWER_DIR .'/css/normalize.css', DOCSVIEWER_DIR .'/css/normalize.css',
@ -204,7 +204,8 @@ class DocumentationViewer extends Controller implements PermissionProvider
// Strip off the base url // Strip off the base url
// //
$base = ltrim( $base = ltrim(
Config::inst()->get('DocumentationViewer', 'link_base'), '/' Config::inst()->get('DocumentationViewer', 'link_base'),
'/'
); );
if ($base && strpos($url, $base) !== false) { if ($base && strpos($url, $base) !== false) {
@ -393,7 +394,8 @@ class DocumentationViewer extends Controller implements PermissionProvider
// add children // add children
$children = $this->getManifest()->getChildrenFor( $children = $this->getManifest()->getChildrenFor(
$entity->getPath(), ($record) ? $record->getPath() : $entity->getPath() $entity->getPath(),
($record) ? $record->getPath() : $entity->getPath()
); );
} else { } else {
if ($current && $current->getKey() == $entity->getKey()) { if ($current && $current->getKey() == $entity->getKey()) {
@ -438,7 +440,7 @@ class DocumentationViewer extends Controller implements PermissionProvider
public function replaceChildrenCalls($html) public function replaceChildrenCalls($html)
{ {
$codes = new ShortcodeParser(); $codes = new ShortcodeParser();
$codes->register('CHILDREN', array($this, 'includeChildren')); $codes->register('CHILDREN', array($this, 'includeChildren'));
return $codes->parse($html); return $codes->parse($html);
} }
@ -694,7 +696,6 @@ class DocumentationViewer extends Controller implements PermissionProvider
$entity = $page->getEntity(); $entity = $page->getEntity();
if ($entity && isset(self::$edit_links[strtolower($entity->title)])) { if ($entity && isset(self::$edit_links[strtolower($entity->title)])) {
// build the edit link, using the version defined // build the edit link, using the version defined
$url = self::$edit_links[strtolower($entity->title)]; $url = self::$edit_links[strtolower($entity->title)];
$version = $entity->getVersion(); $version = $entity->getVersion();
@ -738,7 +739,8 @@ class DocumentationViewer extends Controller implements PermissionProvider
{ {
return ($this->record) return ($this->record)
? $this->getManifest()->getNextPage( ? $this->getManifest()->getNextPage(
$this->record->getPath(), $this->getEntity()->getPath() $this->record->getPath(),
$this->getEntity()->getPath()
) )
: null; : null;
} }
@ -753,7 +755,8 @@ class DocumentationViewer extends Controller implements PermissionProvider
{ {
return ($this->record) return ($this->record)
? $this->getManifest()->getPreviousPage( ? $this->getManifest()->getPreviousPage(
$this->record->getPath(), $this->getEntity()->getPath() $this->record->getPath(),
$this->getEntity()->getPath()
) )
: null; : null;
} }

View File

@ -34,7 +34,8 @@ class DocumentationAdvancedSearchForm extends Form
CheckboxSetField::create( CheckboxSetField::create(
'Versions', 'Versions',
_t('DocumentationViewer.VERSIONS', 'Versions'), _t('DocumentationViewer.VERSIONS', 'Versions'),
$versions, $searchedVersions $versions,
$searchedVersions
) )
); );

View File

@ -1,9 +1,9 @@
<?php <?php
/** /**
* A specific documentation folder within a {@link DocumentationEntity}. * A specific documentation folder within a {@link DocumentationEntity}.
* *
* Maps to a folder on the file system. * Maps to a folder on the file system.
* *
* @package docsviewer * @package docsviewer
* @subpackage model * @subpackage model

View File

@ -87,7 +87,8 @@ class DocumentationPage extends ViewableData
); );
$titleParts = array_filter( $titleParts = array_filter(
$titleParts, function ($val) { $titleParts,
function ($val) {
if ($val) { if ($val) {
return $val; return $val;
} }

View File

@ -10,16 +10,16 @@ class CheckDocsSourcesTask extends BuildTask
protected $description = "Check validity of all docs source files registered"; protected $description = "Check validity of all docs source files registered";
public function start() public function start()
{ {
if(!Director::is_cli()) { if (!Director::is_cli()) {
echo "<ul>"; echo "<ul>";
} }
} }
public function end() public function end()
{ {
if(Director::is_cli()) { if (Director::is_cli()) {
echo "\nTotal errors: {$this->errors}\n"; echo "\nTotal errors: {$this->errors}\n";
} else { } else {
echo "</ul>"; echo "</ul>";
@ -27,10 +27,10 @@ class CheckDocsSourcesTask extends BuildTask
} }
} }
public function showError($error) public function showError($error)
{ {
$this->errors++; $this->errors++;
if(Director::is_cli()) { if (Director::is_cli()) {
echo "\n$error"; echo "\n$error";
} else { } else {
echo "<li>" . Convert::raw2xml($error) . "</li>"; echo "<li>" . Convert::raw2xml($error) . "</li>";

View File

@ -1,9 +1,9 @@
<?php <?php
/** /**
* Rebuilds the search indexes for the documentation pages. * Rebuilds the search indexes for the documentation pages.
* *
* For the hourly cron rebuild use RebuildLuceneDocusIndex_Hourly * For the hourly cron rebuild use RebuildLuceneDocusIndex_Hourly
* *
* @package docsviewer * @package docsviewer
* @subpackage tasks * @subpackage tasks
@ -87,25 +87,29 @@ class RebuildLuceneDocsIndex extends BuildTask
$doc->addField( $doc->addField(
Zend_Search_Lucene_Field::Keyword( Zend_Search_Lucene_Field::Keyword(
'Version', $page->getEntity()->getVersion() 'Version',
$page->getEntity()->getVersion()
) )
); );
$doc->addField( $doc->addField(
Zend_Search_Lucene_Field::Keyword( Zend_Search_Lucene_Field::Keyword(
'Language', $page->getEntity()->getLanguage() 'Language',
$page->getEntity()->getLanguage()
) )
); );
$doc->addField( $doc->addField(
Zend_Search_Lucene_Field::Keyword( Zend_Search_Lucene_Field::Keyword(
'Entity', $page->getEntity() 'Entity',
$page->getEntity()
) )
); );
$doc->addField( $doc->addField(
Zend_Search_Lucene_Field::Keyword( Zend_Search_Lucene_Field::Keyword(
'Link', $page->Link() 'Link',
$page->Link()
) )
); );

View File

@ -2,7 +2,7 @@
class DocumentationEntityTest extends SapphireTest class DocumentationEntityTest extends SapphireTest
{ {
public function dataCompare() public function dataCompare()
{ {
return array( return array(
array('3', '3.0', 1), array('3', '3.0', 1),
@ -20,7 +20,7 @@ class DocumentationEntityTest extends SapphireTest
* @param string $right * @param string $right
* @param int $result * @param int $result
*/ */
public function testCompare($left, $right, $result) public function testCompare($left, $right, $result)
{ {
$leftVersion = new DocumentationEntity('Framework'); $leftVersion = new DocumentationEntity('Framework');
$leftVersion->setVersion($left); $leftVersion->setVersion($left);

View File

@ -16,18 +16,24 @@ class DocumentationManifestTests extends SapphireTest
// explicitly use dev/docs. Custom paths should be tested separately // explicitly use dev/docs. Custom paths should be tested separately
Config::inst()->update( Config::inst()->update(
'DocumentationViewer', 'link_base', 'dev/docs' 'DocumentationViewer',
'link_base',
'dev/docs'
); );
// disable automatic module registration so modules don't interfere. // disable automatic module registration so modules don't interfere.
Config::inst()->update( Config::inst()->update(
'DocumentationManifest', 'automatic_registration', false 'DocumentationManifest',
'automatic_registration',
false
); );
Config::inst()->remove('DocumentationManifest', 'register_entities'); Config::inst()->remove('DocumentationManifest', 'register_entities');
Config::inst()->update( Config::inst()->update(
'DocumentationManifest', 'register_entities', array( 'DocumentationManifest',
'register_entities',
array(
array( array(
'Path' => DOCSVIEWER_PATH . "/tests/docs/", 'Path' => DOCSVIEWER_PATH . "/tests/docs/",
'Title' => 'Doc Test', 'Title' => 'Doc Test',
@ -189,7 +195,8 @@ class DocumentationManifestTests extends SapphireTest
); );
$this->assertDOSContains( $this->assertDOSContains(
$expected, $this->manifest->getChildrenFor( $expected,
$this->manifest->getChildrenFor(
DOCSVIEWER_PATH . '/tests/docs/en/' DOCSVIEWER_PATH . '/tests/docs/en/'
) )
); );

View File

@ -42,7 +42,8 @@ class DocumentationPageTest extends SapphireTest
// single layer // single layer
$this->assertEquals( $this->assertEquals(
'dev/docs/en/doctest/2.4/test/', $page->Link(), 'dev/docs/en/doctest/2.4/test/',
$page->Link(),
'The page link should have no extension and have a language' 'The page link should have no extension and have a language'
); );

View File

@ -23,7 +23,9 @@ class DocumentationParserTest extends SapphireTest
// explicitly use dev/docs. Custom paths should be tested separately // explicitly use dev/docs. Custom paths should be tested separately
Config::inst()->update( Config::inst()->update(
'DocumentationViewer', 'link_base', 'dev/docs/' 'DocumentationViewer',
'link_base',
'dev/docs/'
); );
$this->entity = new DocumentationEntity('DocumentationParserTest'); $this->entity = new DocumentationEntity('DocumentationParserTest');
@ -294,7 +296,9 @@ HTML;
); );
$expected = Controller::join_links( $expected = Controller::join_links(
Director::absoluteBaseURL(), DOCSVIEWER_DIR, '/tests/docs/en/subfolder/_images/image.png' Director::absoluteBaseURL(),
DOCSVIEWER_DIR,
'/tests/docs/en/subfolder/_images/image.png'
); );
$this->assertContains( $this->assertContains(
@ -304,15 +308,20 @@ HTML;
$this->assertContains( $this->assertContains(
sprintf( sprintf(
'[parent image link](%s)', Controller::join_links( '[parent image link](%s)',
Director::absoluteBaseURL(), DOCSVIEWER_DIR, '/tests/docs/en/_images/image.png' Controller::join_links(
Director::absoluteBaseURL(),
DOCSVIEWER_DIR,
'/tests/docs/en/_images/image.png'
) )
), ),
$result $result
); );
$expected = Controller::join_links( $expected = Controller::join_links(
Director::absoluteBaseURL(), DOCSVIEWER_DIR, '/tests/docs/en/_images/image.png' Director::absoluteBaseURL(),
DOCSVIEWER_DIR,
'/tests/docs/en/_images/image.png'
); );
$this->assertContains( $this->assertContains(
@ -350,11 +359,10 @@ HTML;
array('[Title](api:DataObject::populateDefaults())',sprintf($html_format, 'DataObject::populateDefaults()', 'Title')) array('[Title](api:DataObject::populateDefaults())',sprintf($html_format, 'DataObject::populateDefaults()', 'Title'))
); );
foreach($test_cases as $test_case) { foreach ($test_cases as $test_case) {
$expected_html = $test_case[1]; $expected_html = $test_case[1];
$this->assertContains($expected_html, $parsed_page); $this->assertContains($expected_html, $parsed_page);
} }
} }
public function testHeadlineAnchors() public function testHeadlineAnchors()

View File

@ -13,20 +13,26 @@ class DocumentationSearchTest extends FunctionalTest
Config::nest(); Config::nest();
// explicitly use dev/docs. Custom paths should be tested separately // explicitly use dev/docs. Custom paths should be tested separately
Config::inst()->update( Config::inst()->update(
'DocumentationViewer', 'link_base', 'dev/docs' 'DocumentationViewer',
'link_base',
'dev/docs'
); );
// disable automatic module registration so modules don't interfere. // disable automatic module registration so modules don't interfere.
Config::inst()->update( Config::inst()->update(
'DocumentationManifest', 'automatic_registration', false 'DocumentationManifest',
'automatic_registration',
false
); );
Config::inst()->remove('DocumentationManifest', 'register_entities'); Config::inst()->remove('DocumentationManifest', 'register_entities');
Config::inst()->update('DocumentationSearch', 'enabled', true); Config::inst()->update('DocumentationSearch', 'enabled', true);
Config::inst()->update( Config::inst()->update(
'DocumentationManifest', 'register_entities', array( 'DocumentationManifest',
'register_entities',
array(
array( array(
'Path' => DOCSVIEWER_PATH . "/tests/docs-search/", 'Path' => DOCSVIEWER_PATH . "/tests/docs-search/",
'Title' => 'Docs Search Test', ) 'Title' => 'Docs Search Test', )
@ -54,8 +60,8 @@ class DocumentationSearchTest extends FunctionalTest
$response = $c->handleRequest(new SS_HTTPRequest('GET', 'description/'), DataModel::inst()); $response = $c->handleRequest(new SS_HTTPRequest('GET', 'description/'), DataModel::inst());
// $this->assertEquals(404, $response->getStatusCode()); // $this->assertEquals(404, $response->getStatusCode());
// test we get a response to the description. The meta data test will // test we get a response to the description. The meta data test will
// check that the individual fields are valid but we should check urls // check that the individual fields are valid but we should check urls
// are there // are there
Config::inst()->update('DocumentationSearch', 'enabled', true); Config::inst()->update('DocumentationSearch', 'enabled', true);

View File

@ -22,18 +22,24 @@ class DocumentationViewerTest extends FunctionalTest
// explicitly use dev/docs. Custom paths should be tested separately // explicitly use dev/docs. Custom paths should be tested separately
Config::inst()->update( Config::inst()->update(
'DocumentationViewer', 'link_base', 'dev/docs/' 'DocumentationViewer',
'link_base',
'dev/docs/'
); );
// disable automatic module registration so modules don't interfere. // disable automatic module registration so modules don't interfere.
Config::inst()->update( Config::inst()->update(
'DocumentationManifest', 'automatic_registration', false 'DocumentationManifest',
'automatic_registration',
false
); );
Config::inst()->remove('DocumentationManifest', 'register_entities'); Config::inst()->remove('DocumentationManifest', 'register_entities');
Config::inst()->update( Config::inst()->update(
'DocumentationManifest', 'register_entities', array( 'DocumentationManifest',
'register_entities',
array(
array( array(
'Path' => DOCSVIEWER_PATH . "/tests/docs/", 'Path' => DOCSVIEWER_PATH . "/tests/docs/",
'Title' => 'Doc Test', 'Title' => 'Doc Test',

View File

@ -16,20 +16,26 @@ class DocumentationViewerVersionWarningTest extends SapphireTest
Config::nest(); Config::nest();
// explicitly use dev/docs. Custom paths should be tested separately // explicitly use dev/docs. Custom paths should be tested separately
Config::inst()->update( Config::inst()->update(
'DocumentationViewer', 'link_base', 'dev/docs' 'DocumentationViewer',
'link_base',
'dev/docs'
); );
// disable automatic module registration so modules don't interfere. // disable automatic module registration so modules don't interfere.
Config::inst()->update( Config::inst()->update(
'DocumentationManifest', 'automatic_registration', false 'DocumentationManifest',
'automatic_registration',
false
); );
Config::inst()->remove('DocumentationManifest', 'register_entities'); Config::inst()->remove('DocumentationManifest', 'register_entities');
Config::inst()->update( Config::inst()->update(
'DocumentationManifest', 'register_entities', array( 'DocumentationManifest',
'register_entities',
array(
array( array(
'Path' => DOCSVIEWER_PATH . "/tests/docs/", 'Path' => DOCSVIEWER_PATH . "/tests/docs/",
'Title' => 'Doc Test', 'Title' => 'Doc Test',