Skip to content

Commit ce0f128

Browse files
committed
Minor refactoring and fix lint error
1 parent b351ddb commit ce0f128

File tree

1 file changed

+23
-23
lines changed

1 file changed

+23
-23
lines changed

tests/phpunit/tests/rest-api/rest-comments-controller.php

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* @package WordPress
66
* @subpackage REST API
77
*
8-
* @group restapi1
8+
* @group restapi
99
*/
1010
class WP_Test_REST_Comments_Controller extends WP_Test_REST_Controller_Testcase {
1111
protected static $superadmin_id;
@@ -42,23 +42,23 @@ public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
4242
)
4343
);
4444

45-
self::$superadmin_id = $factory->user->create(
45+
self::$superadmin_id = $factory->user->create(
4646
array(
4747
'role' => 'administrator',
4848
'user_login' => 'superadmin',
4949
)
5050
);
51-
self::$admin_id = $factory->user->create(
51+
self::$admin_id = $factory->user->create(
5252
array(
5353
'role' => 'administrator',
5454
)
5555
);
56-
self::$editor_id = $factory->user->create(
56+
self::$editor_id = $factory->user->create(
5757
array(
5858
'role' => 'editor',
5959
)
6060
);
61-
self::$moderator_id = $factory->user->create(
61+
self::$moderator_id = $factory->user->create(
6262
array(
6363
'role' => 'comment_moderator',
6464
)
@@ -68,12 +68,12 @@ public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
6868
'role' => 'contributor',
6969
)
7070
);
71-
self::$subscriber_id = $factory->user->create(
71+
self::$subscriber_id = $factory->user->create(
7272
array(
7373
'role' => 'subscriber',
7474
)
7575
);
76-
self::$author_id = $factory->user->create(
76+
self::$author_id = $factory->user->create(
7777
array(
7878
'role' => 'author',
7979
'display_name' => 'Sea Captain',
@@ -121,6 +121,16 @@ public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
121121
)
122122
);
123123

124+
self::$user_ids = array(
125+
'superadmin' => self::$superadmin_id,
126+
'administrator' => self::$admin_id,
127+
'editor' => self::$editor_id,
128+
'moderator' => self::$moderator_id,
129+
'contributor' => self::$contributor_id,
130+
'subscriber' => self::$subscriber_id,
131+
'author' => self::$author_id,
132+
);
133+
124134
// Set up comments for pagination tests.
125135
for ( $i = 0; $i < self::$total_comments - 1; $i++ ) {
126136
self::$comment_ids[] = $factory->comment->create(
@@ -163,16 +173,6 @@ public function set_up() {
163173
if ( is_multisite() ) {
164174
update_site_option( 'site_admins', array( 'superadmin' ) );
165175
}
166-
167-
self::$user_ids = array(
168-
'superadmin' => self::$superadmin_id,
169-
'administrator' => self::$admin_id,
170-
'editor' => self::$editor_id,
171-
'moderator' => self::$moderator_id,
172-
'contributor' => self::$contributor_id,
173-
'subscriber' => self::$subscriber_id,
174-
'author' => self::$author_id,
175-
);
176176
}
177177

178178
public function test_register_routes() {
@@ -3991,13 +3991,13 @@ public function test_note_get_item_permissions_edit_context( $role, $post_author
39913991

39923992
public function data_note_get_items_permissions_data_provider() {
39933993
return array(
3994-
'Administrator can see note on other posts' => array( 'administrator', 'author', true ),
3995-
'Editor can see note on other posts' => array( 'editor', 'contributor', true ),
3996-
'Author cannot see note on other posts' => array( 'author', 'editor', false ),
3994+
'Administrator can see note on other posts' => array( 'administrator', 'author', true ),
3995+
'Editor can see note on other posts' => array( 'editor', 'contributor', true ),
3996+
'Author cannot see note on other posts' => array( 'author', 'editor', false ),
39973997
'Contributor cannot see note on other posts' => array( 'contributor', 'author', false ),
3998-
'Subscriber cannot see note' => array( 'subscriber', 'author', false ),
3999-
'Author can see note on own post' => array( 'author', 'author', true ),
4000-
'Contributor can see note on own post' => array( 'contributor', 'contributor', true ),
3998+
'Subscriber cannot see note' => array( 'subscriber', 'author', false ),
3999+
'Author can see note on own post' => array( 'author', 'author', true ),
4000+
'Contributor can see note on own post' => array( 'contributor', 'contributor', true ),
40014001
);
40024002
}
40034003

0 commit comments

Comments
 (0)