Code Duplication    Length = 15-16 lines in 2 locations

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

@@ 480-494 (lines=15) @@
477
        $this->assertEquals(0, $new_data['parent']);
478
    }
479
480
    public function test_get_page_with_password() 
481
    {
482
        $page_id = $this->factory->post->create(
483
            array(
484
            'post_type'     => 'page',
485
            'post_password' => '$inthebananastand',
486
            ) 
487
        );
488
489
        $request = new WP_REST_Request('GET', sprintf('/wp/v2/pages/%d', $page_id));
490
        $response = $this->server->dispatch($request);
491
492
        $data = $response->get_data();
493
        $this->assertEquals('', $data['content']['rendered']);
494
        $this->assertTrue($data['content']['protected']);
495
        $this->assertEquals('', $data['excerpt']['rendered']);
496
        $this->assertTrue($data['excerpt']['protected']);
497
    }

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

@@ 1060-1075 (lines=16) @@
1057
        $this->assertErrorResponse('rest_forbidden_context', $response, 401);
1058
    }
1059
1060
    public function test_get_post_with_password() 
1061
    {
1062
        $post_id = $this->factory->post->create(
1063
            array(
1064
            'post_password' => '$inthebananastand',
1065
            ) 
1066
        );
1067
1068
        $request = new WP_REST_Request('GET', sprintf('/wp/v2/posts/%d', $post_id));
1069
        $response = $this->server->dispatch($request);
1070
1071
        $this->check_get_post_response($response, 'view');
1072
1073
        $data = $response->get_data();
1074
        $this->assertEquals('', $data['content']['rendered']);
1075
        $this->assertTrue($data['content']['protected']);
1076
        $this->assertEquals('', $data['excerpt']['rendered']);
1077
        $this->assertTrue($data['excerpt']['protected']);
1078
    }