SetFromTest::testSetFromSuccess(): add additional test cases

... which should be handled correctly based on the code in the method under test.
This commit is contained in:
jrfnl 2021-07-10 03:25:31 +02:00
parent 97f82e5993
commit baee96b604
1 changed files with 30 additions and 0 deletions

View File

@ -48,6 +48,20 @@ final class SetFromTest extends TestCase
public function dataSetFromSuccess()
{
return [
'Email, no name' => [
'expected' => [
'From' => 'a@example.com',
'FromName' => '',
],
'address' => 'a@example.com',
],
'Email, no name; whitespace padding around email' => [
'expected' => [
'From' => 'whitespacepadding@example.com',
'FromName' => '',
],
'address' => " \t whitespacepadding@example.com \n",
],
'Email + name' => [
'expected' => [
'From' => 'a@example.com',
@ -64,6 +78,22 @@ final class SetFromTest extends TestCase
'address' => 'bob@example.com',
'name' => '"Bob\'s Burgers" (Bob\'s "Burgers")',
],
'Email + name; line breaks in name' => [
'expected' => [
'From' => 'removebreaks@example.com',
'FromName' => 'somename',
],
'address' => 'removebreaks@example.com',
'name' => "\r\nsome\r\nname\r\n",
],
'Email + name; whitespace padding around name' => [
'expected' => [
'From' => 'a@example.com',
'FromName' => 'some name',
],
'address' => 'a@example.com',
'name' => "\t\tsome name \r\n",
],
];
}