diff --git a/tests/phpunit/includes/abstract-testcase.php b/tests/phpunit/includes/abstract-testcase.php index 94c7aaf634..79276c0174 100644 --- a/tests/phpunit/includes/abstract-testcase.php +++ b/tests/phpunit/includes/abstract-testcase.php @@ -70,13 +70,11 @@ abstract class WP_UnitTestCase_Base extends PHPUnit\Framework\TestCase { parent::setUpBeforeClass(); - $c = get_called_class(); - if ( ! method_exists( $c, 'wpSetUpBeforeClass' ) ) { - self::commit_transaction(); - return; - } + $class = get_called_class(); - call_user_func( array( $c, 'wpSetUpBeforeClass' ), self::factory() ); + if ( method_exists( $class, 'wpSetUpBeforeClass' ) ) { + call_user_func( array( $class, 'wpSetUpBeforeClass' ), self::factory() ); + } self::commit_transaction(); } @@ -90,13 +88,11 @@ abstract class WP_UnitTestCase_Base extends PHPUnit\Framework\TestCase { _delete_all_data(); self::flush_cache(); - $c = get_called_class(); - if ( ! method_exists( $c, 'wpTearDownAfterClass' ) ) { - self::commit_transaction(); - return; - } + $class = get_called_class(); - call_user_func( array( $c, 'wpTearDownAfterClass' ) ); + if ( method_exists( $class, 'wpTearDownAfterClass' ) ) { + call_user_func( array( $class, 'wpTearDownAfterClass' ) ); + } self::commit_transaction(); }