Make WordPress Core


Ignore:
Timestamp:
11/15/2020 01:59:32 PM (6 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/query/commentCount.php

    r49184 r49603  
    1919        }
    2020
    21         public static function wpSetUpBeforeClass( $factory ) {
    22                 $post_id             = self::factory()->post->create(
     21        public static function wpSetUpBeforeClass( WP_UnitTest_Factory $factory ) {
     22                $post_id             = $factory->post->create(
    2323                        array(
    2424                                'post_content' => 1 . rand_str() . ' about',
     
    2727                );
    2828                self::$post_ids[1][] = $post_id;
    29                 self::factory()->comment->create( array( 'comment_post_ID' => $post_id ) );
    30 
    31                 $post_id             = self::factory()->post->create(
     29                $factory->comment->create( array( 'comment_post_ID' => $post_id ) );
     30
     31                $post_id             = $factory->post->create(
    3232                        array(
    3333                                'post_content' => 1 . rand_str() . ' about',
     
    3737                self::$post_ids[4][] = $post_id;
    3838                for ( $i = 0; $i < 4; $i++ ) {
    39                         self::factory()->comment->create( array( 'comment_post_ID' => $post_id ) );
    40                 }
    41 
    42                 $post_id             = self::factory()->post->create(
     39                        $factory->comment->create( array( 'comment_post_ID' => $post_id ) );
     40                }
     41
     42                $post_id             = $factory->post->create(
    4343                        array(
    4444                                'post_content' => 1 . rand_str() . ' about',
     
    4848                self::$post_ids[5][] = $post_id;
    4949                for ( $i = 0; $i < 5; $i++ ) {
    50                         self::factory()->comment->create( array( 'comment_post_ID' => $post_id ) );
    51                 }
    52 
    53                 $post_id             = self::factory()->post->create(
     50                        $factory->comment->create( array( 'comment_post_ID' => $post_id ) );
     51                }
     52
     53                $post_id             = $factory->post->create(
    5454                        array(
    5555                                'post_content' => 1 . rand_str() . ' about',
     
    5959                self::$post_ids[5][] = $post_id;
    6060                for ( $i = 0; $i < 5; $i++ ) {
    61                         self::factory()->comment->create( array( 'comment_post_ID' => $post_id ) );
     61                        $factory->comment->create( array( 'comment_post_ID' => $post_id ) );
    6262                }
    6363        }
Note: See TracChangeset for help on using the changeset viewer.