Skip to content
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

PHPUnit 10 | AssertIsList trait: polyfill the Assert::assertIsList() method #110

Merged
merged 1 commit into from
Apr 1, 2023

Conversation

jrfnl
Copy link
Collaborator

@jrfnl jrfnl commented Apr 1, 2023

PHPUnit 10.0.0 introduces the new Assert::assertIsList() method.

This commit:

  • Adds two traits with the same name. One to polyfill the methods when not available in PHPUnit. The other - an empty trait - to allow for use-ing the trait in PHPUnit versions in which the methods are already natively available.
  • Logic to the custom autoloader which will load the correct trait depending on the PHPUnit version used.
  • Functional tests for the functionality polyfilled.

Note: the methods use static:: to call the PHPUnit native functionality. This allows for existing method overloads in a child class of the PHPUnit native TestCase to be respected.

Includes:

  • Adding the new polyfill to the existing TestCases classes and adding a test for the polyfill availability to the TestCaseTestTrait.

Refs:

…method

PHPUnit 10.0.0 introduces the new `Assert::assertIsList()` method.

This commit:
* Adds two traits with the same name.
    One to polyfill the methods when not available in PHPUnit.
    The other - an empty trait - to allow for `use`-ing the trait in PHPUnit versions in which the methods are already natively available.
* Logic to the custom autoloader which will load the correct trait depending on the PHPUnit version used.
* Functional tests for the functionality polyfilled.

Note: the methods use `static::` to call the PHPUnit native functionality. This allows for existing method overloads in a child class of the PHPUnit native `TestCase` to be respected.

Includes:
* Adding the new polyfill to the existing `TestCases` classes and adding a test for the polyfill availability to the `TestCaseTestTrait`.

Refs:
* sebastianbergmann/phpunit#4818
* sebastianbergmann/phpunit@71f5074
* sebastianbergmann/phpunit@e04a947
* sebastianbergmann/phpunit@2bc1aea

Co-authored-by: Jaroslav Hanslík <kukulich@kukulich.cz>
Co-authored-by: Sebastian Bergmann <sb@sebastian-bergmann.de>
@jrfnl jrfnl added this to the 2.0.0 milestone Apr 1, 2023
@jrfnl jrfnl merged commit 3eeec05 into 2.x Apr 1, 2023
@jrfnl jrfnl deleted the feature/phpunit-10-add-assertislisttrait branch April 1, 2023 13:31
@jrfnl jrfnl mentioned this pull request Apr 1, 2023
11 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant