Changeset 47328 for trunk/tests/phpunit/tests/rest-api/rest-controller.php
- Timestamp:
- 02/20/2020 04:56:17 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/rest-api/rest-controller.php
r46586 r47328 344 344 } 345 345 346 /** 347 * @ticket 48785 348 */ 349 public function test_get_public_item_schema_with_properties() { 350 $schema = ( new WP_REST_Test_Controller() )->get_public_item_schema(); 351 352 // Double-check that the public item schema set in WP_REST_Test_Controller still has properties. 353 $this->assertArrayHasKey( 'properties', $schema ); 354 355 // But arg_options should be removed. 356 $this->assertArrayNotHasKey( 'arg_options', $schema['properties']['someargoptions'] ); 357 } 358 359 /** 360 * @ticket 48785 361 */ 362 public function test_get_public_item_schema_no_properties() { 363 $controller = new WP_REST_Test_Configurable_Controller( 364 array( 365 '$schema' => 'http://json-schema.org/draft-04/schema#', 366 'title' => 'foo', 367 'type' => 'string', 368 'description' => 'This is my magical endpoint that just returns a string.', 369 ) 370 ); 371 372 // Initial check that the test class is working as expected. 373 $this->assertArrayNotHasKey( 'properties', $controller->get_public_item_schema() ); 374 375 // Test that the schema lacking 'properties' is returned as expected. 376 $this->assertEqualSetsWithIndex( $controller->get_public_item_schema(), $controller->get_test_schema() ); 377 } 378 346 379 public function test_add_additional_fields_to_object_respects_fields_param() { 347 380 $controller = new WP_REST_Test_Controller();
Note: See TracChangeset
for help on using the changeset viewer.