mirror of
https://github.com/ezyang/htmlpurifier.git
synced 2025-07-31 03:10:09 +02:00
[1.2.0] Implement primitive email regexp to be used for mailto. There are many spotty implementation issues, so this code is not actually called anywhere else currently.
git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@517 48356398-32a2-884e-a903-53898d9a118a
This commit is contained in:
16
tests/HTMLPurifier/AttrDef/Email/SimpleCheckTest.php
Normal file
16
tests/HTMLPurifier/AttrDef/Email/SimpleCheckTest.php
Normal file
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
require_once 'HTMLPurifier/AttrDef/Email/SimpleCheck.php';
|
||||
require_once 'HTMLPurifier/AttrDef/EmailHarness.php';
|
||||
|
||||
class HTMLPurifier_AttrDef_Email_SimpleCheckTest
|
||||
extends HTMLPurifier_AttrDef_EmailHarness
|
||||
{
|
||||
|
||||
function setUp() {
|
||||
$this->def = new HTMLPurifier_AttrDef_Email_SimpleCheck();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
33
tests/HTMLPurifier/AttrDef/EmailHarness.php
Normal file
33
tests/HTMLPurifier/AttrDef/EmailHarness.php
Normal file
@@ -0,0 +1,33 @@
|
||||
<?php
|
||||
|
||||
require_once 'HTMLPurifier/AttrDef/Email.php';
|
||||
|
||||
class HTMLPurifier_AttrDef_EmailHarness extends HTMLPurifier_AttrDefHarness
|
||||
{
|
||||
|
||||
/**
|
||||
* Tests common email strings that are obviously pass/fail
|
||||
*/
|
||||
function testCore() {
|
||||
$this->assertDef('bob@example.com');
|
||||
$this->assertDef(' bob@example.com ', 'bob@example.com');
|
||||
$this->assertDef('bob.thebuilder@example.net');
|
||||
$this->assertDef('Bob_the_Builder-the-2nd@example.org');
|
||||
$this->assertDef('Bob%20the%20Builder@white-space.test');
|
||||
|
||||
// extended format, with real name
|
||||
//$this->assertDef('Bob%20Builder%20%3Cbobby.bob.bob@it.is.example.com%3E');
|
||||
//$this->assertDef('Bob Builder <bobby.bob.bob@it.is.example.com>');
|
||||
|
||||
// time to fail
|
||||
$this->assertDef('bob', false);
|
||||
$this->assertDef('bob@home@work', false);
|
||||
$this->assertDef('@example.com', false);
|
||||
$this->assertDef('bob@', false);
|
||||
$this->assertDef('', false);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
@@ -78,6 +78,7 @@ $test_files[] = 'AttrDef/IPv6Test.php';
|
||||
$test_files[] = 'AttrDef/FontTest.php';
|
||||
$test_files[] = 'AttrDef/BorderTest.php';
|
||||
$test_files[] = 'AttrDef/ListStyleTest.php';
|
||||
$test_files[] = 'AttrDef/Email/SimpleCheckTest.php';
|
||||
$test_files[] = 'IDAccumulatorTest.php';
|
||||
$test_files[] = 'TagTransformTest.php';
|
||||
$test_files[] = 'AttrTransform/LangTest.php';
|
||||
|
Reference in New Issue
Block a user