stevebauman/purify

phpunit issue

Closed this issue · 2 comments

0xuhe commented

I wanna test attribute purify. It works fine in local but failed in pupunit testing.

I have made ServiceProvider as readme mentioned.

// provider
        $def->addAttribute('span', 'data-user', 'Text');

// config/purify.php
        'HTML.Allowed' => 'span[data-user]',


// testing
        $content = '<span class="text-primary" data-user="foo">@foo</span>';
        \Purify::clean($content)

// ErrorException : Attribute 'data-user' in element 'span' not supported (for information on implementing this, see the support forums) 

// but it works in tinker

Hi @gfd6th,

How are you running your tests? Is your service provider that registers this custom rule being booted when you run your unit tests?

Closing due to inactivity.