WordPress.org

Make WordPress Core

Changeset 49001


Ignore:
Timestamp:
09/19/2020 09:11:23 AM (5 months ago)
Author:
SergeyBiryukov
Message:

Tests: Simplify the logic in WP_UnitTestCase_Base::setUpBeforeClass() and ::tearDownAfterClass().

See #51344.

File:
1 edited

Legend:

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

    r48939 r49001  
    7171        parent::setUpBeforeClass();
    7272
    73         $c = get_called_class();
    74         if ( ! method_exists( $c, 'wpSetUpBeforeClass' ) ) {
    75             self::commit_transaction();
    76             return;
    77         }
    78 
    79         call_user_func( array( $c, 'wpSetUpBeforeClass' ), self::factory() );
     73        $class = get_called_class();
     74
     75        if ( method_exists( $class, 'wpSetUpBeforeClass' ) ) {
     76            call_user_func( array( $class, 'wpSetUpBeforeClass' ), self::factory() );
     77        }
    8078
    8179        self::commit_transaction();
     
    9189        self::flush_cache();
    9290
    93         $c = get_called_class();
    94         if ( ! method_exists( $c, 'wpTearDownAfterClass' ) ) {
    95             self::commit_transaction();
    96             return;
    97         }
    98 
    99         call_user_func( array( $c, 'wpTearDownAfterClass' ) );
     91        $class = get_called_class();
     92
     93        if ( method_exists( $class, 'wpTearDownAfterClass' ) ) {
     94            call_user_func( array( $class, 'wpTearDownAfterClass' ) );
     95        }
    10096
    10197        self::commit_transaction();
Note: See TracChangeset for help on using the changeset viewer.