Make WordPress Core

Changeset 49002


Ignore:
Timestamp:
09/19/2020 09:25:55 AM (6 years ago)
Author:
SergeyBiryukov
Message:

Tests: Speed up tests for wp_allow_comment() by reusing shared fixtures.

Props frank-klein.
Fixes #51216.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tests/phpunit/tests/comment/wpAllowComment.php

    r48996 r49002  
    88        protected static $comment_id;
    99
    10         function setUp() {
    11                 parent::setUp();
    12 
    13                 self::$post_id    = self::factory()->post->create();
    14                 self::$comment_id = self::factory()->comment->create(
     10        public static function wpSetupBeforeClass( $factory ) {
     11                self::$post_id    = $factory->post->create();
     12                self::$comment_id = $factory->comment->create(
    1513                        array(
    1614                                'comment_post_ID'      => self::$post_id,
    … …  
    2624        }
    2725
    28         function tearDown() {
     26        public static function wpTeardownAfterClass() {
    2927                wp_delete_post( self::$post_id, true );
    3028                wp_delete_comment( self::$comment_id, true );
Note: See TracChangeset for help on using the changeset viewer.