WordPress.org

Make WordPress Core

Changeset 41170


Ignore:
Timestamp:
07/27/2017 02:33:31 PM (10 months ago)
Author:
johnbillion
Message:

Users: Update some tests for admin email change confirmation emails after [41164].

See #40015, #39117

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/user/multisite.php

    r40632 r41170  
    454454        $this->assertContains( '\'Test\' site\'s "name" has <html entities> &', $email->body, 'Email body does not contain the decoded HTML entities' );
    455455        $this->assertNotContains( '&#039;Test&#039; site&#039;s &quot;name&quot; has &lt;html entities&gt; &amp;', 'Email body does contains HTML entities' );
    456         $this->assertContains( '\'Test\' blog\'s "name" has <html entities> &', $email->subject, 'Email body does not contain the decoded HTML entities' );
     456        $this->assertContains( '\'Test\' blog\'s "name" has <html entities> &', $email->subject, 'Email subject does not contain the decoded HTML entities' );
    457457        $this->assertNotContains( '&#039;Test&#039; blog&#039;s &quot;name&quot; has &lt;html entities&gt; &amp;', $email->subject, $email->subject, 'Email subject does contains HTML entities' );
    458458    }
    459459
    460460    /**
    461      * A notification e-mail should not be sent if the new admin e-mail:
    462      * - Matches thee existing admin email, or
    463      * - is not a valid e-mail, or
     461     * A confirmation email should not be sent if the new admin email:
     462     * - Matches the existing admin email, or
     463     * - is not a valid email
    464464     *
    465      * @dataProvider data_user_admin_email_notification_emails
    466      */
    467     function test_ms_new_admin_email_notification_not_sent_when_email_invalid( $email, $message ) {
     465     * @dataProvider data_user_admin_email_confirmation_emails
     466     */
     467    function test_ms_new_admin_email_confirmation_not_sent_when_email_invalid( $email, $message ) {
    468468        reset_phpmailer_instance();
    469469
    470         update_option( 'admin_email', 'existing-email@test.dev' );
    471         update_option_new_admin_email( 'existing-email@test.dev', $email );
     470        update_option_new_admin_email( get_option( 'admin_email' ), $email );
    472471
    473472        $mailer = tests_retrieve_phpmailer_instance();
     
    477476
    478477    /**
    479      * Data provider for test_ms_new_admin_email_notification_not_sent_when_email_invalid().
     478     * Data provider for test_ms_new_admin_email_confirmation_not_sent_when_email_invalid().
    480479     *
    481480     * @return array {
    482481     *     @type array {
    483      *         @type string $email   The new e-mail for admin_email
     482     *         @type string $email   The new email for admin_email
    484483     *         @type string $message An error message to display if the test fails
    485484     *     }
    486485     * }
    487486     */
    488     function data_user_admin_email_notification_emails() {
     487    function data_user_admin_email_confirmation_emails() {
    489488        return array(
    490489            array(
    491                 'existing-email@test.dev',
    492                 'A notification e-mail should not be sent if the current admin e-mail matches the new e-mail',
     490                get_option( 'admin_email' ),
     491                'A confirmation email should not be sent if the current admin email matches the new email',
    493492            ),
    494493            array(
    495494                'not an email',
    496                 'A notification e-mail should not be sent if it is not a valid e-mail',
     495                'A confirmation email should not be sent if it is not a valid email',
    497496            )
    498497        );
     
    534533        $this->assertContains( '\'Test\' site\'s "name" has <html entities> &', $email->body, 'Email body does not contain the decoded HTML entities' );
    535534        $this->assertNotContains( '&#039;Test&#039; site&#039;s &quot;name&quot; has &lt;html entities&gt; &amp;', $email->body, 'Email body does contains HTML entities' );
    536         $this->assertContains( '\'Test\' blog\'s "name" has <html entities> &', $email->subject, 'Email body does not contain the decoded HTML entities' );
     535        $this->assertContains( '\'Test\' blog\'s "name" has <html entities> &', $email->subject, 'Email subject does not contain the decoded HTML entities' );
    537536        $this->assertNotContains( '&#039;Test&#039; blog&#039;s &quot;name&quot; has &lt;html entities&gt; &amp;', $email->subject, 'Email subject does contains HTML entities' );
    538537
Note: See TracChangeset for help on using the changeset viewer.