pixelfed/tests/Unit/PurifierTest.php

26 lines
1.1 KiB
PHP
Raw Permalink Normal View History

2019-04-10 22:46:49 +00:00
<?php
namespace Tests\Unit;
use Purify;
use Tests\TestCase;
class PurifierTest extends TestCase
{
2022-12-21 21:21:07 +00:00
/** @test */
2019-04-10 22:46:49 +00:00
public function puckTest()
{
2022-12-21 21:21:07 +00:00
$actual = Purify::clean("<span class=\"fa-spin fa\">catgirl spinning around in the interblag</span>");
$expected = '<span>catgirl spinning around in the interblag</span>';
2019-04-10 22:46:49 +00:00
$this->assertEquals($expected, $actual);
2022-12-21 21:21:07 +00:00
$actual = Purify::clean("<p class=\"fa-spin fa\">catgirl spinning around in the interblag</p>");
$expected = '<p>catgirl spinning around in the interblag</p>';
2019-04-10 22:46:49 +00:00
$this->assertEquals($expected, $actual);
2019-04-23 23:58:46 +00:00
$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>');
$expected = '<a href="https://pixelfed.social" title="Logo" rel="nofollow noreferrer noopener" target="_blank"><span>pixelfed</span></a>';
$this->assertEquals($expected, $actual);
2019-04-10 22:46:49 +00:00
}
}