-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Symfony package. | ||
* | ||
* (c) Fabien Potencier <fabien@symfony.com> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Symfony\Bridge\PhpUnit\Legacy; | ||
|
||
use PHPUnit\Framework\BaseTestListener; | ||
use PHPUnit\Framework\Test; | ||
|
||
/** | ||
* CoverageListener adds `@covers <className>` on each test suite when possible | ||
* to make the code coverage more accurate. | ||
* | ||
* @author Grégoire Pineau <lyrixx@lyrixx.info> | ||
* | ||
* @internal | ||
*/ | ||
class CoverageListenerForV6 extends BaseTestListener | ||
{ | ||
private $trait; | ||
|
||
public function __construct(callable $sutFqcnResolver = null, $warningOnSutNotFound = false) | ||
{ | ||
$this->trait = new CoverageListenerTrait($sutFqcnResolver, $warningOnSutNotFound); | ||
} | ||
|
||
public function startTest(Test $test) | ||
{ | ||
$this->trait->startTest($test); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the Symfony package. | ||
* | ||
* (c) Fabien Potencier <fabien@symfony.com> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Symfony\Bridge\PhpUnit\Legacy; | ||
|
||
use PHPUnit\Framework\TestListener; | ||
use PHPUnit\Framework\TestListenerDefaultImplementation; | ||
use PHPUnit\Framework\TestSuite; | ||
|
||
/** | ||
* CoverageListener adds `@covers <className>` on each test suite when possible | ||
* to make the code coverage more accurate. | ||
* | ||
* @author Grégoire Pineau <lyrixx@lyrixx.info> | ||
* | ||
* @internal | ||
*/ | ||
class CoverageListenerForV7 implements TestListener | ||
{ | ||
use TestListenerDefaultImplementation; | ||
|
||
private $trait; | ||
|
||
public function __construct(callable $sutFqcnResolver = null, $warningOnSutNotFound = false) | ||
{ | ||
$this->trait = new CoverageListenerTrait($sutFqcnResolver, $warningOnSutNotFound); | ||
} | ||
|
||
public function startTestSuite(TestSuite $suite): void | ||
{ | ||
$this->trait->startTest($test); | ||
} | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,7 +16,9 @@ public function test() | |
$this->markTestSkipped('This test cannot be run on HHVM.'); | ||
} | ||
|
||
if (\PHP_VERSION_ID >= 70000) { | ||
exec('type phpdbg', $output, $returnCode); | ||
|
||
if (\PHP_VERSION_ID >= 70000 && 0 === $returnCode) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. would it work on windows? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We don't care as this test is not run on windows ;) |
||
$php = 'phpdbg -qrr'; | ||
} else { | ||
exec('php --ri xdebug -d zend_extension=xdebug.so 2> /dev/null', $output, $returnCode); | ||
|
There was a problem hiding this comment.
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