You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

42 lines
1.1KB

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