Make WordPress Core


Ignore:
Timestamp:
01/28/2019 02:10:24 PM (6 years ago)
Author:
SergeyBiryukov
Message:

Build/Test Tools: Add support for PHPUnit 7.x.

  • Create an abstract WP_UnitTestCase_Base class to share between PHPUnit 7.x and older versions.
  • Add a speed-trap loader to determine which SpeedTrapListener class needs to be loaded for the current PHPUnit version.
  • Remove unnecessary PHPUnit\Util\Test and PHPUnit_Util_Getopt inheritances.
  • Update Travis CI config to use PHPUnit 7.x for PHP 7.1, 7.2, and nightly PHP versions.

Props jipmoors, netweb, desrosj, ayeshrajans, soulseekah, SergeyBiryukov.
See #43218.

File:
1 copied

Legend:

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

    r44700 r44701  
    1313 * All WordPress unit tests should inherit from this class.
    1414 */
    15 class WP_UnitTestCase extends PHPUnit_Framework_TestCase {
     15abstract class WP_UnitTestCase_Base extends PHPUnit_Framework_TestCase {
    1616
    1717    protected static $forced_tickets   = array();
     
    275275     * Saves the action and filter-related globals so they can be restored later.
    276276     *
    277      * Stores $wp_actions, $wp_current_filter, and $wp_filter
    278      * on a class variable so they can be restored on tearDown() using _restore_hooks().
     277     * Stores $wp_actions, $wp_current_filter, and $wp_filter on a class variable
     278     * so they can be restored on tearDown() using _restore_hooks().
    279279     *
    280280     * @global array $wp_actions
     
    583583            $this->assertNotEmpty( $sub_array );
    584584        }
    585     }
    586 
    587     /**
    588      * Asserts that a condition is not false.
    589      *
    590      * This method has been backported from a more recent PHPUnit version, as tests running on PHP 5.2 use
    591      * PHPUnit 3.6.x.
    592      *
    593      * @since 4.7.4
    594      *
    595      * @param bool   $condition Condition to check.
    596      * @param string $message   Optional. Message to display when the assertion fails.
    597      *
    598      * @throws PHPUnit_Framework_AssertionFailedError
    599      */
    600     public static function assertNotFalse( $condition, $message = '' ) {
    601         self::assertThat( $condition, self::logicalNot( self::isFalse() ), $message );
    602585    }
    603586
Note: See TracChangeset for help on using the changeset viewer.