* * For the full copyright and license information, please view the LICENSE * file that was distributed with this source code. */ namespace League\CommonMark\Tests\Functional\Extension\ExternalLink; use League\CommonMark\CommonMarkConverter; use League\CommonMark\Environment\Environment; use League\CommonMark\Environment\EnvironmentInterface; use League\CommonMark\Extension\Autolink\AutolinkExtension; use League\CommonMark\Extension\CommonMark\CommonMarkCoreExtension; use League\CommonMark\Extension\ExternalLink\ExternalLinkExtension; use League\CommonMark\Parser\MarkdownParser; use League\CommonMark\Renderer\HtmlRenderer; use PHPUnit\Framework\TestCase; final class ExternalLinkExtensionTest extends TestCase { /** * @dataProvider provideEnvironmentForTestingExtensionWithAutolinks */ public function testExtensionWithAutolinks(EnvironmentInterface $environment): void { $markdown = 'Email me at colinodell@gmail.com or read the docs at https://commonmark.thephpleague.com'; $expectedHtml = '
Email me at colinodell@gmail.com or read the docs at https://commonmark.thephpleague.com
'; $parser = new MarkdownParser($environment); $renderer = new HtmlRenderer($environment); $this->assertSame($expectedHtml, \rtrim($renderer->renderDocument($parser->parse($markdown))->getContent())); } /** * @return iterableThis is an external link Google.
'; $this->assertSame($expectedHtml, \rtrim($converter->convert($input)->getContent())); } }