PurifierTest.php 1.2 KB

123456789101112131415161718192021222324252627
  1. <?php
  2. namespace Tests\Unit;
  3. use Purify;
  4. use Tests\TestCase;
  5. use Illuminate\Foundation\Testing\WithFaker;
  6. use Illuminate\Foundation\Testing\RefreshDatabase;
  7. class PurifierTest extends TestCase
  8. {
  9. /** @test */
  10. public function puckTest()
  11. {
  12. $actual = Purify::clean("<span class=\"fa-spin fa\">catgirl spinning around in the interblag</span>");
  13. $expected = '<span>catgirl spinning around in the interblag</span>';
  14. $this->assertEquals($expected, $actual);
  15. $actual = Purify::clean("<p class=\"fa-spin fa\">catgirl spinning around in the interblag</p>");
  16. $expected = '<p>catgirl spinning around in the interblag</p>';
  17. $this->assertEquals($expected, $actual);
  18. $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>');
  19. $expected = '<a href="https://pixelfed.social" title="Logo" rel="nofollow noreferrer noopener" target="_blank"><span>pixelfed</span></a>';
  20. $this->assertEquals($expected, $actual);
  21. }
  22. }