NofollowTest.php 960 B

123456789101112131415161718192021222324252627
  1. <?php
  2. class HTMLPurifier_HTMLModule_NofollowTest extends HTMLPurifier_HTMLModuleHarness
  3. {
  4. function setUp() {
  5. parent::setUp();
  6. $this->config->set('HTML.Nofollow', true);
  7. $this->config->set('Attr.AllowedRel', array("nofollow", "blah"));
  8. }
  9. function testNofollow() {
  10. $this->assertResult(
  11. '<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>',
  12. '<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>'
  13. );
  14. }
  15. function testNofollowDupe() {
  16. $this->assertResult(
  17. '<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>'
  18. );
  19. }
  20. }
  21. // vim: et sw=4 sts=4