Make WordPress Core

Changeset 49696


Ignore:
Timestamp:
11/25/2020 04:09:41 AM (6 years ago)
Author:
peterwilsoncc
Message:

Build/Test Tools: Remove unused posts from AJAX test setUp().

Removes the creation of five posts from the AJAX test suite setUp() function, replacing it with a shared fixture only where required.

See #51802.

Location:
trunk/tests/phpunit
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/includes/testcase-ajax.php

    r48998 r49696  
    150150                $this->_error_level = error_reporting();
    151151                error_reporting( $this->_error_level & ~E_WARNING );
    152 
    153                 // Make some posts.
    154                 self::factory()->post->create_many( 5 );
    155152        }
    156153
  • trunk/tests/phpunit/tests/ajax/CustomizeMenus.php

    r48997 r49696  
    1818
    1919        /**
     20         * Page IDs.
     21         *
     22         * @var int[]
     23         */
     24        public static $pages;
     25
     26        /**
     27         * Post IDs.
     28         *
     29         * @var int[]
     30         */
     31        public static $posts;
     32
     33        /**
     34         * Term IDs.
     35         *
     36         * @var int[]
     37         */
     38        public static $terms;
     39
     40        public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
     41                // Make some post objects.
     42                self::$posts = $factory->post->create_many( 5 );
     43                self::$pages = $factory->post->create_many( 5, array( 'post_type' => 'page' ) );
     44
     45                // Some terms too.
     46                self::$terms = $factory->term->create_many( 5 );
     47        }
     48
     49        /**
    2050         * Set up the test fixture.
    2151         */
     
    342372                );
    343373
    344                 // Create some terms and pages.
    345                 self::factory()->term->create_many( 5 );
    346                 self::factory()->post->create_many( 5, array( 'post_type' => 'page' ) );
    347374                $auto_draft_post = $this->wp_customize->nav_menus->insert_auto_draft_post(
    348375                        array(
Note: See TracChangeset for help on using the changeset viewer.