Skip to content

chore: phpunit 10 support#3242

Merged
stobrien89 merged 29 commits intoaws:masterfrom
yenfryherrerafeliz:chore_php_unit_10
Mar 11, 2026
Merged

chore: phpunit 10 support#3242
stobrien89 merged 29 commits intoaws:masterfrom
yenfryherrerafeliz:chore_php_unit_10

Conversation

@yenfryherrerafeliz
Copy link
Copy Markdown
Contributor

@yenfryherrerafeliz yenfryherrerafeliz commented Jan 27, 2026

Description of changes:

  • Make data provider static functions
  • Use class attributes instead of annotations for @dataProvider, @Covers, and @doesNotPerformAssertions.
  • Remove/Replace the usage of expectDeprecation, expectDeprecationMessage, expectDeprecationMessageMatches, expectError, expectErrorMessage, expectNotice, expectNoticeMessage, expectWarning, and expectWarningMessage.
  • Migrate phpunit xml config file.
  • Add XDEBUG_MODE set to coverage in the Make file definition step for running tests.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Instead of using expectDeprecation now we use expectException but we do use the set_error_handler
to throw that expected exceptions when expecting warnings or user notices.
Enhance data providers within test cases to avoid the usage of instance members since they become now static functions.
- expectWarning, expectError, expectError, etc. were removed in PHPUnit 10, and a workaround was used in order to replace the usage of those APIs.
The replacement is to use set_error_handler to catch the alert, throw a RuntimeException, and then expect this thrown exception.
- Remove constructor override for TestCase extension.
- Remove CoverClass from methods.
@yenfryherrerafeliz yenfryherrerafeliz marked this pull request as ready for review January 30, 2026 21:25
Copy link
Copy Markdown
Member

@stobrien89 stobrien89 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good for the most part, mostly minor things that are easy to miss in such a large PR

Comment thread tests/Credentials/EcsCredentialProviderTest.php Outdated
Comment thread tests/Api/Serializer/RestJsonSerializerTest.php Outdated
Comment thread tests/Api/Serializer/ComplianceTest.php Outdated
Comment thread tests/Api/ShapeTest.php
Comment thread tests/Credentials/InstanceProfileProviderTest.php
Comment thread tests/S3/S3EndpointMiddlewareTest.php Outdated
Comment thread tests/S3/S3ClientTest.php
Comment thread tests/S3/StreamWrapperTest.php Outdated
Comment thread tests/Script/ComposerTest.php
Comment thread tests/S3/TransferTest.php
Comment thread Makefile
- Add the attribute DoesNotPerformAssertions instead of CoversNothing
- Remove assertTrue from tests that do not perform assertions
- Make one leftover data provider function static
- Fixed retry logic in ComposerTest so it properly test retries scenarios after removing onConsecutiveCalls usage.
We already have a dedicated workflow for coverage and hence we dont need this on our tests run workflow. Also, this will slowdown the test run process.
Copy link
Copy Markdown
Member

@stobrien89 stobrien89 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Just needs a rebase for the merge conflicts

Copy link
Copy Markdown
Member

@stobrien89 stobrien89 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the work on this @yenfryherrerafeliz!

@yenfryherrerafeliz
Copy link
Copy Markdown
Contributor Author

vendor/bin/behat --format=progress --tags=integ
...................................................................... 70
...................................................................... 140
...................................................................... 210
...................................................................... 280
...................................................................... 350
...................................................................... 420
...............

127 scenarios (127 passed)
435 steps (435 passed)
21m41.50s (350.49Mb)
vendor/bin/behat --format=progress --suite=smoke --tags='~@noassumerole'
...................................................................... 70
...................................................................... 140
...................................................................... 210
............

111 scenarios (111 passed)
222 steps (222 passed)
0m36.88s (96.23Mb)

Update integ tests to avoid extending TestCase and use Assert:: instead.
@stobrien89 stobrien89 merged commit 1510f83 into aws:master Mar 11, 2026
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants