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.

45 lines
975B

  1. <?php
  2. class HTMLPurifier_ChildDef_ChameleonTest extends HTMLPurifier_ChildDefHarness
  3. {
  4. protected $isInline;
  5. public function setUp()
  6. {
  7. parent::setUp();
  8. $this->obj = new HTMLPurifier_ChildDef_Chameleon(
  9. 'b | i', // allowed only when in inline context
  10. 'b | i | div' // allowed only when in block context
  11. );
  12. $this->context->register('IsInline', $this->isInline);
  13. }
  14. public function testInlineAlwaysAllowed()
  15. {
  16. $this->isInline = true;
  17. $this->assertResult(
  18. '<b>Allowed.</b>'
  19. );
  20. }
  21. public function testBlockNotAllowedInInline()
  22. {
  23. $this->isInline = true;
  24. $this->assertResult(
  25. '<div>Not allowed.</div>', ''
  26. );
  27. }
  28. public function testBlockAllowedInNonInline()
  29. {
  30. $this->isInline = false;
  31. $this->assertResult(
  32. '<div>Allowed.</div>'
  33. );
  34. }
  35. }
  36. // vim: et sw=4 sts=4