NameSyncTest.php 975 B

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