Changeset 42343 for trunk/tests/phpunit/tests/user/wpGetUsersWithNoRole.php
- Timestamp:
- 11/30/2017 11:09:33 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/user/wpGetUsersWithNoRole.php
r41654 r42343 12 12 public function test_get_users_with_no_role_is_accurate() { 13 13 // 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 ); 26 34 27 35 // Test users 28 36 $users = wp_get_users_with_no_role(); 29 37 30 $this->assertEquals( array( 31 $nobody, 32 $nobody_else, 33 ), $users ); 38 $this->assertEquals( 39 array( 40 $nobody, 41 $nobody_else, 42 ), $users 43 ); 34 44 35 45 } … … 43 53 public function test_get_users_with_no_role_multisite_is_accurate() { 44 54 // 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 ); 54 70 55 71 // 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 ); 59 77 60 78 // Add editor to blog 1 … … 63 81 // Test users on root site 64 82 $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 ); 68 88 69 89 // Test users counts on blog 1 … … 76 96 // Re-test users counts on blog 1 77 97 $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 ); 81 103 } 82 104 … … 91 113 wp_roles()->add_role( 'somerole', 'Some role display name' ); 92 114 93 $someuser = self::factory()->user->create( array( 94 'role' => 'somerole', 95 ) ); 115 $someuser = self::factory()->user->create( 116 array( 117 'role' => 'somerole', 118 ) 119 ); 96 120 97 121 $users = wp_get_users_with_no_role(); … … 112 136 switch_to_blog( $site_id ); 113 137 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 ); 117 143 restore_current_blog(); 118 144
Note: See TracChangeset
for help on using the changeset viewer.