Changeset 38832 for trunk/tests/phpunit/tests/rest-api.php
- Timestamp:
- 10/20/2016 02:54:12 AM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/rest-api.php
r38790 r38832 27 27 $this->assertTrue( class_exists( 'WP_REST_Request' ) ); 28 28 $this->assertTrue( class_exists( 'WP_REST_Response' ) ); 29 $this->assertTrue( class_exists( 'WP_REST_Posts_Controller' ) ); 29 30 } 30 31 … … 35 36 function test_init_action_added() { 36 37 $this->assertEquals( 10, has_action( 'init', 'rest_api_init' ) ); 38 } 39 40 public function test_add_extra_api_taxonomy_arguments() { 41 $taxonomy = get_taxonomy( 'category' ); 42 $this->assertTrue( $taxonomy->show_in_rest ); 43 $this->assertEquals( 'categories', $taxonomy->rest_base ); 44 $this->assertEquals( 'WP_REST_Terms_Controller', $taxonomy->rest_controller_class ); 45 46 $taxonomy = get_taxonomy( 'post_tag' ); 47 $this->assertTrue( $taxonomy->show_in_rest ); 48 $this->assertEquals( 'tags', $taxonomy->rest_base ); 49 $this->assertEquals( 'WP_REST_Terms_Controller', $taxonomy->rest_controller_class ); 50 } 51 52 public function test_add_extra_api_post_type_arguments() { 53 $post_type = get_post_type_object( 'post' ); 54 $this->assertTrue( $post_type->show_in_rest ); 55 $this->assertEquals( 'posts', $post_type->rest_base ); 56 $this->assertEquals( 'WP_REST_Posts_Controller', $post_type->rest_controller_class ); 57 58 $post_type = get_post_type_object( 'page' ); 59 $this->assertTrue( $post_type->show_in_rest ); 60 $this->assertEquals( 'pages', $post_type->rest_base ); 61 $this->assertEquals( 'WP_REST_Posts_Controller', $post_type->rest_controller_class ); 62 63 $post_type = get_post_type_object( 'attachment' ); 64 $this->assertTrue( $post_type->show_in_rest ); 65 $this->assertEquals( 'media', $post_type->rest_base ); 66 $this->assertEquals( 'WP_REST_Attachments_Controller', $post_type->rest_controller_class ); 37 67 } 38 68
Note: See TracChangeset
for help on using the changeset viewer.