-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PHPUnit 11.5.0 | AssertContainsOnly trait: polyfill the Assert::asser…
…tContains[Not]Only*() methods (#225) PHPUnit 11.5.0 introduced a range of new assertions. These assertions are specialized alternatives to the pre-existing `assert[Not]ContainsOnly()` methods, which are now soft deprecated and will be removed in PHPUnit 13.0. This commit: * Adds two traits with the same name. One to polyfill the methods when not available in PHPUnit. The other to allow for `use`-ing the trait in PHPUnit versions in which the methods are already natively available. * Adds logic to the custom autoloader which will load the correct trait depending on the PHPUnit version used. * Adds tests. Most polyfilled methods can just fall-through to the pre-existing methods as a polyfill. The exceptions to this rule are: * `assertContains[Not]OnlyIterable()` which needs custom logic for PHPUnit < 7.1.0 in which the PHP native `iterable` type was not yet supported. * `assertContains[Not]OnlyClosedResource()` which needs custom logic for PHP < 7.2 in which the PHP native `resource (closed)` type did not exist yet. In this last case, the custom logic is used for the polyfill on all PHP versions as there is no functional check (in contrast to a version check) which can be used to determine whether the `resource (closed)` type is available. All new methods are loosely tested. Includes: * Adding information on the new polyfill to the README. * Adding the new polyfill to the existing `TestCases` classes. Refs: * sebastianbergmann/phpunit@a726e03 Fixes 214
- Loading branch information
Showing
10 changed files
with
1,816 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.