MarkdownParserTest.php 970 B

12345678910111213141516171819202122232425262728293031323334
  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\Unit\Parser;
  12. use League\CommonMark\Environment\Environment;
  13. use League\CommonMark\Exception\UnexpectedEncodingException;
  14. use League\CommonMark\Extension\CommonMark\CommonMarkCoreExtension;
  15. use League\CommonMark\Parser\MarkdownParser;
  16. use PHPUnit\Framework\TestCase;
  17. final class MarkdownParserTest extends TestCase
  18. {
  19. public function testParsingWithInvalidUTF8(): void
  20. {
  21. $this->expectException(UnexpectedEncodingException::class);
  22. $environment = new Environment();
  23. $environment->addExtension(new CommonMarkCoreExtension());
  24. $docParser = new MarkdownParser($environment);
  25. $docParser->parse("\x09\xca\xca");
  26. }
  27. }