Make WordPress Core

Changeset 57149

Timestamp:
12/02/2023 11:56:31 AM (8 months ago)
Author:
SergeyBiryukov
Message:

Build/Test Tools: Allow overriding the WP_UnitTestCase_Base::factory() method.

This allows third-party plugins to write their own factory extending WP_UnitTest_Factory for testing purposes, as well as benefit from WP_UnitTestCase_Base features.

Follow-up to [35186], [35225], [35242].

Props hugod.
Fixes #59999.

File:
1 edited

Legend:

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

    r56548 r57149  
    7373
    7474        if ( method_exists( $class, 'wpSetUpBeforeClass' ) ) {
    75             call_user_func( array( $class, 'wpSetUpBeforeClass' ), self::factory() );
     75            call_user_func( array( $class, 'wpSetUpBeforeClass' ), s::factory() );
    7676        }
    7777
     
    103103        set_time_limit( 0 );
    104104
    105         $this->factory = self::factory();
     105        $this->factory = s::factory();
    106106
    107107        if ( ! self::$ignore_files ) {
Note: See TracChangeset for help on using the changeset viewer.