EnumTest.php 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. <?php
  2. class HTMLPurifier_AttrDef_EnumTest extends HTMLPurifier_AttrDefHarness
  3. {
  4. function testCaseInsensitive() {
  5. $this->def = new HTMLPurifier_AttrDef_Enum(array('one', 'two'));
  6. $this->assertDef('one');
  7. $this->assertDef('ONE', 'one');
  8. }
  9. function testCaseSensitive() {
  10. $this->def = new HTMLPurifier_AttrDef_Enum(array('one', 'two'), true);
  11. $this->assertDef('one');
  12. $this->assertDef('ONE', false);
  13. }
  14. function testFixing() {
  15. $this->def = new HTMLPurifier_AttrDef_Enum(array('one'));
  16. $this->assertDef(' one ', 'one');
  17. }
  18. function test_make() {
  19. $factory = new HTMLPurifier_AttrDef_Enum();
  20. $def = $factory->make('foo,bar');
  21. $def2 = new HTMLPurifier_AttrDef_Enum(array('foo', 'bar'));
  22. $this->assertIdentical($def, $def2);
  23. $def = $factory->make('s:foo,BAR');
  24. $def2 = new HTMLPurifier_AttrDef_Enum(array('foo', 'BAR'), true);
  25. $this->assertIdentical($def, $def2);
  26. }
  27. }
  28. // vim: et sw=4 sts=4