summaryrefslogtreecommitdiffstatshomepage
path: root/tests/phpunit/includes/phpunit7
Commit message (Collapse)AuthorAge
* Build/Test Tools: Remove the copied-in PHPUnit 9.x MockObject files.Sergey Biryukov2021-08-07
| | | | | | | | | | | As the version constraints for PHPUnit now allow the tests to be run on PHPUnit 8.x and 9.x, these files are no longer needed. Follow-up to [48957], [49037], [51544], [51559-51574]. Props jrf. See #46149. git-svn-id: https://develop.svn.wordpress.org/trunk@51575 602fd350-edb4-49c9-b593-d223f7449a82
* Build/Test Tools: Remove SpeedTrapListener.Sergey Biryukov2021-08-07
| | | | | | | | | | | | | | | | | | | | | Now that the tests can run PHPUnit cross-version and Composer will be used to install the test suite in CI, we could switch out the local copies of the [https://github.com/johnkary/phpunit-speedtrap PHPUnit speedtrap] package in favor of using the Composer package, which would prevent us having to make the WP local copies of the class compatible with later PHPUnit versions. The SpeedTrap test listener was introduced to identify slow tests and take action on these to make them faster. In practice, however, no notable action was ever taken based on the output of the test listener in all the years it was in place. With that in mind, it was decided to remove the SpeedTrap test listeners without replacement. If – at a future date – contributors would want to take action to speed up slow tests anyway, they can: * Either add the package to their local install and use the output they receive locally to identify slow tests. * Or use the PHPUnit native `@small` annotations in combination with the PHPUnit `PHP_Invoker` package as described in the PHPUnit documentation to [https://phpunit.readthedocs.io/en/stable/risky-tests.html#test-execution-timeout run tests with time limits]. Follow-up to [35214], [35226], [35767], [44701], [51559-51572]. Props jrf. See #46149. git-svn-id: https://develop.svn.wordpress.org/trunk@51573 602fd350-edb4-49c9-b593-d223f7449a82
* Build/Test Tools: Unify the PHPUnit adapter TestCases.Sergey Biryukov2021-08-06
| | | | | | | | | | | | | | | | | | | This commit: * Removes the PHPUnit 7 specific `TestCase`. * Removes all existing polyfills from the PHPUnit 5.x `TestCase`. * Imports all polyfill traits from the PHPUnit Polyfills package into the `WP_UnitTestCase` class and updates the DocBlock to reflect the actual function of the class. * Note: The list of polyfills needs to be verified and updated after each new release of the PHPUnit Polyfills package. Alternatively (recommended), one of the built-in `TestCase` classes from the PHPUnit Polyfills package can be used instead. * Moves the `require` for the WP `abstract-testcase.php` to the `bootstrap.php` file. * Adds a `require_once` for the PHPUnit Polyfills autoloader to the `bootstrap.php` file. * Note: while this isn't _strictly_ necessary when the tests are run via Composer, having the include in the bootstrap allows for the tests to also be run via a PHPUnit Phar, providing contributors with more flexibility. Follow-up to [51559]. Props jrf, hellofromTonya, johnbillion, netweb, SergeyBiryukov. See #46149. git-svn-id: https://develop.svn.wordpress.org/trunk@51560 602fd350-edb4-49c9-b593-d223f7449a82
* Tests: Minimize the chances of signature conflicts for ↵Sergey Biryukov2021-05-25
| | | | | | | | | | | | | | | `assertEqualsWithDelta()`. The PHPUnit 7.5+ method `assertEqualsWithDelta()` was polyfilled for PHPUnit < 7.5, but also overloaded for PHPUnit 7.5 itself, which was not necessary and created a higher chance of signature conflicts, especially when the WP test suite is used as a basis for integration tests with plugins/themes. This change removes the unnecessary overloading for PHPUnit 7.5+ and simplifies the overloaded method for PHPUnit < 7.5, including removing the `IsEqual()` class alias declaration, no longer needed. Follow-up to [48952]. Props jrf. See #52625. git-svn-id: https://develop.svn.wordpress.org/trunk@50986 602fd350-edb4-49c9-b593-d223f7449a82
* Tests: Backport two changes from PHPUnit 9.3:Sergey Biryukov2020-09-23
| | | | | | | | | | | | | | | * Replace the `Match` interface with `ParametersMatch`, to avoid parse errors due to `match` being a reserved keyword in PHP 8. * Replace `ReflectionParameter::getClass()` usage, which is deprecated in PHP 8. This allows tests relying on the `getMockForAbstractClass()` and `getMockBuilder()` methods to run again on PHP 8. When the test suite is updated for compatibility with PHPUnit 9.x, these overrides can be removed. Follow-up to [48972]. See #50913, #50902. git-svn-id: https://develop.svn.wordpress.org/trunk@49037 602fd350-edb4-49c9-b593-d223f7449a82
* Tests: Replace the native PHPUnit `getMockForAbstractClass()` and ↵Sergey Biryukov2020-09-13
| | | | | | | | | | | | | | `getMockBuilder()` methods. This avoids parse errors in PHPUnit internals due to `match` being a reserved keyword in PHP 8. To run on PHP 8, the tests relying on these methods require PHPUnit 9.3 or later. When the test suite is updated for compatibility with PHPUnit 9.x, these overrides can be removed. See #50913, #50902. git-svn-id: https://develop.svn.wordpress.org/trunk@48972 602fd350-edb4-49c9-b593-d223f7449a82
* Tests: Remove the polyfill for `assertNotFalse()`.Sergey Biryukov2020-09-07
| | | | | | | | | | | | `assertNotFalse()` is available in PHPUnit since version 4.0. The polyfill was introduced back when WordPress still supported PHP 5.2 and PHPUnit 3.6.x, and is now redundant. Follow-up to [39919], [45058], [47880]. See #38266. git-svn-id: https://develop.svn.wordpress.org/trunk@48953 602fd350-edb4-49c9-b593-d223f7449a82
* Tests: Add a polyfill for `assertEqualsWithDelta()` to `WP_UnitTestCase` and ↵Sergey Biryukov2020-09-07
| | | | | | | | | | use it where appropriate. `assertEqualsWithDelta()` was added in PHPUnit 7.5, while WordPress still supports PHPUnit 5.4.x as the minimum version. See #38266. git-svn-id: https://develop.svn.wordpress.org/trunk@48952 602fd350-edb4-49c9-b593-d223f7449a82
* Code Modernization: Replace `dirname( __FILE__ )` calls with `__DIR__` magic ↵Sergey Biryukov2020-02-06
| | | | | | | | | | | | | | | | | | | constant. This avoids the performance overhead of the function call every time `dirname( __FILE__ )` was used instead of `__DIR__`. This commit also includes: * Removing unnecessary parentheses from `include`/`require` statements. These are language constructs, not function calls. * Replacing `include` statements for several files with `require_once`, for consistency: * `wp-admin/admin-header.php` * `wp-admin/admin-footer.php` * `wp-includes/version.php` Props ayeshrajans, desrosj, valentinbora, jrf, joostdevalk, netweb. Fixes #48082. git-svn-id: https://develop.svn.wordpress.org/trunk@47198 602fd350-edb4-49c9-b593-d223f7449a82
* Docs: Improve inline comments per the documentation standards.Sergey Biryukov2020-01-29
| | | | | | | | Includes minor code layout fixes for better readability. See #48303. git-svn-id: https://develop.svn.wordpress.org/trunk@47122 602fd350-edb4-49c9-b593-d223f7449a82
* Tests: Docs: Correct `@param` formatting in `SpeedTrapListener` after ↵Sergey Biryukov2019-12-11
| | | | | | | | [35226] and [45607]. See #48303. git-svn-id: https://develop.svn.wordpress.org/trunk@46882 602fd350-edb4-49c9-b593-d223f7449a82
* Coding Standards: Fix the remaining issues in `/tests`.Gary Pendergast2019-07-08
| | | | | | | | | | | | All PHP files in `/tests` now conform to the PHP coding standards, or have exceptions appropriately marked. Travis now also runs `phpcs` on the `/tests` directory, any future changes to these files must conform entirely to the WordPress PHP coding standards. 🎉 See #47632. git-svn-id: https://develop.svn.wordpress.org/trunk@45607 602fd350-edb4-49c9-b593-d223f7449a82
* Coding Standards: Fix the `Squiz.PHP.DisallowMultipleAssignments` violations ↵Gary Pendergast2019-07-02
| | | | | | | | | | in `tests`. See #47632. git-svn-id: https://develop.svn.wordpress.org/trunk@45588 602fd350-edb4-49c9-b593-d223f7449a82
* Build/Test Tools: Move `WP_UnitTestCase_Base::assertPostConditions()` to a ↵Sergey Biryukov2019-01-30
| | | | | | | | more appropriate place. See #43218. git-svn-id: https://develop.svn.wordpress.org/trunk@44719 602fd350-edb4-49c9-b593-d223f7449a82
* Build/Test Tools: Add support for PHPUnit 7.x.Sergey Biryukov2019-01-28
* 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