Make WordPress Core


Ignore:
Timestamp:
11/30/2017 11:09:33 PM (8 years ago)
Author:
pento
Message:

Code is Poetry.
WordPress' code just... wasn't.
This is now dealt with.

Props jrf, pento, netweb, GaryJ, jdgrimes, westonruter, Greg Sherwood from PHPCS, and everyone who's ever contributed to WPCS and PHPCS.
Fixes #41057.

File:
1 edited

Legend:

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

    r41654 r42343  
    1212    public function test_get_users_with_no_role_is_accurate() {
    1313        // Setup users
    14         $admin = self::factory()->user->create( array(
    15             'role' => 'administrator',
    16         ) );
    17         $editor = self::factory()->user->create( array(
    18             'role' => 'editor',
    19         ) );
    20         $nobody = self::factory()->user->create( array(
    21             'role' => '',
    22         ) );
    23         $nobody_else = self::factory()->user->create( array(
    24             'role' => '',
    25         ) );
     14        $admin       = self::factory()->user->create(
     15            array(
     16                'role' => 'administrator',
     17            )
     18        );
     19        $editor      = self::factory()->user->create(
     20            array(
     21                'role' => 'editor',
     22            )
     23        );
     24        $nobody      = self::factory()->user->create(
     25            array(
     26                'role' => '',
     27            )
     28        );
     29        $nobody_else = self::factory()->user->create(
     30            array(
     31                'role' => '',
     32            )
     33        );
    2634
    2735        // Test users
    2836        $users = wp_get_users_with_no_role();
    2937
    30         $this->assertEquals( array(
    31             $nobody,
    32             $nobody_else,
    33         ), $users );
     38        $this->assertEquals(
     39            array(
     40                $nobody,
     41                $nobody_else,
     42            ), $users
     43        );
    3444
    3545    }
     
    4353    public function test_get_users_with_no_role_multisite_is_accurate() {
    4454        // Setup users
    45         $admin = self::factory()->user->create( array(
    46             'role' => 'administrator',
    47         ) );
    48         $editor = self::factory()->user->create( array(
    49             'role' => 'editor',
    50         ) );
    51         $nobody = self::factory()->user->create( array(
    52             'role' => '',
    53         ) );
     55        $admin  = self::factory()->user->create(
     56            array(
     57                'role' => 'administrator',
     58            )
     59        );
     60        $editor = self::factory()->user->create(
     61            array(
     62                'role' => 'editor',
     63            )
     64        );
     65        $nobody = self::factory()->user->create(
     66            array(
     67                'role' => '',
     68            )
     69        );
    5470
    5571        // Setup blogs
    56         $blog_1 = (int) self::factory()->blog->create( array(
    57             'user_id' => $editor,
    58         ) );
     72        $blog_1 = (int) self::factory()->blog->create(
     73            array(
     74                'user_id' => $editor,
     75            )
     76        );
    5977
    6078        // Add editor to blog 1
     
    6381        // Test users on root site
    6482        $users = wp_get_users_with_no_role();
    65         $this->assertSame( array(
    66             "{$nobody}",
    67         ), $users );
     83        $this->assertSame(
     84            array(
     85                "{$nobody}",
     86            ), $users
     87        );
    6888
    6989        // Test users counts on blog 1
     
    7696        // Re-test users counts on blog 1
    7797        $users = wp_get_users_with_no_role( $blog_1 );
    78         $this->assertSame( array(
    79             "{$admin}",
    80         ), $users );
     98        $this->assertSame(
     99            array(
     100                "{$admin}",
     101            ), $users
     102        );
    81103    }
    82104
     
    91113        wp_roles()->add_role( 'somerole', 'Some role display name' );
    92114
    93         $someuser = self::factory()->user->create( array(
    94             'role' => 'somerole',
    95         ) );
     115        $someuser = self::factory()->user->create(
     116            array(
     117                'role' => 'somerole',
     118            )
     119        );
    96120
    97121        $users = wp_get_users_with_no_role();
     
    112136        switch_to_blog( $site_id );
    113137        wp_roles()->add_role( 'somerole', 'Some role display name' );
    114         $user_id = self::factory()->user->create( array(
    115             'role' => 'somerole',
    116         ) );
     138        $user_id = self::factory()->user->create(
     139            array(
     140                'role' => 'somerole',
     141            )
     142        );
    117143        restore_current_blog();
    118144
Note: See TracChangeset for help on using the changeset viewer.