NmtokensTest.php 812 B

1234567891011121314151617181920212223242526272829303132333435
  1. <?php
  2. class HTMLPurifier_AttrDef_HTML_NmtokensTest extends HTMLPurifier_AttrDefHarness
  3. {
  4. function setUp() {
  5. parent::setUp();
  6. $this->def = new HTMLPurifier_AttrDef_HTML_Nmtokens();
  7. }
  8. function testDefault() {
  9. $this->assertDef('valid');
  10. $this->assertDef('a0-_');
  11. $this->assertDef('-valid');
  12. $this->assertDef('_valid');
  13. $this->assertDef('double valid');
  14. $this->assertDef('0invalid', false);
  15. $this->assertDef('-0', false);
  16. // test conditional replacement
  17. $this->assertDef('validassoc 0invalid', 'validassoc');
  18. // test whitespace leniency
  19. $this->assertDef(" double\nvalid\r", 'double valid');
  20. // test case sensitivity
  21. $this->assertDef('VALID');
  22. }
  23. }
  24. // vim: et sw=4 sts=4