Skip to content

Commit 7916851

Browse files
committed
Tests: Assert the block patterns item schema.
Verify that OPTIONS succeeds and advertises the expected set of properties in the block patterns schema. Developed in: WordPress#13783 Props shailu25, mukesh27. See #40538. git-svn-id: https://develop.svn.wordpress.org/trunk@63953 602fd350-edb4-49c9-b593-d223f7449a82
1 parent 73569e7 commit 7916851

1 file changed

Lines changed: 26 additions & 2 deletions

File tree

‎tests/phpunit/tests/rest-api/wpRestBlockPatternsController.php‎

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -293,9 +293,33 @@ public function test_prepare_item() {
293293
}
294294

295295
/**
296-
* @doesNotPerformAssertions
296+
* @ticket 40538
297+
*
298+
* @covers WP_REST_Block_Patterns_Controller::get_item_schema
297299
*/
298300
public function test_get_item_schema() {
299-
// Controller does not implement get_item_schema().
301+
$request = new WP_REST_Request( 'OPTIONS', static::REQUEST_ROUTE );
302+
$response = rest_get_server()->dispatch( $request );
303+
$this->assertSame( 200, $response->get_status() );
304+
$data = $response->get_data();
305+
306+
$properties = $data['schema']['properties'];
307+
$this->assertSameSets(
308+
array(
309+
'name',
310+
'title',
311+
'content',
312+
'description',
313+
'viewport_width',
314+
'inserter',
315+
'categories',
316+
'keywords',
317+
'block_types',
318+
'post_types',
319+
'template_types',
320+
'source',
321+
),
322+
array_keys( $properties )
323+
);
300324
}
301325
}

0 commit comments

Comments
 (0)