diff --git a/code/DocumentationManifest.php b/code/DocumentationManifest.php index 541fadb..e54b815 100644 --- a/code/DocumentationManifest.php +++ b/code/DocumentationManifest.php @@ -156,8 +156,8 @@ class DocumentationManifest foreach ($langs as $k => $lang) { if (isset($possible[$lang])) { /** - * @var DocumentationEntity $entity -*/ + * @var DocumentationEntity $entity + */ $entity = Injector::inst()->create( 'DocumentationEntity', $key ); @@ -769,8 +769,8 @@ class DocumentationManifest $output = new ArrayList(); /** - * @var DocumentationEntity $check -*/ + * @var DocumentationEntity $check + */ foreach ($this->getEntities() as $check) { if ($check->getKey() == $entity->getKey()) { if ($check->getLanguage() == $entity->getLanguage()) { diff --git a/code/DocumentationParser.php b/code/DocumentationParser.php index 4326747..8317519 100755 --- a/code/DocumentationParser.php +++ b/code/DocumentationParser.php @@ -2,7 +2,7 @@ /** * Parser wrapping the Markdown Extra parser. - * + * * @see http://michelf.com/projects/php-markdown/extra/ * * @package docsviewer @@ -16,25 +16,25 @@ class DocumentationParser * @var array */ public static $heading_counts = array(); - + /** - * Parse a given path to the documentation for a file. Performs a case - * insensitive lookup on the file system. Automatically appends the file + * Parse a given path to the documentation for a file. Performs a case + * insensitive lookup on the file system. Automatically appends the file * extension to one of the markdown extensions as well so /install/ in a * web browser will match /install.md or /INSTALL.md. - * + * * Filepath: /var/www/myproject/src/cms/en/folder/subfolder/page.md * URL: http://myhost/mywebroot/dev/docs/2.4/cms/en/folder/subfolder/page * Webroot: http://myhost/mywebroot/ * Baselink: dev/docs/2.4/cms/en/ * Pathparts: folder/subfolder/page - * - * @param DocumentationPage $page - * @param String $baselink Link relative to webroot, up until the "root" of the module. Necessary to rewrite relative links - * of the module. Necessary to rewrite relative - * links * - * @return String + * @param DocumentationPage $page + * @param string $baselink Link relative to webroot, up until the "root" of the module. + * Necessary to rewrite relative links of the module. Necessary + * to rewrite relative links + * + * @return string */ public static function parse(DocumentationPage $page, $baselink = null) { @@ -43,7 +43,7 @@ class DocumentationParser } $md = $page->getMarkdown(true); - + // Pre-processing $md = self::rewrite_image_links($md, $page); $md = self::rewrite_relative_links($md, $page, $baselink); @@ -60,7 +60,7 @@ class DocumentationParser return $text; } - + public static function rewrite_code_blocks($md) { $started = false; @@ -148,8 +148,8 @@ class DocumentationParser var_dump('Inner line of code block'); } - // still inside a colon based block, if the line is only whitespace - // then continue with with it. We can continue with it for now as + // still inside a colon based block, if the line is only whitespace + // then continue with with it. We can continue with it for now as // it'll be tidied up later in the $end section. $inner = true; $output[$i] = $line; @@ -210,7 +210,7 @@ class DocumentationParser return $output; } - + public static function rewrite_image_links($md, $page) { // Links with titles @@ -229,14 +229,14 @@ class DocumentationParser foreach ($images[0] as $i => $match) { $title = $images[1][$i]; $url = $images[2][$i]; - + // Don't process absolute links (based on protocol detection) $urlParts = parse_url($url); if ($urlParts && isset($urlParts['scheme'])) { continue; } - + // Rewrite URL (relative or absolute) $baselink = DocumentationHelper::relativePath( DocumentationHelper::normalizePath( @@ -262,13 +262,13 @@ class DocumentationParser while (strpos($relativeUrl, '/..') !== false) { $relativeUrl = preg_replace('/\w+\/\.\.\//', '', $relativeUrl); } - + // Make it absolute again $absoluteUrl = Controller::join_links( Director::absoluteBaseURL(), $relativeUrl ); - + // Replace any double slashes (apart from protocol) // $absoluteUrl = preg_replace('/([^:])\/{2,}/', '$1/', $absoluteUrl); @@ -280,20 +280,20 @@ class DocumentationParser ); } } - + return $md; } - + /** * Rewrite links with special "api:" prefix to html as in the following example: * - * (1) [api:DataObject] gets re-written to + * (1) [api:DataObject] gets re-written to * DataObject * (2) [api:DataObject::$defaults] gets re-written to * DataObject::$defaults * (3) [api:DataObject::populateDefaults()] gets re-written to * DataObject::$defaults - * (4) [Title](api:DataObject) gets re-written to + * (4) [Title](api:DataObject) gets re-written to * Title * (5) [Title](api:DataObject::$defaults) gets re-written to * Title @@ -302,9 +302,9 @@ class DocumentationParser * * The above api links can be enclosed in backticks. * - * The markdown parser gets confused by the extra pair of parentheses in links of the form [DataObject](api:DataObject::populateDefaults()) so + * The markdown parser gets confused by the extra pair of parentheses in links of the form [DataObject](api:DataObject::populateDefaults()) so * all links are re-written as html markup instead of markdown [Title](url). This also prevents other markdown parsing problems. - * + * * @param String $markdown * @param DocumentationPage $doc_page * @return String @@ -334,7 +334,7 @@ class DocumentationParser $title = $links[1][$i]; $link = $links[1][$i]; // change backticked links to avoid being parsed in the same way as non-backticked links - $markdown = str_replace('`'.$match.'`', 'XYZ'.$link.'XYZ', $markdown); + $markdown = str_replace('`'.$match.'`', 'XYZ'.$link.'XYZ', $markdown); } else { $title = $links[1][$i]; $link = $links[2][$i]; @@ -347,7 +347,7 @@ class DocumentationParser } } - // recover backticked links with no titles + // recover backticked links with no titles preg_match_all('#XYZ(.*)?XYZ#', $markdown, $links); if($links) { foreach($links[0] as $i => $match) { @@ -369,7 +369,7 @@ class DocumentationParser return $markdown; } - + /** * */ @@ -377,10 +377,10 @@ class DocumentationParser { $re = '/^\#+(.*)/m'; $md = preg_replace_callback($re, array('DocumentationParser', '_rewrite_heading_anchors_callback'), $md); - + return $md; } - + /** * */ @@ -402,10 +402,10 @@ class DocumentationParser return sprintf("%s {#%s}", preg_replace('/\\r\\n|\\r|\\n/', '', $heading), self::generate_html_id($headingText)); } - + /** * Generate an html element id from a string - * + * * @return String */ public static function generate_html_id($title) @@ -417,13 +417,13 @@ class DocumentationParser $t = preg_replace('/-+/', '-', $t); $t = trim($t, '-'); $t = strtolower($t); - + return $t; } - + /** * Resolves all relative links within markdown. - * + * * @param String $md Markdown content * @param DocumentationPage $page * @@ -461,20 +461,20 @@ class DocumentationParser if ($relativeLink == ".") { $relativeLink = ''; } - + // file base link $fileBaseLink = DocumentationHelper::relativePath(DocumentationHelper::normalizePath(dirname($page->getPath()))); - + if ($matches) { foreach ($matches[0] as $i => $match) { $title = $matches[2][$i]; $url = $matches[3][$i]; - + // Don't process API links if (preg_match('/^api:/', $url)) { continue; } - + // Don't process absolute links (based on protocol detection) $urlParts = parse_url($url); if ($urlParts && isset($urlParts['scheme'])) { @@ -501,12 +501,12 @@ class DocumentationParser $relativeUrl = Controller::join_links($baselink, $relativeLink, $url, '/'); } } - + // Resolve relative paths while (strpos($relativeUrl, '..') !== false) { $relativeUrl = preg_replace('/[-\w]+\/\.\.\//', '', $relativeUrl); } - + // Replace any double slashes (apart from protocol) $relativeUrl = preg_replace('/([^:])\/{2,}/', '$1/', $relativeUrl); @@ -518,10 +518,10 @@ class DocumentationParser ); } } - + return $md; } - + /** * Strips out the metadata for a page * diff --git a/code/controllers/DocumentationViewer.php b/code/controllers/DocumentationViewer.php index 56c539c..c7dde2e 100755 --- a/code/controllers/DocumentationViewer.php +++ b/code/controllers/DocumentationViewer.php @@ -117,14 +117,14 @@ class DocumentationViewer extends Controller implements PermissionProvider ); } } - - /** + + /** * Permission provider to allow more control over who can view docs * * @return array */ - - public function providePermissions() + + public function providePermissions() { return array( 'CMS_VIEW_DEVDOCS' => array( @@ -400,11 +400,11 @@ class DocumentationViewer extends Controller implements PermissionProvider $output->push( new ArrayData( array( - 'Title' => $entity->getTitle(), + 'Title' => $entity->getTitle(), 'Link' => $link, - 'LinkingMode' => $mode, + 'LinkingMode' => $mode, 'DefaultEntity' => $entity->getIsDefaultEntity(), - 'Children' => $children + 'Children' => $children ) ) ); @@ -467,7 +467,7 @@ class DocumentationViewer extends Controller implements PermissionProvider return $this->customise( new ArrayData( array( - 'Children' => $children + 'Children' => $children ) ) )->renderWith('Includes/DocumentationPages'); @@ -587,9 +587,9 @@ class DocumentationViewer extends Controller implements PermissionProvider $output->push( new ArrayData( array( - 'Link' => Controller::join_links($baseLink, $url), - 'Title' => $page['title'], - 'FirstLetter' => $first + 'Link' => Controller::join_links($baseLink, $url), + 'Title' => $page['title'], + 'FirstLetter' => $first ) ) ); @@ -622,14 +622,14 @@ class DocumentationViewer extends Controller implements PermissionProvider * - %version% * - %entity% * - %path% - * - %lang% + * - %lang% * * For example to provide an edit link to the framework module in github: * * * DocumentationViewer::set_edit_link( - * 'framework', - * 'https://github.com/silverstripe/%entity%/edit/%version%/docs/%lang%/%path%', + * 'framework', + * 'https://github.com/silverstripe/%entity%/edit/%version%/docs/%lang%/%path%', * $opts * )); * @@ -658,8 +658,6 @@ class DocumentationViewer extends Controller implements PermissionProvider if ($page) { $entity = $page->getEntity(); - - if ($entity && isset(self::$edit_links[strtolower($entity->title)])) { // build the edit link, using the version defined @@ -671,7 +669,7 @@ class DocumentationViewer extends Controller implements PermissionProvider } - if ($version == "trunk" && (isset($url['options']['rewritetrunktomaster']))) { + if ($version == 'trunk' && (isset($url['options']['rewritetrunktomaster']))) { if ($url['options']['rewritetrunktomaster']) { $version = "master"; } @@ -699,7 +697,7 @@ class DocumentationViewer extends Controller implements PermissionProvider * Returns the next page. Either retrieves the sibling of the current page * or return the next sibling of the parent page. * - * @return DocumentationPage + * @return DocumentationPage|null */ public function getNextPage() { @@ -714,7 +712,7 @@ class DocumentationViewer extends Controller implements PermissionProvider * Returns the previous page. Either returns the previous sibling or the * parent of this page * - * @return DocumentationPage + * @return DocumentationPage|null */ public function getPreviousPage() { @@ -726,7 +724,7 @@ class DocumentationViewer extends Controller implements PermissionProvider } /** - * @return string + * @return string|void */ public function getGoogleAnalyticsCode() { @@ -745,6 +743,9 @@ class DocumentationViewer extends Controller implements PermissionProvider return $this->config()->get('documentation_title'); } + /** + * @return string + */ public function getDocumentationBaseHref() { return Config::inst()->get('DocumentationViewer', 'link_base'); diff --git a/code/extensions/DocumentationStaticPublisherExtension.php b/code/extensions/DocumentationStaticPublisherExtension.php index 83159c9..5d7a1ac 100644 --- a/code/extensions/DocumentationStaticPublisherExtension.php +++ b/code/extensions/DocumentationStaticPublisherExtension.php @@ -10,14 +10,14 @@ * * StaticExporter: * extensions: - * - DocumentationStaticPublisherExtension + * - DocumentationStaticPublisherExtension * * - * If you don't plan on using static publisher for anything else and you have - * the cms module installed, make sure you disable that from being published. - * + * If you don't plan on using static publisher for anything else and you have + * the cms module installed, make sure you disable that from being published. + * * Again, in your applications config.yml file - * + * * * StaticExporter: * disable_sitetree_export: true @@ -30,7 +30,7 @@ class DocumentationStaticPublisherExtension extends Extension public function alterExportUrls(&$urls) { $manifest = new DocumentationManifest(true); - + foreach ($manifest->getPages() as $url => $page) { $urls[$url] = $url; } diff --git a/code/extensions/DocumentationViewerVersionWarning.php b/code/extensions/DocumentationViewerVersionWarning.php index 7ef6ac8..4bfcde6 100644 --- a/code/extensions/DocumentationViewerVersionWarning.php +++ b/code/extensions/DocumentationViewerVersionWarning.php @@ -1,14 +1,15 @@ owner->getPage(); @@ -16,7 +17,7 @@ class DocumentationViewerVersionWarning extends Extension if (!$page) { return false; } - + $entity = $page->getEntity(); if (!$entity) { @@ -32,12 +33,12 @@ class DocumentationViewerVersionWarning extends Extension $stable = $this->owner->getManifest()->getStableVersion($entity); $compare = $entity->compare($stable); - if ($entity->getVersion() == "master" || $compare > 0) { + if ($entity->getVersion() == 'master' || $compare > 0) { return $this->owner->customise( new ArrayData( array( - 'FutureRelease' => true, - 'StableVersion' => DBField::create_field('HTMLText', $stable->getVersion()) + 'FutureRelease' => true, + 'StableVersion' => DBField::create_field('HTMLText', $stable->getVersion()) ) ) ); @@ -45,13 +46,13 @@ class DocumentationViewerVersionWarning extends Extension return $this->owner->customise( new ArrayData( array( - 'OutdatedRelease' => true, - 'StableVersion' => DBField::create_field('HTMLText', $stable->getVersion()) + 'OutdatedRelease' => true, + 'StableVersion' => DBField::create_field('HTMLText', $stable->getVersion()) ) ) ); } - + return false; } } diff --git a/code/models/DocumentationEntity.php b/code/models/DocumentationEntity.php index 177c172..c4a4d66 100755 --- a/code/models/DocumentationEntity.php +++ b/code/models/DocumentationEntity.php @@ -255,7 +255,7 @@ class DocumentationEntity extends ViewableData * * @return string */ - public function getVersionTitle() + public function getVersionTitle() { return $this->versionTitle; } @@ -266,7 +266,7 @@ class DocumentationEntity extends ViewableData * @param string $title * @return $this */ - public function setVersionTitle($title) + public function setVersionTitle($title) { $this->versionTitle = $title; return $this; @@ -278,7 +278,7 @@ class DocumentationEntity extends ViewableData * @param bool $archived * @return $this */ - public function setIsArchived($archived) + public function setIsArchived($archived) { $this->archived = $archived; return $this; @@ -287,7 +287,7 @@ class DocumentationEntity extends ViewableData /** * @return bool */ - public function getIsArchived() + public function getIsArchived() { return $this->archived; } @@ -320,8 +320,7 @@ class DocumentationEntity extends ViewableData } /** - * @param string $path - * + * @param string $path * @return $this */ public function setPath($path) @@ -350,8 +349,6 @@ class DocumentationEntity extends ViewableData return $this->stable; } - - /** * Returns an integer value based on if a given version is the latest * version. Will return -1 for if the version is older, 0 if versions are @@ -367,7 +364,7 @@ class DocumentationEntity extends ViewableData // Normalise versions prior to comparison $dots = substr_count($v1, '.') - substr_count($v2, '.'); - while($dots > 0) { + while ($dots > 0) { $dots--; $v2 .= '.99999'; } @@ -384,10 +381,10 @@ class DocumentationEntity extends ViewableData public function toMap() { return array( - 'Key' => $this->key, - 'Path' => $this->getPath(), - 'Version' => $this->getVersion(), - 'Branch' => $this->getBranch(), + 'Key' => $this->key, + 'Path' => $this->getPath(), + 'Version' => $this->getVersion(), + 'Branch' => $this->getBranch(), 'IsStable' => $this->getIsStable(), 'Language' => $this->getLanguage() ); diff --git a/code/models/DocumentationPage.php b/code/models/DocumentationPage.php index a73d2f2..04c1a97 100755 --- a/code/models/DocumentationPage.php +++ b/code/models/DocumentationPage.php @@ -1,12 +1,12 @@ filename); } - + /** * @param string - has to be plain text for open search compatibility. * @@ -64,17 +64,19 @@ class DocumentationPage extends ViewableData public function getBreadcrumbTitle($divider = ' - ') { $pathParts = explode('/', trim($this->getRelativePath(), '/')); - + // from the page from this array_pop($pathParts); // add the module to the breadcrumb trail. $pathParts[] = $this->entity->getTitle(); - + $titleParts = array_map( array( - 'DocumentationHelper', 'clean_page_name' - ), $pathParts + 'DocumentationHelper', + 'clean_page_name' + ), + $pathParts ); $titleParts = array_filter( @@ -91,7 +93,7 @@ class DocumentationPage extends ViewableData return implode($divider, $titleParts); } - + /** * @return DocumentationEntity */ @@ -111,7 +113,7 @@ class DocumentationPage extends ViewableData $page = DocumentationHelper::clean_page_name($this->filename); - if ($page == "Index") { + if ($page == 'Index') { return $this->getTitleFromFolder(); } @@ -124,7 +126,7 @@ class DocumentationPage extends ViewableData $entity = $this->getEntity()->getPath(); $folder = str_replace('index.md', '', $folder); - + // if it's the root of the entity then we want to use the entity name // otherwise we'll get 'En' for the entity folder if ($folder == $entity) { @@ -136,7 +138,7 @@ class DocumentationPage extends ViewableData return DocumentationHelper::clean_page_name($folderName); } - + /** * @return string */ @@ -146,25 +148,25 @@ class DocumentationPage extends ViewableData } /** - * Return the raw markdown for a given documentation page. + * Return the raw markdown for a given documentation page. * * @param boolean $removeMetaData * - * @return string + * @return string|false */ public function getMarkdown($removeMetaData = false) { try { if (is_file($this->getPath()) && $md = file_get_contents($this->getPath())) { $this->populateMetaDataFromText($md, $removeMetaData); - + return $md; } $this->read = true; } catch (InvalidArgumentException $e) { } - + return false; } @@ -175,19 +177,22 @@ class DocumentationPage extends ViewableData $this->$key = $value; } + /** + * @return string + */ public function getIntroduction() { if (!$this->read) { $this->getMarkdown(); } - + return $this->introduction; } - + /** * Parse a file and return the parsed HTML version. * - * @param string $baselink + * @param string $baselink * * @return string */ @@ -200,10 +205,10 @@ class DocumentationPage extends ViewableData return $html; } - + /** * This should return the link from the entity root to the page. The link - * value has the cleaned version of the folder names. See + * value has the cleaned version of the folder names. See * {@link getRelativePath()} for the actual file path. * * @return string @@ -213,10 +218,12 @@ class DocumentationPage extends ViewableData $path = $this->getRelativePath(); $url = explode('/', $path); $url = implode( - '/', array_map( + '/', + array_map( function ($a) { return DocumentationHelper::clean_page_url($a); - }, $url + }, + $url ) ); @@ -245,7 +252,7 @@ class DocumentationPage extends ViewableData } /** - * Returns the URL that will be required for the user to hit to view the + * Returns the URL that will be required for the user to hit to view the * given document base name. * * @param boolean $short If true, will attempt to return a short version of the url @@ -261,11 +268,11 @@ class DocumentationPage extends ViewableData ), '/' ); } - + /** - * Return metadata from the first html block in the page, then remove the + * Return metadata from the first html block in the page, then remove the * block on request - * + * * @param DocumentationPage $md * @param bool $remove */ @@ -278,11 +285,11 @@ class DocumentationPage extends ViewableData if ($matches && $block[1]) { $metaDataFound = false; - + // find the key/value pairs $intPattern = '/(?[A-Za-z][A-Za-z0-9_-]+)[\t]*:[\t]*(?[^:\n\r\/]+)/x'; $matches = preg_match_all($intPattern, $block[1], $meta); - + foreach ($meta['key'] as $index => $key) { if (isset($meta['value'][$index])) { // check if a property exists for this key @@ -293,7 +300,7 @@ class DocumentationPage extends ViewableData } } - // optionally remove the metadata block (only on the page that + // optionally remove the metadata block (only on the page that // is displayed) if ($metaDataFound && $removeMetaData) { $md = preg_replace($extPattern, '', $md); @@ -307,6 +314,9 @@ class DocumentationPage extends ViewableData return $this->entity->getVersion(); } + /** + * @return string + */ public function __toString() { return sprintf(get_class($this) .': %s)', $this->getPath()); diff --git a/tests/DocumentationHelperTests.php b/tests/DocumentationHelperTests.php index ea7a597..fbd1265 100644 --- a/tests/DocumentationHelperTests.php +++ b/tests/DocumentationHelperTests.php @@ -9,7 +9,8 @@ class DocumentationHelperTests extends SapphireTest public function testCleanName() { $this->assertEquals( - "File path", DocumentationHelper::clean_page_name( + 'File path', + DocumentationHelper::clean_page_name( '00_file-path.md' ) ); @@ -18,13 +19,15 @@ class DocumentationHelperTests extends SapphireTest public function testCleanUrl() { $this->assertEquals( - "some_path", DocumentationHelper::clean_page_url( + 'some_path', + DocumentationHelper::clean_page_url( 'Some Path' ) ); $this->assertEquals( - "somefilepath", DocumentationHelper::clean_page_url( + 'somefilepath', + DocumentationHelper::clean_page_url( '00_SomeFilePath.md' ) ); @@ -33,19 +36,22 @@ class DocumentationHelperTests extends SapphireTest public function testTrimSortNumber() { $this->assertEquals( - 'file', DocumentationHelper::trim_sort_number( + 'file', + DocumentationHelper::trim_sort_number( '0_file' ) ); $this->assertEquals( - '2.1', DocumentationHelper::trim_sort_number( + '2.1', + DocumentationHelper::trim_sort_number( '2.1' ) ); $this->assertEquals( - 'dev/tasks/2.1', DocumentationHelper::trim_sort_number( + 'dev/tasks/2.1', + DocumentationHelper::trim_sort_number( 'dev/tasks/2.1' ) ); @@ -54,13 +60,15 @@ class DocumentationHelperTests extends SapphireTest public function testTrimExtension() { $this->assertEquals( - 'file', DocumentationHelper::trim_extension_off( + 'file', + DocumentationHelper::trim_extension_off( 'file.md' ) ); $this->assertEquals( - 'dev/path/file', DocumentationHelper::trim_extension_off( + 'dev/path/file', + DocumentationHelper::trim_extension_off( 'dev/path/file.md' ) ); @@ -69,19 +77,22 @@ class DocumentationHelperTests extends SapphireTest public function testGetExtension() { $this->assertEquals( - 'md', DocumentationHelper::get_extension( + 'md', + DocumentationHelper::get_extension( 'file.md' ) ); $this->assertEquals( - 'md', DocumentationHelper::get_extension( + 'md', + DocumentationHelper::get_extension( 'dev/tasks/file.md' ) ); $this->assertEquals( - 'txt', DocumentationHelper::get_extension( + 'txt', + DocumentationHelper::get_extension( 'dev/tasks/file.txt' ) ); diff --git a/tests/DocumentationManifestTests.php b/tests/DocumentationManifestTests.php index 141d695..717e7d3 100644 --- a/tests/DocumentationManifestTests.php +++ b/tests/DocumentationManifestTests.php @@ -14,7 +14,7 @@ class DocumentationManifestTests extends SapphireTest 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( 'DocumentationViewer', 'link_base', 'dev/docs' ); @@ -57,11 +57,11 @@ class DocumentationManifestTests extends SapphireTest $this->manifest = new DocumentationManifest(true); } - + public function tearDown() { parent::tearDown(); - + Config::unnest(); } @@ -108,7 +108,8 @@ class DocumentationManifestTests extends SapphireTest // get next page at the end of one subfolder goes back up to the top // most directory $this->assertStringEndsWith( - '2.3/test/', $this->manifest->getNextPage( + '2.3/test/', + $this->manifest->getNextPage( DOCSVIEWER_PATH . '/tests/docs/en/subfolder/subsubfolder/subsubpage.md', DOCSVIEWER_PATH . '/tests/docs/en/' )->Link @@ -116,7 +117,8 @@ class DocumentationManifestTests extends SapphireTest // after sorting, 2 is shown. $this->assertContains( - '/intermediate/', $this->manifest->getNextPage( + '/intermediate/', + $this->manifest->getNextPage( DOCSVIEWER_PATH . '/tests/docs/en/sort/01-basic.md', DOCSVIEWER_PATH . '/tests/docs/en/' )->Link @@ -125,7 +127,8 @@ class DocumentationManifestTests extends SapphireTest // next gets the following URL $this->assertContains( - '/test/', $this->manifest->getNextPage( + '/test/', + $this->manifest->getNextPage( DOCSVIEWER_PATH . '/tests/docs-v2.4/en/index.md', DOCSVIEWER_PATH . '/tests/docs-v2.4/en/' )->Link @@ -145,7 +148,8 @@ class DocumentationManifestTests extends SapphireTest { // goes right into subfolders $this->assertContains( - 'subfolder/subsubfolder/subsubpage', $this->manifest->getPreviousPage( + 'subfolder/subsubfolder/subsubpage', + $this->manifest->getPreviousPage( DOCSVIEWER_PATH . '/tests/docs/en/test.md', DOCSVIEWER_PATH . '/tests/docs/en/' )->Link @@ -186,7 +190,7 @@ class DocumentationManifestTests extends SapphireTest $this->assertDOSContains( $expected, $this->manifest->getChildrenFor( - DOCSVIEWER_PATH . "/tests/docs/en/" + DOCSVIEWER_PATH . '/tests/docs/en/' ) ); @@ -197,7 +201,8 @@ class DocumentationManifestTests extends SapphireTest ); $this->assertDOSContains( - $expected, $this->manifest->getChildrenFor( + $expected, + $this->manifest->getChildrenFor( DOCSVIEWER_PATH . '/tests/docs-v3.0/en/', DOCSVIEWER_PATH . '/tests/docs-v3.0/en/ChangeLog.md' ) @@ -229,7 +234,7 @@ class DocumentationManifestTests extends SapphireTest $this->assertEquals(3, $this->manifest->getAllVersionsOfEntity($entity)->count()); $entity = $this->manifest->getEntities()->find('Language', 'de'); - + $this->assertEquals(1, $this->manifest->getAllVersionsOfEntity($entity)->count()); }