Commit 2171fe16 authored by webchick's avatar webchick

Issue #2400407 by klausi: Update PHPUnit to latest version.

parent ca850b84
......@@ -24,7 +24,7 @@
"guzzlehttp/guzzle": "dev-master#1879fbe853b0c64d109e369c7aeff09849e62d1e",
"symfony-cmf/routing": "1.3.*",
"easyrdf/easyrdf": "0.9.*",
"phpunit/phpunit": "4.6.*",
"phpunit/phpunit": "4.8.*",
"zendframework/zend-feed": "2.4.*",
"mikey179/vfsStream": "~1.2",
"stack/builder": "1.0.*",
......
......@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
"This file is @generated automatically"
],
"hash": "775f6be68f3d5efa8872e99cdf0e2f83",
"hash": "98540c017d14f1cad9f0b1bc722600ad",
"packages": [
{
"name": "behat/mink",
......@@ -1177,16 +1177,16 @@
},
{
"name": "phpunit/php-code-coverage",
"version": "2.0.16",
"version": "2.2.2",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-code-coverage.git",
"reference": "934fd03eb6840508231a7f73eb8940cf32c3b66c"
"reference": "2d7c03c0e4e080901b8f33b2897b0577be18a13c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/934fd03eb6840508231a7f73eb8940cf32c3b66c",
"reference": "934fd03eb6840508231a7f73eb8940cf32c3b66c",
"url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/2d7c03c0e4e080901b8f33b2897b0577be18a13c",
"reference": "2d7c03c0e4e080901b8f33b2897b0577be18a13c",
"shasum": ""
},
"require": {
......@@ -1194,7 +1194,7 @@
"phpunit/php-file-iterator": "~1.3",
"phpunit/php-text-template": "~1.2",
"phpunit/php-token-stream": "~1.3",
"sebastian/environment": "~1.0",
"sebastian/environment": "^1.3.2",
"sebastian/version": "~1.0"
},
"require-dev": {
......@@ -1209,7 +1209,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "2.0.x-dev"
"dev-master": "2.2.x-dev"
}
},
"autoload": {
......@@ -1235,7 +1235,7 @@
"testing",
"xunit"
],
"time": "2015-04-11 04:35:00"
"time": "2015-08-04 03:42:39"
},
{
"name": "phpunit/php-file-iterator",
......@@ -1330,16 +1330,16 @@
},
{
"name": "phpunit/php-timer",
"version": "1.0.5",
"version": "1.0.7",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/php-timer.git",
"reference": "19689d4354b295ee3d8c54b4f42c3efb69cbc17c"
"reference": "3e82f4e9fc92665fafd9157568e4dcb01d014e5b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/19689d4354b295ee3d8c54b4f42c3efb69cbc17c",
"reference": "19689d4354b295ee3d8c54b4f42c3efb69cbc17c",
"url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/3e82f4e9fc92665fafd9157568e4dcb01d014e5b",
"reference": "3e82f4e9fc92665fafd9157568e4dcb01d014e5b",
"shasum": ""
},
"require": {
......@@ -1348,13 +1348,10 @@
"type": "library",
"autoload": {
"classmap": [
"PHP/"
"src/"
]
},
"notification-url": "https://packagist.org/downloads/",
"include-path": [
""
],
"license": [
"BSD-3-Clause"
],
......@@ -1370,7 +1367,7 @@
"keywords": [
"timer"
],
"time": "2013-08-02 07:42:54"
"time": "2015-06-21 08:01:12"
},
{
"name": "phpunit/php-token-stream",
......@@ -1423,16 +1420,16 @@
},
{
"name": "phpunit/phpunit",
"version": "4.6.4",
"version": "4.8.6",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/phpunit.git",
"reference": "163232991e652e6efed2f8470326fffa61e848e2"
"reference": "2246830f4a1a551c67933e4171bf2126dc29d357"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/163232991e652e6efed2f8470326fffa61e848e2",
"reference": "163232991e652e6efed2f8470326fffa61e848e2",
"url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/2246830f4a1a551c67933e4171bf2126dc29d357",
"reference": "2246830f4a1a551c67933e4171bf2126dc29d357",
"shasum": ""
},
"require": {
......@@ -1442,15 +1439,15 @@
"ext-reflection": "*",
"ext-spl": "*",
"php": ">=5.3.3",
"phpspec/prophecy": "~1.3,>=1.3.1",
"phpunit/php-code-coverage": "~2.0,>=2.0.11",
"phpspec/prophecy": "^1.3.1",
"phpunit/php-code-coverage": "~2.1",
"phpunit/php-file-iterator": "~1.4",
"phpunit/php-text-template": "~1.2",
"phpunit/php-timer": "~1.0",
"phpunit/php-timer": ">=1.0.6",
"phpunit/phpunit-mock-objects": "~2.3",
"sebastian/comparator": "~1.1",
"sebastian/diff": "~1.2",
"sebastian/environment": "~1.2",
"sebastian/environment": "~1.3",
"sebastian/exporter": "~1.2",
"sebastian/global-state": "~1.0",
"sebastian/version": "~1.0",
......@@ -1465,7 +1462,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "4.6.x-dev"
"dev-master": "4.8.x-dev"
}
},
"autoload": {
......@@ -1491,7 +1488,7 @@
"testing",
"xunit"
],
"time": "2015-04-11 05:23:21"
"time": "2015-08-24 04:09:38"
},
{
"name": "phpunit/phpunit-mock-objects",
......@@ -1753,16 +1750,16 @@
},
{
"name": "sebastian/environment",
"version": "1.2.2",
"version": "1.3.2",
"source": {
"type": "git",
"url": "https://github.com/sebastianbergmann/environment.git",
"reference": "5a8c7d31914337b69923db26c4221b81ff5a196e"
"reference": "6324c907ce7a52478eeeaede764f48733ef5ae44"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/5a8c7d31914337b69923db26c4221b81ff5a196e",
"reference": "5a8c7d31914337b69923db26c4221b81ff5a196e",
"url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/6324c907ce7a52478eeeaede764f48733ef5ae44",
"reference": "6324c907ce7a52478eeeaede764f48733ef5ae44",
"shasum": ""
},
"require": {
......@@ -1799,7 +1796,7 @@
"environment",
"hhvm"
],
"time": "2015-01-01 10:01:08"
"time": "2015-08-03 06:14:51"
},
{
"name": "sebastian/exporter",
......
......@@ -181,6 +181,7 @@
'PHP_CodeCoverage' => $vendorDir . '/phpunit/php-code-coverage/src/CodeCoverage.php',
'PHP_CodeCoverage_Driver' => $vendorDir . '/phpunit/php-code-coverage/src/CodeCoverage/Driver.php',
'PHP_CodeCoverage_Driver_HHVM' => $vendorDir . '/phpunit/php-code-coverage/src/CodeCoverage/Driver/HHVM.php',
'PHP_CodeCoverage_Driver_PHPDBG' => $vendorDir . '/phpunit/php-code-coverage/src/CodeCoverage/Driver/PHPDBG.php',
'PHP_CodeCoverage_Driver_Xdebug' => $vendorDir . '/phpunit/php-code-coverage/src/CodeCoverage/Driver/Xdebug.php',
'PHP_CodeCoverage_Exception' => $vendorDir . '/phpunit/php-code-coverage/src/CodeCoverage/Exception.php',
'PHP_CodeCoverage_Exception_UnintentionallyCoveredCode' => $vendorDir . '/phpunit/php-code-coverage/src/CodeCoverage/Exception/UnintentionallyCoveredCode.php',
......@@ -212,7 +213,7 @@
'PHP_CodeCoverage_Report_XML_Totals' => $vendorDir . '/phpunit/php-code-coverage/src/CodeCoverage/Report/XML/Totals.php',
'PHP_CodeCoverage_Util' => $vendorDir . '/phpunit/php-code-coverage/src/CodeCoverage/Util.php',
'PHP_CodeCoverage_Util_InvalidArgumentHelper' => $vendorDir . '/phpunit/php-code-coverage/src/CodeCoverage/Util/InvalidArgumentHelper.php',
'PHP_Timer' => $vendorDir . '/phpunit/php-timer/PHP/Timer.php',
'PHP_Timer' => $vendorDir . '/phpunit/php-timer/src/Timer.php',
'PHP_Token' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_TokenWithScope' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
'PHP_TokenWithScopeAndVisibility' => $vendorDir . '/phpunit/php-token-stream/src/Token.php',
......
......@@ -7,5 +7,4 @@
return array(
$vendorDir . '/phpunit/php-text-template',
$vendorDir . '/phpunit/php-timer',
);
This diff is collapsed.
......@@ -8,7 +8,7 @@ php:
- 5.6
before_script:
- COMPOSER_ROOT_VERSION=dev-master composer install --dev --prefer-source
- COMPOSER_ROOT_VERSION=dev-master composer install --prefer-source
script: vendor/bin/phpunit --configuration ./build/travis-ci.xml
......
# Changes in PHP_CodeCoverage 2.2
All notable changes of the PHP_CodeCoverage 2.2 release series are documented in this file using the [Keep a CHANGELOG](http://keepachangelog.com/) principles.
## [2.2.2] - 2015-08-04
### Added
* Reintroduced the `PHP_CodeCoverage_Driver_HHVM` driver as an extension of `PHP_CodeCoverage_Driver_Xdebug` that does not use `xdebug_start_code_coverage()` with options not supported by HHVM
### Changed
* Bumped required version of `sebastian/environment` to 1.3.2 for [#365](https://github.com/sebastianbergmann/php-code-coverage/issues/365)
## [2.2.1] - 2015-08-02
### Changed
* Bumped required version of `sebastian/environment` to 1.3.1 for [#365](https://github.com/sebastianbergmann/php-code-coverage/issues/365)
## [2.2.0] - 2015-08-01
### Added
* Added a driver for PHPDBG (requires PHP 7)
* Added `PHP_CodeCoverage::setDisableIgnoredLines()` to disable the ignoring of lines using annotations such as `@codeCoverageIgnore`
### Changed
* Annotating a method with `@deprecated` now has the same effect as annotating it with `@codeCoverageIgnore`
### Removed
* The dedicated driver for HHVM, `PHP_CodeCoverage_Driver_HHVM` has been removed
[2.2.2]: https://github.com/sebastianbergmann/php-code-coverage/compare/2.2.1...2.2.2
[2.2.1]: https://github.com/sebastianbergmann/php-code-coverage/compare/2.2.0...2.2.1
[2.2.0]: https://github.com/sebastianbergmann/php-code-coverage/compare/2.1...2.2.0
......@@ -25,7 +25,7 @@
"phpunit/php-file-iterator": "~1.3",
"phpunit/php-token-stream": "~1.3",
"phpunit/php-text-template": "~1.2",
"sebastian/environment": "~1.0",
"sebastian/environment": "^1.3.2",
"sebastian/version": "~1.0"
},
"require-dev": {
......@@ -44,7 +44,7 @@
},
"extra": {
"branch-alias": {
"dev-master": "2.0.x-dev"
"dev-master": "2.2.x-dev"
}
}
}
......@@ -11,16 +11,28 @@
/**
* Interface for code coverage drivers.
*
* @category PHP
* @package CodeCoverage
* @author Sebastian Bergmann <sebastian@phpunit.de>
* @copyright 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
* @since Class available since Release 1.0.0
* @since Class available since Release 1.0.0
*/
interface PHP_CodeCoverage_Driver
{
/**
* @var int
* @see http://xdebug.org/docs/code_coverage
*/
const LINE_EXECUTED = 1;
/**
* @var int
* @see http://xdebug.org/docs/code_coverage
*/
const LINE_NOT_EXECUTED = -1;
/**
* @var int
* @see http://xdebug.org/docs/code_coverage
*/
const LINE_NOT_EXECUTABLE = -2;
/**
* Start collection of code coverage information.
*/
......
......@@ -11,46 +11,16 @@
/**
* Driver for HHVM's code coverage functionality.
*
* @category PHP
* @package CodeCoverage
* @author Sebastian Bergmann <sebastian@phpunit.de>
* @copyright 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
* @since Class available since Release 1.3.0
* @since Class available since Release 2.2.2
* @codeCoverageIgnore
*/
class PHP_CodeCoverage_Driver_HHVM implements PHP_CodeCoverage_Driver
class PHP_CodeCoverage_Driver_HHVM extends PHP_CodeCoverage_Driver_Xdebug
{
/**
* Constructor.
*/
public function __construct()
{
if (!defined('HHVM_VERSION')) {
throw new PHP_CodeCoverage_Exception('This driver requires HHVM');
}
}
/**
* Start collection of code coverage information.
*/
public function start()
{
fb_enable_code_coverage();
}
/**
* Stop collection of code coverage information.
*
* @return array
*/
public function stop()
{
$codeCoverage = fb_get_code_coverage(true);
fb_disable_code_coverage();
return $codeCoverage;
xdebug_start_code_coverage();
}
}
<?php
/*
* This file is part of the PHP_CodeCoverage package.
*
* (c) Sebastian Bergmann <sebastian@phpunit.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
/**
* Driver for PHPDBG's code coverage functionality.
*
* @since Class available since Release 2.2.0
* @codeCoverageIgnore
*/
class PHP_CodeCoverage_Driver_PHPDBG implements PHP_CodeCoverage_Driver
{
/**
* Constructor.
*/
public function __construct()
{
if (PHP_SAPI !== 'phpdbg') {
throw new PHP_CodeCoverage_Exception(
'This driver requires the PHPDBG SAPI'
);
}
if (!function_exists('phpdbg_start_oplog')) {
throw new PHP_CodeCoverage_Exception(
'This build of PHPDBG does not support code coverage'
);
}
}
/**
* Start collection of code coverage information.
*/
public function start()
{
phpdbg_start_oplog();
}
/**
* Stop collection of code coverage information.
*
* @return array
*/
public function stop()
{
static $fetchedLines = array();
$dbgData = phpdbg_end_oplog();
if ($fetchedLines == array()) {
$sourceLines = phpdbg_get_executable();
} else {
$newFiles = array_diff(
get_included_files(),
array_keys($fetchedLines)
);
if ($newFiles) {
$sourceLines = phpdbg_get_executable(
array('files' => $newFiles)
);
} else {
$sourceLines = array();
}
}
foreach ($sourceLines as $file => $lines) {
foreach ($lines as $lineNo => $numExecuted) {
$sourceLines[$file][$lineNo] = self::LINE_NOT_EXECUTED;
}
}
$fetchedLines = array_merge($fetchedLines, $sourceLines);
return $this->detectExecutedLines($fetchedLines, $dbgData);
}
/**
* Convert phpdbg based data into the format CodeCoverage expects
*
* @param array $sourceLines
* @param array $dbgData
* @return array
*/
private function detectExecutedLines(array $sourceLines, array $dbgData)
{
foreach ($dbgData as $file => $coveredLines) {
foreach ($coveredLines as $lineNo => $numExecuted) {
// phpdbg also reports $lineNo=0 when e.g. exceptions get thrown.
// make sure we only mark lines executed which are actually executable.
if (isset($sourceLines[$file][$lineNo])) {
$sourceLines[$file][$lineNo] = self::LINE_EXECUTED;
}
}
}
return $sourceLines;
}
}
......@@ -11,13 +11,7 @@
/**
* Driver for Xdebug's code coverage functionality.
*
* @category PHP
* @package CodeCoverage
* @author Sebastian Bergmann <sebastian@phpunit.de>
* @copyright 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
* @since Class available since Release 1.0.0
* @since Class available since Release 1.0.0
* @codeCoverageIgnore
*/
class PHP_CodeCoverage_Driver_Xdebug implements PHP_CodeCoverage_Driver
......@@ -68,11 +62,9 @@ public function stop()
private function cleanup(array $data)
{
foreach (array_keys($data) as $file) {
if (isset($data[$file][0])) {
unset($data[$file][0]);
}
unset($data[$file][0]);
if (file_exists($file)) {
if ($file != 'xdebug://debug-eval' && file_exists($file)) {
$numLines = $this->getNumberOfLinesInFile($file);
foreach (array_keys($data[$file]) as $line) {
......@@ -88,7 +80,7 @@ private function cleanup(array $data)
/**
* @param string $file
* @return integer
* @return int
* @since Method available since Release 2.0.0
*/
private function getNumberOfLinesInFile($file)
......
......@@ -11,13 +11,7 @@
/**
* Exception class for PHP_CodeCoverage component.
*
* @category PHP
* @package CodeCoverage
* @author Sebastian Bergmann <sebastian@phpunit.de>
* @copyright 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
* @since Class available since Release 1.1.0
* @since Class available since Release 1.1.0
*/
class PHP_CodeCoverage_Exception extends RuntimeException
{
......
......@@ -11,13 +11,7 @@
/**
* Exception that is raised when code is unintentionally covered.
*