8000 [PhpUnitBridge] Added support for PHPUnit 7 in Coverage Listener by lyrixx · Pull Request #26089 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[PhpUnitBridge] Added support for PHPUnit 7 in Coverage Listener #26089

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
Feb 14, 2018

Conversation

lyrixx
Copy link
Member
@lyrixx lyrixx commented Feb 8, 2018
Q A
Branch? 3.4
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets
License MIT
Doc PR

if (\PHP_VERSION_ID >= 70000) {
exec('type phpdbg', $output, $returnCode);

if (\PHP_VERSION_ID >= 70000 && 0 === $returnCode) {
Copy link
Member Author

Choose a reason for hiding this comment

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

ping @nicolas-grekas : I did not have phpdbg on my machine, so I added that (IIRC, you added this part)

Copy link
Member

Choose a reason for hiding this comment

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

would it work on windows?

Copy link
Member Author

Choose a reason for hiding this comment

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

We don't care as this test is not run on windows ;)

if (class_exists('PHPUnit_Runner_Version') && version_compare(\PHPUnit_Runner_Version::id(), '6.0.0', '<')) {
class_alias('Symfony\Bridge\PhpUnit\Legacy\CoverageListener', 'Symfony\Bridge\PhpUnit\CoverageListener');
} elseif (version_compare(\PHPUnit\Runner\Version::id(), '7.0.0', '>=')) {
require_once __DIR__.'/CoverageListenerWithReturnTypes.php';
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 don't get why I have to do that :/
Without this line, I got

PHP Warning:  Class 'Symfony\Bridge\PhpUnit\CoverageListenerWithReturnTypes' not found in /home/gregoire/dev/github.com/lyrixx/symfony/src/Symfony/Bridge/PhpUnit/CoverageListener.php on line 25

How to reproduce:

  • install phpunit 7+
  • get my branch
  • cd src/Symfony/Bridge/PhpUnit/
  • composer install
  • phpunit

Copy link
Member

Choose a reason for hiding this comment

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

Strange. Related: in #26139 I'm proposing to completely split implems in separate classes, and do only aliases here. I'd suggest to do the same here.

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, I will mimic your PR

@lyrixx lyrixx requested a review from nicolas-grekas February 8, 2018 10:44
@nicolas-grekas nicolas-grekas added this to the 3.4 milestone Feb 9, 2018
@lyrixx lyrixx force-pushed the phpunit-cover-listener-7.0 branch 2 times, most recently from bd117f7 to 8a824e6 Compare February 13, 2018 17:56
@lyrixx
Copy link
Member Author
lyrixx commented Feb 13, 2018

I updated the PR to mimic existing code.
But I still need to use the require_once.

@lyrixx lyrixx force-pushed the phpunit-cover-listener-7.0 branch from 8a824e6 to 6c0e6af Compare February 14, 2018 09:38
@lyrixx
Copy link
Member Author
lyrixx commented Feb 14, 2018

But I still need to use the require_once.

Ok, now the listener does not need anymore the require_once.

The PR is now ready

@nicolas-grekas
Copy link
Member

Thank you @lyrixx.

@nicolas-grekas nicolas-grekas merged commit 6c0e6af into symfony:3.4 Feb 14, 2018
nicolas-grekas added a commit that referenced this pull request Feb 14, 2018
…stener (lyrixx)

This PR was merged into the 3.4 branch.

Discussion
----------

[PhpUnitBridge] Added support for PHPUnit 7 in Coverage Listener

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets |
| License       | MIT
8000

| Doc PR        |

Commits
-------

6c0e6af [PhpUnitBridge] Added support for PHPUnit 7 in Coverage Listener
@lyrixx lyrixx deleted the phpunit-cover-listener-7.0 branch February 14, 2018 13:22
This was referenced Mar 1, 2018

public function startTestSuite(TestSuite $suite): void
{
$this->trait->startTest($test);
Copy link
Contributor

Choose a reason for hiding this comment

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

This is wrong, the suite variable should be used

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.

5 participants
0