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.

NameSyncTest.php 1.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. class HTMLPurifier_AttrTransform_NameSyncTest extends HTMLPurifier_AttrTransformHarness
  3. {
  4. public function setUp()
  5. {
  6. parent::setUp();
  7. $this->obj = new HTMLPurifier_AttrTransform_NameSync();
  8. $this->accumulator = new HTMLPurifier_IDAccumulator();
  9. $this->context->register('IDAccumulator', $this->accumulator);
  10. $this->config->set('Attr.EnableID', true);
  11. }
  12. public function testEmpty()
  13. {
  14. $this->assertResult( array() );
  15. }
  16. public function testAllowSame()
  17. {
  18. $this->assertResult(
  19. array('name' => 'free', 'id' => 'free')
  20. );
  21. }
  22. public function testAllowDifferent()
  23. {
  24. $this->assertResult(
  25. array('name' => 'tryit', 'id' => 'thisgood')
  26. );
  27. }
  28. public function testCheckName()
  29. {
  30. $this->accumulator->add('notok');
  31. $this->assertResult(
  32. array('name' => 'notok', 'id' => 'ok'),
  33. array('id' => 'ok')
  34. );
  35. }
  36. }
  37. // vim: et sw=4 sts=4