Make WordPress Core


Ignore:
Timestamp:
11/04/2021 03:22:47 PM (3 years ago)
Author:
hellofromTonya
Message:

Coding Standards: Add visibility to methods in tests/phpunit/tests/.

Adds a public visibility to test fixtures, tests, data providers, and callbacks methods.

Adds a private visibility to helper methods within test classes.

Renames callbacks and helpers that previously started with a _ prefix. Why? For consistency and to leverage using the method visibility. Further naming standardizations is beyond the scope of this commit.

Props costdev, jrf, hellofromTonya.
Fixes #54177.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/admin/includesPlugin.php

    r51800 r52010  
    1313    }
    1414
    15     function test_get_plugin_data() {
     15    public function test_get_plugin_data() {
    1616        $data = get_plugin_data( DIR_TESTDATA . '/plugins/hello.php' );
    1717
     
    3636    }
    3737
    38     function test_menu_page_url() {
     38    public function test_menu_page_url() {
    3939        $current_user = get_current_user_id();
    4040        wp_set_current_user( self::factory()->user->create( array( 'role' => 'administrator' ) ) );
     
    7878     * @dataProvider data_submenu_position
    7979     */
    80     function test_submenu_position( $position, $expected_position ) {
     80    public function test_submenu_position( $position, $expected_position ) {
    8181        global $submenu;
    8282        global $menu;
     
    126126     * @dataProvider data_submenu_position
    127127     */
    128     function test_submenu_helpers_position( $position, $expected_position ) {
     128    public function test_submenu_helpers_position( $position, $expected_position ) {
    129129        global $submenu;
    130130        global $menu;
     
    228228     * }
    229229     */
    230     function submenus_to_add() {
     230    private function submenus_to_add() {
    231231        return array(
    232232            array( 'Submenu Position', 'Submenu Position', 'manage_options', 'sub-page', '' ),
     
    250250     * }
    251251     */
    252     function data_submenu_position() {
     252    public function data_submenu_position() {
    253253        $menu_count = count( $this->submenus_to_add() );
    254254        return array(
     
    269269     * @ticket 48599
    270270     */
    271     function test_position_when_parent_slug_child_slug_are_the_same() {
     271    public function test_position_when_parent_slug_child_slug_are_the_same() {
    272272        global $submenu, $menu;
    273273
     
    301301     * @ticket 48599
    302302     */
    303     function test_passing_string_as_position_fires_doing_it_wrong() {
     303    public function test_passing_string_as_position_fires_doing_it_wrong() {
    304304        $this->setExpectedIncorrectUsage( 'add_submenu_page' );
    305305        global $submenu, $menu;
     
    325325    }
    326326
    327     function test_is_plugin_active_true() {
     327    public function test_is_plugin_active_true() {
    328328        activate_plugin( 'hello.php' );
    329329        $test = is_plugin_active( 'hello.php' );
     
    333333    }
    334334
    335     function test_is_plugin_active_false() {
     335    public function test_is_plugin_active_false() {
    336336        deactivate_plugins( 'hello.php' );
    337337        $test = is_plugin_active( 'hello.php' );
     
    339339    }
    340340
    341     function test_is_plugin_inactive_true() {
     341    public function test_is_plugin_inactive_true() {
    342342        deactivate_plugins( 'hello.php' );
    343343        $test = is_plugin_inactive( 'hello.php' );
     
    345345    }
    346346
    347     function test_is_plugin_inactive_false() {
     347    public function test_is_plugin_inactive_false() {
    348348        activate_plugin( 'hello.php' );
    349349        $test = is_plugin_inactive( 'hello.php' );
Note: See TracChangeset for help on using the changeset viewer.