AttrDefHarness.php 865 B

123456789101112131415161718192021222324252627282930313233
  1. <?php
  2. class HTMLPurifier_AttrDefHarness extends HTMLPurifier_Harness
  3. {
  4. protected $def;
  5. protected $context, $config;
  6. public function setUp()
  7. {
  8. $this->config = HTMLPurifier_Config::createDefault();
  9. $this->context = new HTMLPurifier_Context();
  10. }
  11. // cannot be used for accumulator
  12. public function assertDef($string, $expect = true, $or_false = false)
  13. {
  14. // $expect can be a string or bool
  15. $result = $this->def->validate($string, $this->config, $this->context);
  16. if ($expect === true) {
  17. if (!($or_false && $result === false)) {
  18. $this->assertIdentical($string, $result);
  19. }
  20. } else {
  21. if (!($or_false && $result === false)) {
  22. $this->assertIdentical($expect, $result);
  23. }
  24. }
  25. }
  26. }
  27. // vim: et sw=4 sts=4