URITest.php 915 B

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