Code Duplication    Length = 14-17 lines in 2 locations

tests/phpunit/tests/rest-api/rest-post-meta-fields.php 1 location

@@ 446-462 (lines=17) @@
443
        $wpdb->show_errors = true;
444
    }
445
446
    public function test_set_value_invalid_type() 
447
    {
448
        $values = get_post_meta(self::$post_id, 'test_invalid_type', false);
449
        $this->assertEmpty($values);
450
451
        $this->grant_write_permission();
452
453
        $data = array(
454
         'meta' => array(
455
          'test_invalid_type' => 'test_value',
456
         ),
457
        );
458
        $request = new WP_REST_Request('POST', sprintf('/wp/v2/posts/%d', self::$post_id));
459
        $request->set_body_params($data);
460
461
        $response = $this->server->dispatch($request);
462
        $this->assertEmpty(get_post_meta(self::$post_id, 'test_invalid_type', false));
463
    }
464
465
    public function test_set_value_multiple() 

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

@@ 2372-2385 (lines=14) @@
2369
        $this->assertErrorResponse('rest_invalid_field', $response, 400);
2370
    }
2371
2372
    public function test_update_password_protected_post_with_sticky_fails() 
2373
    {
2374
        wp_set_current_user(self::$editor_id);
2375
2376
        wp_update_post(array( 'ID' => self::$post_id, 'post_password' => '123' ));
2377
2378
        $request = new WP_REST_Request('PUT', sprintf('/wp/v2/posts/%d', self::$post_id));
2379
        $params = $this->set_post_data(
2380
            array(
2381
            'sticky' => true,
2382
            ) 
2383
        );
2384
        $request->set_body_params($params);
2385
        $response = $this->server->dispatch($request);
2386
2387
        $this->assertErrorResponse('rest_invalid_field', $response, 400);
2388
    }