mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-03-31 18:54:29 +00:00
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. git-svn-id: https://develop.svn.wordpress.org/trunk@44701 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
31
tests/phpunit/includes/phpunit7/testcase.php
Normal file
31
tests/phpunit/includes/phpunit7/testcase.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
require_once dirname( dirname( __FILE__ ) ) . '/abstract-testcase.php';
|
||||
|
||||
/**
|
||||
* Defines a basic fixture to run multiple tests.
|
||||
*
|
||||
* Resets the state of the WordPress installation before and after every test.
|
||||
*
|
||||
* Includes utility functions and assertions useful for testing WordPress.
|
||||
*
|
||||
* All WordPress unit tests should inherit from this class.
|
||||
*/
|
||||
class WP_UnitTestCase extends WP_UnitTestCase_Base {
|
||||
/**
|
||||
* Asserts that a condition is not false.
|
||||
*
|
||||
* This method has been backported from a more recent PHPUnit version, as tests running on PHP 5.2 use
|
||||
* PHPUnit 3.6.x.
|
||||
*
|
||||
* @since 4.7.4
|
||||
*
|
||||
* @param bool $condition Condition to check.
|
||||
* @param string $message Optional. Message to display when the assertion fails.
|
||||
*
|
||||
* @throws PHPUnit_Framework_AssertionFailedError
|
||||
*/
|
||||
public static function assertNotFalse( $condition, string $message = '' ): void {
|
||||
self::assertThat( $condition, self::logicalNot( self::isFalse() ), $message );
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user