Make WordPress Core


Ignore:
Timestamp:
11/25/2021 07:39:31 PM (2 months ago)
Author:
johnbillion
Message:

Build/Test Tools: Correct the order and naming of expected and actual values in various tests.

This corrects the order of the parameters when used in assertions so if/when they fail the failure message is correct.

See #53363

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/l10n/loadTextdomainJustInTime.php

    r51568 r52248  
    7070
    7171        $is_textdomain_loaded_before = is_textdomain_loaded( 'internationalized-plugin' );
    72         $expected_output             = i18n_plugin_test();
     72        $actual_output               = i18n_plugin_test();
    7373        $is_textdomain_loaded_after  = is_textdomain_loaded( 'internationalized-plugin' );
    7474
     
    7676
    7777        $this->assertFalse( $is_textdomain_loaded_before );
    78         $this->assertSame( 'Das ist ein Dummy Plugin', $expected_output );
     78        $this->assertSame( 'Das ist ein Dummy Plugin', $actual_output );
    7979        $this->assertTrue( $is_textdomain_loaded_after );
    8080    }
     
    9191
    9292        $is_textdomain_loaded_before = is_textdomain_loaded( 'internationalized-theme' );
    93         $expected_output             = i18n_theme_test();
     93        $actual_output               = i18n_theme_test();
    9494        $is_textdomain_loaded_after  = is_textdomain_loaded( 'internationalized-theme' );
    9595
     
    9797
    9898        $this->assertFalse( $is_textdomain_loaded_before );
    99         $this->assertSame( 'Das ist ein Dummy Theme', $expected_output );
     99        $this->assertSame( 'Das ist ein Dummy Theme', $actual_output );
    100100        $this->assertTrue( $is_textdomain_loaded_after );
    101101    }
     
    122122        require_once DIR_TESTDATA . '/plugins/internationalized-plugin.php';
    123123
    124         $expected_output_before      = i18n_plugin_test();
     124        $actual_output_before        = i18n_plugin_test();
    125125        $is_textdomain_loaded_before = is_textdomain_loaded( 'internationalized-plugin' );
    126126
     
    128128        remove_filter( 'locale', array( $this, 'filter_set_locale_to_german' ) );
    129129
    130         $expected_output_after      = i18n_plugin_test();
     130        $actual_output_after        = i18n_plugin_test();
    131131        $is_textdomain_loaded_after = is_textdomain_loaded( 'internationalized-plugin' );
    132132
     
    134134        load_textdomain( 'internationalized-plugin', WP_LANG_DIR . '/plugins/internationalized-plugin-de_DE.mo' );
    135135
    136         $expected_output_final      = i18n_plugin_test();
     136        $actual_output_final        = i18n_plugin_test();
    137137        $is_textdomain_loaded_final = is_textdomain_loaded( 'internationalized-plugin' );
    138138
     
    141141
    142142        // Text domain loaded just in time.
    143         $this->assertSame( 'Das ist ein Dummy Plugin', $expected_output_before );
     143        $this->assertSame( 'Das ist ein Dummy Plugin', $actual_output_before );
    144144        $this->assertTrue( $is_textdomain_loaded_before );
    145145
    146146        // Text domain unloaded.
    147         $this->assertSame( 'This is a dummy plugin', $expected_output_after );
     147        $this->assertSame( 'This is a dummy plugin', $actual_output_after );
    148148        $this->assertFalse( $is_textdomain_loaded_after );
    149149
    150150        // Text domain loaded manually again.
    151         $this->assertSame( 'Das ist ein Dummy Plugin', $expected_output_final );
     151        $this->assertSame( 'Das ist ein Dummy Plugin', $actual_output_final );
    152152        $this->assertTrue( $is_textdomain_loaded_final );
    153153    }
     
    160160
    161161        switch_to_locale( 'de_DE' );
    162         $expected = i18n_plugin_test();
     162        $actual = i18n_plugin_test();
    163163        restore_previous_locale();
    164164
    165         $this->assertSame( 'Das ist ein Dummy Plugin', $expected );
     165        $this->assertSame( 'Das ist ein Dummy Plugin', $actual );
    166166    }
    167167
     
    173173
    174174        switch_to_locale( 'de_DE' );
    175         $expected_de_de = i18n_plugin_test();
     175        $actual_de_de = i18n_plugin_test();
    176176
    177177        switch_to_locale( 'es_ES' );
    178         $expected_es_es = i18n_plugin_test();
     178        $actual_es_es = i18n_plugin_test();
    179179
    180180        restore_current_locale();
    181181
    182         $this->assertSame( 'Das ist ein Dummy Plugin', $expected_de_de );
    183         $this->assertSame( 'This is a dummy plugin', $expected_es_es );
     182        $this->assertSame( 'Das ist ein Dummy Plugin', $actual_de_de );
     183        $this->assertSame( 'This is a dummy plugin', $actual_es_es );
    184184    }
    185185
     
    193193
    194194        switch_to_locale( 'de_DE' );
    195         $expected = i18n_theme_test();
     195        $actual = i18n_theme_test();
    196196        restore_previous_locale();
    197197
    198198        switch_theme( WP_DEFAULT_THEME );
    199199
    200         $this->assertSame( 'Das ist ein Dummy Theme', $expected );
     200        $this->assertSame( 'Das ist ein Dummy Theme', $actual );
    201201    }
    202202
     
    210210        wp_set_current_user( self::$user_id );
    211211
    212         $expected = i18n_plugin_test();
    213 
    214         $this->assertSame( 'Das ist ein Dummy Plugin', $expected );
     212        $actual = i18n_plugin_test();
     213
     214        $this->assertSame( 'Das ist ein Dummy Plugin', $actual );
    215215    }
    216216
     
    225225        require_once get_stylesheet_directory() . '/functions.php';
    226226
    227         $expected = i18n_theme_test();
     227        $actual = i18n_theme_test();
    228228
    229229        switch_theme( WP_DEFAULT_THEME );
    230230
    231         $this->assertSame( 'Das ist ein Dummy Theme', $expected );
     231        $this->assertSame( 'Das ist ein Dummy Theme', $actual );
    232232    }
    233233
Note: See TracChangeset for help on using the changeset viewer.