Skip to content

Commit

Permalink
Update tests to support origin
Browse files Browse the repository at this point in the history
  • Loading branch information
talldan committed Nov 25, 2021
1 parent 11e1a10 commit 2bb7197
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions tests/phpunit/tests/rest-api/wpRestTemplatesController.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
*
* @covers WP_REST_Templates_Controller
*
* @group restapi
* @group dan
*/
class Tests_REST_WpRestTemplatesController extends WP_Test_REST_Controller_Testcase {
/**
Expand Down Expand Up @@ -53,7 +53,6 @@ public static function wpTearDownAfterClass() {
wp_delete_post( self::$post->ID );
}


public function test_register_routes() {
$routes = rest_get_server()->get_routes();
$this->assertArrayHasKey( '/wp/v2/templates', $routes );
Expand Down Expand Up @@ -93,6 +92,7 @@ public function test_get_items() {
'theme' => 'default',
'slug' => 'my_template',
'source' => 'custom',
'origin' => null,
'type' => 'wp_template',
'description' => 'Description of my template.',
'title' => array(
Expand Down Expand Up @@ -135,6 +135,7 @@ public function test_get_item() {
'theme' => 'default',
'slug' => 'my_template',
'source' => 'custom',
'origin' => null,
'type' => 'wp_template',
'description' => 'Description of my template.',
'title' => array(
Expand Down Expand Up @@ -180,6 +181,7 @@ public function test_create_item() {
),
'slug' => 'my_custom_template',
'source' => 'custom',
'origin' => null,
'type' => 'wp_template',
'description' => 'Just a description',
'title' => array(
Expand Down Expand Up @@ -228,6 +230,7 @@ public function test_create_item_raw() {
),
'slug' => 'my_custom_template_raw',
'source' => 'custom',
'origin' => null,
'type' => 'wp_template',
'description' => 'Just a description',
'title' => array(
Expand All @@ -251,7 +254,7 @@ public function test_create_item_invalid_author() {
'description' => 'Just a description',
'title' => 'My Template',
'content' => 'Content',
'author' => -999,
'author' => 99999,
)
);
$response = rest_get_server()->dispatch( $request );
Expand Down Expand Up @@ -392,13 +395,14 @@ public function test_get_item_schema() {
$response = rest_get_server()->dispatch( $request );
$data = $response->get_data();
$properties = $data['schema']['properties'];
$this->assertCount( 12, $properties );
$this->assertCount( 13, $properties );
$this->assertArrayHasKey( 'id', $properties );
$this->assertArrayHasKey( 'description', $properties );
$this->assertArrayHasKey( 'slug', $properties );
$this->assertArrayHasKey( 'theme', $properties );
$this->assertArrayHasKey( 'type', $properties );
$this->assertArrayHasKey( 'source', $properties );
$this->assertArrayHasKey( 'origin', $properties );
$this->assertArrayHasKey( 'content', $properties );
$this->assertArrayHasKey( 'title', $properties );
$this->assertArrayHasKey( 'description', $properties );
Expand Down

0 comments on commit 2bb7197

Please sign in to comment.