EmbedParserTest.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637
  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\Extension\Embed;
  12. use League\CommonMark\Extension\Embed\Embed;
  13. use League\CommonMark\Extension\Embed\EmbedParser;
  14. use League\CommonMark\Node\Block\AbstractBlock;
  15. use PHPUnit\Framework\TestCase;
  16. final class EmbedParserTest extends TestCase
  17. {
  18. public function testEverything(): void
  19. {
  20. $url = 'https://www.youtube.com/watch?v=dQw4w9WgXcQ';
  21. $parser = new EmbedParser($url);
  22. $block = $parser->getBlock();
  23. self::assertInstanceOf(Embed::class, $block);
  24. \assert($block instanceof Embed);
  25. self::assertSame($url, $block->getUrl());
  26. self::assertFalse($parser->isContainer());
  27. self::assertFalse($parser->canHaveLazyContinuationLines());
  28. self::assertFalse($parser->canContain($this->getMockForAbstractClass(AbstractBlock::class)));
  29. }
  30. }