Code Duplication    Length = 7-9 lines in 5 locations

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

@@ 82-88 (lines=7) @@
79
        copy($orig_file2, $this->test_file2);
80
    }
81
82
    public function test_register_routes() 
83
    {
84
        $routes = $this->server->get_routes();
85
        $this->assertArrayHasKey('/wp/v2/media', $routes);
86
        $this->assertCount(2, $routes['/wp/v2/media']);
87
        $this->assertArrayHasKey('/wp/v2/media/(?P<id>[\d]+)', $routes);
88
        $this->assertCount(3, $routes['/wp/v2/media/(?P<id>[\d]+)']);
89
    }
90
91
    public static function disposition_provider() 

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

@@ 126-133 (lines=8) @@
123
        }
124
    }
125
126
    public function test_register_routes() 
127
    {
128
        $routes = $this->server->get_routes();
129
130
        $this->assertArrayHasKey('/wp/v2/comments', $routes);
131
        $this->assertCount(2, $routes['/wp/v2/comments']);
132
        $this->assertArrayHasKey('/wp/v2/comments/(?P<id>[\d]+)', $routes);
133
        $this->assertCount(3, $routes['/wp/v2/comments/(?P<id>[\d]+)']);
134
    }
135
136
    public function test_context_param() 

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

@@ 82-89 (lines=8) @@
79
        register_post_type('youseeme', array( 'supports' => array(), 'show_in_rest' => true ));
80
    }
81
82
    public function test_register_routes() 
83
    {
84
        $routes = $this->server->get_routes();
85
86
        $this->assertArrayHasKey('/wp/v2/posts', $routes);
87
        $this->assertCount(2, $routes['/wp/v2/posts']);
88
        $this->assertArrayHasKey('/wp/v2/posts/(?P<id>[\d]+)', $routes);
89
        $this->assertCount(3, $routes['/wp/v2/posts/(?P<id>[\d]+)']);
90
    }
91
92
    public function test_context_param() 

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

@@ 61-67 (lines=7) @@
58
        $this->revision_id2 = $this->revision_2->ID;
59
    }
60
61
    public function test_register_routes() 
62
    {
63
        $routes = $this->server->get_routes();
64
        $this->assertArrayHasKey('/wp/v2/posts/(?P<parent>[\d]+)/revisions', $routes);
65
        $this->assertArrayHasKey('/wp/v2/posts/(?P<parent>[\d]+)/revisions/(?P<id>[\d]+)', $routes);
66
        $this->assertArrayHasKey('/wp/v2/pages/(?P<parent>[\d]+)/revisions', $routes);
67
        $this->assertArrayHasKey('/wp/v2/pages/(?P<parent>[\d]+)/revisions/(?P<id>[\d]+)', $routes);
68
    }
69
70
    public function test_context_param() 

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

@@ 64-72 (lines=9) @@
61
        $this->endpoint = new WP_REST_Users_Controller();
62
    }
63
64
    public function test_register_routes() 
65
    {
66
        $routes = $this->server->get_routes();
67
68
        $this->assertArrayHasKey('/wp/v2/users', $routes);
69
        $this->assertCount(2, $routes['/wp/v2/users']);
70
        $this->assertArrayHasKey('/wp/v2/users/(?P<id>[\d]+)', $routes);
71
        $this->assertCount(3, $routes['/wp/v2/users/(?P<id>[\d]+)']);
72
        $this->assertArrayHasKey('/wp/v2/users/me', $routes);
73
    }
74
75
    public function test_context_param()