URITest.php 905 B

1234567891011121314151617181920212223242526272829
  1. <?php
  2. class HTMLPurifier_AttrDef_CSS_URITest extends HTMLPurifier_AttrDefHarness
  3. {
  4. function test() {
  5. $this->def = new HTMLPurifier_AttrDef_CSS_URI();
  6. $this->assertDef('', false);
  7. // we could be nice but we won't be
  8. $this->assertDef('http://www.example.com/', false);
  9. $this->assertDef('url(', false);
  10. $this->assertDef('url("")', true);
  11. $result = 'url("http://www.example.com/")';
  12. $this->assertDef('url(http://www.example.com/)', $result);
  13. $this->assertDef('url("http://www.example.com/")', $result);
  14. $this->assertDef("url('http://www.example.com/')", $result);
  15. $this->assertDef(
  16. ' url( "http://www.example.com/" ) ', $result);
  17. $this->assertDef("url(http://www.example.com/foo,bar\)\'\()",
  18. 'url("http://www.example.com/foo,bar%29%27%28")');
  19. }
  20. }
  21. // vim: et sw=4 sts=4