Make WordPress Core


Ignore:
Timestamp:
09/05/2013 09:56:10 PM (13 years ago)
Author:
nacin
Message:

Remove old WP version checks from PHPUnit test cases now that tests are branched with each version.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/mail.php

    r25002 r25264  
    128128                // WordPress 3.2 and later correctly split the address into the two parts and send them seperately to PHPMailer
    129129                // 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]);
    142136
    143137                $this->assertEquals($message . "\n", $GLOBALS['phpmailer']->mock_sent[0]['body']);
     
    160154                // WordPress 3.2 and later correctly split the address into the two parts and send them seperately to PHPMailer
    161155                // 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]);
    171160
    172161                $this->assertEquals($message . "\n", $GLOBALS['phpmailer']->mock_sent[0]['body']);
     
    202191                wp_mail( $to, $subject, $message );
    203192
    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
    209195                $this->assertEquals($message . "\n", $GLOBALS['phpmailer']->mock_sent[0]['body']);
    210196                unset( $_SERVER['SERVER_NAME'] );
Note: See TracChangeset for help on using the changeset viewer.