Make WordPress Core


Ignore:
Timestamp:
09/06/2022 10:09:49 PM (4 years ago)
Author:
SergeyBiryukov
Message:

Tests: Use the factory method instead of the property.

This replaces all references to the WP_UnitTestCase_Base::$factory property with static function calls to the WP_UnitTestCase_Base::factory() method.

This is a consistency improvement for the test suite.

Follow up to [35225], [35242], [49603], [54087], [54088].

Props jrf.
See #55652.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/rest-api/rest-posts-controller.php

    r54088 r54090  
    274274
    275275        public function test_get_items_author_query() {
    276                 $this->factory->post->create( array( 'post_author' => self::$editor_id ) );
    277                 $this->factory->post->create( array( 'post_author' => self::$author_id ) );
     276                self::factory()->post->create( array( 'post_author' => self::$editor_id ) );
     277                self::factory()->post->create( array( 'post_author' => self::$author_id ) );
    278278
    279279                $total_posts = self::$total_posts + 2;
    … …  
    306306
    307307        public function test_get_items_author_exclude_query() {
    308                 $this->factory->post->create( array( 'post_author' => self::$editor_id ) );
    309                 $this->factory->post->create( array( 'post_author' => self::$author_id ) );
     308                self::factory()->post->create( array( 'post_author' => self::$editor_id ) );
     309                self::factory()->post->create( array( 'post_author' => self::$author_id ) );
    310310
    311311                $total_posts = self::$total_posts + 2;
    … …  
    348348
    349349        public function test_get_items_include_query() {
    350                 $id1 = $this->factory->post->create(
     350                $id1 = self::factory()->post->create(
    351351                        array(
    352352                                'post_status' => 'publish',
    … …  
    354354                        )
    355355                );
    356                 $id2 = $this->factory->post->create(
     356                $id2 = self::factory()->post->create(
    357357                        array(
    358358                                'post_status' => 'publish',
    … …  
    387387
    388388        public function test_get_items_orderby_author_query() {
    389                 $id2 = $this->factory->post->create(
     389                $id2 = self::factory()->post->create(
    390390                        array(
    391391                                'post_status' => 'publish',
    … …  
    393393                        )
    394394                );
    395                 $id3 = $this->factory->post->create(
     395                $id3 = self::factory()->post->create(
    396396                        array(
    397397                                'post_status' => 'publish',
    … …  
    399399                        )
    400400                );
    401                 $id1 = $this->factory->post->create(
     401                $id1 = self::factory()->post->create(
    402402                        array(
    403403                                'post_status' => 'publish',
    … …  
    422422
    423423        public function test_get_items_orderby_modified_query() {
    424                 $id1 = $this->factory->post->create( array( 'post_status' => 'publish' ) );
    425                 $id2 = $this->factory->post->create( array( 'post_status' => 'publish' ) );
    426                 $id3 = $this->factory->post->create( array( 'post_status' => 'publish' ) );
     424                $id1 = self::factory()->post->create( array( 'post_status' => 'publish' ) );
     425                $id2 = self::factory()->post->create( array( 'post_status' => 'publish' ) );
     426                $id3 = self::factory()->post->create( array( 'post_status' => 'publish' ) );
    427427
    428428                $this->update_post_modified( $id1, '2016-04-20 4:26:20' );
    … …  
    446446
    447447        public function test_get_items_orderby_parent_query() {
    448                 $id1 = $this->factory->post->create(
     448                $id1 = self::factory()->post->create(
    449449                        array(
    450450                                'post_status' => 'publish',
    … …  
    452452                        )
    453453                );
    454                 $id2 = $this->factory->post->create(
     454                $id2 = self::factory()->post->create(
    455455                        array(
    456456                                'post_status' => 'publish',
    … …  
    458458                        )
    459459                );
    460                 $id3 = $this->factory->post->create(
     460                $id3 = self::factory()->post->create(
    461461                        array(
    462462                                'post_status' => 'publish',
    … …  
    484484
    485485        public function test_get_items_exclude_query() {
    486                 $id1 = $this->factory->post->create( array( 'post_status' => 'publish' ) );
    487                 $id2 = $this->factory->post->create( array( 'post_status' => 'publish' ) );
     486                $id1 = self::factory()->post->create( array( 'post_status' => 'publish' ) );
     487                $id2 = self::factory()->post->create( array( 'post_status' => 'publish' ) );
    488488
    489489                $request  = new WP_REST_Request( 'GET', '/wp/v2/posts' );
    … …  
    514514
    515515        public function test_get_items_search_query() {
    516                 $this->factory->post->create(
     516                self::factory()->post->create(
    517517                        array(
    518518                                'post_title'  => 'Search Result',
    … …  
    536536
    537537        public function test_get_items_slug_query() {
    538                 $this->factory->post->create(
     538                self::factory()->post->create(
    539539                        array(
    540540                                'post_title'  => 'Apple',
    … …  
    542542                        )
    543543                );
    544                 $this->factory->post->create(
     544                self::factory()->post->create(
    545545                        array(
    546546                                'post_title'  => 'Banana',
    … …  
    559559
    560560        public function test_get_items_multiple_slugs_array_query() {
    561                 $this->factory->post->create(
     561                self::factory()->post->create(
    562562                        array(
    563563                                'post_title'  => 'Apple',
    … …  
    565565                        )
    566566                );
    567                 $this->factory->post->create(
     567                self::factory()->post->create(
    568568                        array(
    569569                                'post_title'  => 'Banana',
    … …  
    571571                        )
    572572                );
    573                 $this->factory->post->create(
     573                self::factory()->post->create(
    574574                        array(
    575575                                'post_title'  => 'Peach',
    … …  
    593593
    594594        public function test_get_items_multiple_slugs_string_query() {
    595                 $this->factory->post->create(
     595                self::factory()->post->create(
    596596                        array(
    597597                                'post_title'  => 'Apple',
    … …  
    599599                        )
    600600                );
    601                 $this->factory->post->create(
     601                self::factory()->post->create(
    602602                        array(
    603603                                'post_title'  => 'Banana',
    … …  
    605605                        )
    606606                );
    607                 $this->factory->post->create(
     607                self::factory()->post->create(
    608608                        array(
    609609                                'post_title'  => 'Peach',
    … …  
    629629                wp_set_current_user( 0 );
    630630
    631                 $this->factory->post->create( array( 'post_status' => 'draft' ) );
     631                self::factory()->post->create( array( 'post_status' => 'draft' ) );
    632632
    633633                $request = new WP_REST_Request( 'GET', '/wp/v2/posts' );
    … …  
    655655                wp_set_current_user( self::$editor_id );
    656656
    657                 $this->factory->post->create( array( 'post_status' => 'draft' ) );
    658                 $this->factory->post->create( array( 'post_status' => 'private' ) );
    659                 $this->factory->post->create( array( 'post_status' => 'publish' ) );
     657                self::factory()->post->create( array( 'post_status' => 'draft' ) );
     658                self::factory()->post->create( array( 'post_status' => 'private' ) );
     659                self::factory()->post->create( array( 'post_status' => 'publish' ) );
    660660
    661661                $request = new WP_REST_Request( 'GET', '/wp/v2/posts' );
    … …  
    678678                wp_set_current_user( self::$editor_id );
    679679
    680                 $this->factory->post->create( array( 'post_status' => 'draft' ) );
    681                 $this->factory->post->create( array( 'post_status' => 'pending' ) );
    682                 $this->factory->post->create( array( 'post_status' => 'publish' ) );
     680                self::factory()->post->create( array( 'post_status' => 'draft' ) );
     681                self::factory()->post->create( array( 'post_status' => 'pending' ) );
     682                self::factory()->post->create( array( 'post_status' => 'publish' ) );
    683683
    684684                $request = new WP_REST_Request( 'GET', '/wp/v2/posts' );
    … …  
    710710         */
    711711        public function test_get_items_multiple_statuses_custom_role_one_invalid_query() {
    712                 $private_post_id = $this->factory->post->create( array( 'post_status' => 'private' ) );
     712                $private_post_id = self::factory()->post->create( array( 'post_status' => 'private' ) );
    713713
    714714                wp_set_current_user( self::$private_reader_id );
    … …  
    731731
    732732        public function test_get_items_status_without_permissions() {
    733                 $draft_id = $this->factory->post->create(
     733                $draft_id = self::factory()->post->create(
    734734                        array(
    735735                                'post_status' => 'draft',
    … …  
    751751
    752752        public function test_get_items_order_and_orderby() {
    753                 $this->factory->post->create(
     753                self::factory()->post->create(
    754754                        array(
    755755                                'post_title'  => 'Apple Pie',
    … …  
    757757                        )
    758758                );
    759                 $this->factory->post->create(
     759                self::factory()->post->create(
    760760                        array(
    761761                                'post_title'  => 'Apple Sauce',
    … …  
    763763                        )
    764764                );
    765                 $this->factory->post->create(
     765                self::factory()->post->create(
    766766                        array(
    767767                                'post_title'  => 'Apple Cobbler',
    … …  
    769769                        )
    770770                );
    771                 $this->factory->post->create(
     771                self::factory()->post->create(
    772772                        array(
    773773                                'post_title'  => 'Apple Coffee Cake',
    … …  
    806806
    807807        public function test_get_items_with_orderby_include_without_include_param() {
    808                 $this->factory->post->create( array( 'post_status' => 'publish' ) );
     808                self::factory()->post->create( array( 'post_status' => 'publish' ) );
    809809
    810810                $request = new WP_REST_Request( 'GET', '/wp/v2/posts' );
    … …  
    817817
    818818        public function test_get_items_with_orderby_id() {
    819                 $id1 = $this->factory->post->create(
     819                $id1 = self::factory()->post->create(
    820820                        array(
    821821                                'post_status' => 'publish',
    … …  
    823823                        )
    824824                );
    825                 $id2 = $this->factory->post->create(
     825                $id2 = self::factory()->post->create(
    826826                        array(
    827827                                'post_status' => 'publish',
    … …  
    829829                        )
    830830                );
    831                 $id3 = $this->factory->post->create(
     831                $id3 = self::factory()->post->create(
    832832                        array(
    833833                                'post_status' => 'publish',
    … …  
    851851
    852852        public function test_get_items_with_orderby_slug() {
    853                 $id1 = $this->factory->post->create(
     853                $id1 = self::factory()->post->create(
    854854                        array(
    855855                                'post_title'  => 'ABC',
    … …  
    858858                        )
    859859                );
    860                 $id2 = $this->factory->post->create(
     860                $id2 = self::factory()->post->create(
    861861                        array(
    862862                                'post_title'  => 'XYZ',
    … …  
    882882                $slugs = array( 'burrito', 'taco', 'chalupa' );
    883883                foreach ( $slugs as $slug ) {
    884                         $this->factory->post->create(
     884                        self::factory()->post->create(
    885885                                array(
    886886                                        'post_title'  => $slug,
    … …  
    904904
    905905        public function test_get_items_with_orderby_relevance() {
    906                 $id1 = $this->factory->post->create(
     906                $id1 = self::factory()->post->create(
    907907                        array(
    908908                                'post_title'   => 'Title is more relevant',
    … …  
    911911                        )
    912912                );
    913                 $id2 = $this->factory->post->create(
     913                $id2 = self::factory()->post->create(
    914914                        array(
    915915                                'post_title'   => 'Title is',
    … …  
    932932
    933933        public function test_get_items_with_orderby_relevance_two_terms() {
    934                 $id1 = $this->factory->post->create(
     934                $id1 = self::factory()->post->create(
    935935                        array(
    936936                                'post_title'   => 'Title is more relevant',
    … …  
    939939                        )
    940940                );
    941                 $id2 = $this->factory->post->create(
     941                $id2 = self::factory()->post->create(
    942942                        array(
    943943                                'post_title'   => 'Title is',
    … …  
    10061006        public function test_get_items_tags_exclude_query() {
    10071007                $id1 = self::$post_id;
    1008                 $id2 = $this->factory->post->create( array( 'post_status' => 'publish' ) );
    1009                 $id3 = $this->factory->post->create( array( 'post_status' => 'publish' ) );
    1010                 $id4 = $this->factory->post->create( array( 'post_status' => 'publish' ) );
     1008                $id2 = self::factory()->post->create( array( 'post_status' => 'publish' ) );
     1009                $id3 = self::factory()->post->create( array( 'post_status' => 'publish' ) );
     1010                $id4 = self::factory()->post->create( array( 'post_status' => 'publish' ) );
    10111011                $tag = wp_insert_term( 'My Tag', 'post_tag' );
    10121012
    … …  
    10291029        public function test_get_items_tags_and_categories_query() {
    10301030                $id1      = self::$post_id;
    1031                 $id2      = $this->factory->post->create( array( 'post_status' => 'publish' ) );
     1031                $id2      = self::factory()->post->create( array( 'post_status' => 'publish' ) );
    10321032                $tag      = wp_insert_term( 'My Tag', 'post_tag' );
    10331033                $category = wp_insert_term( 'My Category', 'category' );
    … …  
    10541054        public function test_get_items_tags_or_categories_query() {
    10551055                $id1      = self::$post_id;
    1056                 $id2      = $this->factory->post->create( array( 'post_status' => 'publish' ) );
     1056                $id2      = self::factory()->post->create( array( 'post_status' => 'publish' ) );
    10571057                $tag      = wp_insert_term( 'My Tag', 'post_tag' );
    10581058                $category = wp_insert_term( 'My Category', 'category' );
    … …  
    10761076        public function test_get_items_tags_and_categories_exclude_query() {
    10771077                $id1      = self::$post_id;
    1078                 $id2      = $this->factory->post->create( array( 'post_status' => 'publish' ) );
     1078                $id2      = self::factory()->post->create( array( 'post_status' => 'publish' ) );
    10791079                $tag      = wp_insert_term( 'My Tag', 'post_tag' );
    10801080                $category = wp_insert_term( 'My Category', 'category' );
    … …  
    11031103        public function test_get_items_tags_or_categories_exclude_query() {
    11041104                $id1      = end( self::$post_ids );
    1105                 $id2      = $this->factory->post->create( array( 'post_status' => 'publish' ) );
    1106                 $id3      = $this->factory->post->create( array( 'post_status' => 'publish' ) );
    1107                 $id4      = $this->factory->post->create( array( 'post_status' => 'publish' ) );
     1105                $id2      = self::factory()->post->create( array( 'post_status' => 'publish' ) );
     1106                $id3      = self::factory()->post->create( array( 'post_status' => 'publish' ) );
     1107                $id4      = self::factory()->post->create( array( 'post_status' => 'publish' ) );
    11081108                $tag      = wp_insert_term( 'My Tag', 'post_tag' );
    11091109                $category = wp_insert_term( 'My Category', 'category' );
    … …  
    13671367        public function test_get_items_sticky() {
    13681368                $id1 = self::$post_id;
    1369                 $id2 = $this->factory->post->create( array( 'post_status' => 'publish' ) );
     1369                $id2 = self::factory()->post->create( array( 'post_status' => 'publish' ) );
    13701370
    13711371                update_option( 'sticky_posts', array( $id2 ) );
    … …  
    13881388        public function test_get_items_sticky_with_include() {
    13891389                $id1 = self::$post_id;
    1390                 $id2 = $this->factory->post->create( array( 'post_status' => 'publish' ) );
     1390                $id2 = self::factory()->post->create( array( 'post_status' => 'publish' ) );
    13911391
    13921392                update_option( 'sticky_posts', array( $id2 ) );
    … …  
    14561456        public function test_get_items_not_sticky() {
    14571457                $id1 = end( self::$post_ids );
    1458                 $id2 = $this->factory->post->create( array( 'post_status' => 'publish' ) );
     1458                $id2 = self::factory()->post->create( array( 'post_status' => 'publish' ) );
    14591459
    14601460                $total_posts = self::$total_posts + 1;
    … …  
    14781478        public function test_get_items_not_sticky_with_exclude() {
    14791479                $id1 = end( self::$post_ids );
    1480                 $id2 = $this->factory->post->create( array( 'post_status' => 'publish' ) );
    1481                 $id3 = $this->factory->post->create( array( 'post_status' => 'publish' ) );
     1480                $id2 = self::factory()->post->create( array( 'post_status' => 'publish' ) );
     1481                $id3 = self::factory()->post->create( array( 'post_status' => 'publish' ) );
    14821482
    14831483                $total_posts = self::$total_posts + 2;
    … …  
    15041504        public function test_get_items_not_sticky_with_exclude_no_sticky_posts() {
    15051505                $id1 = self::$post_id;
    1506                 $id2 = $this->factory->post->create( array( 'post_status' => 'publish' ) );
    1507                 $id3 = $this->factory->post->create( array( 'post_status' => 'publish' ) );
     1506                $id2 = self::factory()->post->create( array( 'post_status' => 'publish' ) );
     1507                $id3 = self::factory()->post->create( array( 'post_status' => 'publish' ) );
    15081508
    15091509                $total_posts = self::$total_posts + 2;
    … …  
    15751575                $parent_ids       = array( $parent_id1, $parent_id2 );
    15761576                $attachment_ids   = array();
    1577                 $attachment_ids[] = $this->factory->attachment->create_object(
     1577                $attachment_ids[] = self::factory()->attachment->create_object(
    15781578                        DIR_TESTDATA . '/images/canola.jpg',
    15791579                        $parent_id1,
    … …  
    15841584                );
    15851585
    1586                 $attachment_ids[] = $this->factory->attachment->create_object(
     1586                $attachment_ids[] = self::factory()->attachment->create_object(
    15871587                        DIR_TESTDATA . '/images/canola.jpg',
    15881588                        $parent_id2,
    … …  
    16291629
    16301630                // 3rd page.
    1631                 $this->factory->post->create();
     1631                self::factory()->post->create();
    16321632                $total_posts++;
    16331633                $total_pages++;
    … …  
    17081708
    17091709        public function test_get_items_status_draft_permissions() {
    1710                 $draft_id = $this->factory->post->create( array( 'post_status' => 'draft' ) );
     1710                $draft_id = self::factory()->post->create( array( 'post_status' => 'draft' ) );
    17111711
    17121712                // Drafts status query var inaccessible to unauthorized users.
    … …  
    17381738         */
    17391739        public function test_get_items_status_private_permissions() {
    1740                 $private_post_id = $this->factory->post->create( array( 'post_status' => 'private' ) );
     1740                $private_post_id = self::factory()->post->create( array( 'post_status' => 'private' ) );
    17411741
    17421742                wp_set_current_user( 0 );
    … …  
    17931793
    17941794        public function test_get_items_valid_date() {
    1795                 $post1 = $this->factory->post->create( array( 'post_date' => '2016-01-15T00:00:00Z' ) );
    1796                 $post2 = $this->factory->post->create( array( 'post_date' => '2016-01-16T00:00:00Z' ) );
    1797                 $post3 = $this->factory->post->create( array( 'post_date' => '2016-01-17T00:00:00Z' ) );
     1795                $post1 = self::factory()->post->create( array( 'post_date' => '2016-01-15T00:00:00Z' ) );
     1796                $post2 = self::factory()->post->create( array( 'post_date' => '2016-01-16T00:00:00Z' ) );
     1797                $post3 = self::factory()->post->create( array( 'post_date' => '2016-01-17T00:00:00Z' ) );
    17981798
    17991799                $request = new WP_REST_Request( 'GET', '/wp/v2/posts' );
    … …  
    18211821         */
    18221822        public function test_get_items_valid_modified_date() {
    1823                 $post1 = $this->factory->post->create( array( 'post_date' => '2016-01-01 00:00:00' ) );
    1824                 $post2 = $this->factory->post->create( array( 'post_date' => '2016-01-02 00:00:00' ) );
    1825                 $post3 = $this->factory->post->create( array( 'post_date' => '2016-01-03 00:00:00' ) );
     1823                $post1 = self::factory()->post->create( array( 'post_date' => '2016-01-01 00:00:00' ) );
     1824                $post2 = self::factory()->post->create( array( 'post_date' => '2016-01-02 00:00:00' ) );
     1825                $post3 = self::factory()->post->create( array( 'post_date' => '2016-01-03 00:00:00' ) );
    18261826                $this->update_post_modified( $post1, '2016-01-15 00:00:00' );
    18271827                $this->update_post_modified( $post2, '2016-01-16 00:00:00' );
    … …  
    19411941
    19421942        public function test_get_post_draft_status_not_authenticated() {
    1943                 $draft_id = $this->factory->post->create(
     1943                $draft_id = self::factory()->post->create(
    19441944                        array(
    19451945                                'post_status' => 'draft',
    … …  
    19571957        public function test_get_post_draft_edit_context() {
    19581958                $post_content = 'Hello World!';
    1959                 $this->factory->post->create(
     1959                self::factory()->post->create(
    19601960                        array(
    19611961                                'post_title'    => 'Hola',
    … …  
    19661966                        )
    19671967                );
    1968                 $draft_id = $this->factory->post->create(
     1968                $draft_id = self::factory()->post->create(
    19691969                        array(
    19701970                                'post_status'  => 'draft',
    … …  
    20322032
    20332033        public function test_get_post_with_password() {
    2034                 $post_id = $this->factory->post->create(
     2034                $post_id = self::factory()->post->create(
    20352035                        array(
    20362036                                'post_password' => '$inthebananastand',
    … …  
    20512051
    20522052        public function test_get_post_with_password_using_password() {
    2053                 $post_id = $this->factory->post->create(
     2053                $post_id = self::factory()->post->create(
    20542054                        array(
    20552055                                'post_password' => '$inthebananastand',
    … …  
    20752075
    20762076        public function test_get_post_with_password_using_incorrect_password() {
    2077                 $post_id = $this->factory->post->create(
     2077                $post_id = self::factory()->post->create(
    20782078                        array(
    20792079                                'post_password' => '$inthebananastand',
    … …  
    20912091
    20922092        public function test_get_post_with_password_without_permission() {
    2093                 $post_id = $this->factory->post->create(
     2093                $post_id = self::factory()->post->create(
    20942094                        array(
    20952095                                'post_password' => '$inthebananastand',
    … …  
    21152115         */
    21162116        public function test_get_post_should_not_have_block_version_when_context_view() {
    2117                 $post_id = $this->factory->post->create(
     2117                $post_id = self::factory()->post->create(
    21182118                        array(
    21192119                                'post_content' => '<!-- wp:core/separator -->',
    … …  
    21352135                wp_set_current_user( self::$editor_id );
    21362136
    2137                 $post_id = $this->factory->post->create(
     2137                $post_id = self::factory()->post->create(
    21382138                        array(
    21392139                                'post_content' => '<!-- wp:core/separator -->',
    … …  
    21562156                wp_set_current_user( self::$editor_id );
    21572157
    2158                 $post_id = $this->factory->post->create(
     2158                $post_id = self::factory()->post->create(
    21592159                        array(
    21602160                                'post_content' => '<hr />',
    … …  
    27842784
    27852785                $file          = DIR_TESTDATA . '/images/canola.jpg';
    2786                 $attachment_id = $this->factory->attachment->create_object(
     2786                $attachment_id = self::factory()->attachment->create_object(
    27872787                        $file,
    27882788                        0,
    … …  
    31883188        public function test_rest_update_post_with_empty_date() {
    31893189                // Create a new test post.
    3190                 $post_id = $this->factory->post->create();
     3190                $post_id = self::factory()->post->create();
    31913191
    31923192                wp_set_current_user( self::$editor_id );
    … …  
    34373437                update_option( 'timezone_string', $params['timezone_string'] );
    34383438
    3439                 $post_id = $this->factory->post->create( array( 'post_status' => $status ) );
     3439                $post_id = self::factory()->post->create( array( 'post_status' => $status ) );
    34403440
    34413441                $request = new WP_REST_Request( 'PUT', sprintf( '/wp/v2/posts/%d', $post_id ) );
    … …  
    35023502                // Need to set dates using wpdb directly because `wp_update_post` and
    35033503                // `wp_insert_post` have additional validation on dates.
    3504                 $post_id = $this->factory->post->create();
     3504                $post_id = self::factory()->post->create();
    35053505                $wpdb->update(
    35063506                        $wpdb->posts,
    … …  
    41724172
    41734173        public function test_delete_item() {
    4174                 $post_id = $this->factory->post->create( array( 'post_title' => 'Deleted post' ) );
     4174                $post_id = self::factory()->post->create( array( 'post_title' => 'Deleted post' ) );
    41754175
    41764176                wp_set_current_user( self::$editor_id );
    … …  
    41874187
    41884188        public function test_delete_item_skip_trash() {
    4189                 $post_id = $this->factory->post->create( array( 'post_title' => 'Deleted post' ) );
     4189                $post_id = self::factory()->post->create( array( 'post_title' => 'Deleted post' ) );
    41904190
    41914191                wp_set_current_user( self::$editor_id );
    … …  
    42024202
    42034203        public function test_delete_item_already_trashed() {
    4204                 $post_id = $this->factory->post->create( array( 'post_title' => 'Deleted post' ) );
     4204                $post_id = self::factory()->post->create( array( 'post_title' => 'Deleted post' ) );
    42054205
    42064206                wp_set_current_user( self::$editor_id );
    … …  
    42234223
    42244224        public function test_delete_post_invalid_post_type() {
    4225                 $page_id = $this->factory->post->create( array( 'post_type' => 'page' ) );
     4225                $page_id = self::factory()->post->create( array( 'post_type' => 'page' ) );
    42264226
    42274227                wp_set_current_user( self::$editor_id );
    … …  
    44664466                wp_set_current_user( 1 );
    44674467
    4468                 $post_id = $this->factory->post->create();
     4468                $post_id = self::factory()->post->create();
    44694469
    44704470                $request  = new WP_REST_Request( 'GET', '/wp/v2/posts/' . $post_id );
    … …  
    45114511                        )
    45124512                );
    4513                 $post_id = $this->factory->post->create();
     4513                $post_id = self::factory()->post->create();
    45144514
    45154515                // 'my_custom_int' should appear because ?_fields= isn't set.
    … …  
    49324932                wp_set_current_user( self::$editor_id );
    49334933
    4934                 $post_id = $this->factory->post->create(
     4934                $post_id = self::factory()->post->create(
    49354935                        array(
    49364936                                'post_title'  => 'Permalink Template',
    … …  
    49564956                wp_set_current_user( self::$editor_id );
    49574957
    4958                 $post_id = $this->factory->post->create(
     4958                $post_id = self::factory()->post->create(
    49594959                        array(
    49604960                                'post_title'  => 'Permalink Template',
Note: See TracChangeset for help on using the changeset viewer.