EmbedTest.php 1.3 KB

12345678910111213141516171819202122232425262728293031
  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 PHPUnit\Framework\TestCase;
  14. final class EmbedTest extends TestCase
  15. {
  16. public function testConstructorGettersAndSetters(): void
  17. {
  18. $embed = new Embed('https://www.youtube.com/watch?v=dQw4w9WgXcQ');
  19. $this->assertSame('https://www.youtube.com/watch?v=dQw4w9WgXcQ', $embed->getUrl());
  20. $this->assertNull($embed->getEmbedCode());
  21. $embed->setEmbedCode('<iframe width="560" height="315" src="https://www.youtube.com/embed/dQw4w9WgXcQ" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>');
  22. $this->assertSame('<iframe width="560" height="315" src="https://www.youtube.com/embed/dQw4w9WgXcQ" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>', $embed->getEmbedCode());
  23. }
  24. }