-
Notifications
You must be signed in to change notification settings - Fork 497
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Tests: update test suite to allow for running the tests on PHPUnit 10 #817
Tests: update test suite to allow for running the tests on PHPUnit 10 #817
Commits on Jun 26, 2023
-
Composer: update the PHPUnit Polyfills
A PHPUnit 10 compatible version of the PHPUnit Polyfills has been released, so let's start using it. Ref: * https:/Yoast/PHPUnit-Polyfills/releases/tag/2.0.0
Configuration menu - View commit details
-
Copy full SHA for 19f1c51 - Browse repository at this point
Copy the full SHA 19f1c51View commit details -
Transport/BaseTestCase::dataSNISupport(): remove unused and unnecessa…
…ry method parameter Data providers cannot take arguments, so this `$options` parameter is useless and should never have been declared. PHPUnit 10 will flag it, so let's remove it.
Configuration menu - View commit details
-
Copy full SHA for b555585 - Browse repository at this point
Copy the full SHA b555585View commit details -
TestCase::textArrayToDataprovider(): make static
This method is used exclusively by data providers and as of PHPUnit 10, data providers should be static methods, so this method needs to be `static` too.
Configuration menu - View commit details
-
Copy full SHA for f177e1d - Browse repository at this point
Copy the full SHA f177e1dView commit details -
TestCase::transportProvider(): make static
This method is used exclusively as a data providers and as of PHPUnit 10, data providers should be static methods, so this method needs to be `static` too.
Configuration menu - View commit details
-
Copy full SHA for 1b13f11 - Browse repository at this point
Copy the full SHA 1b13f11View commit details -
TestCase: split
httpbin()
method and make Session\ConstructorTest::……dataValidUrl() method static As of PHPUnit 10, data providers are (again) expected to be `static` methods. One of the data providers is using the `httpbin()` method, but as the `httpbin()` method needs `$this` to handle the test skipping, the method cannot be made static. This commit splits the `httpbin()` method into three methods: * A `skipOnUnavailableHttpbinHost()` method which contains the test skip check. * A `static` `getHttpbinUrl()` method which builds the URL. * The original `httpbin()` method which now calls the two new methods to maintain the same functionality as before. By splitting the method in this way, we prevent having to change all method calls to the `httpbin()` method throughout the test suite and can still fix the data provider method using the `httpbin()` method to not use `$this` (which allows to make it `static`).
Configuration menu - View commit details
-
Copy full SHA for f15c06c - Browse repository at this point
Copy the full SHA f15c06cView commit details -
Tests: make dataproviders
static
As of PHPUnit 10, data providers are (again) expected to be `static` methods. This updates the test suite to respect that. Includes removing the use of `$this` from select data providers.
Configuration menu - View commit details
-
Copy full SHA for 64e62ec - Browse repository at this point
Copy the full SHA 64e62ecView commit details -
Tests: replace
assertObjectHasAttribute()
with `assertObjectHasProp……erty()` The `assertObjectHasAttribute()` method has been deprecated in PHPUnit 9 and removed in PHPUnit 10. PHPUnit 10.1 introduces a replacement `assertObjectHasProperty()` method, which is polyfilled by the PHPUnit Polyfills. This switches all uses of the old method to the new method name.
Configuration menu - View commit details
-
Copy full SHA for c03629d - Browse repository at this point
Copy the full SHA c03629dView commit details -
Tests: work around for
MockBuilder::setMethods()
removalPlease note: * The `getMockBuilder()` method is also deprecated now, so replacing with another method call on the `MockBuilder` class will only work in the short/medium term and in a future iteration, this will have to be refactored again. * The `addMethods()` method has been (soft) deprecated in PHPUnit 10.1 and is expected to be removed in PHPUnit 12. Also see 814 Refs: * sebastianbergmann/phpunit 3687#issuecomment-492537584 * sebastianbergmann/phpunit 3770 * sebastianbergmann/phpunit 3769 * sebastianbergmann/phpunit 4775
Configuration menu - View commit details
-
Copy full SHA for 38c1847 - Browse repository at this point
Copy the full SHA 38c1847View commit details -
Tests: work around for removal of expectDeprecation et al
PHPUnit will no longer stop a test on deprecations/notices/warnings. This also means that the PHPUnit native way to expect deprecations/notices/warnings etc is no longer supported. This implements a work-around for the limited cases in which that functionality was used in this test suite. Refs: * https://phpunit.de/announcements/phpunit-10.html * sebastianbergmann/phpunit 5062
Configuration menu - View commit details
-
Copy full SHA for 4f3550a - Browse repository at this point
Copy the full SHA 4f3550aView commit details -
Curl/Fsockopen: add some extra defensive coding
The `error_get_last()` function can return `null` if no error occurred, in which case, the `throw new Exception()` statement will run into two new errors: * `Trying to access array offset on value of type null` for accessing `$error['message']`. * ... which then leads to a `Exception::__construct(): Passing null to parameter #1 ($message) of type string is deprecated`. This commit adds some defensive coding to handle the hypothetical situation that `error_get_last()` would return `null` when a file could not be opened. Note: this is actually a bug in PHPUnit 10 which breaks `error_get_last()`. We should be able to remove the extra defensive coding once the upstream bug has been fixed. Upstream bug report: sebastianbergmann/phpunit#5428
Configuration menu - View commit details
-
Copy full SHA for 5bbef6d - Browse repository at this point
Copy the full SHA 5bbef6dView commit details -
PHPUnit: add separate configuration for PHPUnit 10
PHPUnit 10 makes significant changes to the configuration file. Most notably: * In PHPUnit 9.3, the manner of specifying the code coverage configuration has changed. * In PHPUnit 10.0, a significant number of attributes of the `<phpunit>` element were removed or renamed. * In PHPUnit 10.1, the manner of specifying code coverage has changed again. While there is a `--migrate-configuration` option available in PHPUnit, that doesn't get us a well enough converted configuration file, so instead use a separate `phpunit10.xml.dist` file for running the tests on PHPUnit 10 with an optimal configuration. Includes: * Ignoring the new file for package archives. * Adding separate scripts to the `composer.json` file to make how to run the tests on PHPUnit 10 more obvious for contributors. * Updating the GH Actions workflows to take the new configuration file into account when appropriate.
Configuration menu - View commit details
-
Copy full SHA for 2c43c17 - Browse repository at this point
Copy the full SHA 2c43c17View commit details
Commits on Jul 24, 2023
-
Composer: add script descriptions
... as it is now less intuitive to run the unit tests via the Composer scripts, so improve the discoverability of the different scripts by adding descriptions for each script.
Configuration menu - View commit details
-
Copy full SHA for 148c25e - Browse repository at this point
Copy the full SHA 148c25eView commit details