-
Notifications
You must be signed in to change notification settings - Fork 111
Fix mail messages with blank line on top #24
Fix mail messages with blank line on top #24
Conversation
Add a data provider and compact assertions against current object state.
@@ -42,6 +42,8 @@ public function __construct(array $params) | |||
} else { | |||
$params['raw'] = stream_get_contents($params['file']); | |||
} | |||
|
|||
$params['raw'] = ltrim($params['raw']); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should apply the workaround always? (out of the if block)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it makes sense.
Reading issue #19 seems this is not enough and another alternative should be provided. |
$this->assertEquals('Peter Müller <peter-mueller@example.com>', $message->from); | ||
} | ||
|
||
public function testGetHeaderAsArray() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Having these as separate tests ensures that we can have granular tests for each behavior. Pushing all assertions into a single method makes identifying breakages harder, as the first assertion that fails causes any following assertions to never execute, which means we often end up playing whack-a-mole (fix one assertion, only to find the same test fails on an additional assertion). Please re-instate these discrete methods.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I re-instated these when merging.
My reading of the two indicates they're completely separate issues. |
Fix mail messages with blank line on top
Re-instated each of: - testIsMultipart() - testGetHeader() - testGetDecodedHeader() - testGetHeaderAsArray() each with the `filesProvider` data provider; these replace the newly added `testParseFile()` in order to provide better granularity of assertions and behavior.
This commit backports changes from the 2.5 series for the 2.4.8 LTS release. These include the following: - [zendframework#11](zendframework#11) ensures that the sender can be a mailbox name, or an email specifying a host that omits the TLD. - [zendframework#21](zendframework#21) provides a patch to allow addresses in the form `Name address@domain.tld` (without angle brackets surrounding the actual email addres). - [zendframework#24](zendframework#24) fixes parsing of mail messagse that contain an initial blank line (prior to any headers), a situation observed in particular with GMail. - [zendframework#26](zendframework#26) fixes the `ContentType` header to properly handle parameters with encoded values.
This commit backports changes from the 2.5 series for the 2.4.8 LTS release. These include the following: - [#11](zendframework/zend-mail#11) ensures that the sender can be a mailbox name, or an email specifying a host that omits the TLD. - [#21](zendframework/zend-mail#21) provides a patch to allow addresses in the form `Name address@domain.tld` (without angle brackets surrounding the actual email addres). - [#24](zendframework/zend-mail#24) fixes parsing of mail messagse that contain an initial blank line (prior to any headers), a situation observed in particular with GMail. - [#26](zendframework/zend-mail#26) fixes the `ContentType` header to properly handle parameters with encoded values.
At the moment of write this patch GMail (a popular mail provider) prepend mail messages with a line with whitespaces
This PR remove that line before parse.