parser->parse('http://www.google.com/test_')->render(); self::assertSame('
', trim($result)); } public function testLinkWithUnderscore(): void { $rst = <<<'EOF' has_underscore_ .. _has_underscore: https://www.google.com EOF; $result = $this->parser->parse($rst)->render(); self::assertSame('', trim($result)); } public function testInvalidLinks(): void { $this->configuration->setIgnoreInvalidReferences(true); $this->configuration->abortOnError(false); $rst = <<<'EOF' does_not_exist_ `Does Not Exist1`_ :ref:`Does Not Exist2does_not_exist
', $result); self::assertStringContainsString('Does Not Exist1
', $result); self::assertStringContainsString('Does Not Exist2
', $result); } public function testLinkWithParenthesis(): void { $rst = <<<'EOF' Example_, `Example Web Site`_, Example (`Web Site`_), and Example (Link_) .. _Example: http://www.example.com/ .. _`Example Web Site`: http://www.example.com/ .. _`Web Site`: http://www.example.com/ .. _Link: http://www.example.com/ EOF; $result = $this->parser->parse($rst)->render(); self::assertSame('Example, Example Web Site, Example (Web Site), and Example (Link)
', trim($result)); } protected function setUp(): void { $this->configuration = new Configuration(); $this->parser = new Parser(new Kernel($this->configuration)); } }