- Timestamp:
- 08/17/2018 01:50:26 AM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/rest-api/rest-posts-controller.php
r43439 r43571 76 76 parent::setUp(); 77 77 register_post_type( 78 'youseeme', array( 78 'youseeme', 79 array( 79 80 'supports' => array(), 80 81 'show_in_rest' => true, … … 162 163 'tags', 163 164 'tags_exclude', 164 ), $keys 165 ), 166 $keys 165 167 ); 166 168 } … … 1109 1111 array( 1110 1112 'page' => 2, 1111 ), rest_url( '/wp/v2/posts' ) 1113 ), 1114 rest_url( '/wp/v2/posts' ) 1112 1115 ); 1113 1116 $this->assertFalse( stripos( $headers['Link'], 'rel="prev"' ) ); … … 1128 1131 array( 1129 1132 'page' => 2, 1130 ), rest_url( '/wp/v2/posts' ) 1133 ), 1134 rest_url( '/wp/v2/posts' ) 1131 1135 ); 1132 1136 $this->assertContains( '<' . $prev_link . '>; rel="prev"', $headers['Link'] ); … … 1134 1138 array( 1135 1139 'page' => 4, 1136 ), rest_url( '/wp/v2/posts' ) 1140 ), 1141 rest_url( '/wp/v2/posts' ) 1137 1142 ); 1138 1143 $this->assertContains( '<' . $next_link . '>; rel="next"', $headers['Link'] ); … … 1147 1152 array( 1148 1153 'page' => 5, 1149 ), rest_url( '/wp/v2/posts' ) 1154 ), 1155 rest_url( '/wp/v2/posts' ) 1150 1156 ); 1151 1157 $this->assertContains( '<' . $prev_link . '>; rel="prev"', $headers['Link'] ); … … 1175 1181 'per_page' => 5, 1176 1182 'page' => 1, 1177 ), rest_url( '/wp/v2/posts' ) 1183 ), 1184 rest_url( '/wp/v2/posts' ) 1178 1185 ); 1179 1186 $this->assertContains( '<' . $prev_link . '>; rel="prev"', $headers['Link'] ); … … 1182 1189 'per_page' => 5, 1183 1190 'page' => 3, 1184 ), rest_url( '/wp/v2/posts' ) 1191 ), 1192 rest_url( '/wp/v2/posts' ) 1185 1193 ); 1186 1194 $this->assertContains( '<' . $next_link . '>; rel="next"', $headers['Link'] ); … … 1532 1540 $obj = get_post( self::$post_id ); 1533 1541 $response = $endpoint->prepare_item_for_response( $obj, $request ); 1534 $this->assertEquals( array( 1535 'id', 1536 'slug', 1537 ), array_keys( $response->get_data() ) ); 1542 $this->assertEquals( 1543 array( 1544 'id', 1545 'slug', 1546 ), 1547 array_keys( $response->get_data() ) 1548 ); 1538 1549 } 1539 1550 … … 2019 2030 $file = DIR_TESTDATA . '/images/canola.jpg'; 2020 2031 $this->attachment_id = $this->factory->attachment->create_object( 2021 $file, 0, array( 2032 $file, 2033 0, 2034 array( 2022 2035 'post_mime_type' => 'image/jpeg', 2023 2036 'menu_order' => rand( 1, 100 ), … … 3254 3267 'content' => '<div>div</div> <strong>strong</strong> <script>oh noes</script>', 3255 3268 'excerpt' => '<div>div</div> <strong>strong</strong> <script>oh noes</script>', 3256 ), array( 3269 ), 3270 array( 3257 3271 'title' => array( 3258 3272 'raw' => 'div <strong>strong</strong> oh noes', … … 3276 3290 'content' => '<div>div</div> <strong>strong</strong> <script>oh noes</script>', 3277 3291 'excerpt' => '<div>div</div> <strong>strong</strong> <script>oh noes</script>', 3278 ), array( 3292 ), 3293 array( 3279 3294 'title' => array( 3280 3295 'raw' => '<div>div</div> <strong>strong</strong> <script>oh noes</script>', … … 3302 3317 'content' => '<div>div</div> <strong>strong</strong> <script>oh noes</script>', 3303 3318 'excerpt' => '<div>div</div> <strong>strong</strong> <script>oh noes</script>', 3304 ), array( 3319 ), 3320 array( 3305 3321 'title' => array( 3306 3322 'raw' => '<div>div</div> <strong>strong</strong> <script>oh noes</script>', … … 3388 3404 3389 3405 register_post_type( 3390 'invalid-controller', array( 3406 'invalid-controller', 3407 array( 3391 3408 'show_in_rest' => true, 3392 3409 'rest_controller_class' => 'Fake_Class_Baba', … … 3557 3574 'any', 3558 3575 ), 3559 ), $status_arg['items'] 3576 ), 3577 $status_arg['items'] 3560 3578 ); 3561 3579 } … … 3571 3589 3572 3590 register_rest_field( 3573 'post', 'my_custom_int', array( 3591 'post', 3592 'my_custom_int', 3593 array( 3574 3594 'schema' => $schema, 3575 3595 'get_callback' => array( $this, 'additional_field_get_callback' ), … … 3630 3650 3631 3651 register_rest_field( 3632 'post', 'my_custom_int', array( 3652 'post', 3653 'my_custom_int', 3654 array( 3633 3655 'schema' => $schema, 3634 3656 'get_callback' => array( $this, 'additional_field_get_callback' ),
Note: See TracChangeset
for help on using the changeset viewer.