- Timestamp:
- 09/06/2022 10:09:49 PM (3 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tests/phpunit/tests/rest-api/rest-pages-controller.php
r54058 r54090 52 52 $this->assertSame( array( 'view', 'embed', 'edit' ), $data['endpoints'][0]['args']['context']['enum'] ); 53 53 // Single. 54 $page_id = $this->factory->post->create( array( 'post_type' => 'page' ) );54 $page_id = self::factory()->post->create( array( 'post_type' => 'page' ) ); 55 55 $request = new WP_REST_Request( 'OPTIONS', '/wp/v2/pages/' . $page_id ); 56 56 $response = rest_get_server()->dispatch( $request ); … … 95 95 96 96 public function test_get_items() { 97 $id1 = $this->factory->post->create(98 array( 99 'post_status' => 'publish', 100 'post_type' => 'page', 101 ) 102 ); 103 $id2 = $this->factory->post->create(97 $id1 = self::factory()->post->create( 98 array( 99 'post_status' => 'publish', 100 'post_type' => 'page', 101 ) 102 ); 103 $id2 = self::factory()->post->create( 104 104 array( 105 105 'post_status' => 'draft', … … 115 115 116 116 public function test_get_items_parent_query() { 117 $id1 = $this->factory->post->create(118 array( 119 'post_status' => 'publish', 120 'post_type' => 'page', 121 ) 122 ); 123 $id2 = $this->factory->post->create(117 $id1 = self::factory()->post->create( 118 array( 119 'post_status' => 'publish', 120 'post_type' => 'page', 121 ) 122 ); 123 $id2 = self::factory()->post->create( 124 124 array( 125 125 'post_status' => 'publish', … … 149 149 150 150 public function test_get_items_parents_query() { 151 $id1 = $this->factory->post->create(152 array( 153 'post_status' => 'publish', 154 'post_type' => 'page', 155 ) 156 ); 157 $id2 = $this->factory->post->create(151 $id1 = self::factory()->post->create( 152 array( 153 'post_status' => 'publish', 154 'post_type' => 'page', 155 ) 156 ); 157 $id2 = self::factory()->post->create( 158 158 array( 159 159 'post_status' => 'publish', … … 162 162 ) 163 163 ); 164 $id3 = $this->factory->post->create(165 array( 166 'post_status' => 'publish', 167 'post_type' => 'page', 168 ) 169 ); 170 $id4 = $this->factory->post->create(164 $id3 = self::factory()->post->create( 165 array( 166 'post_status' => 'publish', 167 'post_type' => 'page', 168 ) 169 ); 170 $id4 = self::factory()->post->create( 171 171 array( 172 172 'post_status' => 'publish', … … 191 191 192 192 public function test_get_items_parent_exclude_query() { 193 $id1 = $this->factory->post->create(194 array( 195 'post_status' => 'publish', 196 'post_type' => 'page', 197 ) 198 ); 199 $this->factory->post->create(193 $id1 = self::factory()->post->create( 194 array( 195 'post_status' => 'publish', 196 'post_type' => 'page', 197 ) 198 ); 199 self::factory()->post->create( 200 200 array( 201 201 'post_status' => 'publish', … … 225 225 226 226 public function test_get_items_menu_order_query() { 227 $id1 = $this->factory->post->create(228 array( 229 'post_status' => 'publish', 230 'post_type' => 'page', 231 ) 232 ); 233 $id2 = $this->factory->post->create(227 $id1 = self::factory()->post->create( 228 array( 229 'post_status' => 'publish', 230 'post_type' => 'page', 231 ) 232 ); 233 $id2 = self::factory()->post->create( 234 234 array( 235 235 'post_status' => 'publish', … … 238 238 ) 239 239 ); 240 $id3 = $this->factory->post->create(240 $id3 = self::factory()->post->create( 241 241 array( 242 242 'post_status' => 'publish', … … 245 245 ) 246 246 ); 247 $id4 = $this->factory->post->create(247 $id4 = self::factory()->post->create( 248 248 array( 249 249 'post_status' => 'publish', … … 303 303 // Private query vars inaccessible to unauthorized users. 304 304 wp_set_current_user( 0 ); 305 $page_id = $this->factory->post->create(306 array( 307 'post_status' => 'publish', 308 'post_type' => 'page', 309 ) 310 ); 311 $draft_id = $this->factory->post->create(305 $page_id = self::factory()->post->create( 306 array( 307 'post_status' => 'publish', 308 'post_type' => 'page', 309 ) 310 ); 311 $draft_id = self::factory()->post->create( 312 312 array( 313 313 'post_status' => 'draft', … … 337 337 338 338 public function test_get_items_valid_date() { 339 $post1 = $this->factory->post->create(339 $post1 = self::factory()->post->create( 340 340 array( 341 341 'post_date' => '2016-01-15T00:00:00Z', … … 343 343 ) 344 344 ); 345 $post2 = $this->factory->post->create(345 $post2 = self::factory()->post->create( 346 346 array( 347 347 'post_date' => '2016-01-16T00:00:00Z', … … 349 349 ) 350 350 ); 351 $post3 = $this->factory->post->create(351 $post3 = self::factory()->post->create( 352 352 array( 353 353 'post_date' => '2016-01-17T00:00:00Z', … … 379 379 */ 380 380 public function test_get_items_valid_modified_date() { 381 $post1 = $this->factory->post->create(381 $post1 = self::factory()->post->create( 382 382 array( 383 383 'post_date' => '2016-01-01 00:00:00', … … 385 385 ) 386 386 ); 387 $post2 = $this->factory->post->create(387 $post2 = self::factory()->post->create( 388 388 array( 389 389 'post_date' => '2016-01-02 00:00:00', … … 391 391 ) 392 392 ); 393 $post3 = $this->factory->post->create(393 $post3 = self::factory()->post->create( 394 394 array( 395 395 'post_date' => '2016-01-03 00:00:00', … … 417 417 418 418 public function test_get_item_invalid_post_type() { 419 $post_id = $this->factory->post->create();419 $post_id = self::factory()->post->create(); 420 420 $request = new WP_REST_Request( 'GET', '/wp/v2/pages/' . $post_id ); 421 421 $response = rest_get_server()->dispatch( $request ); … … 449 449 450 450 public function test_create_page_with_parent() { 451 $page_id = $this->factory->post->create(451 $page_id = self::factory()->post->create( 452 452 array( 453 453 'type' => 'page', … … 499 499 500 500 public function test_delete_item() { 501 $page_id = $this->factory->post->create(501 $page_id = self::factory()->post->create( 502 502 array( 503 503 'post_type' => 'page', … … 526 526 public function test_prepare_item_limit_fields() { 527 527 wp_set_current_user( self::$editor_id ); 528 $page_id = $this->factory->post->create(528 $page_id = self::factory()->post->create( 529 529 array( 530 530 'post_status' => 'publish', … … 548 548 549 549 public function test_get_pages_params() { 550 $this->factory->post->create_many(550 self::factory()->post->create_many( 551 551 8, 552 552 array( … … 579 579 public function test_update_page_menu_order() { 580 580 581 $page_id = $this->factory->post->create(581 $page_id = self::factory()->post->create( 582 582 array( 583 583 'post_type' => 'page', … … 602 602 public function test_update_page_menu_order_to_zero() { 603 603 604 $page_id = $this->factory->post->create(604 $page_id = self::factory()->post->create( 605 605 array( 606 606 'post_type' => 'page', … … 625 625 626 626 public function test_update_page_parent_non_zero() { 627 $page_id1 = $this->factory->post->create(628 array( 629 'post_type' => 'page', 630 ) 631 ); 632 $page_id2 = $this->factory->post->create(627 $page_id1 = self::factory()->post->create( 628 array( 629 'post_type' => 'page', 630 ) 631 ); 632 $page_id2 = self::factory()->post->create( 633 633 array( 634 634 'post_type' => 'page', … … 648 648 649 649 public function test_update_page_parent_zero() { 650 $page_id1 = $this->factory->post->create(651 array( 652 'post_type' => 'page', 653 ) 654 ); 655 $page_id2 = $this->factory->post->create(650 $page_id1 = self::factory()->post->create( 651 array( 652 'post_type' => 'page', 653 ) 654 ); 655 $page_id2 = self::factory()->post->create( 656 656 array( 657 657 'post_type' => 'page', … … 672 672 673 673 public function test_get_page_with_password() { 674 $page_id = $this->factory->post->create(674 $page_id = self::factory()->post->create( 675 675 array( 676 676 'post_type' => 'page', … … 690 690 691 691 public function test_get_page_with_password_using_password() { 692 $page_id = $this->factory->post->create(692 $page_id = self::factory()->post->create( 693 693 array( 694 694 'post_type' => 'page', … … 712 712 713 713 public function test_get_page_with_password_using_incorrect_password() { 714 $page_id = $this->factory->post->create(714 $page_id = self::factory()->post->create( 715 715 array( 716 716 'post_type' => 'page', … … 728 728 729 729 public function test_get_page_with_password_without_permission() { 730 $page_id = $this->factory->post->create(730 $page_id = self::factory()->post->create( 731 731 array( 732 732 'post_type' => 'page',
Note: See TracChangeset
for help on using the changeset viewer.