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 8 Shift #1

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

PHPUnit 8 Shift #1

wants to merge 4 commits into from

Conversation

debaste
Copy link
Owner

@debaste debaste commented Nov 25, 2023

This pull request contains changes for upgrading to PHPUnit 8 automated by the PHPUnit 8 Shift.

Before merging, you need to:

  • Checkout the shift-105251 branch
  • Review all pull request comments for additional changes
  • Run composer update (if the scripts fail, add --no-scripts)
  • Run your tests suite: vendor/bin/phpunit

If there were changes you felt could have been automated, please reply to the follow-up email with your feedback or on Twitter.

Since PHP 5.4 the short array syntax `[]` may be used instead of `array()`.
From the [PHPUnit 8 release notes][1], the `TestCase` methods below now declare a `void` return type:

- `setUpBeforeClass()`
- `setUp()`
- `assertPreConditions()`
- `assertPostConditions()`
- `tearDown()`
- `tearDownAfterClass()`
- `onNotSuccessfulTest()`

[1]: https://phpunit.de/announcements/phpunit-8.html
@debaste
Copy link
Owner Author

debaste commented Nov 25, 2023

⚠️ PHPUnit 8 deprecated using assertContains and assertNotContains for strings. These assertions now only handle arrays or Traversable objects.

Shift attempted to convert these assertions where reliable, but detected additional uses you should review and, if the arguments are strings, convert them to the new string assertion methods.

  • tests/framework/base/CModelTest.php
  • tests/framework/db/schema/CDbCriteriaTest.php
  • tests/framework/utils/CMarkdownParserTest.php
  • tests/framework/validators/CBooleanValidatorTest.php
  • tests/framework/validators/CCompareValidatorTest.php
  • tests/framework/web/CClientScriptTest.php
  • tests/framework/web/helpers/CHtmlTest.php

@debaste
Copy link
Owner Author

debaste commented Nov 25, 2023

ℹ️ PHPUnit 8 now enables resolution of test dependencies by default. This was optionally introduced in PHPUnit 7.2. If necessary, you may configure this from the command line or within phpunit.xml.

@debaste
Copy link
Owner Author

debaste commented Nov 25, 2023

ℹ️ PHPUnit 8 now enables caching of test results by default. This was optionally introduced in PHPUnit 7.3. If necessary, you may configure this from the command line or within phpunit.xml.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants