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.

31 lines
993B

  1. <?php
  2. class HTMLPurifier_HTMLModule_NofollowTest extends HTMLPurifier_HTMLModuleHarness
  3. {
  4. public function setUp()
  5. {
  6. parent::setUp();
  7. $this->config->set('HTML.Nofollow', true);
  8. $this->config->set('Attr.AllowedRel', array("nofollow", "blah"));
  9. }
  10. public function testNofollow()
  11. {
  12. $this->assertResult(
  13. '<a href="http://google.com">x</a><a href="http://google.com" rel="blah">a</a><a href="/local">b</a><a href="mailto:foo@example.com">c</a>',
  14. '<a href="http://google.com" rel="nofollow">x</a><a href="http://google.com" rel="blah nofollow">a</a><a href="/local">b</a><a href="mailto:foo@example.com">c</a>'
  15. );
  16. }
  17. public function testNofollowDupe()
  18. {
  19. $this->assertResult(
  20. '<a href="http://google.com" rel="nofollow">x</a><a href="http://google.com" rel="blah nofollow">a</a><a href="/local">b</a><a href="mailto:foo@example.com">c</a>'
  21. );
  22. }
  23. }
  24. // vim: et sw=4 sts=4