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

Support PHPUnit 10 #47

Merged
merged 1 commit into from Oct 21, 2023
Merged

Conversation

codemasher
Copy link
Contributor

@codemasher codemasher commented Feb 12, 2023

This PR adds support for PHPUnit 10. From now on, data providers have to be static methods, which may or may not affect older PHPUnit versions.

Edit: there, saved you some work: codemasher@9b5da09

@LordSimal
Copy link

Would love to see this reviewed and maybe merged/released 😁

Copy link
Collaborator

@shadowhand shadowhand left a comment

Choose a reason for hiding this comment

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

Let's narrow this, and please squash your commits into one.

@@ -18,7 +18,7 @@
"require": {
"php": "^7.1 || ^8.0",
"psr/http-factory": "^1.0",
"phpunit/phpunit": "^6.5 || ^7.0 || ^8.0 || ^9.0"
"phpunit/phpunit": "^6.5 || ^7.0 || ^8.0 || ^9.0 || ^10.0"
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think we can change this to ^9.6 || ^10.0 since 9.6.x is the last series that supports PHP 7.3 (and up).

Choose a reason for hiding this comment

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

We can't do that without dropping PHP 7.1 and 7.2 support. Guzzle still needs PHP 7.2 support, and other packages in the php-http namespace need 7.1 and 7.2.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Oh. That's disappointing.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The branch I linked in the OP is a cleanup that supports PHP 7.4+ - you can take it and do whatever you want with it. Alternatively, you can have the PHP 8.1+ version that I've included in my library's tests for the time being because this package breaks CI in its current form.

Copy link
Contributor

Choose a reason for hiding this comment

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

We can't do that without dropping PHP 7.1 and 7.2 support.

Can't those using older PHP versions continue using older release of this package?

@codemasher
Copy link
Contributor Author

Choose your fighter:

@ADmad
Copy link
Contributor

ADmad commented Apr 10, 2023

Ping

@@ -38,7 +38,7 @@ protected function assertRequest($request, $method, $uri)
$this->assertSame($uri, (string) $request->getUri());
}

public function dataMethods()
public static function dataMethods()
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why are these made static? Is that a PHPUnit 10.x thing?

Copy link
Contributor

Choose a reason for hiding this comment

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

Is that a PHPUnit 10.x thing?

Yes

Choose a reason for hiding this comment

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

Dataproviders need to be static in PHPUnit 10

{
$data = [];

foreach ($this->dataMethods() as $methodData) {
foreach (self::dataMethods() as $methodData) {

Choose a reason for hiding this comment

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

This should be static:: to mimic the old behaviour of being able to override dataMethods in the parent.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Good catch!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

fixed!

@shadowhand
Copy link
Collaborator

I'm not sure what to do here. PHP < 8.0 is officially EOL, so I don't know why we should be supported those versions, especially PHP < 7.4.

Seems like we should probably tag the current HEAD and then create a new major version for PHPUnit 10 and supported PHP versions.

@LordSimal
Copy link

Seems like we should probably tag the current HEAD and then create a new major version for PHPUnit 10 and supported PHP versions.

Yes please!

@shadowhand shadowhand changed the base branch from master to 2.x October 21, 2023 22:42
@shadowhand shadowhand merged commit ca50c72 into http-interop:2.x Oct 21, 2023
@shadowhand
Copy link
Collaborator

Version 2.0.0 has been released with this change, with the modification of also requiring only PHPUnit 10.x and PHP 8.x.

@codemasher
Copy link
Contributor Author

In that case you should update/use the cleaned up PHP 8.1+ branch i made which uses attributes to call the data providers instead of doc blocks (which is deprecated iirc). codemasher@a05443b

@shadowhand
Copy link
Collaborator

New PRs welcomed

codemasher added a commit to codemasher/http-factory-tests that referenced this pull request Oct 22, 2023
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.

None yet

5 participants