PurifierTest.php 1.1 KB

1234567891011121314151617181920212223242526
  1. <?php
  2. namespace Tests\Unit;
  3. use PHPUnit\Framework\Attributes\Test;
  4. use Purify;
  5. use Tests\TestCase;
  6. class PurifierTest extends TestCase
  7. {
  8. #[Test]
  9. public function puckTest()
  10. {
  11. $actual = Purify::clean("<span class=\"fa-spin fa\">catgirl spinning around in the interblag</span>");
  12. $expected = '<span>catgirl spinning around in the interblag</span>';
  13. $this->assertEquals($expected, $actual);
  14. $actual = Purify::clean("<p class=\"fa-spin fa\">catgirl spinning around in the interblag</p>");
  15. $expected = '<p>catgirl spinning around in the interblag</p>';
  16. $this->assertEquals($expected, $actual);
  17. $actual = Purify::clean('<a class="navbar-brand d-flex align-items-center" href="https://pixelfed.social" title="Logo"><img src="/img/pixelfed-icon-color.svg" height="30px" class="px-2"><span class="font-weight-bold mb-0 d-none d-sm-block" style="font-size:20px;">pixelfed</span></a>');
  18. $expected = '<a href="https://pixelfed.social" title="Logo" rel="nofollow noreferrer noopener" target="_blank"><span>pixelfed</span></a>';
  19. $this->assertEquals($expected, $actual);
  20. }
  21. }