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
Preliminary support for PCOV #667
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# Test Infection with PCOV and PHPUnit 8 | ||
|
||
https://github.com/infection/infection/issues/665 | ||
|
||
## Summary | ||
|
||
...the issue boils down to Infection not being aware of PCOV as a coverage driver. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{ | ||
"require-dev": { | ||
"phpunit/phpunit": "^8" | ||
}, | ||
"autoload": { | ||
"psr-4": { | ||
"PCOV_PHPUnit8\\": "src/" | ||
} | ||
}, | ||
"autoload-dev": { | ||
"psr-4": { | ||
"PCOV_PHPUnit8\\Test\\": "tests/" | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
Total: 1 | ||
Killed: 1 | ||
Errored: 0 | ||
Escaped: 0 | ||
Timed Out: 0 | ||
Not Covered: 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
{ | ||
"timeout": 25, | ||
"source": { | ||
"directories": [ | ||
"src" | ||
] | ||
}, | ||
"logs": { | ||
"summary": "infection.log" | ||
}, | ||
"tmpDir": "." | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:noNamespaceSchemaLocation="./vendor/phpunit/phpunit/phpunit.xsd" | ||
bootstrap="./vendor/autoload.php" | ||
colors="true" | ||
> | ||
<testsuites> | ||
<testsuite name="Test Suite"> | ||
<directory>./tests/</directory> | ||
</testsuite> | ||
</testsuites> | ||
|
||
<filter> | ||
<whitelist> | ||
<directory>./src/</directory> | ||
</whitelist> | ||
</filter> | ||
</phpunit> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -e | ||
|
||
tputx () { | ||
test -x $(which tput) && tput "$@" | ||
} | ||
|
||
run () { | ||
local INFECTION=${1} | ||
local PHPARGS=${2} | ||
|
||
if [ "$PHPDBG" = "1" ] | ||
then | ||
phpdbg $PHPARGS -qrr $INFECTION | ||
else | ||
php $PHPARGS $INFECTION | ||
fi | ||
} | ||
|
||
cd $(dirname "$0") | ||
|
||
if [ "$PHPDBG" = "1" ] | ||
then | ||
exit 0 | ||
fi | ||
|
||
if php -r "exit(version_compare(PHP_VERSION, '7.3.0'));" | ||
then | ||
exit 0 | ||
fi | ||
|
||
tputx bold | ||
echo "Checking for PCOV..." | ||
tputx sgr0 | ||
|
||
|
||
if ! php --ri pcov | ||
then | ||
tput setaf 1 # red | ||
echo "PCOV not detected" | ||
exit 0 | ||
fi | ||
|
||
readonly INFECTION=../../../../${1} | ||
|
||
set -e pipefail | ||
|
||
php $INFECTION | ||
|
||
diff -w expected-output.txt infection.log | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
<?php | ||
|
||
namespace PCOV_PHPUnit8; | ||
|
||
class SourceClass | ||
{ | ||
public function hello(): string | ||
{ | ||
return 'hello'; | ||
} | ||
} |
15 changes: 15 additions & 0 deletions
15
tests/Fixtures/e2e/PCOV_PHPUnit8/tests/SourceClassTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?php | ||
|
||
namespace PCOV_PHPUnit8\Test; | ||
|
||
use PCOV_PHPUnit8\SourceClass; | ||
use PHPUnit\Framework\TestCase; | ||
|
||
class SourceClassTest extends TestCase | ||
{ | ||
public function test_hello() | ||
{ | ||
$sourceClass = new SourceClass(); | ||
$this->assertSame('hello', $sourceClass->hello()); | ||
} | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
I'm not entirely sure if we need this, but this may be a good idea in sake of verbosity.