TableOfContentsXmlTest.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. <?php
  2. declare(strict_types=1);
  3. /*
  4. * This file is part of the league/commonmark package.
  5. *
  6. * (c) Colin O'Dell <colinodell@gmail.com>
  7. *
  8. * For the full copyright and license information, please view the LICENSE
  9. * file that was distributed with this source code.
  10. */
  11. namespace League\CommonMark\Tests\Functional\Extension\TableOfContents;
  12. use League\CommonMark\ConverterInterface;
  13. use League\CommonMark\Environment\Environment;
  14. use League\CommonMark\Extension\CommonMark\CommonMarkCoreExtension;
  15. use League\CommonMark\Extension\HeadingPermalink\HeadingPermalinkExtension;
  16. use League\CommonMark\Extension\TableOfContents\TableOfContentsExtension;
  17. use League\CommonMark\Tests\Functional\AbstractLocalDataTest;
  18. use League\CommonMark\Xml\MarkdownToXmlConverter;
  19. final class TableOfContentsXmlTest extends AbstractLocalDataTest
  20. {
  21. /**
  22. * @param array<string, mixed> $config
  23. */
  24. protected function createConverter(array $config = []): ConverterInterface
  25. {
  26. $environment = new Environment($config);
  27. $environment->addExtension(new CommonMarkCoreExtension());
  28. $environment->addExtension(new HeadingPermalinkExtension());
  29. $environment->addExtension(new TableOfContentsExtension());
  30. return new MarkdownToXmlConverter($environment);
  31. }
  32. /**
  33. * {@inheritDoc}
  34. */
  35. public function dataProvider(): iterable
  36. {
  37. yield from $this->loadTests(__DIR__ . '/xml', '*', '.md', '.xml');
  38. }
  39. }