- Timestamp:
- 06/21/2024 01:04:47 PM (11 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/rest-api/rest-post-types-controller.php
r56746 r58452 78 78 } 79 79 80 /** 81 * @ticket 61477 82 */ 83 public function test_get_item_template_cpt() { 84 register_post_type( 85 'cpt_template', 86 array( 87 'show_in_rest' => true, 88 'rest_base' => 'cpt_template', 89 'rest_namespace' => 'wordpress/v1', 90 'template' => array( 91 array( 'core/paragraph', array( 'placeholder' => 'Content' ) ), 92 ), 93 'template_lock' => 'all', 94 ) 95 ); 96 $request = new WP_REST_Request( 'GET', '/wp/v2/types/cpt_template' ); 97 $response = rest_get_server()->dispatch( $request ); 98 $this->check_post_type_object_response( 'view', $response, 'cpt_template' ); 99 } 100 80 101 public function test_get_item_page() { 81 102 $request = new WP_REST_Request( 'GET', '/wp/v2/types/page' ); … … 166 187 $properties = $data['schema']['properties']; 167 188 168 $this->assertCount( 1 4, $properties, 'Schema should have 14properties' );189 $this->assertCount( 16, $properties, 'Schema should have 16 properties' ); 169 190 $this->assertArrayHasKey( 'capabilities', $properties, '`capabilities` should be included in the schema' ); 170 191 $this->assertArrayHasKey( 'description', $properties, '`description` should be included in the schema' ); … … 181 202 $this->assertArrayHasKey( 'visibility', $properties, '`visibility` should be included in the schema' ); 182 203 $this->assertArrayHasKey( 'icon', $properties, '`icon` should be included in the schema' ); 204 $this->assertArrayHasKey( 'template', $properties, '`template` should be included in the schema' ); 205 $this->assertArrayHasKey( 'template_lock', $properties, '`template_lock` should be included in the schema' ); 183 206 } 184 207 … … 231 254 $this->assertSame( $post_type_obj->rest_namespace, $data['rest_namespace'] ); 232 255 $this->assertSame( $post_type_obj->has_archive, $data['has_archive'] ); 256 $this->assertSame( $post_type_obj->template ?? array(), $data['template'] ); 257 $this->assertSame( ! empty( $post_type_obj->template_lock ) ? $post_type_obj->template_lock : false, $data['template_lock'] ); 233 258 234 259 $links = test_rest_expand_compact_links( $links );
Note: See TracChangeset
for help on using the changeset viewer.