Code Duplication    Length = 7-8 lines in 4 locations

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

@@ 951-958 (lines=8) @@
948
        $this->assertErrorResponse('rest_post_invalid_id', $response, 404);
949
    }
950
951
    public function test_get_comment_not_approved() 
952
    {
953
        wp_set_current_user(0);
954
955
        $request = new WP_REST_Request('GET', sprintf('/wp/v2/comments/%d', self::$hold_id));
956
957
        $response = $this->server->dispatch($request);
958
        $this->assertErrorResponse('rest_cannot_read', $response, 401);
959
    }
960
961
    public function test_get_comment_not_approved_same_user() 
@@ 961-968 (lines=8) @@
958
        $this->assertErrorResponse('rest_cannot_read', $response, 401);
959
    }
960
961
    public function test_get_comment_not_approved_same_user() 
962
    {
963
        wp_set_current_user(self::$admin_id);
964
965
        $request = new WP_REST_Request('GET', sprintf('/wp/v2/comments/%d', self::$hold_id));
966
967
        $response = $this->server->dispatch($request);
968
        $this->assertEquals(200, $response->get_status());
969
    }
970
971
    public function test_get_comment_with_children_link() 
@@ 2756-2763 (lines=8) @@
2753
        $this->assertErrorResponse('rest_already_trashed', $response, 410);
2754
    }
2755
2756
    public function test_delete_comment_invalid_id() 
2757
    {
2758
        wp_set_current_user(self::$admin_id);
2759
2760
        $request = new WP_REST_Request('DELETE', sprintf('/wp/v2/comments/%d', REST_TESTS_IMPOSSIBLY_HIGH_NUMBER));
2761
2762
        $response = $this->server->dispatch($request);
2763
        $this->assertErrorResponse('rest_comment_invalid_id', $response, 404);
2764
    }
2765
2766
    public function test_delete_comment_without_permission() 

tests/phpunit/tests/rest-api/rest-users-controller.php 1 location

@@ 645-651 (lines=7) @@
642
        $this->assertEquals(substr(get_avatar_url($user->user_email), 9), substr($data['avatar_urls'][96], 9));
643
    }
644
645
    public function test_get_user_invalid_id() 
646
    {
647
        wp_set_current_user(self::$user);
648
        $request = new WP_REST_Request('GET', '/wp/v2/users/100');
649
        $response = $this->server->dispatch($request);
650
651
        $this->assertErrorResponse('rest_user_invalid_id', $response, 404);
652
    }
653
654
    public function test_get_user_empty_capabilities()