Skip to content

Make FeatureTestListener PHPUnit 6 compatible #21

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

Merged
merged 1 commit into from
May 2, 2017
Merged

Make FeatureTestListener PHPUnit 6 compatible #21

merged 1 commit into from
May 2, 2017

Conversation

sagikazarmark
Copy link
Member

Q A
Bug fix? no
New feature? yes
BC breaks? no
Deprecations? no
Related tickets partially #20
License MIT

What's in this PR?

Fixes the rest of #20

@sagikazarmark
Copy link
Member Author

Ping @xabbuh

@@ -2,13 +2,16 @@

namespace Http\Client\Tests;

class FeatureTestListener extends \PHPUnit_TextUI_ResultPrinter
use PHPUnit\Framework\TestCase;
use PHPUnit\TextUI\ResultPrinter;
Copy link
Member

Choose a reason for hiding this comment

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

This class was not present in PHPUnit 4.x and 5.x, was it?

Copy link
Member Author

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

Yeah, but its name was \PHPUnit_TextUI_ResultPrinter back then. I think we could register a class alias in case the namespaced class does not exist (the class body doesn't seem to be different).

Copy link
Member Author

Choose a reason for hiding this comment

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

I'm a little bit confused: I followed the same naming pattern as you did. I guess there is a legacy layer which resolves the new class names to the old ones in case the new one does not exist. You raised the minimum version of PHPUnit in the previous PR to 4.8.35 (for which version the tests are passing).

So I am not sure I understand what the problem is. 😞

Copy link
Member

Choose a reason for hiding this comment

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

The classes that are part of the forward compatibility layer are explicitly listed here: https://github.com/sebastianbergmann/phpunit/tree/4.8/src/ForwardCompatibility Thus, for every other class we will have to use class aliases.

Copy link
Member Author

Choose a reason for hiding this comment

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

Okay, got it. I think this would better fit into a bootstrap file which is always autoloaded by composer. What do you think? Or just place it here? Should do some checks, if the alias already exists?

{
public function write($buffer)
{
}

public function startTest(\PHPUnit_Framework_Test $test)
public function startTest(TestCase $test)
Copy link
Member

Choose a reason for hiding this comment

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

TestCase is one implementation of Test. Thus this change will violate Liskov's substitution principle.

Copy link
Member Author

Choose a reason for hiding this comment

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

Ah, didn't spot it was Test, not TestCase

@Nyholm
Copy link
Member

Nyholm commented May 2, 2017

Will the FeatureTestListener be compatible with PHPUnit 5 after this PR get merged?

@sagikazarmark
Copy link
Member Author

AFAIK yes, but only with a certain version (where the compatibility layer is added).

@Nyholm
Copy link
Member

Nyholm commented May 2, 2017

Okey. Good

@Nyholm Nyholm merged commit 18c0cfd into master May 2, 2017
@Nyholm Nyholm deleted the phpunit6 branch May 2, 2017 09:28
@sagikazarmark
Copy link
Member Author

Wait a sec, I missed this comment:

#21 (comment)

@sagikazarmark
Copy link
Member Author

We need to add some class aliases

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.

3 participants