Merge pull request #205 from doctrine/upgrade-rst-parser

Update doctrine/RST to doctrine/rst-parser.
This commit is contained in:
Jonathan H. Wage
2018-08-22 12:29:39 -05:00
committed by GitHub
23 changed files with 268 additions and 192 deletions

View File

@@ -71,7 +71,7 @@ services:
- '@doctrine.docs.rst_builder'
doctrine.rst.kernel.html:
class: Gregwar\RST\HTML\Kernel
class: Doctrine\RST\HTML\Kernel
public: false
doctrine.rst.kernel:
@@ -82,7 +82,7 @@ services:
- []
doctrine.rst.builder:
class: Gregwar\RST\Builder
class: Doctrine\RST\Builder
public: false
arguments:
- '@doctrine.rst.kernel'

View File

@@ -4,10 +4,10 @@ declare(strict_types=1);
namespace Doctrine\Website\Docs;
use Doctrine\RST\Builder;
use Doctrine\RST\Document;
use Doctrine\Website\Projects\Project;
use Doctrine\Website\Projects\ProjectVersion;
use Gregwar\RST\Builder;
use Gregwar\RST\Document;
use function array_merge;
use function dirname;
use function file_exists;

View File

@@ -6,12 +6,12 @@ namespace Doctrine\Website\Docs;
use AlgoliaSearch\Client;
use AlgoliaSearch\Index;
use Doctrine\RST\HTML\Document;
use Doctrine\RST\HTML\Nodes\ParagraphNode;
use Doctrine\RST\HTML\Nodes\TitleNode;
use Doctrine\RST\Nodes\Node;
use Doctrine\Website\Projects\Project;
use Doctrine\Website\Projects\ProjectVersion;
use Gregwar\RST\HTML\Document;
use Gregwar\RST\HTML\Nodes\ParagraphNode;
use Gregwar\RST\HTML\Nodes\TitleNode;
use Gregwar\RST\Nodes\Node;
use function get_class;
use function in_array;
use function md5;
@@ -109,7 +109,7 @@ class SearchIndexer
});
foreach ($nodes as $node) {
$value = $node->getValue();
$value = (string) $node->getValue();
if (strpos($value, '{{ SOURCE_FILE') !== false) {
continue;
@@ -160,7 +160,7 @@ class SearchIndexer
}
return [
'objectID' => $version->getSlug() . '-' . $currentLink . '-' . md5($node->getValue()),
'objectID' => $version->getSlug() . '-' . $currentLink . '-' . md5((string) $node->getValue()),
'rank' => $this->getRank($node),
'h1' => $current['h1'],
'h2' => $current['h2'],

View File

@@ -4,9 +4,10 @@ declare(strict_types=1);
namespace Doctrine\Website\DoctrineSculpinBundle\Directive;
use Gregwar\RST\Nodes\WrapperNode;
use Gregwar\RST\Parser;
use Gregwar\RST\SubDirective;
use Doctrine\RST\Nodes\Node;
use Doctrine\RST\Nodes\WrapperNode;
use Doctrine\RST\Parser;
use Doctrine\RST\SubDirective;
class CautionDirective extends SubDirective
{
@@ -16,12 +17,15 @@ class CautionDirective extends SubDirective
}
/**
* @phpcsSuppress SlevomatCodingStandard.TypeHints.TypeHintDeclaration.MissingParameterTypeHint
*
* @param string[] $options
*/
public function processSub(Parser $parser, $document, $variable, $data, array $options) : WrapperNode
{
public function processSub(
Parser $parser,
?Node $document,
string $variable,
string $data,
array $options
) : ?Node {
return new WrapperNode($document, '<div class="alert caution bg-light-yellow text-dark border"><i class="fas fa-exclamation-triangle text-danger mr-2"></i>', '</div>');
}
}

View File

@@ -4,10 +4,11 @@ declare(strict_types=1);
namespace Doctrine\Website\DoctrineSculpinBundle\Directive;
use Doctrine\RST\Directive;
use Doctrine\RST\Nodes\Node;
use Doctrine\RST\Parser;
use Doctrine\Website\Docs\CodeBlockLanguageDetector;
use Doctrine\Website\Docs\CodeBlockRenderer;
use Gregwar\RST\Directive;
use Gregwar\RST\Parser;
use function array_reverse;
use function preg_split;
use function trim;
@@ -43,12 +44,15 @@ class CodeBlockDirective extends Directive
}
/**
* @phpcsSuppress SlevomatCodingStandard.TypeHints.TypeHintDeclaration.MissingParameterTypeHint
*
* @param string[] $options
*/
public function process(Parser $parser, $node, $variable, $data, array $options) : void
{
public function process(
Parser $parser,
?Node $node,
string $variable,
string $data,
array $options
) : void {
if (! $node) {
return;
}

View File

@@ -4,10 +4,11 @@ declare(strict_types=1);
namespace Doctrine\Website\DoctrineSculpinBundle\Directive;
use Gregwar\RST\Nodes\CodeNode;
use Gregwar\RST\Nodes\RawNode;
use Gregwar\RST\Parser;
use Gregwar\RST\SubDirective;
use Doctrine\RST\Nodes\CodeNode;
use Doctrine\RST\Nodes\Node;
use Doctrine\RST\Nodes\RawNode;
use Doctrine\RST\Parser;
use Doctrine\RST\SubDirective;
use function strtoupper;
class ConfigurationBlockDirective extends SubDirective
@@ -18,12 +19,15 @@ class ConfigurationBlockDirective extends SubDirective
}
/**
* @phpcsSuppress SlevomatCodingStandard.TypeHints.TypeHintDeclaration.MissingParameterTypeHint
*
* @param string[] $options
*/
public function processSub(Parser $parser, $document, $variable, $data, array $options) : RawNode
{
public function processSub(
Parser $parser,
?Node $document,
string $variable,
string $data,
array $options
) : ?Node {
$html = '<div class="configuration-block jsactive clearfix"><ul class="simple">';
foreach ($document->getNodes() as $node) {

View File

@@ -4,9 +4,10 @@ declare(strict_types=1);
namespace Doctrine\Website\DoctrineSculpinBundle\Directive;
use Gregwar\RST\Nodes\WrapperNode;
use Gregwar\RST\Parser;
use Gregwar\RST\SubDirective;
use Doctrine\RST\Nodes\Node;
use Doctrine\RST\Nodes\WrapperNode;
use Doctrine\RST\Parser;
use Doctrine\RST\SubDirective;
class HintDirective extends SubDirective
{
@@ -16,12 +17,15 @@ class HintDirective extends SubDirective
}
/**
* @phpcsSuppress SlevomatCodingStandard.TypeHints.TypeHintDeclaration.MissingParameterTypeHint
*
* @param string[] $options
*/
public function processSub(Parser $parser, $document, $variable, $data, array $options) : WrapperNode
{
public function processSub(
Parser $parser,
?Node $document,
string $variable,
string $data,
array $options
) : ?Node {
return new WrapperNode($document, '<div class="alert hint bg-primary text-white"><i class="fas fa-hand-point-right mr-2"></i>', '</div>');
}
}

View File

@@ -4,7 +4,7 @@ declare(strict_types=1);
namespace Doctrine\Website\DoctrineSculpinBundle\Directive;
use Gregwar\RST\SubDirective;
use Doctrine\RST\SubDirective;
class IndexDirective extends SubDirective
{

View File

@@ -4,9 +4,10 @@ declare(strict_types=1);
namespace Doctrine\Website\DoctrineSculpinBundle\Directive;
use Gregwar\RST\Nodes\WrapperNode;
use Gregwar\RST\Parser;
use Gregwar\RST\SubDirective;
use Doctrine\RST\Nodes\Node;
use Doctrine\RST\Nodes\WrapperNode;
use Doctrine\RST\Parser;
use Doctrine\RST\SubDirective;
class NoteDirective extends SubDirective
{
@@ -16,12 +17,15 @@ class NoteDirective extends SubDirective
}
/**
* @phpcsSuppress SlevomatCodingStandard.TypeHints.TypeHintDeclaration.MissingParameterTypeHint
*
* @param string[] $options
*/
public function processSub(Parser $parser, $document, $variable, $data, array $options) : WrapperNode
{
public function processSub(
Parser $parser,
?Node $document,
string $variable,
string $data,
array $options
) : ?Node {
return new WrapperNode($document, '<div class="alert note bg-light-yellow text-dark border"><i class="fas fa-sticky-note text-primary mr-2"></i>', '</div>');
}
}

View File

@@ -4,9 +4,10 @@ declare(strict_types=1);
namespace Doctrine\Website\DoctrineSculpinBundle\Directive;
use Gregwar\RST\Nodes\WrapperNode;
use Gregwar\RST\Parser;
use Gregwar\RST\SubDirective;
use Doctrine\RST\Nodes\Node;
use Doctrine\RST\Nodes\WrapperNode;
use Doctrine\RST\Parser;
use Doctrine\RST\SubDirective;
class NoticeDirective extends SubDirective
{
@@ -16,12 +17,15 @@ class NoticeDirective extends SubDirective
}
/**
* @phpcsSuppress SlevomatCodingStandard.TypeHints.TypeHintDeclaration.MissingParameterTypeHint
*
* @param string[] $options
*/
public function processSub(Parser $parser, $document, $variable, $data, array $options) : WrapperNode
{
public function processSub(
Parser $parser,
?Node $document,
string $variable,
string $data,
array $options
) : ?Node {
return new WrapperNode($document, '<div class="alert notice bg-secondary text-white"><i class="fas fa-bell mr-2"></i>', '</div>');
}
}

View File

@@ -4,9 +4,10 @@ declare(strict_types=1);
namespace Doctrine\Website\DoctrineSculpinBundle\Directive;
use Gregwar\RST\Nodes\WrapperNode;
use Gregwar\RST\Parser;
use Gregwar\RST\SubDirective;
use Doctrine\RST\Nodes\Node;
use Doctrine\RST\Nodes\WrapperNode;
use Doctrine\RST\Parser;
use Doctrine\RST\SubDirective;
class RoleDirective extends SubDirective
{
@@ -16,12 +17,15 @@ class RoleDirective extends SubDirective
}
/**
* @phpcsSuppress SlevomatCodingStandard.TypeHints.TypeHintDeclaration.MissingParameterTypeHint
*
* @param string[] $options
*/
public function processSub(Parser $parser, $document, $variable, $data, array $options) : WrapperNode
{
public function processSub(
Parser $parser,
?Node $document,
string $variable,
string $data,
array $options
) : ?Node {
return new WrapperNode($document, '<div class="role">', '</div>');
}
}

View File

@@ -4,9 +4,10 @@ declare(strict_types=1);
namespace Doctrine\Website\DoctrineSculpinBundle\Directive;
use Gregwar\RST\Nodes\WrapperNode;
use Gregwar\RST\Parser;
use Gregwar\RST\SubDirective;
use Doctrine\RST\Nodes\Node;
use Doctrine\RST\Nodes\WrapperNode;
use Doctrine\RST\Parser;
use Doctrine\RST\SubDirective;
class SectionAuthorDirective extends SubDirective
{
@@ -16,12 +17,15 @@ class SectionAuthorDirective extends SubDirective
}
/**
* @phpcsSuppress SlevomatCodingStandard.TypeHints.TypeHintDeclaration.MissingParameterTypeHint
*
* @param string[] $options
*/
public function processSub(Parser $parser, $document, $variable, $data, array $options) : WrapperNode
{
public function processSub(
Parser $parser,
?Node $document,
string $variable,
string $data,
array $options
) : ?Node {
return new WrapperNode($document, '<div class="section-author">', '</div>');
}
}

View File

@@ -4,9 +4,10 @@ declare(strict_types=1);
namespace Doctrine\Website\DoctrineSculpinBundle\Directive;
use Gregwar\RST\Nodes\WrapperNode;
use Gregwar\RST\Parser;
use Gregwar\RST\SubDirective;
use Doctrine\RST\Nodes\Node;
use Doctrine\RST\Nodes\WrapperNode;
use Doctrine\RST\Parser;
use Doctrine\RST\SubDirective;
class TipDirective extends SubDirective
{
@@ -16,12 +17,15 @@ class TipDirective extends SubDirective
}
/**
* @phpcsSuppress SlevomatCodingStandard.TypeHints.TypeHintDeclaration.MissingParameterTypeHint
*
* @param string[] $options
*/
public function processSub(Parser $parser, $document, $variable, $data, array $options) : WrapperNode
{
public function processSub(
Parser $parser,
?Node $document,
string $variable,
string $data,
array $options
) : ?Node {
return new WrapperNode($document, '<div class="alert tip bg-success text-light"><i class="fas fa-question-circle mr-2"></i>', '</div>');
}
}

View File

@@ -4,9 +4,10 @@ declare(strict_types=1);
namespace Doctrine\Website\DoctrineSculpinBundle\Directive;
use Gregwar\RST\Nodes\WrapperNode;
use Gregwar\RST\Parser;
use Gregwar\RST\SubDirective;
use Doctrine\RST\Nodes\Node;
use Doctrine\RST\Nodes\WrapperNode;
use Doctrine\RST\Parser;
use Doctrine\RST\SubDirective;
class TocDirective extends SubDirective
{
@@ -16,12 +17,15 @@ class TocDirective extends SubDirective
}
/**
* @phpcsSuppress SlevomatCodingStandard.TypeHints.TypeHintDeclaration.MissingParameterTypeHint
*
* @param string[] $options
*/
public function processSub(Parser $parser, $document, $variable, $data, array $options) : WrapperNode
{
public function processSub(
Parser $parser,
?Node $document,
string $variable,
string $data,
array $options
) : ?Node {
return new WrapperNode($document, '<div class="toc-section">', '</div>');
}
}

View File

@@ -4,9 +4,10 @@ declare(strict_types=1);
namespace Doctrine\Website\DoctrineSculpinBundle\Directive;
use Gregwar\RST\Nodes\RawNode;
use Gregwar\RST\Parser;
use Gregwar\RST\SubDirective;
use Doctrine\RST\Nodes\Node;
use Doctrine\RST\Nodes\RawNode;
use Doctrine\RST\Parser;
use Doctrine\RST\SubDirective;
class TocHeaderDirective extends SubDirective
{
@@ -16,12 +17,15 @@ class TocHeaderDirective extends SubDirective
}
/**
* @phpcsSuppress SlevomatCodingStandard.TypeHints.TypeHintDeclaration.MissingParameterTypeHint
*
* @param string[] $options
*/
public function processSub(Parser $parser, $document, $variable, $data, array $options) : RawNode
{
public function processSub(
Parser $parser,
?Node $document,
string $variable,
string $data,
array $options
) : ?Node {
return new RawNode('<h2 class="toc-header">' . $data . '</h2>');
}
}

View File

@@ -4,9 +4,10 @@ declare(strict_types=1);
namespace Doctrine\Website\DoctrineSculpinBundle\Directive;
use Gregwar\RST\Nodes\WrapperNode;
use Gregwar\RST\Parser;
use Gregwar\RST\SubDirective;
use Doctrine\RST\Nodes\Node;
use Doctrine\RST\Nodes\WrapperNode;
use Doctrine\RST\Parser;
use Doctrine\RST\SubDirective;
class VersionAddedDirective extends SubDirective
{
@@ -16,12 +17,15 @@ class VersionAddedDirective extends SubDirective
}
/**
* @phpcsSuppress SlevomatCodingStandard.TypeHints.TypeHintDeclaration.MissingParameterTypeHint
*
* @param string[] $options
*/
public function processSub(Parser $parser, $document, $variable, $data, array $options) : WrapperNode
{
public function processSub(
Parser $parser,
?Node $document,
string $variable,
string $data,
array $options
) : ?Node {
return new WrapperNode($document, '<div class="version-added">', '</div>');
}
}

View File

@@ -4,9 +4,10 @@ declare(strict_types=1);
namespace Doctrine\Website\DoctrineSculpinBundle\Directive;
use Gregwar\RST\Nodes\WrapperNode;
use Gregwar\RST\Parser;
use Gregwar\RST\SubDirective;
use Doctrine\RST\Nodes\Node;
use Doctrine\RST\Nodes\WrapperNode;
use Doctrine\RST\Parser;
use Doctrine\RST\SubDirective;
class WarningDirective extends SubDirective
{
@@ -16,12 +17,15 @@ class WarningDirective extends SubDirective
}
/**
* @phpcsSuppress SlevomatCodingStandard.TypeHints.TypeHintDeclaration.MissingParameterTypeHint
*
* @param string[] $options
*/
public function processSub(Parser $parser, $document, $variable, $data, array $options) : WrapperNode
{
public function processSub(
Parser $parser,
?Node $document,
string $variable,
string $data,
array $options
) : ?Node {
return new WrapperNode($document, '<div class="alert warning bg-light-yellow text-dark border"><i class="fas fa-exclamation-circle text-warning mr-2"></i>', '</div>');
}
}

View File

@@ -4,12 +4,12 @@ declare(strict_types=1);
namespace Doctrine\Website\RST;
use Gregwar\RST\Builder;
use Gregwar\RST\Directive;
use Gregwar\RST\Document;
use Gregwar\RST\HTML\Kernel as HtmlKernel;
use Gregwar\RST\Kernel as BaseKernel;
use Gregwar\RST\Reference;
use Doctrine\RST\Builder;
use Doctrine\RST\Directive;
use Doctrine\RST\Document;
use Doctrine\RST\HTML\Kernel as HtmlKernel;
use Doctrine\RST\Kernel as BaseKernel;
use Doctrine\RST\Reference;
use function array_merge;
class Kernel extends BaseKernel
@@ -50,9 +50,8 @@ class Kernel extends BaseKernel
/**
* @phpcsSuppress SlevomatCodingStandard.TypeHints.TypeHintDeclaration.MissingParameterTypeHint
*
* @param string $name
*/
public function getClass($name) : string
public function getClass(string $name) : string
{
return $this->baseKernel->getClass($name);
}

View File

@@ -12,20 +12,14 @@
"homepage": "https://jwage.com"
}
],
"repositories": [
{
"type": "vcs",
"url": "https://github.com/doctrine/RST"
}
],
"require": {
"sculpin/sculpin": "^2.1@dev",
"dflydev/embedded-composer": "^1.0@dev",
"kriswallsmith/assetic": "1.1.2",
"components/highlightjs": "^9.7",
"algolia/algoliasearch-client-php": "~1.25.0",
"gregwar/rst": "master",
"scrivo/highlight.php": "9.12.0.2"
"components/highlightjs": "^9.7",
"dflydev/embedded-composer": "^1.0@dev",
"doctrine/rst-parser": "dev-master",
"kriswallsmith/assetic": "1.1.2",
"scrivo/highlight.php": "9.12.0.2",
"sculpin/sculpin": "^2.1@dev"
},
"require-dev": {
"phpunit/phpunit": "^7.0",
@@ -37,7 +31,8 @@
"component-dir": "source/components",
"components": [
"components/highlightjs"
]
],
"sort-packages": true
},
"scripts": {
"post-install-cmd": [

118
composer.lock generated
View File

@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "7ac433bc9277ed60c3006310b5c742ec",
"content-hash": "43a301c45077b7a8d808c401613304a8",
"packages": [
{
"name": "algolia/algoliasearch-client-php",
@@ -918,6 +918,62 @@
],
"time": "2014-12-20T21:24:13+00:00"
},
{
"name": "doctrine/rst-parser",
"version": "dev-master",
"source": {
"type": "git",
"url": "https://github.com/doctrine/rst-parser.git",
"reference": "34ed1743987c6c186003be05e5cbf8f9d78a5198"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/doctrine/rst-parser/zipball/34ed1743987c6c186003be05e5cbf8f9d78a5198",
"reference": "34ed1743987c6c186003be05e5cbf8f9d78a5198",
"shasum": ""
},
"require": {
"php": "^7.1"
},
"require-dev": {
"doctrine/coding-standard": "^4.0",
"phpstan/phpstan": "^0.10",
"phpstan/phpstan-deprecation-rules": "^0.10",
"phpstan/phpstan-phpunit": "^0.10",
"phpstan/phpstan-strict-rules": "^0.10",
"phpunit/phpunit": "^7.0"
},
"type": "library",
"autoload": {
"psr-4": {
"Doctrine\\RST\\": "lib/"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Grégoire Passault",
"email": "g.passault@gmail.com",
"homepage": "http://www.gregwar.com/"
},
{
"name": "Jonathan H. Wage",
"email": "jonwage@gmail.com",
"homepage": "https://jwage.com"
}
],
"description": "PHP library to parse reStructuredText documents",
"homepage": "https://github.com/doctrine/rst-parser",
"keywords": [
"markup",
"parser",
"rst"
],
"time": "2018-08-22T04:53:10+00:00"
},
{
"name": "evenement/evenement",
"version": "v2.1.0",
@@ -966,61 +1022,6 @@
],
"time": "2017-07-17T17:39:19+00:00"
},
{
"name": "gregwar/rst",
"version": "dev-master",
"target-dir": "Gregwar/RST",
"source": {
"type": "git",
"url": "https://github.com/doctrine/RST.git",
"reference": "7a62a308c653bfaadf7e7256630e9cf88fbbd9a0"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/doctrine/RST/zipball/7a62a308c653bfaadf7e7256630e9cf88fbbd9a0",
"reference": "7a62a308c653bfaadf7e7256630e9cf88fbbd9a0",
"shasum": ""
},
"require": {
"php": ">=5.3.0"
},
"require-dev": {
"phpunit/phpunit": "^7.0"
},
"type": "library",
"autoload": {
"psr-0": {
"Gregwar\\RST": ""
}
},
"license": [
"MIT"
],
"authors": [
{
"name": "Grégoire Passault",
"email": "g.passault@gmail.com",
"homepage": "http://www.gregwar.com/"
},
{
"name": "Jonathan H. Wage",
"email": "jonwage@gmail.com",
"homepage": "https://jwage.com"
}
],
"description": "PHP library to parse reStructuredText documents",
"homepage": "https://github.com/Gregwar/RST",
"keywords": [
"markup",
"parser",
"rst"
],
"support": {
"source": "https://github.com/doctrine/RST/tree/master",
"issues": "https://github.com/doctrine/RST/issues"
},
"time": "2018-08-22T01:52:56+00:00"
},
{
"name": "justinrainbow/json-schema",
"version": "5.2.7",
@@ -4703,8 +4704,9 @@
"aliases": [],
"minimum-stability": "dev",
"stability-flags": {
"sculpin/sculpin": 20,
"dflydev/embedded-composer": 20
"dflydev/embedded-composer": 20,
"doctrine/rst-parser": 20,
"sculpin/sculpin": 20
},
"prefer-stable": true,
"prefer-lowest": false,

View File

@@ -4,14 +4,14 @@ declare(strict_types=1);
namespace Doctrine\Website\Tests\Docs;
use Doctrine\RST\Builder;
use Doctrine\RST\HTML\Kernel as HTMLKernel;
use Doctrine\Website\Docs\RSTBuilder;
use Doctrine\Website\DoctrineSculpinBundle\Directive\TocDirective;
use Doctrine\Website\DoctrineSculpinBundle\Directive\TocHeaderDirective;
use Doctrine\Website\Projects\Project;
use Doctrine\Website\Projects\ProjectVersion;
use Doctrine\Website\RST\Kernel;
use Gregwar\RST\Builder;
use Gregwar\RST\HTML\Kernel as HTMLKernel;
use PHPUnit\Framework\TestCase;
use function array_keys;
use function file_get_contents;

View File

@@ -6,14 +6,15 @@ namespace Doctrine\Website\Tests\Docs;
use AlgoliaSearch\Client;
use AlgoliaSearch\Index;
use Doctrine\RST\Environment;
use Doctrine\RST\HTML\Document;
use Doctrine\RST\HTML\Nodes\ParagraphNode;
use Doctrine\RST\HTML\Nodes\TitleNode;
use Doctrine\RST\Nodes\RawNode;
use Doctrine\Website\Docs\RSTBuilder;
use Doctrine\Website\Docs\SearchIndexer;
use Doctrine\Website\Projects\Project;
use Doctrine\Website\Projects\ProjectVersion;
use Gregwar\RST\Environment;
use Gregwar\RST\HTML\Document;
use Gregwar\RST\HTML\Nodes\ParagraphNode;
use Gregwar\RST\HTML\Nodes\TitleNode;
use PHPUnit\Framework\TestCase;
class SearchIndexerTest extends TestCase
@@ -104,11 +105,17 @@ class SearchIndexerTest extends TestCase
->method('getUrl')
->willReturn('index');
$h1Node = new TitleNode('Test 1', 1, 'title.1');
$h2Node = new TitleNode('Test 2', 2, 'title.1.1');
$h3Node = new TitleNode('Test 3', 3, 'title.1.2');
$h4Node = new TitleNode('Test 4', 4, 'title.1.3');
$h5Node = new TitleNode('Test 5', 5, 'title.1.4');
$node1 = new RawNode('Test 1');
$node2 = new RawNode('Test 2');
$node3 = new RawNode('Test 3');
$node4 = new RawNode('Test 4');
$node5 = new RawNode('Test 5');
$h1Node = new TitleNode($node1, 1, 'title.1');
$h2Node = new TitleNode($node2, 2, 'title.1.1');
$h3Node = new TitleNode($node3, 3, 'title.1.2');
$h4Node = new TitleNode($node4, 4, 'title.1.3');
$h5Node = new TitleNode($node5, 5, 'title.1.4');
$paragraph1Node = new ParagraphNode('Paragraph 1');
$paragraph2Node = new ParagraphNode('Paragraph 2');

View File

@@ -85,6 +85,27 @@ class FunctionalTest extends TestCase
}
}
public function testLinks() : void
{
$crawler = $this->assertValid('/projects/doctrine-orm/en/2.6/reference/events.html');
$this->assertContains('<a href="#reference-events-lifecycle-events">lifecycle events</a>', $crawler->html());
$crawler = $this->assertValid('/projects/doctrine-dbal/en/2.8/reference/data-retrieval-and-manipulation.html');
$this->assertContains('<a href="types.html#mappingMatrix">Types</a>', $crawler->html());
$crawler = $this->assertValid('/projects/doctrine-orm/en/2.6/reference/architecture.html');
$this->assertContains('<a href="../cookbook/implementing-wakeup-or-clone.html">do so safely</a>', $crawler->html());
$crawler = $this->assertValid('/projects/doctrine-orm/en/2.6/reference/annotations-reference.html');
$this->assertContains('<a href="annotations-reference.html#annref_column_result">@ColumnResult</a>', $crawler->html());
$crawler = $this->assertValid('/projects/doctrine-dbal/en/2.8/reference/events.html');
$this->assertContains('<a href="platforms.html">Platforms</a>', $crawler->html());
$crawler = $this->assertValid('/projects/doctrine-orm/en/2.6/reference/improving-performance.html');
$this->assertContains('<a href="../tutorials/extra-lazy-associations.html">tutorial</a>', $crawler->html());
}
private function assertValid(string $path) : Crawler
{
$fullPath = realpath($this->buildDir . $path);