Make WordPress Core


Ignore:
Timestamp:
11/15/2020 01:59:32 PM (4 years ago)
Author:
johnbillion
Message:

Build/Test Tools: Standardise the name, signature, and usage of the wpSetUpBeforeClass() method that's used in test classes.

This brings consistency to this often-used method, and allows IDEs to provide help to developers when using its $factory parameter.

See #51344

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/post/wpListPages.php

    r49327 r49603  
    5454    public static $time;
    5555
    56     public static function wpSetupBeforeClass() {
     56    public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
    5757        self::$time = time();
    5858
    5959        $post_date = gmdate( 'Y-m-d H:i:s', self::$time );
    6060
    61         self::$editor = self::factory()->user->create( array( 'role' => 'editor' ) );
    62         self::$author = self::factory()->user->create( array( 'role' => 'author' ) );
    63 
    64         self::$parent_1 = self::factory()->post->create(
     61        self::$editor = $factory->user->create( array( 'role' => 'editor' ) );
     62        self::$author = $factory->user->create( array( 'role' => 'author' ) );
     63
     64        self::$parent_1 = $factory->post->create(
    6565            array(
    6666                'post_author' => self::$editor,
     
    7171        );
    7272
    73         self::$parent_2 = self::factory()->post->create(
     73        self::$parent_2 = $factory->post->create(
    7474            array(
    7575                'post_type'  => 'page',
     
    7979        );
    8080
    81         self::$parent_3 = self::factory()->post->create(
     81        self::$parent_3 = $factory->post->create(
    8282            array(
    8383                'post_author' => self::$author,
     
    8989
    9090        foreach ( array( self::$parent_1, self::$parent_2, self::$parent_3 ) as $page ) {
    91             self::$children[ $page ][] = self::factory()->post->create(
     91            self::$children[ $page ][] = $factory->post->create(
    9292                array(
    9393                    'post_parent' => $page,
     
    9797                )
    9898            );
    99             self::$children[ $page ][] = self::factory()->post->create(
     99            self::$children[ $page ][] = $factory->post->create(
    100100                array(
    101101                    'post_parent' => $page,
     
    105105                )
    106106            );
    107             self::$children[ $page ][] = self::factory()->post->create(
     107            self::$children[ $page ][] = $factory->post->create(
    108108                array(
    109109                    'post_parent' => $page,
Note: See TracChangeset for help on using the changeset viewer.