EmailHarness.php 976 B

12345678910111213141516171819202122232425262728293031
  1. <?php
  2. class HTMLPurifier_AttrDef_URI_EmailHarness extends HTMLPurifier_AttrDefHarness
  3. {
  4. /**
  5. * Tests common email strings that are obviously pass/fail
  6. */
  7. function testCore() {
  8. $this->assertDef('bob@example.com');
  9. $this->assertDef(' bob@example.com ', 'bob@example.com');
  10. $this->assertDef('bob.thebuilder@example.net');
  11. $this->assertDef('Bob_the_Builder-the-2nd@example.org');
  12. $this->assertDef('Bob%20the%20Builder@white-space.test');
  13. // extended format, with real name
  14. //$this->assertDef('Bob%20Builder%20%3Cbobby.bob.bob@it.is.example.com%3E');
  15. //$this->assertDef('Bob Builder <bobby.bob.bob@it.is.example.com>');
  16. // time to fail
  17. $this->assertDef('bob', false);
  18. $this->assertDef('bob@home@work', false);
  19. $this->assertDef('@example.com', false);
  20. $this->assertDef('bob@', false);
  21. $this->assertDef('', false);
  22. }
  23. }
  24. // vim: et sw=4 sts=4