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.

SwitchTest.php 1.0KB

12345678910111213141516171819202122232425262728293031323334353637
  1. <?php
  2. class HTMLPurifier_AttrDef_SwitchTest extends HTMLPurifier_AttrDefHarness
  3. {
  4. protected $with, $without;
  5. public function setUp()
  6. {
  7. parent::setUp();
  8. generate_mock_once('HTMLPurifier_AttrDef');
  9. $this->with = new HTMLPurifier_AttrDefMock();
  10. $this->without = new HTMLPurifier_AttrDefMock();
  11. $this->def = new HTMLPurifier_AttrDef_Switch('tag', $this->with, $this->without);
  12. }
  13. public function testWith()
  14. {
  15. $token = new HTMLPurifier_Token_Start('tag');
  16. $this->context->register('CurrentToken', $token);
  17. $this->with->expectOnce('validate');
  18. $this->with->setReturnValue('validate', 'foo');
  19. $this->assertDef('bar', 'foo');
  20. }
  21. public function testWithout()
  22. {
  23. $token = new HTMLPurifier_Token_Start('other-tag');
  24. $this->context->register('CurrentToken', $token);
  25. $this->without->expectOnce('validate');
  26. $this->without->setReturnValue('validate', 'foo');
  27. $this->assertDef('bar', 'foo');
  28. }
  29. }
  30. // vim: et sw=4 sts=4