Skip to content
This repository has been archived by the owner on Jun 27, 2020. It is now read-only.

Commit

Permalink
add test for zendframework#147 regression
Browse files Browse the repository at this point in the history
  • Loading branch information
glensc committed Mar 4, 2019
1 parent ece418b commit c3dd482
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions test/AddressListTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,4 +144,25 @@ public function testSemicolonSeparator()
$this->assertTrue($addressList->has('asda.fasd@example.net'));
$this->assertTrue($addressList->has('root@example.org'));
}

/**
* If name-field is quoted with "", then ' inside it should not treated as terminator, but as value.
*/
public function testMixedQuotesInName() {
$header = '"Bob O\'Reilly" <bob@example.com>,blah@example.com';

// In previous versions, this throws:
// 'Bob O'Reilly <bob@example.com>,blah' can not be matched against dot-atom format
// hence the try/catch block, to allow finding the root cause.
try {
$to = Header\To::fromString('To:' . $header);
} catch (InvalidArgumentException $e) {
$this->fail('Header\To::fromString should not throw. Exception message: ' . $e->getMessage());
}

$addressList = $to->getAddressList();
$this->assertTrue($addressList->has('bob@example.com'));
$this->assertTrue($addressList->has('blah@example.com'));
$this->assertEquals("Bob O'Reilly", $addressList->get('bob@example.com')->getName());
}
}

0 comments on commit c3dd482

Please sign in to comment.