Code Duplication    Length = 17-19 lines in 2 locations

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

@@ 885-901 (lines=17) @@
882
        $this->check_comment_data($data, 'edit', $response->get_links());
883
    }
884
885
    public function test_get_comment_author_avatar_urls() 
886
    {
887
        $request = new WP_REST_Request('GET', sprintf('/wp/v2/comments/%d', self::$approved_id));
888
889
        $response = $this->server->dispatch($request);
890
891
        $data = $response->get_data();
892
        $this->assertArrayHasKey(24,  $data['author_avatar_urls']);
893
        $this->assertArrayHasKey(48,  $data['author_avatar_urls']);
894
        $this->assertArrayHasKey(96,  $data['author_avatar_urls']);
895
896
        $comment = get_comment(self::$approved_id);
897
        /**
898
         * Ignore the subdomain, since 'get_avatar_url randomly sets the Gravatar
899
         * server when building the url string.
900
         */
901
        $this->assertEquals(substr(get_avatar_url($comment->comment_author_email), 9), substr($data['author_avatar_urls'][96], 9));
902
    }
903
904
    public function test_get_comment_invalid_id() 

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

@@ 624-642 (lines=19) @@
621
        $this->check_get_user_response($data, 'edit');
622
    }
623
624
    public function test_get_user_avatar_urls() 
625
    {
626
        wp_set_current_user(self::$user);
627
628
        $request = new WP_REST_Request('GET', sprintf('/wp/v2/users/%d', self::$editor));
629
630
        $response = $this->server->dispatch($request);
631
632
        $data = $response->get_data();
633
        $this->assertArrayHasKey(24,  $data['avatar_urls']);
634
        $this->assertArrayHasKey(48,  $data['avatar_urls']);
635
        $this->assertArrayHasKey(96,  $data['avatar_urls']);
636
637
        $user = get_user_by('id', self::$editor);
638
        /**
639
         * Ignore the subdomain, since 'get_avatar_url randomly sets the Gravatar
640
         * server when building the url string.
641
         */
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()