Changeset 48951 for trunk/tests/phpunit/tests/rest-api/rest-controller.php
- Timestamp:
- 09/07/2020 02:35:52 AM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/rest-api/rest-controller.php
r48939 r48951 223 223 } 224 224 225 /** 226 * @ticket 50876 227 */ 228 public function test_get_endpoint_args_for_item_schema() { 229 $controller = new WP_REST_Test_Controller(); 230 $args = $controller->get_endpoint_args_for_item_schema(); 231 232 $this->assertArrayHasKey( 'somestring', $args ); 233 $this->assertArrayHasKey( 'someinteger', $args ); 234 $this->assertArrayHasKey( 'someboolean', $args ); 235 $this->assertArrayHasKey( 'someurl', $args ); 236 $this->assertArrayHasKey( 'somedate', $args ); 237 $this->assertArrayHasKey( 'someemail', $args ); 238 $this->assertArrayHasKey( 'somehex', $args ); 239 $this->assertArrayHasKey( 'someuuid', $args ); 240 $this->assertArrayHasKey( 'someenum', $args ); 241 $this->assertArrayHasKey( 'someargoptions', $args ); 242 $this->assertArrayHasKey( 'somedefault', $args ); 243 $this->assertArrayHasKey( 'somearray', $args ); 244 $this->assertArrayHasKey( 'someobject', $args ); 245 } 246 225 247 public function test_get_endpoint_args_for_item_schema_description() { 226 248 $controller = new WP_REST_Test_Controller(); 227 $args = $controller->get_endpoint_args_for_item_schema(); 228 $this->assertSame( 'A pretty string.', $args['somestring']['description'] ); 249 $args = rest_get_endpoint_args_for_schema( $controller->get_item_schema() ); 250 251 $this->assertEquals( 'A pretty string.', $args['somestring']['description'] ); 229 252 $this->assertFalse( isset( $args['someinteger']['description'] ) ); 230 253 } … … 233 256 234 257 $controller = new WP_REST_Test_Controller(); 235 $args = $controller->get_endpoint_args_for_item_schema();258 $args = rest_get_endpoint_args_for_schema( $controller->get_item_schema() ); 236 259 237 260 $this->assertFalse( $args['someargoptions']['required'] ); … … 242 265 243 266 $controller = new WP_REST_Test_Controller(); 244 245 $args = $controller->get_endpoint_args_for_item_schema(); 267 $args = rest_get_endpoint_args_for_schema( $controller->get_item_schema() ); 246 268 247 269 $this->assertSame( 'a', $args['somedefault']['default'] ); … … 254 276 255 277 $controller = new WP_REST_Test_Controller(); 256 $args = $controller->get_endpoint_args_for_item_schema();278 $args = rest_get_endpoint_args_for_schema( $controller->get_item_schema() ); 257 279 258 280 foreach ( array( 'minLength', 'maxLength', 'pattern' ) as $property ) {
Note: See TracChangeset
for help on using the changeset viewer.