Skip to content
This repository was archived by the owner on Jan 30, 2020. It is now read-only.
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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('[email protected]'));
$this->assertTrue($addressList->has('[email protected]'));
}

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

// In previous versions, this throws:
// 'Bob O'Reilly <[email protected]>,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('[email protected]'));
$this->assertTrue($addressList->has('[email protected]'));
$this->assertEquals("Bob O'Reilly", $addressList->get('[email protected]')->getName());
}
}