Skip to content

Commit

Permalink
Merge pull request #37 from egulias/multiple_spaces
Browse files Browse the repository at this point in the history
#36 - Multiple spaces in local part
  • Loading branch information
egulias committed Nov 17, 2014
2 parents 518f80a + e61481f commit 3f623e9
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Egulias/EmailValidator/EmailLexer.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ protected function getCatchablePatterns()
'[0-9]+',
'\r\n',
'::',
'\s+',
'\s+?',
'[\x10-\x1F]+',
'.',
);
Expand Down
1 change: 0 additions & 1 deletion src/Egulias/EmailValidator/Parser/LocalPart.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
use Egulias\EmailValidator\EmailValidator;
use \InvalidArgumentException;


class LocalPart extends Parser
{
public function parse($localPart)
Expand Down
11 changes: 11 additions & 0 deletions tests/egulias/Tests/EmailValidator/EmailLexerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,17 @@ public function testLexerTokens($str, $token)
$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();
Expand Down
2 changes: 2 additions & 0 deletions tests/egulias/Tests/EmailValidator/EmailValidatorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ public function getInvalidEmails()
{
return array(

array('user [email protected]'),
array('user [email protected]'),
array('[email protected]'),
array('example@[email protected]'),
array('([email protected])'),
Expand Down

0 comments on commit 3f623e9

Please sign in to comment.