Changeset 52436
- Timestamp:
- 01/04/2022 02:23:56 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/rest-api/wpRestTemplatesController.php
r52399 r52436 384 384 'has_theme_file' => false, 385 385 'is_custom' => true, 386 'author' => self::$admin_id, 387 ), 388 $data 389 ); 390 } 391 392 /** 393 * @ticket 54680 394 * @covers WP_REST_Templates_Controller::create_item 395 * @covers WP_REST_Templates_Controller::get_item_schema 396 */ 397 public function test_create_item_with_numeric_slug() { 398 wp_set_current_user( self::$admin_id ); 399 $request = new WP_REST_Request( 'POST', '/wp/v2/templates' ); 400 $request->set_body_params( 401 array( 402 'slug' => '404', 403 'description' => 'Template shown when no content is found.', 404 'title' => '404', 405 'author' => self::$admin_id, 406 ) 407 ); 408 $response = rest_get_server()->dispatch( $request ); 409 $data = $response->get_data(); 410 unset( $data['_links'] ); 411 unset( $data['wp_id'] ); 412 413 $this->assertSame( 414 array( 415 'id' => 'default//404', 416 'theme' => 'default', 417 'content' => array( 418 'raw' => '', 419 ), 420 'slug' => '404', 421 'source' => 'custom', 422 'origin' => null, 423 'type' => 'wp_template', 424 'description' => 'Template shown when no content is found.', 425 'title' => array( 426 'raw' => '404', 427 'rendered' => '404', 428 ), 429 'status' => 'publish', 430 'has_theme_file' => false, 431 'is_custom' => false, 386 432 'author' => self::$admin_id, 387 433 ),
Note: See TracChangeset
for help on using the changeset viewer.