Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions PHP/CodeCoverage.php
Original file line number Diff line number Diff line change
Expand Up @@ -794,4 +794,14 @@ protected function getLinesToBeIgnored($filename)

return $this->ignoredLines[$filename];
}

public function setData(array $data)
{
$this->data = $data;
}

public function setTests(array $tests)
{
$this->tests = $tests;
}
}
20 changes: 20 additions & 0 deletions PHP/CodeCoverage/Filter.php
Original file line number Diff line number Diff line change
Expand Up @@ -347,4 +347,24 @@ protected function addDirectoryContainingClassToBlacklist($className, $parent =

$this->addDirectoryToBlacklist($directory);
}

public function getBlacklistedFiles()
{
return $this->blacklistedFiles;
}

public function setBlacklistedFiles($blacklistedFiles)
{
$this->blacklistedFiles = $blacklistedFiles;
}

public function getWhitelistedFiles()
{
return $this->whitelistedFiles;
}

public function setWhitelistedFiles($whitelistedFiles)
{
$this->whitelistedFiles = $whitelistedFiles;
}
}
15 changes: 10 additions & 5 deletions PHP/CodeCoverage/Report/PHP.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,11 @@
*/

/**
* Uses serialize() to write a PHP_CodeCoverage object to a file.
* Uses var_export() to write a PHP_CodeCoverage object to a file.
*
* @category PHP
* @package CodeCoverage
* @author Sebastian Bergmann <sebastian@phpunit.de>
* @author uyga <iamuyga@gmail.com>
* @copyright 2009-2013 Sebastian Bergmann <sebastian@phpunit.de>
* @license http://www.opensource.org/licenses/BSD-3-Clause The BSD 3-Clause License
* @link http://github.com/sebastianbergmann/php-code-coverage
Expand All @@ -63,12 +63,17 @@ class PHP_CodeCoverage_Report_PHP
*/
public function process(PHP_CodeCoverage $coverage, $target = NULL)
{
$coverage = serialize($coverage);
$output = '<?php $filter = new PHP_CodeCoverage_Filter();'
. '$filter->setBlacklistedFiles(' . var_export($coverage->filter()->getBlacklistedFiles(), 1) . ');'
. '$filter->setWhitelistedFiles(' . var_export($coverage->filter()->getWhitelistedFiles(), 1) . ');'
. '$object = new PHP_CodeCoverage(new PHP_CodeCoverage_Driver_Xdebug(), $filter); $object->setData('
. var_export($coverage->getData(), 1) . '); $object->setTests('
. var_export($coverage->getTests(), 1) . '); return $object;';

if ($target !== NULL) {
return file_put_contents($target, $coverage);
return file_put_contents($target, $output);
} else {
return $coverage;
return $output;
}
}
}
1 change: 1 addition & 0 deletions Tests/_files/CoverageClassExtendedTest.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
include_once('CoveredClass.php');
class CoverageClassExtendedTest extends PHPUnit_Framework_TestCase
{
/**
Expand Down
1 change: 1 addition & 0 deletions Tests/_files/CoverageFunctionParenthesesTest.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
include_once('CoveredFunction.php');
class CoverageFunctionParenthesesTest extends PHPUnit_Framework_TestCase
{
/**
Expand Down
1 change: 1 addition & 0 deletions Tests/_files/NamespaceCoverageClassExtendedTest.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php
include_once('NamespaceCoveredClass.php');
class NamespaceCoverageClassExtendedTest extends PHPUnit_Framework_TestCase
{
/**
Expand Down