Changeset 25264 for trunk/tests/phpunit/tests/mail.php
- Timestamp:
- 09/05/2013 09:56:10 PM (12 years ago)
- File:
-
- 1 edited
-
trunk/tests/phpunit/tests/mail.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/mail.php
r25002 r25264 128 128 // WordPress 3.2 and later correctly split the address into the two parts and send them seperately to PHPMailer 129 129 // Earlier versions of PHPMailer were not touchy about the formatting of these arguments. 130 if ( version_compare( $GLOBALS['wp_version'], '3.1.9', '>' ) ) { 131 $this->assertEquals('address@tld.com', $GLOBALS['phpmailer']->mock_sent[0]['to'][0][0]); 132 $this->assertEquals('Name', $GLOBALS['phpmailer']->mock_sent[0]['to'][0][1]); 133 $this->assertEquals('cc@cc.com', $GLOBALS['phpmailer']->mock_sent[0]['cc'][0][0]); 134 $this->assertEquals('The Carbon Guy', $GLOBALS['phpmailer']->mock_sent[0]['cc'][0][1]); 135 $this->assertEquals('bcc@bcc.com', $GLOBALS['phpmailer']->mock_sent[0]['bcc'][0][0]); 136 $this->assertEquals('The Blind Carbon Guy', $GLOBALS['phpmailer']->mock_sent[0]['bcc'][0][1]); 137 } else { 138 $this->assertEquals($to, $GLOBALS['phpmailer']->mock_sent[0]['to'][0][0]); 139 $this->assertEquals($cc, $GLOBALS['phpmailer']->mock_sent[0]['cc'][0][0]); 140 $this->assertEquals($bcc, $GLOBALS['phpmailer']->mock_sent[0]['bcc'][0][0]); 141 } 130 $this->assertEquals('address@tld.com', $GLOBALS['phpmailer']->mock_sent[0]['to'][0][0]); 131 $this->assertEquals('Name', $GLOBALS['phpmailer']->mock_sent[0]['to'][0][1]); 132 $this->assertEquals('cc@cc.com', $GLOBALS['phpmailer']->mock_sent[0]['cc'][0][0]); 133 $this->assertEquals('The Carbon Guy', $GLOBALS['phpmailer']->mock_sent[0]['cc'][0][1]); 134 $this->assertEquals('bcc@bcc.com', $GLOBALS['phpmailer']->mock_sent[0]['bcc'][0][0]); 135 $this->assertEquals('The Blind Carbon Guy', $GLOBALS['phpmailer']->mock_sent[0]['bcc'][0][1]); 142 136 143 137 $this->assertEquals($message . "\n", $GLOBALS['phpmailer']->mock_sent[0]['body']); … … 160 154 // WordPress 3.2 and later correctly split the address into the two parts and send them seperately to PHPMailer 161 155 // Earlier versions of PHPMailer were not touchy about the formatting of these arguments. 162 if ( version_compare( $GLOBALS['wp_version'], '3.1.9', '>' ) ) { 163 $this->assertEquals('address@tld.com', $GLOBALS['phpmailer']->mock_sent[0]['to'][0][0]); 164 $this->assertEquals('Name', $GLOBALS['phpmailer']->mock_sent[0]['to'][0][1]); 165 $this->assertEquals('another_address@different-tld.com', $GLOBALS['phpmailer']->mock_sent[0]['to'][1][0]); 166 $this->assertEquals('Another Name', $GLOBALS['phpmailer']->mock_sent[0]['to'][1][1]); 167 } else { 168 $this->assertEquals('Name <address@tld.com>', $GLOBALS['phpmailer']->mock_sent[0]['to'][0][0]); 169 $this->assertEquals('Another Name <another_address@different-tld.com>', $GLOBALS['phpmailer']->mock_sent[0]['to'][1][0]); 170 } 156 $this->assertEquals('address@tld.com', $GLOBALS['phpmailer']->mock_sent[0]['to'][0][0]); 157 $this->assertEquals('Name', $GLOBALS['phpmailer']->mock_sent[0]['to'][0][1]); 158 $this->assertEquals('another_address@different-tld.com', $GLOBALS['phpmailer']->mock_sent[0]['to'][1][0]); 159 $this->assertEquals('Another Name', $GLOBALS['phpmailer']->mock_sent[0]['to'][1][1]); 171 160 172 161 $this->assertEquals($message . "\n", $GLOBALS['phpmailer']->mock_sent[0]['body']); … … 202 191 wp_mail( $to, $subject, $message ); 203 192 204 // Old PHPMailer blindly accepts the address, the new one santizes it 205 if ( version_compare( $GLOBALS['wp_version'], '3.1.9', '>' ) ) 206 $this->assertEquals('address@tld.com', $GLOBALS['phpmailer']->mock_sent[0]['to'][0][0]); 207 else 208 $this->assertEquals('<address@tld.com>', $GLOBALS['phpmailer']->mock_sent[0]['to'][0][0]); 193 $this->assertEquals('address@tld.com', $GLOBALS['phpmailer']->mock_sent[0]['to'][0][0]); 194 209 195 $this->assertEquals($message . "\n", $GLOBALS['phpmailer']->mock_sent[0]['body']); 210 196 unset( $_SERVER['SERVER_NAME'] );
Note: See TracChangeset
for help on using the changeset viewer.