1
0
Fork 0

Merge pull request #3953 from alcohol/allow-numeric-author-name

Allow numeric author name
pull/3962/head
Jordi Boggiano 2015-04-21 20:47:49 +01:00
commit 35a9b5dbf9
2 changed files with 9 additions and 1 deletions

View File

@ -40,7 +40,7 @@ class InitCommand extends Command
public function parseAuthorString($author) public function parseAuthorString($author)
{ {
if (preg_match('/^(?P<name>[- \.,\p{L}\']+) <(?P<email>.+?)>$/u', $author, $match)) { if (preg_match('/^(?P<name>[- \.,\p{L}\p{N}\']+) <(?P<email>.+?)>$/u', $author, $match)) {
if ($this->isValidEmail($match['email'])) { if ($this->isValidEmail($match['email'])) {
return array( return array(
'name' => trim($match['name']), 'name' => trim($match['name']),

View File

@ -33,6 +33,14 @@ class InitCommandTest extends TestCase
$this->assertEquals('matti@example.com', $author['email']); $this->assertEquals('matti@example.com', $author['email']);
} }
public function testParseNumericAuthorString()
{
$command = new InitCommand;
$author = $command->parseAuthorString('h4x0r <h4x@example.com>');
$this->assertEquals('h4x0r', $author['name']);
$this->assertEquals('h4x@example.com', $author['email']);
}
public function testParseEmptyAuthorString() public function testParseEmptyAuthorString()
{ {
$command = new InitCommand; $command = new InitCommand;