mirror of
https://github.com/egulias/EmailValidator.git
synced 2026-08-31 04:28:57 +00:00
#36 - Multiple spaces in local part
This commit is contained in:
@@ -142,7 +142,7 @@ class EmailLexer extends AbstractLexer
|
||||
'[0-9]+',
|
||||
'\r\n',
|
||||
'::',
|
||||
'\s+',
|
||||
'\s+?',
|
||||
'[\x10-\x1F]+',
|
||||
'.',
|
||||
);
|
||||
|
||||
@@ -6,7 +6,6 @@ use Egulias\EmailValidator\EmailLexer;
|
||||
use Egulias\EmailValidator\EmailValidator;
|
||||
use \InvalidArgumentException;
|
||||
|
||||
|
||||
class LocalPart extends Parser
|
||||
{
|
||||
public function parse($localPart)
|
||||
|
||||
@@ -26,6 +26,17 @@ class EmailLexerTests extends \PHPUnit_Framework_TestCase
|
||||
$this->assertEquals($token, $lexer->token['type']);
|
||||
}
|
||||
|
||||
public function testLexerParsesMultipleSpaces()
|
||||
{
|
||||
$lexer = new EmailLexer();
|
||||
$lexer->setInput(' ');
|
||||
$lexer->moveNext();
|
||||
$lexer->moveNext();
|
||||
$this->assertEquals(EmailLexer::S_SP, $lexer->token['type']);
|
||||
$lexer->moveNext();
|
||||
$this->assertEquals(EmailLexer::S_SP, $lexer->token['type']);
|
||||
}
|
||||
|
||||
public function testLexerForTab()
|
||||
{
|
||||
$lexer = new EmailLexer();
|
||||
|
||||
@@ -62,6 +62,8 @@ class EmailValidatorTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
return array(
|
||||
|
||||
array('user name@example.com'),
|
||||
array('user name@example.com'),
|
||||
array('example.@example.co.uk'),
|
||||
array('example@example@example.co.uk'),
|
||||
array('(test_exampel@example.fr)'),
|
||||
|
||||
Reference in New Issue
Block a user