TYPO3 CMS  TYPO3_6-2
MailPostProcessorTest.php
Go to the documentation of this file.
1 <?php
3 
21 
25  protected $mailPostProcessor;
26 
32  public function setUp() {
33  $this->mailPostProcessor = $this->getAccessibleMock(
34  'TYPO3\CMS\Form\PostProcess\MailPostProcessor',
35  array('dummy'),
36  array(),
37  '',
38  FALSE
39  );
40  }
41 
48  public function filterValidEmailsProvider() {
49  return array(
50  'empty string' => array(
51  '',
52  array(),
53  ),
54  'string not representing an email' => array(
55  'notAnAddress',
56  array(),
57  ),
58  'simple single valid address' => array(
59  'someone@example.com',
60  array(
61  'someone@example.com',
62  ),
63  ),
64  'multiple valid simple addresses' => array(
65  'someone@example.com, foo@bar.com',
66  array(
67  'someone@example.com',
68  'foo@bar.com',
69  ),
70  ),
71  'multiple addresses with personal part' => array(
72  'Foo <foo@example.com>, <bar@example.com>, "Foo, bar" <foo.bar@example.com>',
73  array(
74  'bar@example.com',
75  'foo@example.com' => 'Foo',
76  'foo.bar@example.com' => '"Foo, bar"',
77  ),
78  ),
79  'list with invalid addresses is filtered' => array(
80  'invalid, @invalid, someone@example.com',
81  array(
82  'someone@example.com',
83  ),
84  ),
85  );
86  }
87 
92  public function filterValidEmailsReturnsOnlyValidAddresses($input, $expected) {
93  $actualResult = $this->mailPostProcessor->_call('filterValidEmails', $input);
94  $this->assertEquals($expected, $actualResult);
95  }
96 
97 }
filterValidEmailsReturnsOnlyValidAddresses($input, $expected)
$mailPostProcessor
filterValidEmailsProvider()
setUp()
getAccessibleMock( $originalClassName, array $methods=array(), array $arguments=array(), $mockClassName='', $callOriginalConstructor=TRUE, $callOriginalClone=TRUE, $callAutoload=TRUE)