Code Duplication    Length = 15-15 lines in 3 locations

tests/phpunit/tests/rest-api/rest-post-meta-fields.php 2 locations

@@ 143-157 (lines=15) @@
140
        wp_set_current_user($user);
141
    }
142
143
    public function test_get_value() 
144
    {
145
        add_post_meta(self::$post_id, 'test_single', 'testvalue');
146
147
        $request = new WP_REST_Request('GET', sprintf('/wp/v2/posts/%d', self::$post_id));
148
        $response = $this->server->dispatch($request);
149
150
        $this->assertEquals(200, $response->get_status());
151
152
        $data = $response->get_data();
153
        $this->assertArrayHasKey('meta', $data);
154
155
        $meta = (array) $data['meta'];
156
        $this->assertArrayHasKey('test_single', $meta);
157
        $this->assertEquals('testvalue', $meta['test_single']);
158
    }
159
160
    /**
@@ 291-305 (lines=15) @@
288
        $this->assertSame(true, $meta['test_bool']);
289
    }
290
291
    public function test_get_value_custom_name() 
292
    {
293
        add_post_meta(self::$post_id, 'test_custom_name', 'janet');
294
295
        $request = new WP_REST_Request('GET', sprintf('/wp/v2/posts/%d', self::$post_id));
296
        $response = $this->server->dispatch($request);
297
298
        $this->assertEquals(200, $response->get_status());
299
300
        $data = $response->get_data();
301
        $this->assertArrayHasKey('meta', $data);
302
303
        $meta = (array) $data['meta'];
304
        $this->assertArrayHasKey('new_name', $meta);
305
        $this->assertEquals('janet', $meta['new_name']);
306
    }
307
308
    /**

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

@@ 751-765 (lines=15) @@
748
        $this->assertErrorResponse('rest_user_cannot_view', $response, 401);
749
    }
750
751
    public function test_get_current_user() 
752
    {
753
        wp_set_current_user(self::$user);
754
755
        $request = new WP_REST_Request('GET', '/wp/v2/users/me');
756
757
        $response = $this->server->dispatch($request);
758
        $this->assertEquals(200, $response->get_status());
759
        $this->check_get_user_response($response, 'view');
760
761
        $headers = $response->get_headers();
762
        $this->assertArrayNotHasKey('Location', $headers);
763
764
        $links = $response->get_links();
765
        $this->assertEquals(rest_url('wp/v2/users/' . self::$user), $links['self'][0]['href']);
766
    }
767
768
    public function test_get_current_user_without_permission()