Skip to content
This repository was archived by the owner on Jan 30, 2020. It is now read-only.

Commit eeb0031

Browse files
committed
convert exception to assertion
1 parent 4769b31 commit eeb0031

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/Header/AbstractAddressList.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ function (&$value) use (&$wasEncoded) {
8282

8383
$values = array_filter($values);
8484

85+
/** @var AddressList $addressList */
8586
$addressList = $header->getAddressList();
8687
foreach ($values as $address) {
8788
$addressList->addFromString($address);

test/AddressListTest.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,11 @@ public function testSemicolonSeparator()
116116
$header = 'Some User <some.user@example.com>; uzer2.surname@example.org; asda.fasd@example.net, root@example.org';
117117

118118
// this throws: 'The input exceeds the allowed length'
119-
$to = Header\To::fromString('To:' . $header);
119+
try {
120+
$to = Header\To::fromString('To:' . $header);
121+
} catch (\Zend\Mail\Exception\InvalidArgumentException $e) {
122+
$this->fail('Header\To::fromString should not throw');
123+
}
120124
$addressList = $to->getAddressList();
121125

122126
$this->assertEquals('Some User', $addressList->get('some.user@example.com')->getName());

0 commit comments

Comments
 (0)