Ticket #42278: 42278.patch
File 42278.patch, 21.5 KB (added by , 7 years ago) |
---|
-
tests/phpunit/includes/bootstrap.php
diff --git tests/phpunit/includes/bootstrap.php tests/phpunit/includes/bootstrap.php index 5d3e159685..29d9d0b66a 100644
require_once ABSPATH . '/wp-settings.php'; 105 105 // Delete any default posts & related data 106 106 _delete_all_posts(); 107 107 108 require dirname( __FILE__ ) . '/shared-fixtures.php'; 109 110 // Create shared user fixtures. 111 _tests_create_shared_user_fixtures(); 112 108 113 require dirname( __FILE__ ) . '/testcase.php'; 109 114 require dirname( __FILE__ ) . '/testcase-rest-api.php'; 110 115 require dirname( __FILE__ ) . '/testcase-rest-controller.php'; -
tests/phpunit/includes/functions.php
diff --git tests/phpunit/includes/functions.php tests/phpunit/includes/functions.php index 9a450ece84..1ccd5ac99c 100644
function _delete_all_data() { 75 75 76 76 $wpdb->query( "UPDATE {$wpdb->term_taxonomy} SET count = 0" ); 77 77 78 $wpdb->query( "DELETE FROM {$wpdb->users} WHERE ID != 1" ); 79 $wpdb->query( "DELETE FROM {$wpdb->usermeta} WHERE user_id != 1" ); 78 79 $wpdb->query( "DELETE FROM {$wpdb->users} WHERE ID != 1 AND ID != 2 AND ID != 3 AND ID != 4 AND ID != 5" ); 80 $wpdb->query( "DELETE FROM {$wpdb->usermeta} WHERE user_id != 1 AND user_id != 2 AND user_id != 3 AND user_id != 4 AND user_id != 5" ); 80 81 } 81 82 82 83 function _delete_all_posts() { -
new file tests/phpunit/includes/shared-fixtures.php
diff --git tests/phpunit/includes/shared-fixtures.php tests/phpunit/includes/shared-fixtures.php new file mode 100644 index 0000000000..30fd4f0301
- + 1 <?php 2 3 function _tests_create_shared_user_fixtures() { 4 // Editor. 5 wp_insert_user( array( 6 'role' => 'editor', 7 'user_email' => 'editor_user@example.org', 8 'user_login' => 'editor_user', 9 'user_pass' => 'password', 10 ) ); 11 12 // Author. 13 wp_insert_user( array( 14 'role' => 'author', 15 'user_email' => 'author_user@example.org', 16 'user_login' => 'author_user', 17 'user_pass' => 'password', 18 ) ); 19 20 // Contributor. 21 wp_insert_user( array( 22 'role' => 'contributor', 23 'user_email' => 'contributor_user@example.org', 24 'user_login' => 'contributor_user', 25 'user_pass' => 'password', 26 ) ); 27 28 // Subscriber. 29 wp_insert_user( array( 30 'role' => 'subscriber', 31 'user_email' => 'subscriber_user@example.org', 32 'user_login' => 'subscriber_user', 33 'user_pass' => 'password', 34 ) ); 35 } 36 37 function tests_get_shared_admin_user() { 38 static $admin; 39 40 if ( ! $admin ) { 41 $admin = get_user_by( 'id', 1 ); 42 } 43 44 return $admin; 45 } 46 47 function tests_get_shared_editor_user() { 48 static $editor; 49 50 if ( ! $editor ) { 51 $editor = get_user_by( 'id', 2 ); 52 } 53 54 return $editor; 55 } 56 57 function tests_get_shared_author_user() { 58 static $author; 59 60 if ( ! $author ) { 61 $author = get_user_by( 'id', 3 ); 62 } 63 64 return $author; 65 } 66 67 function tests_get_shared_contributor_user() { 68 static $contributor; 69 70 if ( ! $contributor ) { 71 $contributor = get_user_by( 'id', 4 ); 72 } 73 74 return $contributor; 75 } 76 77 function tests_get_shared_subscriber_user() { 78 static $subscriber; 79 80 if ( ! $subscriber ) { 81 $subscriber = get_user_by( 'id', 5 ); 82 } 83 84 return $subscriber; 85 } 86 -
new file tests/phpunit/tests/includes/shared-fixtures.php
diff --git tests/phpunit/tests/includes/shared-fixtures.php tests/phpunit/tests/includes/shared-fixtures.php new file mode 100644 index 0000000000..0081f89686
- + 1 <?php 2 3 /** 4 * @group testsuite 5 */ 6 class Test_Shared_Fixtures extends WP_UnitTestCase { 7 8 public function test_get_shared_admin_user() { 9 $admin = tests_get_shared_admin_user(); 10 11 $this->assertSame( 'administrator', $admin->roles[0] ); 12 } 13 14 public function test_get_shared_editor_user() { 15 $editor = tests_get_shared_editor_user(); 16 17 $this->assertSame( 'editor', $editor->roles[0] ); 18 } 19 20 public function test_get_shared_author_user() { 21 $author = tests_get_shared_author_user(); 22 23 $this->assertSame( 'author', $author->roles[0] ); 24 } 25 26 public function test_get_shared_contributor_user() { 27 $contributor = tests_get_shared_contributor_user(); 28 29 $this->assertSame( 'contributor', $contributor->roles[0] ); 30 } 31 32 public function test_get_shared_subscriber_user() { 33 $subscriber = tests_get_shared_subscriber_user(); 34 35 $this->assertSame( 'subscriber', $subscriber->roles[0] ); 36 } 37 } -
tests/phpunit/tests/meta.php
diff --git tests/phpunit/tests/meta.php tests/phpunit/tests/meta.php index b436630af7..ed4e9461ed 100644
class Tests_Meta extends WP_UnitTestCase { 137 137 ) 138 138 ); 139 139 140 $this->assertEquals( 1, count( $u ) );140 $this->assertEquals( 5, count( $u ) ); 141 141 142 142 // User found is not locally defined author (it's the admin) 143 143 $this->assertNotEquals( $this->author->user_login, $u[0]->user_login ); … … class Tests_Meta extends WP_UnitTestCase { 163 163 ); 164 164 165 165 $this->assertEquals( 166 2, count(166 6, count( 167 167 get_users( 168 168 array( 169 169 'meta_query' => array( … … class Tests_Meta extends WP_UnitTestCase { 180 180 delete_metadata( 'user', $this->author->ID, 'meta_key' ); 181 181 182 182 $this->assertEquals( 183 2, count(183 6, count( 184 184 get_users( 185 185 array( 186 186 'meta_query' => array( -
tests/phpunit/tests/rest-api/rest-users-controller.php
diff --git tests/phpunit/tests/rest-api/rest-users-controller.php tests/phpunit/tests/rest-api/rest-users-controller.php index 7b81eb1240..a4ba4b2482 100644
class WP_Test_REST_Users_Controller extends WP_Test_REST_Controller_Testcase { 280 280 $request = new WP_REST_Request( 'GET', '/wp/v2/users' ); 281 281 $response = $this->server->dispatch( $request ); 282 282 $headers = $response->get_headers(); 283 $this->assertEquals( 5 3, $headers['X-WP-Total'] );283 $this->assertEquals( 57, $headers['X-WP-Total'] ); 284 284 $this->assertEquals( 6, $headers['X-WP-TotalPages'] ); 285 285 $next_link = add_query_arg( 286 286 array( … … class WP_Test_REST_Users_Controller extends WP_Test_REST_Controller_Testcase { 299 299 $request->set_param( 'page', 3 ); 300 300 $response = $this->server->dispatch( $request ); 301 301 $headers = $response->get_headers(); 302 $this->assertEquals( 5 4, $headers['X-WP-Total'] );302 $this->assertEquals( 58, $headers['X-WP-Total'] ); 303 303 $this->assertEquals( 6, $headers['X-WP-TotalPages'] ); 304 304 $prev_link = add_query_arg( 305 305 array( … … class WP_Test_REST_Users_Controller extends WP_Test_REST_Controller_Testcase { 318 318 $request->set_param( 'page', 6 ); 319 319 $response = $this->server->dispatch( $request ); 320 320 $headers = $response->get_headers(); 321 $this->assertEquals( 5 4, $headers['X-WP-Total'] );321 $this->assertEquals( 58, $headers['X-WP-Total'] ); 322 322 $this->assertEquals( 6, $headers['X-WP-TotalPages'] ); 323 323 $prev_link = add_query_arg( 324 324 array( … … class WP_Test_REST_Users_Controller extends WP_Test_REST_Controller_Testcase { 332 332 $request->set_param( 'page', 8 ); 333 333 $response = $this->server->dispatch( $request ); 334 334 $headers = $response->get_headers(); 335 $this->assertEquals( 5 4, $headers['X-WP-Total'] );335 $this->assertEquals( 58, $headers['X-WP-Total'] ); 336 336 $this->assertEquals( 6, $headers['X-WP-TotalPages'] ); 337 337 $prev_link = add_query_arg( 338 338 array( … … class WP_Test_REST_Users_Controller extends WP_Test_REST_Controller_Testcase { 530 530 $request = new WP_REST_Request( 'GET', '/wp/v2/users' ); 531 531 $request->set_param( 'offset', 1 ); 532 532 $response = $this->server->dispatch( $request ); 533 $this->assertCount( 9, $response->get_data() );533 $this->assertCount( 10, $response->get_data() ); 534 534 // 'offset' works with 'per_page' 535 535 $request->set_param( 'per_page', 2 ); 536 536 $response = $this->server->dispatch( $request ); … … class WP_Test_REST_Users_Controller extends WP_Test_REST_Controller_Testcase { 728 728 // Note: Do not test using editor role as there is an editor role created in testing and it makes it hard to test this functionality. 729 729 public function test_get_items_roles() { 730 730 wp_set_current_user( self::$user ); 731 $tango = $this->factory->user->create( 732 array( 733 'display_name' => 'tango', 734 'role' => 'subscriber', 735 ) 736 ); 737 $yolo = $this->factory->user->create( 738 array( 739 'display_name' => 'yolo', 740 'role' => 'author', 741 ) 742 ); 731 743 732 $request = new WP_REST_Request( 'GET', '/wp/v2/users' ); 744 733 $request->set_param( 'roles', 'author,subscriber' ); 745 734 $response = $this->server->dispatch( $request ); 746 735 $data = $response->get_data(); 747 736 $this->assertEquals( 2, count( $data ) ); 748 $this->assertEquals( $tango, $data[0]['id'] ); 749 $this->assertEquals( $yolo, $data[1]['id'] ); 737 $this->assertEquals( tests_get_shared_author_user()->ID, $data[0]['id'] ); 738 $this->assertEquals( tests_get_shared_subscriber_user()->ID, $data[1]['id'] ); 739 750 740 $request->set_param( 'roles', 'author' ); 751 741 $response = $this->server->dispatch( $request ); 752 742 $data = $response->get_data(); 753 743 $this->assertEquals( 1, count( $data ) ); 754 $this->assertEquals( $yolo, $data[0]['id'] );744 $this->assertEquals( tests_get_shared_author_user()->ID, $data[0]['id'] ); 755 745 wp_set_current_user( 0 ); 756 746 $request->set_param( 'roles', 'author' ); 757 747 $response = $this->server->dispatch( $request ); … … class WP_Test_REST_Users_Controller extends WP_Test_REST_Controller_Testcase { 764 754 765 755 public function test_get_items_invalid_roles() { 766 756 wp_set_current_user( self::$user ); 767 $lolz = $this->factory->user->create( 768 array( 769 'display_name' => 'lolz', 770 'role' => 'author', 771 ) 772 ); 757 773 758 $request = new WP_REST_Request( 'GET', '/wp/v2/users' ); 774 759 $request->set_param( 'roles', 'ilovesteak,author' ); 775 760 $response = $this->server->dispatch( $request ); 776 761 $data = $response->get_data(); 777 762 $this->assertEquals( 1, count( $data ) ); 778 $this->assertEquals( $lolz, $data[0]['id'] ); 763 $this->assertEquals( tests_get_shared_author_user()->ID, $data[0]['id'] ); 764 779 765 $request = new WP_REST_Request( 'GET', '/wp/v2/users' ); 780 766 $request->set_param( 'roles', 'steakisgood' ); 781 767 $response = $this->server->dispatch( $request ); -
tests/phpunit/tests/user/countUsers.php
diff --git tests/phpunit/tests/user/countUsers.php tests/phpunit/tests/user/countUsers.php index 8d1efad61a..4b02203865 100644
class Tests_User_CountUsers extends WP_UnitTestCase { 12 12 * @group ms-excluded 13 13 */ 14 14 public function test_count_users_is_accurate( $strategy ) { 15 // Setup users16 $admin = self::factory()->user->create(17 array(18 'role' => 'administrator',19 )20 );21 $editor = self::factory()->user->create(22 array(23 'role' => 'editor',24 )25 );26 $author = self::factory()->user->create(27 array(28 'role' => 'author',29 )30 );31 $contributor = self::factory()->user->create(32 array(33 'role' => 'contributor',34 )35 );36 $subscriber = self::factory()->user->create(37 array(38 'role' => 'subscriber',39 )40 );41 15 $none = self::factory()->user->create( 42 16 array( 43 17 'role' => '', … … class Tests_User_CountUsers extends WP_UnitTestCase { 52 26 // Test user counts 53 27 $count = count_users( $strategy ); 54 28 55 $this->assertEquals( 8, $count['total_users'] );29 $this->assertEquals( 7, $count['total_users'] ); 56 30 $this->assertEquals( 57 31 array( 58 'administrator' => 2,32 'administrator' => 1, 59 33 'editor' => 1, 60 34 'author' => 1, 61 35 'contributor' => 1, … … class Tests_User_CountUsers extends WP_UnitTestCase { 131 105 // Test users counts on root site 132 106 $count = count_users( $strategy ); 133 107 134 $this->assertEquals( 8, $count['total_users'] );108 $this->assertEquals( 12, $count['total_users'] ); 135 109 $this->assertEquals( 136 110 array( 137 111 'administrator' => 2, 138 'editor' => 1,139 'author' => 1,140 'contributor' => 1,141 'subscriber' => 1,112 'editor' => 2, 113 'author' => 2, 114 'contributor' => 2, 115 'subscriber' => 2, 142 116 'none' => 2, 143 117 ), $count['avail_roles'] 144 118 ); … … class Tests_User_CountUsers extends WP_UnitTestCase { 207 181 * @dataProvider data_count_users_strategies 208 182 */ 209 183 public function test_count_users_is_accurate_with_multiple_roles( $strategy ) { 210 211 // Setup users 212 $admin = self::factory()->user->create( 213 array( 214 'role' => 'administrator', 215 ) 216 ); 184 // Setup user 217 185 $editor = self::factory()->user->create( 218 186 array( 219 187 'role' => 'editor', … … class Tests_User_CountUsers extends WP_UnitTestCase { 232 200 // Test user counts 233 201 $count = count_users( $strategy ); 234 202 235 $this->assertEquals( 3, $count['total_users'] );203 $this->assertEquals( 6, $count['total_users'] ); 236 204 $this->assertEquals( 237 205 array( 238 'administrator' => 2, 239 'editor' => 1, 240 'author' => 1, 206 'administrator' => 1, 207 'editor' => 2, 208 'author' => 2, 209 'contributor' => 1, 210 'subscriber' => 1, 241 211 'none' => 0, 242 212 ), $count['avail_roles'] 243 213 ); -
tests/phpunit/tests/user/listAuthors.php
diff --git tests/phpunit/tests/user/listAuthors.php tests/phpunit/tests/user/listAuthors.php index 1568c34680..14881ba1a9 100644
class Tests_User_ListAuthors extends WP_UnitTestCase { 148 148 149 149 function test_wp_list_authors_hide_empty() { 150 150 $fred_id = self::$fred_id; 151 $expected['hide_empty'] = '<li><a href="' . self::$user_urls[1] . '" title="Posts by bob">bob</a></li><li><a href="' . get_author_posts_url( $fred_id ) . '" title="Posts by fred">fred</a></li><li><a href="' . self::$user_urls[2] . '" title="Posts by paul">paul</a></li><li><a href="' . self::$user_urls[0] . '" title="Posts by zack">zack</a></li>'; 151 $expected['hide_empty'] = '<li><a href="' . get_author_posts_url( tests_get_shared_author_user()->ID ) . '" title="Posts by ' . tests_get_shared_author_user()->user_nicename . '">' . tests_get_shared_author_user()->user_nicename . '</a></li>'; 152 $expected['hide_empty'] .= '<li><a href="' . self::$user_urls[1] . '" title="Posts by bob">bob</a></li>'; 153 $expected['hide_empty'] .= '<li><a href="' . get_author_posts_url( tests_get_shared_contributor_user()->ID ) . '" title="Posts by ' . tests_get_shared_contributor_user()->user_nicename . '">' . tests_get_shared_contributor_user()->user_nicename . '</a></li>'; 154 $expected['hide_empty'] .= '<li><a href="' . get_author_posts_url( tests_get_shared_editor_user()->ID ) . '" title="Posts by ' . tests_get_shared_editor_user()->user_nicename . '">' . tests_get_shared_editor_user()->user_nicename . '</a></li>'; 155 $expected['hide_empty'] .= '<li><a href="' . get_author_posts_url( $fred_id ) . '" title="Posts by fred">fred</a></li>'; 156 $expected['hide_empty'] .= '<li><a href="' . self::$user_urls[2] . '" title="Posts by paul">paul</a></li>'; 157 $expected['hide_empty'] .= '<li><a href="' . get_author_posts_url( tests_get_shared_subscriber_user()->ID ) . '" title="Posts by ' . tests_get_shared_subscriber_user()->user_nicename . '">' . tests_get_shared_subscriber_user()->user_nicename . '</a></li>'; 158 $expected['hide_empty'] .= '<li><a href="' . self::$user_urls[0] . '" title="Posts by zack">zack</a></li>'; 159 152 160 $this->AssertEquals( 153 161 $expected['hide_empty'], wp_list_authors( 154 162 array( -
tests/phpunit/tests/user/query.php
diff --git tests/phpunit/tests/user/query.php tests/phpunit/tests/user/query.php index 64c110606e..34f0371bba 100644
class Tests_User_Query extends WP_UnitTestCase { 131 131 $users = $users->get_results(); 132 132 133 133 // +1 for the default user created during installation. 134 $this->assertEquals( 1 3, count( $users ) );134 $this->assertEquals( 17, count( $users ) ); 135 135 foreach ( $users as $user ) { 136 136 $this->assertInstanceOf( 'WP_User', $user ); 137 137 } … … class Tests_User_Query extends WP_UnitTestCase { 143 143 ) 144 144 ); 145 145 $users = $users->get_results(); 146 $this->assertEquals( 1 3, count( $users ) );146 $this->assertEquals( 17, count( $users ) ); 147 147 foreach ( $users as $user ) { 148 148 $this->assertInstanceOf( 'WP_User', $user ); 149 149 } … … class Tests_User_Query extends WP_UnitTestCase { 156 156 $users = new WP_User_Query( array( 'blog_id' => get_current_blog_id() ) ); 157 157 $total_users = $users->get_total(); 158 158 159 $this->assertSame( 1 3, $total_users );159 $this->assertSame( 17, $total_users ); 160 160 } 161 161 162 162 /** … … class Tests_User_Query extends WP_UnitTestCase { 496 496 // +1 for the default user created by the test suite. 497 497 $users = new WP_User_Query( array( 'blog_id' => get_current_blog_id() ) ); 498 498 $users = $users->get_results(); 499 $this->assertEquals( 1 3, count( $users ) );499 $this->assertEquals( 17, count( $users ) ); 500 500 501 501 $users = new WP_User_Query( 502 502 array( … … class Tests_User_Query extends WP_UnitTestCase { 523 523 ) 524 524 ); 525 525 $users = $users->get_results(); 526 $this->assertEquals( 1 3, count( $users ) );526 $this->assertEquals( 17, count( $users ) ); 527 527 } 528 528 529 529 /** … … class Tests_User_Query extends WP_UnitTestCase { 1133 1133 ); 1134 1134 1135 1135 $foundCount = count( $q->get_results() ); 1136 $expectedCount = 1 0; // 13 total users minus 3 from query1136 $expectedCount = 14; // 13 total users minus 3 from query 1137 1137 1138 1138 $this->assertContains( "AND user_nicename NOT IN ( 'peter','paul','mary' )", $q->query_where ); 1139 1139 $this->assertEquals( $expectedCount, $foundCount ); … … class Tests_User_Query extends WP_UnitTestCase { 1234 1234 ); 1235 1235 1236 1236 $foundCount = count( $q->get_results() ); 1237 $expectedCount = 1 0; // 13 total users minus 3 from query1237 $expectedCount = 14; // 13 total users minus 3 from query 1238 1238 1239 1239 $this->assertContains( "AND user_login NOT IN ( '$user_login1','$user_login2','$user_login3' )", $q->query_where ); 1240 1240 $this->assertEquals( $expectedCount, $foundCount ); … … class Tests_User_Query extends WP_UnitTestCase { 1308 1308 $wp_user_search = new WP_User_Query( array( 'role' => 'subscriber' ) ); 1309 1309 $users = $wp_user_search->get_results(); 1310 1310 1311 $this->assertEquals( 2, count( $users ) );1311 $this->assertEquals( 3, count( $users ) ); 1312 1312 } 1313 1313 1314 1314 /** … … class Tests_User_Query extends WP_UnitTestCase { 1317 1317 public function test_get_multiple_roles_by_user_query() { 1318 1318 $wp_user_search = new WP_User_Query( array( 'role__in' => array( 'subscriber', 'editor' ) ) ); 1319 1319 $users = $wp_user_search->get_results(); 1320 $this->assertEquals( 5, count( $users ) );1320 $this->assertEquals( 7, count( $users ) ); 1321 1321 } 1322 1322 1323 1323 /** … … class Tests_User_Query extends WP_UnitTestCase { 1330 1330 ) 1331 1331 ); 1332 1332 1333 $this->assertEquals( 2, count( $users ) );1333 $this->assertEquals( 3, count( $users ) ); 1334 1334 } 1335 1335 1336 1336 /** … … class Tests_User_Query extends WP_UnitTestCase { 1352 1352 ) 1353 1353 ); 1354 1354 1355 $this->assertEqualSets( self::$editor_ids, $users );1355 $this->assertEqualSets( array_merge( array( tests_get_shared_editor_user()->ID ), self::$editor_ids) , $users ); 1356 1356 } 1357 1357 1358 1358 … … class Tests_User_Query extends WP_UnitTestCase { 1366 1366 ) 1367 1367 ); 1368 1368 1369 $this->assertEquals( 2, count( $users ) );1369 $this->assertEquals( 3, count( $users ) ); 1370 1370 } 1371 1371 1372 1372 /** … … class Tests_User_Query extends WP_UnitTestCase { 1401 1401 $users = $users->get_results(); 1402 1402 1403 1403 // +1 for the default user created during installation. 1404 $this->assertEquals( 8, count( $users ) );1404 $this->assertEquals( 10, count( $users ) ); 1405 1405 foreach ( $users as $user ) { 1406 1406 $this->assertInstanceOf( 'WP_User', $user ); 1407 1407 } … … class Tests_User_Query extends WP_UnitTestCase { 1491 1491 ); 1492 1492 1493 1493 // +1 for the default user created during installation. 1494 $this->assertEquals( 1 1, count( $users ) );1494 $this->assertEquals( 14, count( $users ) ); 1495 1495 1496 1496 $users = get_users( 1497 1497 array( … … class Tests_User_Query extends WP_UnitTestCase { 1500 1500 ); 1501 1501 1502 1502 // +1 for the default user created during installation. 1503 $this->assertEquals( 1 0, count( $users ) );1503 $this->assertEquals( 13, count( $users ) ); 1504 1504 } 1505 1505 1506 1506 /** … … class Tests_User_Query extends WP_UnitTestCase { 1518 1518 ) 1519 1519 ); 1520 1520 1521 $this->assertEquals( 5, count( $users ) );1521 $this->assertEquals( 6, count( $users ) ); 1522 1522 1523 1523 $users = get_users( 1524 1524 array( … … class Tests_User_Query extends WP_UnitTestCase { 1527 1527 ) 1528 1528 ); 1529 1529 1530 $this->assertEquals( 3, count( $users ) );1530 $this->assertEquals( 4, count( $users ) ); 1531 1531 } 1532 1532 1533 1533 /** … … class Tests_User_Query extends WP_UnitTestCase { 1544 1544 ) 1545 1545 ); 1546 1546 1547 $this->assertEquals( 1, count( $users ) );1547 $this->assertEquals( 2, count( $users ) ); 1548 1548 } 1549 1549 1550 1550 /** … … class Tests_User_Query extends WP_UnitTestCase { 1562 1562 ); 1563 1563 1564 1564 // +1 for the default user created during installation. 1565 $this->assertEquals( 1 2, count( $users ) );1565 $this->assertEquals( 15, count( $users ) ); 1566 1566 1567 1567 $users = get_users( 1568 1568 array( … … class Tests_User_Query extends WP_UnitTestCase { 1571 1571 ); 1572 1572 1573 1573 // +1 for the default user created during installation. 1574 $this->assertEquals( 1 0, count( $users ) );1574 $this->assertEquals( 13, count( $users ) ); 1575 1575 } 1576 1576 1577 1577 /** -
tests/phpunit/tests/xmlrpc/wp/getUsers.php
diff --git tests/phpunit/tests/xmlrpc/wp/getUsers.php tests/phpunit/tests/xmlrpc/wp/getUsers.php index bddafcf39a..192b4b38d8 100644
class Tests_XMLRPC_wp_getUsers extends WP_XMLRPC_UnitTestCase { 66 66 $filter = array( 'role' => 'editor' ); 67 67 $results = $this->myxmlrpcserver->wp_getUsers( array( 1, 'administrator', 'administrator', $filter ) ); 68 68 $this->assertNotIXRError( $results ); 69 $this->assertCount( 1, $results );69 $this->assertCount( 2, $results ); 70 70 $this->assertEquals( $editor_id, $results[0]['user_id'] ); 71 71 72 72 // test 'authors', which should return all non-subscribers