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

Forward compatibility with PHPUnit 5 and PHPUnit 6 #86

Merged
merged 1 commit into from
Nov 23, 2017
Merged

Forward compatibility with PHPUnit 5 and PHPUnit 6 #86

merged 1 commit into from
Nov 23, 2017

Conversation

carusogabriel
Copy link
Contributor

I've added PHPUnit 5 support. Also, prepare for PHPUnit 6. I did not support version 6 already because getMock method was removed from it, but createMock isn't available in version 4. So we will need to decide:

Migrate to PHPUnit 6, drop version 4 support, as well PHP 5.6 will become the minimum requirement or stay as we are, or stay where we are.

@clue
Copy link
Owner

clue commented Nov 13, 2017

Thank you for this PR! 👍

The getMock($class) method can be replaced with getMockBuilder($class)->getMock(), so this should allow us to support all relevant PHPUnit versions across all supported PHP versions 👍 Can you look into this?

@clue clue added this to the v2.2.1 milestone Nov 13, 2017
@carusogabriel
Copy link
Contributor Author

@clue Sure. I'll change this calls and amend this PR ASAP.

@@ -106,28 +112,28 @@ public function provideRequestProtocolVersion()
*/
public function testRequestProtocolVersion(Request $Request, $method, $uri, $headers, $protocolVersion)
{
$http = $this->getMock(
$http = $this->getMockBuilder(
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@clue What should we do here? createPartialMock does not work for PHPUnit 4.

Copy link
Owner

Choose a reason for hiding this comment

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

Not sure I follow, can you elaborate what the issue is? The getMock() method does in fact work just fine with PHPUnit 4 or am I missing something?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If I substitute getMock() to getMockBuilder()->getMock() for PHPUnit 5 and 6 compatibility, is didn't work. But, there's this createParticalMock() that solves this issue, buts it doesn't existis in PHPUnit 4

Copy link
Owner

Choose a reason for hiding this comment

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

Interesting! How about adding a check à la if(phpunit 4) { dothis(); } else { dothat(); } here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@clue I'll find a better way, or, we'll need to decide what versions to support.

@carusogabriel
Copy link
Contributor Author

@clue Done, I've found every method support in all versions.

@clue clue changed the title Support PHPUnit 5 and prepare for version 6 Forward compatibility with PHPUnit 5 and PHPUnit 6 Nov 23, 2017
Copy link
Owner

@clue clue 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 keeping up with this, changes LGTM! :shipit: 👍

@clue clue merged commit c6adece into clue:master Nov 23, 2017
@carusogabriel carusogabriel deleted the phpunit branch November 23, 2017 12:08
@clue clue modified the milestones: v2.2.1, v2.3.0 Feb 9, 2018
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.

2 participants