FallbackNodeXmlRendererTest.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435
  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\Xml;
  12. use League\CommonMark\Extension\CommonMark\Node\Block\Heading;
  13. use League\CommonMark\Extension\SmartPunct\Quote;
  14. use League\CommonMark\Xml\FallbackNodeXmlRenderer;
  15. use PHPUnit\Framework\TestCase;
  16. final class FallbackNodeXmlRendererTest extends TestCase
  17. {
  18. public function testIt(): void
  19. {
  20. $renderer = new FallbackNodeXmlRenderer();
  21. $block = new Heading(3);
  22. $this->assertSame('custom_block_heading', $renderer->getXmlTagName($block));
  23. $this->assertSame(['level' => 3], $renderer->getXmlAttributes($block));
  24. $inline = new Quote('"');
  25. $this->assertSame('custom_inline_quote', $renderer->getXmlTagName($inline));
  26. $this->assertSame(['literal' => '"'], $renderer->getXmlAttributes($inline));
  27. }
  28. }