laravel-6 support

This commit is contained in:
RafficMohammed
2023-01-08 01:17:22 +05:30
parent 1a5c16ae4b
commit 774eed8b0e
4962 changed files with 279380 additions and 297961 deletions

View File

@@ -1 +1,3 @@
/tools export-ignore
*.php diff=php

View File

@@ -0,0 +1 @@
github: sebastianbergmann

View File

@@ -1,44 +0,0 @@
# Configuration for probot-stale - https://github.com/probot/stale
# Number of days of inactivity before an Issue or Pull Request becomes stale
daysUntilStale: 60
# Number of days of inactivity before a stale Issue or Pull Request is closed.
# Set to false to disable. If disabled, issues still need to be closed manually, but will remain marked as stale.
daysUntilClose: 7
# Issues or Pull Requests with these labels will never be considered stale. Set to `[]` to disable
exemptLabels:
- breaking-change
- enhancement
- discussion
- cleanup
- refactoring
# Set to true to ignore issues in a project (defaults to false)
exemptProjects: false
# Set to true to ignore issues in a milestone (defaults to false)
exemptMilestones: false
# Label to use when marking as stale
staleLabel: stale
# Comment to post when marking as stale. Set to `false` to disable
markComment: >
This issue has been automatically marked as stale because it has not had activity within the last 60 days. It will be closed after 7 days if no further activity occurs. Thank you for your contributions.
# Comment to post when removing the stale label.
# unmarkComment: >
# Your comment here.
# Comment to post when closing a stale Issue or Pull Request.
closeComment: >
This issue has been automatically closed because it has not had activity since it was marked as stale. Thank you for your contributions.
# Limit the number of actions per hour, from 1-30. Default is 30
limitPerRun: 30
# Limit to only `issues` or `pulls`
only: issues

View File

@@ -4,4 +4,4 @@
/.idea
/.php_cs
/.php_cs.cache
/.phpunit.result.cache

View File

@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
$header = <<<'EOF'
This file is part of the php-code-coverage package.
@@ -51,6 +51,7 @@ return PhpCsFixer\Config::create()
'compact_nullable_typehint' => true,
'concat_space' => ['spacing' => 'one'],
'declare_equal_normalize' => ['space' => 'none'],
'declare_strict_types' => true,
'dir_constant' => true,
'elseif' => true,
'encoding' => true,
@@ -156,7 +157,7 @@ return PhpCsFixer\Config::create()
'phpdoc_to_comment' => true,
'phpdoc_trim' => true,
'phpdoc_trim_consecutive_blank_line_separation' => true,
'phpdoc_types' => true,
'phpdoc_types' => ['groups' => ['simple', 'meta']],
'phpdoc_types_order' => true,
'phpdoc_var_without_name' => true,
'pow_to_exponentiation' => true,
@@ -177,7 +178,13 @@ return PhpCsFixer\Config::create()
'trailing_comma_in_multiline_array' => true,
'trim_array_spaces' => true,
'unary_operator_spaces' => true,
'visibility_required' => true,
'visibility_required' => [
'elements' => [
'const',
'method',
'property',
],
],
'void_return' => true,
'whitespace_after_comma_in_array' => true,
]
@@ -186,4 +193,5 @@ return PhpCsFixer\Config::create()
PhpCsFixer\Finder::create()
->files()
->in(__DIR__ . '/src')
->in(__DIR__ . '/tests/tests')
);

View File

@@ -1,36 +1,47 @@
language: php
sudo: false
php:
- 7.1
- 7.2
- 7.3
- master
- 7.4snapshot
matrix:
allow_failures:
- php: master
fast_finish: true
env:
matrix:
- DEPENDENCIES="high"
- DEPENDENCIES="low"
- DRIVER="xdebug" DEPENDENCIES="high"
- DRIVER="phpdbg" DEPENDENCIES="high"
- DRIVER="pcov" DEPENDENCIES="high"
- DRIVER="xdebug" DEPENDENCIES="low"
- DRIVER="phpdbg" DEPENDENCIES="low"
- DRIVER="pcov" DEPENDENCIES="low"
global:
- DEFAULT_COMPOSER_FLAGS="--no-interaction --no-ansi --no-progress --no-suggest"
before_install:
- composer self-update
- composer clear-cache
- ./tools/composer clear-cache
install:
- if [[ "$DEPENDENCIES" = 'high' ]]; then travis_retry composer update $DEFAULT_COMPOSER_FLAGS; fi
- if [[ "$DEPENDENCIES" = 'low' ]]; then travis_retry composer update $DEFAULT_COMPOSER_FLAGS --prefer-lowest; fi
- if [[ "$DEPENDENCIES" = 'high' ]]; then travis_retry ./tools/composer update $DEFAULT_COMPOSER_FLAGS; fi
- if [[ "$DEPENDENCIES" = 'low' ]]; then travis_retry ./tools/composer update $DEFAULT_COMPOSER_FLAGS --prefer-lowest; fi
before_script:
- |
if [[ "$DRIVER" = 'pcov' ]]; then
echo > $HOME/.phpenv/versions/$TRAVIS_PHP_VERSION/etc/conf.d/xdebug.ini
git clone --single-branch --branch=v1.0.6 --depth=1 https://github.com/krakjoe/pcov
cd pcov
phpize
./configure
make clean install
echo "extension=pcov.so" > $HOME/.phpenv/versions/$TRAVIS_PHP_VERSION/etc/conf.d/pcov.ini
cd $TRAVIS_BUILD_DIR
fi
script:
- if [[ "$DRIVER" = 'phpdbg' ]]; then phpdbg -qrr vendor/bin/phpunit --coverage-clover=coverage.xml; fi
- if [[ "$DRIVER" = 'xdebug' ]]; then vendor/bin/phpunit --coverage-clover=coverage.xml; fi
- if [[ "$DRIVER" != 'phpdbg' ]]; then vendor/bin/phpunit --coverage-clover=coverage.xml; fi
after_success:
- bash <(curl -s https://codecov.io/bash)
@@ -38,3 +49,12 @@ after_success:
notifications:
email: false
jobs:
include:
- stage: Static Code Analysis
php: 7.3
env: php-cs-fixer
install:
- phpenv config-rm xdebug.ini
script:
- ./tools/php-cs-fixer fix --dry-run -v --show-progress=dots --diff-format=udiff

View File

@@ -1,41 +0,0 @@
# Changes in php-code-coverage 6.1
All notable changes of the php-code-coverage 6.1 release series are documented in this file using the [Keep a CHANGELOG](http://keepachangelog.com/) principles.
## [6.1.4] - 2018-10-31
### Fixed
* Fixed [#650](https://github.com/sebastianbergmann/php-code-coverage/issues/650): Wasted screen space in HTML code coverage report
## [6.1.3] - 2018-10-23
### Changed
* Use `^3.1` of `sebastian/environment` again due to [regression](https://github.com/sebastianbergmann/environment/issues/31)
## [6.1.2] - 2018-10-23
### Fixed
* Fixed [#645](https://github.com/sebastianbergmann/php-code-coverage/pull/645): Crash that can occur when php-token-stream parses invalid files
## [6.1.1] - 2018-10-18
### Changed
* This component now allows `^4` of `sebastian/environment`
## [6.1.0] - 2018-10-16
### Changed
* Class names are now abbreviated (unqualified name shown, fully qualified name shown on hover) in the file view of the HTML report
* Update HTML report to Bootstrap 4
[6.1.4]: https://github.com/sebastianbergmann/php-code-coverage/compare/6.1.3...6.1.4
[6.1.3]: https://github.com/sebastianbergmann/php-code-coverage/compare/6.1.2...6.1.3
[6.1.2]: https://github.com/sebastianbergmann/php-code-coverage/compare/6.1.1...6.1.2
[6.1.1]: https://github.com/sebastianbergmann/php-code-coverage/compare/6.1.0...6.1.1
[6.1.0]: https://github.com/sebastianbergmann/php-code-coverage/compare/6.0...6.1.0

View File

@@ -0,0 +1,166 @@
# ChangeLog
All notable changes are documented in this file using the [Keep a CHANGELOG](http://keepachangelog.com/) principles.
## [7.0.15] - 2021-07-26
### Changed
* Bumped required version of php-token-stream
## [7.0.14] - 2020-12-02
### Changed
* [#837](https://github.com/sebastianbergmann/php-code-coverage/issues/837): Allow version 4 of php-token-stream
## [7.0.13] - 2020-11-30
### Changed
* Changed PHP version constraint in `composer.json` from `^7.2` to `>=7.2` to allow installation of this version of this library on PHP 8. However, this version of this library does not work on PHP 8. PHPUnit 8.5, which uses this version of this library, does not call into this library and instead shows a message that code coverage functionality is not available for PHPUnit 8.5 on PHP 8.
## [7.0.12] - 2020-11-27
### Added
* [#834](https://github.com/sebastianbergmann/php-code-coverage/issues/834): Support `XDEBUG_MODE` environment variable
## [7.0.11] - 2020-11-27
### Added
* Support for Xdebug 3
## [7.0.10] - 2019-11-20
### Fixed
* [#710](https://github.com/sebastianbergmann/php-code-coverage/pull/710): Code Coverage does not work in PhpStorm
## [7.0.9] - 2019-11-20
### Changed
* [#709](https://github.com/sebastianbergmann/php-code-coverage/pull/709): Prioritize PCOV over Xdebug
## [7.0.8] - 2019-09-17
### Changed
* Update HTML report Bootstrap 4.3.1, jQuery 3.4.1, and popper.js 1.15.0
## [7.0.7] - 2019-07-25
### Changed
* Bumped required version of php-token-stream
## [7.0.6] - 2019-07-08
### Changed
* Bumped required version of php-token-stream
## [7.0.5] - 2019-06-06
### Fixed
* [#681](https://github.com/sebastianbergmann/php-code-coverage/pull/681): `use function` statements are not ignored
## [7.0.4] - 2019-05-29
### Fixed
* [#682](https://github.com/sebastianbergmann/php-code-coverage/pull/682): Code that is not executed is reported as being executed when using PCOV
## [7.0.3] - 2019-02-26
### Fixed
* [#671](https://github.com/sebastianbergmann/php-code-coverage/issues/671): `TypeError` when directory name is a number
## [7.0.2] - 2019-02-15
### Changed
* Updated HTML report to Bootstrap 4.3.0
### Fixed
* [#667](https://github.com/sebastianbergmann/php-code-coverage/pull/667): `TypeError` in PHP reporter
## [7.0.1] - 2019-02-01
### Fixed
* [#664](https://github.com/sebastianbergmann/php-code-coverage/issues/664): `TypeError` when whitelisted file does not exist
## [7.0.0] - 2019-02-01
### Added
* Implemented [#663](https://github.com/sebastianbergmann/php-code-coverage/pull/663): Support for PCOV
### Fixed
* [#654](https://github.com/sebastianbergmann/php-code-coverage/issues/654): HTML report fails to load assets
* [#655](https://github.com/sebastianbergmann/php-code-coverage/issues/655): Popin pops in outside of screen
### Removed
* This component is no longer supported on PHP 7.1
## [6.1.4] - 2018-10-31
### Fixed
* [#650](https://github.com/sebastianbergmann/php-code-coverage/issues/650): Wasted screen space in HTML code coverage report
## [6.1.3] - 2018-10-23
### Changed
* Use `^3.1` of `sebastian/environment` again due to [regression](https://github.com/sebastianbergmann/environment/issues/31)
## [6.1.2] - 2018-10-23
### Fixed
* [#645](https://github.com/sebastianbergmann/php-code-coverage/pull/645): Crash that can occur when php-token-stream parses invalid files
## [6.1.1] - 2018-10-18
### Changed
* This component now allows `^4` of `sebastian/environment`
## [6.1.0] - 2018-10-16
### Changed
* Class names are now abbreviated (unqualified name shown, fully qualified name shown on hover) in the file view of the HTML report
* Update HTML report to Bootstrap 4
[7.0.15]: https://github.com/sebastianbergmann/php-code-coverage/compare/7.0.14...7.0.15
[7.0.14]: https://github.com/sebastianbergmann/php-code-coverage/compare/7.0.13...7.0.14
[7.0.13]: https://github.com/sebastianbergmann/php-code-coverage/compare/7.0.12...7.0.13
[7.0.12]: https://github.com/sebastianbergmann/php-code-coverage/compare/7.0.11...7.0.12
[7.0.11]: https://github.com/sebastianbergmann/php-code-coverage/compare/7.0.10...7.0.11
[7.0.10]: https://github.com/sebastianbergmann/php-code-coverage/compare/7.0.9...7.0.10
[7.0.9]: https://github.com/sebastianbergmann/php-code-coverage/compare/7.0.8...7.0.9
[7.0.8]: https://github.com/sebastianbergmann/php-code-coverage/compare/7.0.7...7.0.8
[7.0.7]: https://github.com/sebastianbergmann/php-code-coverage/compare/7.0.6...7.0.7
[7.0.6]: https://github.com/sebastianbergmann/php-code-coverage/compare/7.0.5...7.0.6
[7.0.5]: https://github.com/sebastianbergmann/php-code-coverage/compare/7.0.4...7.0.5
[7.0.4]: https://github.com/sebastianbergmann/php-code-coverage/compare/7.0.3...7.0.4
[7.0.3]: https://github.com/sebastianbergmann/php-code-coverage/compare/7.0.2...7.0.3
[7.0.2]: https://github.com/sebastianbergmann/php-code-coverage/compare/7.0.1...7.0.2
[7.0.1]: https://github.com/sebastianbergmann/php-code-coverage/compare/7.0.0...7.0.1
[7.0.0]: https://github.com/sebastianbergmann/php-code-coverage/compare/6.1.4...7.0.0
[6.1.4]: https://github.com/sebastianbergmann/php-code-coverage/compare/6.1.3...6.1.4
[6.1.3]: https://github.com/sebastianbergmann/php-code-coverage/compare/6.1.2...6.1.3
[6.1.2]: https://github.com/sebastianbergmann/php-code-coverage/compare/6.1.1...6.1.2
[6.1.1]: https://github.com/sebastianbergmann/php-code-coverage/compare/6.1.0...6.1.1
[6.1.0]: https://github.com/sebastianbergmann/php-code-coverage/compare/6.0...6.1.0

View File

@@ -1,6 +1,6 @@
php-code-coverage
Copyright (c) 2009-2018, Sebastian Bergmann <sebastian@phpunit.de>.
Copyright (c) 2009-2019, Sebastian Bergmann <sebastian@phpunit.de>.
All rights reserved.
Redistribution and use in source and binary forms, with or without

View File

@@ -1,14 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<project name="php-code-coverage" default="setup">
<target name="setup" depends="clean,composer"/>
<target name="setup" depends="clean,install-dependencies"/>
<target name="clean" description="Cleanup build artifacts">
<delete dir="${basedir}/vendor"/>
<delete file="${basedir}/composer.lock"/>
</target>
<target name="composer" depends="clean" description="Install dependencies with Composer">
<exec executable="composer" taskname="composer">
<target name="install-dependencies" depends="clean" description="Install dependencies with Composer">
<exec executable="${basedir}/tools/composer" taskname="composer">
<arg value="update"/>
<arg value="--no-interaction"/>
<arg value="--no-progress"/>
@@ -16,4 +16,15 @@
<arg value="--no-suggest"/>
</exec>
</target>
<target name="update-tools">
<exec executable="phive">
<arg value="--no-progress"/>
<arg value="update"/>
</exec>
<exec executable="${basedir}/tools/composer">
<arg value="self-update"/>
</exec>
</target>
</project>

View File

@@ -25,31 +25,37 @@
},
"prefer-stable": true,
"require": {
"php": "^7.1",
"php": ">=7.2",
"ext-dom": "*",
"ext-xmlwriter": "*",
"phpunit/php-file-iterator": "^2.0",
"phpunit/php-token-stream": "^3.0",
"phpunit/php-file-iterator": "^2.0.2",
"phpunit/php-token-stream": "^3.1.3 || ^4.0",
"phpunit/php-text-template": "^1.2.1",
"sebastian/code-unit-reverse-lookup": "^1.0.1",
"sebastian/environment": "^3.1 || ^4.0",
"sebastian/environment": "^4.2.2",
"sebastian/version": "^2.0.1",
"theseer/tokenizer": "^1.1"
"theseer/tokenizer": "^1.1.3"
},
"require-dev": {
"phpunit/phpunit": "^7.0"
"phpunit/phpunit": "^8.2.2"
},
"suggest": {
"ext-xdebug": "^2.6.0"
"ext-xdebug": "^2.7.2"
},
"autoload": {
"classmap": [
"src/"
]
},
"autoload-dev": {
"files": [
"tests/TestCase.php",
"tests/_files/BankAccountTest.php"
]
},
"extra": {
"branch-alias": {
"dev-master": "6.1-dev"
"dev-master": "7.0-dev"
}
}
}

View File

@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<phive xmlns="https://phar.io/phive">
<phar name="php-cs-fixer" version="^2.14" installed="2.14.2" location="./tools/php-cs-fixer" copy="true"/>
</phive>

View File

@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
/*
* This file is part of the php-code-coverage package.
*
@@ -13,6 +13,7 @@ use PHPUnit\Framework\TestCase;
use PHPUnit\Runner\PhptTestCase;
use PHPUnit\Util\Test;
use SebastianBergmann\CodeCoverage\Driver\Driver;
use SebastianBergmann\CodeCoverage\Driver\PCOV;
use SebastianBergmann\CodeCoverage\Driver\PHPDBG;
use SebastianBergmann\CodeCoverage\Driver\Xdebug;
use SebastianBergmann\CodeCoverage\Node\Builder;
@@ -158,9 +159,7 @@ final class CodeCoverage
public function getReport(): Directory
{
if ($this->report === null) {
$builder = new Builder;
$this->report = $builder->build($this);
$this->report = (new Builder)->build($this);
}
return $this->report;
@@ -662,8 +661,7 @@ final class CodeCoverage
$firstMethod = \array_shift($classOrTrait['methods']);
$firstMethodStartLine = $firstMethod['startLine'];
$firstMethodEndLine = $firstMethod['endLine'];
$lastMethodEndLine = $firstMethodEndLine;
$lastMethodEndLine = $firstMethod['endLine'];
do {
$lastMethod = \array_pop($classOrTrait['methods']);
@@ -696,7 +694,7 @@ final class CodeCoverage
switch (\get_class($token)) {
case \PHP_Token_COMMENT::class:
case \PHP_Token_DOC_COMMENT::class:
$_token = \trim($token);
$_token = \trim((string) $token);
$_line = \trim($lines[$token->getLine() - 1]);
if ($_token === '// @codeCoverageIgnore' ||
@@ -713,7 +711,7 @@ final class CodeCoverage
if (!$ignore) {
$start = $token->getLine();
$end = $start + \substr_count($token, "\n");
$end = $start + \substr_count((string) $token, "\n");
// Do not ignore the first line when there is a token
// before the comment
@@ -740,7 +738,7 @@ final class CodeCoverage
case \PHP_Token_FUNCTION::class:
/* @var \PHP_Token_Interface $token */
$docblock = $token->getDocblock();
$docblock = (string) $token->getDocblock();
$this->ignoredLines[$fileName][] = $token->getLine();
@@ -763,6 +761,7 @@ final class CodeCoverage
case \PHP_Token_OPEN_TAG::class:
case \PHP_Token_CLOSE_TAG::class:
case \PHP_Token_USE::class:
case \PHP_Token_USE_FUNCTION::class:
$this->ignoredLines[$fileName][] = $token->getLine();
break;
@@ -893,12 +892,12 @@ final class CodeCoverage
{
$runtime = new Runtime;
if (!$runtime->canCollectCodeCoverage()) {
throw new RuntimeException('No code coverage driver available');
if ($runtime->hasPHPDBGCodeCoverage()) {
return new PHPDBG;
}
if ($runtime->isPHPDBG()) {
return new PHPDBG;
if ($runtime->hasPCOV()) {
return new PCOV;
}
if ($runtime->hasXdebug()) {
@@ -957,10 +956,9 @@ final class CodeCoverage
}
}
$data = [];
$coverage = $this->driver->stop();
$data = [];
foreach ($coverage as $file => $fileCoverage) {
foreach ($this->driver->stop() as $file => $fileCoverage) {
if ($this->filter->isFiltered($file)) {
continue;
}

View File

@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
/*
* This file is part of the php-code-coverage package.
*

View File

@@ -0,0 +1,45 @@
<?php declare(strict_types=1);
/*
* This file is part of the php-code-coverage 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.
*/
namespace SebastianBergmann\CodeCoverage\Driver;
/**
* Driver for PCOV code coverage functionality.
*
* @codeCoverageIgnore
*/
final class PCOV implements Driver
{
/**
* Start collection of code coverage information.
*/
public function start(bool $determineUnusedAndDead = true): void
{
\pcov\start();
}
/**
* Stop collection of code coverage information.
*/
public function stop(): array
{
\pcov\stop();
$waiting = \pcov\waiting();
$collect = [];
if ($waiting) {
$collect = \pcov\collect(\pcov\inclusive, $waiting);
\pcov\clear();
}
return $collect;
}
}

View File

@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
/*
* This file is part of the php-code-coverage package.
*

View File

@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
/*
* This file is part of the php-code-coverage package.
*
@@ -38,8 +38,19 @@ final class Xdebug implements Driver
throw new RuntimeException('This driver requires Xdebug');
}
if (!\ini_get('xdebug.coverage_enable')) {
throw new RuntimeException('xdebug.coverage_enable=On has to be set in php.ini');
if (\version_compare(\phpversion('xdebug'), '3', '>=')) {
$mode = \getenv('XDEBUG_MODE');
if ($mode === false) {
$mode = \ini_get('xdebug.mode');
}
if ($mode === false ||
!\in_array('coverage', \explode(',', $mode), true)) {
throw new RuntimeException('XDEBUG_MODE=coverage or xdebug.mode=coverage has to be set');
}
} elseif (!\ini_get('xdebug.coverage_enable')) {
throw new RuntimeException('xdebug.coverage_enable=On has to be set');
}
if ($filter === null) {

View File

@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
/*
* This file is part of the php-code-coverage package.
*

View File

@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
/*
* This file is part of the php-code-coverage package.
*

View File

@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
/*
* This file is part of the php-code-coverage package.
*

View File

@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
/*
* This file is part of the php-code-coverage package.
*

View File

@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
/*
* This file is part of the php-code-coverage package.
*

View File

@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
/*
* This file is part of the php-code-coverage package.
*

View File

@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
/*
* This file is part of the php-code-coverage package.
*
@@ -48,7 +48,13 @@ final class Filter
*/
public function addFileToWhitelist(string $filename): void
{
$this->whitelistedFiles[\realpath($filename)] = true;
$filename = \realpath($filename);
if (!$filename) {
return;
}
$this->whitelistedFiles[$filename] = true;
}
/**
@@ -83,6 +89,10 @@ final class Filter
{
$filename = \realpath($filename);
if (!$filename || !isset($this->whitelistedFiles[$filename])) {
return;
}
unset($this->whitelistedFiles[$filename]);
}

View File

@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
/*
* This file is part of the php-code-coverage package.
*

View File

@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
/*
* This file is part of the php-code-coverage package.
*
@@ -35,7 +35,9 @@ final class Builder
private function addItems(Directory $root, array $items, array $tests, bool $cacheTokens): void
{
foreach ($items as $key => $value) {
if (\substr($key, -2) == '/f') {
$key = (string) $key;
if (\substr($key, -2) === '/f') {
$key = \substr($key, 0, -2);
if (\file_exists($root->getPath() . \DIRECTORY_SEPARATOR . $key)) {
@@ -100,7 +102,7 @@ final class Builder
for ($i = 0; $i < $max; $i++) {
$type = '';
if ($i == ($max - 1)) {
if ($i === ($max - 1)) {
$type = '/f';
}
@@ -190,7 +192,7 @@ final class Builder
for ($i = 0; $i < $max - 1; $i++) {
if (!isset($paths[$i][0]) ||
!isset($paths[$i + 1][0]) ||
$paths[$i][0] != $paths[$i + 1][0]) {
$paths[$i][0] !== $paths[$i + 1][0]) {
$done = true;
break;
@@ -200,7 +202,7 @@ final class Builder
if (!$done) {
$commonPath .= $paths[0][0];
if ($paths[0][0] != \DIRECTORY_SEPARATOR) {
if ($paths[0][0] !== \DIRECTORY_SEPARATOR) {
$commonPath .= \DIRECTORY_SEPARATOR;
}

View File

@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
/*
* This file is part of the php-code-coverage package.
*

View File

@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
/*
* This file is part of the php-code-coverage package.
*
@@ -578,7 +578,7 @@ final class File extends AbstractNode
private function crap(int $ccn, float $coverage): string
{
if ($coverage === 0) {
if ($coverage === 0.0) {
return (string) ($ccn ** 2 + $ccn);
}

View File

@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
/*
* This file is part of the php-code-coverage package.
*

View File

@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
/*
* This file is part of the php-code-coverage package.
*
@@ -27,11 +27,11 @@ final class Clover
$xmlDocument->formatOutput = true;
$xmlCoverage = $xmlDocument->createElement('coverage');
$xmlCoverage->setAttribute('generated', (int) $_SERVER['REQUEST_TIME']);
$xmlCoverage->setAttribute('generated', (string) $_SERVER['REQUEST_TIME']);
$xmlDocument->appendChild($xmlCoverage);
$xmlProject = $xmlDocument->createElement('project');
$xmlProject->setAttribute('timestamp', (int) $_SERVER['REQUEST_TIME']);
$xmlProject->setAttribute('timestamp', (string) $_SERVER['REQUEST_TIME']);
if (\is_string($name)) {
$xmlProject->setAttribute('name', $name);
@@ -133,15 +133,15 @@ final class Clover
$xmlFile->appendChild($xmlClass);
$xmlMetrics = $xmlDocument->createElement('metrics');
$xmlMetrics->setAttribute('complexity', $class['ccn']);
$xmlMetrics->setAttribute('methods', $classMethods);
$xmlMetrics->setAttribute('coveredmethods', $coveredMethods);
$xmlMetrics->setAttribute('conditionals', 0);
$xmlMetrics->setAttribute('coveredconditionals', 0);
$xmlMetrics->setAttribute('statements', $classStatements);
$xmlMetrics->setAttribute('coveredstatements', $coveredClassStatements);
$xmlMetrics->setAttribute('elements', $classMethods + $classStatements /* + conditionals */);
$xmlMetrics->setAttribute('coveredelements', $coveredMethods + $coveredClassStatements /* + coveredconditionals */);
$xmlMetrics->setAttribute('complexity', (string) $class['ccn']);
$xmlMetrics->setAttribute('methods', (string) $classMethods);
$xmlMetrics->setAttribute('coveredmethods', (string) $coveredMethods);
$xmlMetrics->setAttribute('conditionals', '0');
$xmlMetrics->setAttribute('coveredconditionals', '0');
$xmlMetrics->setAttribute('statements', (string) $classStatements);
$xmlMetrics->setAttribute('coveredstatements', (string) $coveredClassStatements);
$xmlMetrics->setAttribute('elements', (string) ($classMethods + $classStatements /* + conditionals */));
$xmlMetrics->setAttribute('coveredelements', (string) ($coveredMethods + $coveredClassStatements /* + coveredconditionals */));
$xmlClass->appendChild($xmlMetrics);
}
@@ -159,7 +159,7 @@ final class Clover
foreach ($lines as $line => $data) {
$xmlLine = $xmlDocument->createElement('line');
$xmlLine->setAttribute('num', $line);
$xmlLine->setAttribute('num', (string) $line);
$xmlLine->setAttribute('type', $data['type']);
if (isset($data['name'])) {
@@ -171,31 +171,31 @@ final class Clover
}
if (isset($data['ccn'])) {
$xmlLine->setAttribute('complexity', $data['ccn']);
$xmlLine->setAttribute('complexity', (string) $data['ccn']);
}
if (isset($data['crap'])) {
$xmlLine->setAttribute('crap', $data['crap']);
$xmlLine->setAttribute('crap', (string) $data['crap']);
}
$xmlLine->setAttribute('count', $data['count']);
$xmlLine->setAttribute('count', (string) $data['count']);
$xmlFile->appendChild($xmlLine);
}
$linesOfCode = $item->getLinesOfCode();
$xmlMetrics = $xmlDocument->createElement('metrics');
$xmlMetrics->setAttribute('loc', $linesOfCode['loc']);
$xmlMetrics->setAttribute('ncloc', $linesOfCode['ncloc']);
$xmlMetrics->setAttribute('classes', $item->getNumClassesAndTraits());
$xmlMetrics->setAttribute('methods', $item->getNumMethods());
$xmlMetrics->setAttribute('coveredmethods', $item->getNumTestedMethods());
$xmlMetrics->setAttribute('conditionals', 0);
$xmlMetrics->setAttribute('coveredconditionals', 0);
$xmlMetrics->setAttribute('statements', $item->getNumExecutableLines());
$xmlMetrics->setAttribute('coveredstatements', $item->getNumExecutedLines());
$xmlMetrics->setAttribute('elements', $item->getNumMethods() + $item->getNumExecutableLines() /* + conditionals */);
$xmlMetrics->setAttribute('coveredelements', $item->getNumTestedMethods() + $item->getNumExecutedLines() /* + coveredconditionals */);
$xmlMetrics->setAttribute('loc', (string) $linesOfCode['loc']);
$xmlMetrics->setAttribute('ncloc', (string) $linesOfCode['ncloc']);
$xmlMetrics->setAttribute('classes', (string) $item->getNumClassesAndTraits());
$xmlMetrics->setAttribute('methods', (string) $item->getNumMethods());
$xmlMetrics->setAttribute('coveredmethods', (string) $item->getNumTestedMethods());
$xmlMetrics->setAttribute('conditionals', '0');
$xmlMetrics->setAttribute('coveredconditionals', '0');
$xmlMetrics->setAttribute('statements', (string) $item->getNumExecutableLines());
$xmlMetrics->setAttribute('coveredstatements', (string) $item->getNumExecutedLines());
$xmlMetrics->setAttribute('elements', (string) ($item->getNumMethods() + $item->getNumExecutableLines() /* + conditionals */));
$xmlMetrics->setAttribute('coveredelements', (string) ($item->getNumTestedMethods() + $item->getNumExecutedLines() /* + coveredconditionals */));
$xmlFile->appendChild($xmlMetrics);
if ($namespace === 'global') {
@@ -217,18 +217,18 @@ final class Clover
$linesOfCode = $report->getLinesOfCode();
$xmlMetrics = $xmlDocument->createElement('metrics');
$xmlMetrics->setAttribute('files', \count($report));
$xmlMetrics->setAttribute('loc', $linesOfCode['loc']);
$xmlMetrics->setAttribute('ncloc', $linesOfCode['ncloc']);
$xmlMetrics->setAttribute('classes', $report->getNumClassesAndTraits());
$xmlMetrics->setAttribute('methods', $report->getNumMethods());
$xmlMetrics->setAttribute('coveredmethods', $report->getNumTestedMethods());
$xmlMetrics->setAttribute('conditionals', 0);
$xmlMetrics->setAttribute('coveredconditionals', 0);
$xmlMetrics->setAttribute('statements', $report->getNumExecutableLines());
$xmlMetrics->setAttribute('coveredstatements', $report->getNumExecutedLines());
$xmlMetrics->setAttribute('elements', $report->getNumMethods() + $report->getNumExecutableLines() /* + conditionals */);
$xmlMetrics->setAttribute('coveredelements', $report->getNumTestedMethods() + $report->getNumExecutedLines() /* + coveredconditionals */);
$xmlMetrics->setAttribute('files', (string) \count($report));
$xmlMetrics->setAttribute('loc', (string) $linesOfCode['loc']);
$xmlMetrics->setAttribute('ncloc', (string) $linesOfCode['ncloc']);
$xmlMetrics->setAttribute('classes', (string) $report->getNumClassesAndTraits());
$xmlMetrics->setAttribute('methods', (string) $report->getNumMethods());
$xmlMetrics->setAttribute('coveredmethods', (string) $report->getNumTestedMethods());
$xmlMetrics->setAttribute('conditionals', '0');
$xmlMetrics->setAttribute('coveredconditionals', '0');
$xmlMetrics->setAttribute('statements', (string) $report->getNumExecutableLines());
$xmlMetrics->setAttribute('coveredstatements', (string) $report->getNumExecutedLines());
$xmlMetrics->setAttribute('elements', (string) ($report->getNumMethods() + $report->getNumExecutableLines() /* + conditionals */));
$xmlMetrics->setAttribute('coveredelements', (string) ($report->getNumTestedMethods() + $report->getNumExecutedLines() /* + coveredconditionals */));
$xmlProject->appendChild($xmlMetrics);
$buffer = $xmlDocument->saveXML();

View File

@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
/*
* This file is part of the php-code-coverage package.
*
@@ -38,7 +38,7 @@ final class Crap4j
$project = $document->createElement('project', \is_string($name) ? $name : '');
$root->appendChild($project);
$root->appendChild($document->createElement('timestamp', \date('Y-m-d H:i:s', (int) $_SERVER['REQUEST_TIME'])));
$root->appendChild($document->createElement('timestamp', \date('Y-m-d H:i:s', $_SERVER['REQUEST_TIME'])));
$stats = $document->createElement('stats');
$methodsNode = $document->createElement('methods');
@@ -86,10 +86,10 @@ final class Crap4j
$methodNode->appendChild($document->createElement('methodName', $methodName));
$methodNode->appendChild($document->createElement('methodSignature', \htmlspecialchars($method['signature'])));
$methodNode->appendChild($document->createElement('fullMethod', \htmlspecialchars($method['signature'])));
$methodNode->appendChild($document->createElement('crap', $this->roundValue($method['crap'])));
$methodNode->appendChild($document->createElement('complexity', $method['ccn']));
$methodNode->appendChild($document->createElement('coverage', $this->roundValue($method['coverage'])));
$methodNode->appendChild($document->createElement('crapLoad', \round($crapLoad)));
$methodNode->appendChild($document->createElement('crap', (string) $this->roundValue($method['crap'])));
$methodNode->appendChild($document->createElement('complexity', (string) $method['ccn']));
$methodNode->appendChild($document->createElement('coverage', (string) $this->roundValue($method['coverage'])));
$methodNode->appendChild($document->createElement('crapLoad', (string) \round($crapLoad)));
$methodsNode->appendChild($methodNode);
}
@@ -97,10 +97,10 @@ final class Crap4j
}
$stats->appendChild($document->createElement('name', 'Method Crap Stats'));
$stats->appendChild($document->createElement('methodCount', $fullMethodCount));
$stats->appendChild($document->createElement('crapMethodCount', $fullCrapMethodCount));
$stats->appendChild($document->createElement('crapLoad', \round($fullCrapLoad)));
$stats->appendChild($document->createElement('totalCrap', $fullCrap));
$stats->appendChild($document->createElement('methodCount', (string) $fullMethodCount));
$stats->appendChild($document->createElement('crapMethodCount', (string) $fullCrapMethodCount));
$stats->appendChild($document->createElement('crapLoad', (string) \round($fullCrapLoad)));
$stats->appendChild($document->createElement('totalCrap', (string) $fullCrap));
$crapMethodPercent = 0;
@@ -108,7 +108,7 @@ final class Crap4j
$crapMethodPercent = $this->roundValue((100 * $fullCrapMethodCount) / $fullMethodCount);
}
$stats->appendChild($document->createElement('crapMethodPercent', $crapMethodPercent));
$stats->appendChild($document->createElement('crapMethodPercent', (string) $crapMethodPercent));
$root->appendChild($stats);
$root->appendChild($methodsNode);

View File

@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
/*
* This file is part of the php-code-coverage package.
*
@@ -118,7 +118,7 @@ final class Facade
*/
private function copyFiles(string $target): void
{
$dir = $this->getDirectory($target . '.css');
$dir = $this->getDirectory($target . '_css');
\copy($this->templatePath . 'css/bootstrap.min.css', $dir . 'bootstrap.min.css');
\copy($this->templatePath . 'css/nv.d3.min.css', $dir . 'nv.d3.min.css');
@@ -126,11 +126,11 @@ final class Facade
\copy($this->templatePath . 'css/custom.css', $dir . 'custom.css');
\copy($this->templatePath . 'css/octicons.css', $dir . 'octicons.css');
$dir = $this->getDirectory($target . '.icons');
$dir = $this->getDirectory($target . '_icons');
\copy($this->templatePath . 'icons/file-code.svg', $dir . 'file-code.svg');
\copy($this->templatePath . 'icons/file-directory.svg', $dir . 'file-directory.svg');
$dir = $this->getDirectory($target . '.js');
$dir = $this->getDirectory($target . '_js');
\copy($this->templatePath . 'js/bootstrap.min.js', $dir . 'bootstrap.min.js');
\copy($this->templatePath . 'js/popper.min.js', $dir . 'popper.min.js');
\copy($this->templatePath . 'js/d3.min.js', $dir . 'd3.min.js');

View File

@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
/*
* This file is part of the php-code-coverage package.
*
@@ -265,6 +265,13 @@ abstract class Renderer
);
}
if ($runtime->hasPCOV() && !$runtime->hasPHPDBGCodeCoverage()) {
$buffer .= \sprintf(
' with <a href="https://github.com/krakjoe/pcov">PCOV %s</a>',
\phpversion('pcov')
);
}
return $buffer;
}
}

View File

@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
/*
* This file is part of the php-code-coverage package.
*

View File

@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
/*
* This file is part of the php-code-coverage package.
*
@@ -76,7 +76,7 @@ final class Directory extends Renderer
$up = \str_repeat('../', \count($node->getPathAsArray()) - 2);
$data['icon'] = \sprintf('<img src="%s.icons/file-directory.svg" class="octicon" />', $up);
$data['icon'] = \sprintf('<img src="%s_icons/file-directory.svg" class="octicon" />', $up);
} else {
$data['name'] = \sprintf(
'<a href="%s.html">%s</a>',
@@ -86,7 +86,7 @@ final class Directory extends Renderer
$up = \str_repeat('../', \count($node->getPathAsArray()) - 2);
$data['icon'] = \sprintf('<img src="%s.icons/file-code.svg" class="octicon" />', $up);
$data['icon'] = \sprintf('<img src="%s_icons/file-code.svg" class="octicon" />', $up);
}
}

View File

@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
/*
* This file is part of the php-code-coverage package.
*
@@ -339,14 +339,14 @@ final class File extends Renderer
if (!empty($popoverTitle)) {
$popover = \sprintf(
' data-title="%s" data-content="%s" data-placement="bottom" data-html="true"',
' data-title="%s" data-content="%s" data-placement="top" data-html="true"',
$popoverTitle,
\htmlspecialchars($popoverContent, $this->htmlSpecialCharsFlags)
);
}
$lines .= \sprintf(
' <tr%s%s><td><div align="right"><a name="%d"></a><a href="#%d">%d</a></div></td><td class="codeLine">%s</td></tr>' . "\n",
' <tr%s><td%s><div align="right"><a name="%d"></a><a href="#%d">%d</a></div></td><td class="codeLine">%s</td></tr>' . "\n",
$trClass,
$popover,
$i,

File diff suppressed because one or more lines are too long

View File

@@ -4,10 +4,10 @@
<meta charset="UTF-8">
<title>Dashboard for {{full_path}}</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="{{path_to_root}}.css/bootstrap.min.css" rel="stylesheet" type="text/css">
<link href="{{path_to_root}}.css/nv.d3.min.css" rel="stylesheet" type="text/css">
<link href="{{path_to_root}}.css/style.css" rel="stylesheet" type="text/css">
<link href="{{path_to_root}}.css/custom.css" rel="stylesheet" type="text/css">
<link href="{{path_to_root}}_css/bootstrap.min.css" rel="stylesheet" type="text/css">
<link href="{{path_to_root}}_css/nv.d3.min.css" rel="stylesheet" type="text/css">
<link href="{{path_to_root}}_css/style.css" rel="stylesheet" type="text/css">
<link href="{{path_to_root}}_css/custom.css" rel="stylesheet" type="text/css">
</head>
<body>
<header>
@@ -137,9 +137,9 @@
</p>
</footer>
</div>
<script src="{{path_to_root}}.js/jquery.min.js" type="text/javascript"></script>
<script src="{{path_to_root}}.js/d3.min.js" type="text/javascript"></script>
<script src="{{path_to_root}}.js/nv.d3.min.js" type="text/javascript"></script>
<script src="{{path_to_root}}_js/jquery.min.js" type="text/javascript"></script>
<script src="{{path_to_root}}_js/d3.min.js" type="text/javascript"></script>
<script src="{{path_to_root}}_js/nv.d3.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function() {
nv.addGraph(function() {

View File

@@ -4,10 +4,10 @@
<meta charset="UTF-8">
<title>Code Coverage for {{full_path}}</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="{{path_to_root}}.css/bootstrap.min.css" rel="stylesheet" type="text/css">
<link href="{{path_to_root}}.css/octicons.css" rel="stylesheet" type="text/css">
<link href="{{path_to_root}}.css/style.css" rel="stylesheet" type="text/css">
<link href="{{path_to_root}}.css/custom.css" rel="stylesheet" type="text/css">
<link href="{{path_to_root}}_css/bootstrap.min.css" rel="stylesheet" type="text/css">
<link href="{{path_to_root}}_css/octicons.css" rel="stylesheet" type="text/css">
<link href="{{path_to_root}}_css/style.css" rel="stylesheet" type="text/css">
<link href="{{path_to_root}}_css/custom.css" rel="stylesheet" type="text/css">
</head>
<body>
<header>

View File

@@ -4,10 +4,10 @@
<meta charset="UTF-8">
<title>Code Coverage for {{full_path}}</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="{{path_to_root}}.css/bootstrap.min.css" rel="stylesheet" type="text/css">
<link href="{{path_to_root}}.css/octicons.css" rel="stylesheet" type="text/css">
<link href="{{path_to_root}}.css/style.css" rel="stylesheet" type="text/css">
<link href="{{path_to_root}}.css/custom.css" rel="stylesheet" type="text/css">
<link href="{{path_to_root}}_css/bootstrap.min.css" rel="stylesheet" type="text/css">
<link href="{{path_to_root}}_css/octicons.css" rel="stylesheet" type="text/css">
<link href="{{path_to_root}}_css/style.css" rel="stylesheet" type="text/css">
<link href="{{path_to_root}}_css/custom.css" rel="stylesheet" type="text/css">
</head>
<body>
<header>
@@ -64,9 +64,9 @@
</a>
</footer>
</div>
<script src="{{path_to_root}}.js/jquery.min.js" type="text/javascript"></script>
<script src="{{path_to_root}}.js/popper.min.js" type="text/javascript"></script>
<script src="{{path_to_root}}.js/bootstrap.min.js" type="text/javascript"></script>
<script src="{{path_to_root}}.js/file.js" type="text/javascript"></script>
<script src="{{path_to_root}}_js/jquery.min.js" type="text/javascript"></script>
<script src="{{path_to_root}}_js/popper.min.js" type="text/javascript"></script>
<script src="{{path_to_root}}_js/bootstrap.min.js" type="text/javascript"></script>
<script src="{{path_to_root}}_js/file.js" type="text/javascript"></script>
</body>
</html>

File diff suppressed because one or more lines are too long

View File

@@ -31,6 +31,7 @@
.on({
'mouseenter.popover': function () {
var $target = $(this);
var $container = $target.children().first();
$target.data('popover-hover', true);
@@ -40,7 +41,7 @@
}
// show the popover
$target.popover('show');
$container.popover('show');
// register mouse events on the popover
$target.next('.popover:not(.popover-initialized)')
@@ -49,13 +50,13 @@
$target.data('popover-hover', true);
},
'mouseleave': function () {
hidePopover($target);
hidePopover($container);
}
})
.addClass('popover-initialized');
},
'mouseleave.popover': function () {
hidePopover($(this));
hidePopover($(this).children().first());
}
});
});

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
/*
* This file is part of the php-code-coverage package.
*
@@ -34,9 +34,9 @@ $filter = $coverage->filter();
$filter->setWhitelistedFiles(%s);
return $coverage;',
\var_export($coverage->getData(true), 1),
\var_export($coverage->getTests(), 1),
\var_export($filter->getWhitelistedFiles(), 1)
\var_export($coverage->getData(true), true),
\var_export($coverage->getTests(), true),
\var_export($filter->getWhitelistedFiles(), true)
);
if ($target !== null) {

View File

@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
/*
* This file is part of the php-code-coverage package.
*

View File

@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
/*
* This file is part of the php-code-coverage package.
*
@@ -42,6 +42,11 @@ final class BuildInformation
$driverNode->setAttribute('name', 'xdebug');
$driverNode->setAttribute('version', \phpversion('xdebug'));
}
if ($runtime->hasPCOV()) {
$driverNode->setAttribute('name', 'pcov');
$driverNode->setAttribute('version', \phpversion('pcov'));
}
}
public function setBuildTime(\DateTime $date): void

View File

@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
/*
* This file is part of the php-code-coverage package.
*

View File

@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
/*
* This file is part of the php-code-coverage package.
*

View File

@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
/*
* This file is part of the php-code-coverage package.
*
@@ -68,7 +68,7 @@ final class Facade
{
$buildNode = $this->project->getBuildInformation();
$buildNode->setRuntimeInformation(new Runtime());
$buildNode->setBuildTime(\DateTime::createFromFormat('U', $_SERVER['REQUEST_TIME']));
$buildNode->setBuildTime(\DateTime::createFromFormat('U', (string) $_SERVER['REQUEST_TIME']));
$buildNode->setGeneratorVersions($this->phpUnitVersion, Version::id());
}
@@ -151,7 +151,7 @@ final class Facade
continue;
}
$coverage = $fileReport->getLineCoverage($line);
$coverage = $fileReport->getLineCoverage((string) $line);
foreach ($tests as $test) {
$coverage->addTest($test);
@@ -181,7 +181,7 @@ final class Facade
$unit['executedLines']
);
$unitObject->setCrap($unit['crap']);
$unitObject->setCrap((float) $unit['crap']);
$unitObject->setPackage(
$unit['package']['fullPackage'],
@@ -195,12 +195,12 @@ final class Facade
foreach ($unit['methods'] as $method) {
$methodObject = $unitObject->addMethod($method['methodName']);
$methodObject->setSignature($method['signature']);
$methodObject->setLines($method['startLine'], $method['endLine']);
$methodObject->setLines((string) $method['startLine'], (string) $method['endLine']);
$methodObject->setCrap($method['crap']);
$methodObject->setTotals(
$method['executableLines'],
$method['executedLines'],
$method['coverage']
(string) $method['executableLines'],
(string) $method['executedLines'],
(string) $method['coverage']
);
}
}
@@ -210,9 +210,9 @@ final class Facade
$functionObject = $report->getFunctionObject($function['functionName']);
$functionObject->setSignature($function['signature']);
$functionObject->setLines($function['startLine']);
$functionObject->setLines((string) $function['startLine']);
$functionObject->setCrap($function['crap']);
$functionObject->setTotals($function['executableLines'], $function['executedLines'], $function['coverage']);
$functionObject->setTotals((string) $function['executableLines'], (string) $function['executedLines'], (string) $function['coverage']);
}
private function processTests(array $tests): void

View File

@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
/*
* This file is part of the php-code-coverage package.
*

View File

@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
/*
* This file is part of the php-code-coverage package.
*

View File

@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
/*
* This file is part of the php-code-coverage package.
*

View File

@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
/*
* This file is part of the php-code-coverage package.
*

View File

@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
/*
* This file is part of the php-code-coverage package.
*

View File

@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
/*
* This file is part of the php-code-coverage package.
*

View File

@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
/*
* This file is part of the php-code-coverage package.
*
@@ -40,7 +40,7 @@ final class Tests
$node->setAttribute('name', $test);
$node->setAttribute('size', $result['size']);
$node->setAttribute('result', (int) $result['status']);
$node->setAttribute('result', (string) $result['status']);
$node->setAttribute('status', $this->codeMap[(int) $result['status']]);
}
}

View File

@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
/*
* This file is part of the php-code-coverage package.
*
@@ -87,54 +87,54 @@ final class Totals
public function setNumLines(int $loc, int $cloc, int $ncloc, int $executable, int $executed): void
{
$this->linesNode->setAttribute('total', $loc);
$this->linesNode->setAttribute('comments', $cloc);
$this->linesNode->setAttribute('code', $ncloc);
$this->linesNode->setAttribute('executable', $executable);
$this->linesNode->setAttribute('executed', $executed);
$this->linesNode->setAttribute('total', (string) $loc);
$this->linesNode->setAttribute('comments', (string) $cloc);
$this->linesNode->setAttribute('code', (string) $ncloc);
$this->linesNode->setAttribute('executable', (string) $executable);
$this->linesNode->setAttribute('executed', (string) $executed);
$this->linesNode->setAttribute(
'percent',
$executable === 0 ? 0 : \sprintf('%01.2F', Util::percent($executed, $executable))
$executable === 0 ? '0' : \sprintf('%01.2F', Util::percent($executed, $executable))
);
}
public function setNumClasses(int $count, int $tested): void
{
$this->classesNode->setAttribute('count', $count);
$this->classesNode->setAttribute('tested', $tested);
$this->classesNode->setAttribute('count', (string) $count);
$this->classesNode->setAttribute('tested', (string) $tested);
$this->classesNode->setAttribute(
'percent',
$count === 0 ? 0 : \sprintf('%01.2F', Util::percent($tested, $count))
$count === 0 ? '0' : \sprintf('%01.2F', Util::percent($tested, $count))
);
}
public function setNumTraits(int $count, int $tested): void
{
$this->traitsNode->setAttribute('count', $count);
$this->traitsNode->setAttribute('tested', $tested);
$this->traitsNode->setAttribute('count', (string) $count);
$this->traitsNode->setAttribute('tested', (string) $tested);
$this->traitsNode->setAttribute(
'percent',
$count === 0 ? 0 : \sprintf('%01.2F', Util::percent($tested, $count))
$count === 0 ? '0' : \sprintf('%01.2F', Util::percent($tested, $count))
);
}
public function setNumMethods(int $count, int $tested): void
{
$this->methodsNode->setAttribute('count', $count);
$this->methodsNode->setAttribute('tested', $tested);
$this->methodsNode->setAttribute('count', (string) $count);
$this->methodsNode->setAttribute('tested', (string) $tested);
$this->methodsNode->setAttribute(
'percent',
$count === 0 ? 0 : \sprintf('%01.2F', Util::percent($tested, $count))
$count === 0 ? '0' : \sprintf('%01.2F', Util::percent($tested, $count))
);
}
public function setNumFunctions(int $count, int $tested): void
{
$this->functionsNode->setAttribute('count', $count);
$this->functionsNode->setAttribute('tested', $tested);
$this->functionsNode->setAttribute('count', (string) $count);
$this->functionsNode->setAttribute('tested', (string) $tested);
$this->functionsNode->setAttribute(
'percent',
$count === 0 ? 0 : \sprintf('%01.2F', Util::percent($tested, $count))
$count === 0 ? '0' : \sprintf('%01.2F', Util::percent($tested, $count))
);
}
}

View File

@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
/*
* This file is part of the php-code-coverage package.
*
@@ -25,14 +25,14 @@ final class Unit
public function setLines(int $start, int $executable, int $executed): void
{
$this->contextNode->setAttribute('start', $start);
$this->contextNode->setAttribute('executable', $executable);
$this->contextNode->setAttribute('executed', $executed);
$this->contextNode->setAttribute('start', (string) $start);
$this->contextNode->setAttribute('executable', (string) $executable);
$this->contextNode->setAttribute('executed', (string) $executed);
}
public function setCrap(float $crap): void
{
$this->contextNode->setAttribute('crap', $crap);
$this->contextNode->setAttribute('crap', (string) $crap);
}
public function setPackage(string $full, string $package, string $sub, string $category): void

View File

@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
/*
* This file is part of the php-code-coverage package.
*

View File

@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
/*
* This file is part of the php-code-coverage package.
*
@@ -21,7 +21,7 @@ final class Version
public static function id(): string
{
if (self::$version === null) {
$version = new VersionId('6.1.4', \dirname(__DIR__));
$version = new VersionId('7.0.15', \dirname(__DIR__));
self::$version = $version->getVersion();
}

View File

@@ -11,17 +11,13 @@
namespace SebastianBergmann\CodeCoverage;
use SebastianBergmann\CodeCoverage\Driver\Driver;
use SebastianBergmann\CodeCoverage\Report\Xml\Coverage;
/**
* Abstract base class for test case classes.
*
* @since Class available since Release 1.0.0
*/
abstract class TestCase extends \PHPUnit\Framework\TestCase
{
protected static $TEST_TMP_PATH;
public static function setUpBeforeClass()
public static function setUpBeforeClass(): void
{
self::$TEST_TMP_PATH = TEST_FILES_PATH . 'tmp';
}
@@ -78,10 +74,9 @@ abstract class TestCase extends \PHPUnit\Framework\TestCase
];
}
protected function getCoverageForBankAccount()
protected function getCoverageForBankAccount(): CodeCoverage
{
$data = $this->getXdebugDataForBankAccount();
require_once TEST_FILES_PATH . '/BankAccountTest.php';
$stub = $this->createMock(Driver::class);
@@ -145,7 +140,7 @@ abstract class TestCase extends \PHPUnit\Framework\TestCase
return $coverage;
}
protected function getCoverageForBankAccountForFirstTwoTests()
protected function getCoverageForBankAccountForFirstTwoTests(): CodeCoverage
{
$data = $this->getXdebugDataForBankAccount();
@@ -230,7 +225,7 @@ abstract class TestCase extends \PHPUnit\Framework\TestCase
return $coverage;
}
protected function getExpectedDataArrayForBankAccount()
protected function getExpectedDataArrayForBankAccount(): array
{
return [
TEST_FILES_PATH . 'BankAccount.php' => [
@@ -264,7 +259,7 @@ abstract class TestCase extends \PHPUnit\Framework\TestCase
];
}
protected function getExpectedDataArrayForBankAccountInReverseOrder()
protected function getExpectedDataArrayForBankAccountInReverseOrder(): array
{
return [
TEST_FILES_PATH . 'BankAccount.php' => [
@@ -298,7 +293,7 @@ abstract class TestCase extends \PHPUnit\Framework\TestCase
];
}
protected function getCoverageForFileWithIgnoredLines()
protected function getCoverageForFileWithIgnoredLines(): CodeCoverage
{
$filter = new Filter;
$filter->addFileToWhitelist(TEST_FILES_PATH . 'source_with_ignore.php');
@@ -314,7 +309,7 @@ abstract class TestCase extends \PHPUnit\Framework\TestCase
return $coverage;
}
protected function setUpXdebugStubForFileWithIgnoredLines()
protected function setUpXdebugStubForFileWithIgnoredLines(): Driver
{
$stub = $this->createMock(Driver::class);
@@ -334,7 +329,7 @@ abstract class TestCase extends \PHPUnit\Framework\TestCase
return $stub;
}
protected function getCoverageForClassWithAnonymousFunction()
protected function getCoverageForClassWithAnonymousFunction(): CodeCoverage
{
$filter = new Filter;
$filter->addFileToWhitelist(TEST_FILES_PATH . 'source_with_class_and_anonymous_function.php');
@@ -350,7 +345,7 @@ abstract class TestCase extends \PHPUnit\Framework\TestCase
return $coverage;
}
protected function setUpXdebugStubForClassWithAnonymousFunction()
protected function setUpXdebugStubForClassWithAnonymousFunction(): Driver
{
$stub = $this->createMock(Driver::class);
@@ -375,7 +370,7 @@ abstract class TestCase extends \PHPUnit\Framework\TestCase
return $stub;
}
protected function getCoverageForCrashParsing()
protected function getCoverageForCrashParsing(): CodeCoverage
{
$filter = new Filter;
$filter->addFileToWhitelist(TEST_FILES_PATH . 'Crash.php');
@@ -387,7 +382,7 @@ abstract class TestCase extends \PHPUnit\Framework\TestCase
);
}
protected function setUpXdebugStubForCrashParsing()
protected function setUpXdebugStubForCrashParsing(): Driver
{
$stub = $this->createMock(Driver::class);

View File

@@ -7,7 +7,7 @@
</class>
<line num="6" type="method" name="getBalance" visibility="public" complexity="1" crap="1" count="2"/>
<line num="8" type="stmt" count="2"/>
<line num="11" type="method" name="setBalance" visibility="protected" complexity="2" crap="6.00" count="0"/>
<line num="11" type="method" name="setBalance" visibility="protected" complexity="2" crap="6" count="0"/>
<line num="13" type="stmt" count="0"/>
<line num="14" type="stmt" count="0"/>
<line num="15" type="stmt" count="0"/>

View File

@@ -1,13 +1,11 @@
<?php
require_once 'BankAccount.php';
use PHPUnit\Framework\TestCase;
class BankAccountTest extends TestCase
{
protected $ba;
protected function setUp()
protected function setUp(): void
{
$this->ba = new BankAccount;
}

View File

@@ -4,10 +4,10 @@
<meta charset="UTF-8">
<title>Code Coverage for %s%eBankAccount.php</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href=".css/bootstrap.min.css" rel="stylesheet" type="text/css">
<link href=".css/octicons.css" rel="stylesheet" type="text/css">
<link href=".css/style.css" rel="stylesheet" type="text/css">
<link href=".css/custom.css" rel="stylesheet" type="text/css">
<link href="_css/bootstrap.min.css" rel="stylesheet" type="text/css">
<link href="_css/octicons.css" rel="stylesheet" type="text/css">
<link href="_css/style.css" rel="stylesheet" type="text/css">
<link href="_css/custom.css" rel="stylesheet" type="text/css">
</head>
<body>
<header>
@@ -130,7 +130,7 @@
</td>
<td class="danger small"><div align="right">0.00%</div></td>
<td class="danger small"><div align="right">0&nbsp;/&nbsp;1</div></td>
<td class="danger small">6.00</td>
<td class="danger small">6</td>
<td class="danger big"> <div class="progress">
<div class="progress-bar bg-danger" role="progressbar" aria-valuenow="0.00" aria-valuemin="0" aria-valuemax="100" style="width: 0.00%">
<span class="sr-only">0.00% covered (danger)</span>
@@ -196,7 +196,7 @@
<tr><td><div align="right"><a name="5"></a><a href="#5">5</a></div></td><td class="codeLine"></td></tr>
<tr><td><div align="right"><a name="6"></a><a href="#6">6</a></div></td><td class="codeLine"><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">public</span><span class="default">&nbsp;</span><span class="keyword">function</span><span class="default">&nbsp;</span><span class="default">getBalance</span><span class="keyword">(</span><span class="keyword">)</span></td></tr>
<tr><td><div align="right"><a name="7"></a><a href="#7">7</a></div></td><td class="codeLine"><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">{</span></td></tr>
<tr class="covered-by-large-tests popin" data-title="2 tests cover line 8" data-content="&lt;ul&gt;&lt;li&gt;BankAccountTest::testBalanceIsInitiallyZero&lt;/li&gt;&lt;li&gt;BankAccountTest::testDepositWithdrawMoney&lt;/li&gt;&lt;/ul&gt;" data-placement="bottom" data-html="true"><td><div align="right"><a name="8"></a><a href="#8">8</a></div></td><td class="codeLine"><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">return</span><span class="default">&nbsp;</span><span class="default">$this</span><span class="default">-&gt;</span><span class="default">balance</span><span class="keyword">;</span></td></tr>
<tr class="covered-by-large-tests popin"><td data-title="2 tests cover line 8" data-content="&lt;ul&gt;&lt;li&gt;BankAccountTest::testBalanceIsInitiallyZero&lt;/li&gt;&lt;li&gt;BankAccountTest::testDepositWithdrawMoney&lt;/li&gt;&lt;/ul&gt;" data-placement="top" data-html="true"><div align="right"><a name="8"></a><a href="#8">8</a></div></td><td class="codeLine"><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">return</span><span class="default">&nbsp;</span><span class="default">$this</span><span class="default">-&gt;</span><span class="default">balance</span><span class="keyword">;</span></td></tr>
<tr class="warning"><td><div align="right"><a name="9"></a><a href="#9">9</a></div></td><td class="codeLine"><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">}</span></td></tr>
<tr><td><div align="right"><a name="10"></a><a href="#10">10</a></div></td><td class="codeLine"></td></tr>
<tr><td><div align="right"><a name="11"></a><a href="#11">11</a></div></td><td class="codeLine"><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">protected</span><span class="default">&nbsp;</span><span class="keyword">function</span><span class="default">&nbsp;</span><span class="default">setBalance</span><span class="keyword">(</span><span class="default">$balance</span><span class="keyword">)</span></td></tr>
@@ -210,16 +210,16 @@
<tr><td><div align="right"><a name="19"></a><a href="#19">19</a></div></td><td class="codeLine"></td></tr>
<tr><td><div align="right"><a name="20"></a><a href="#20">20</a></div></td><td class="codeLine"><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">public</span><span class="default">&nbsp;</span><span class="keyword">function</span><span class="default">&nbsp;</span><span class="default">depositMoney</span><span class="keyword">(</span><span class="default">$balance</span><span class="keyword">)</span></td></tr>
<tr><td><div align="right"><a name="21"></a><a href="#21">21</a></div></td><td class="codeLine"><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">{</span></td></tr>
<tr class="covered-by-large-tests popin" data-title="2 tests cover line 22" data-content="&lt;ul&gt;&lt;li&gt;BankAccountTest::testBalanceCannotBecomeNegative2&lt;/li&gt;&lt;li&gt;BankAccountTest::testDepositWithdrawMoney&lt;/li&gt;&lt;/ul&gt;" data-placement="bottom" data-html="true"><td><div align="right"><a name="22"></a><a href="#22">22</a></div></td><td class="codeLine"><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="default">$this</span><span class="default">-&gt;</span><span class="default">setBalance</span><span class="keyword">(</span><span class="default">$this</span><span class="default">-&gt;</span><span class="default">getBalance</span><span class="keyword">(</span><span class="keyword">)</span><span class="default">&nbsp;</span><span class="keyword">+</span><span class="default">&nbsp;</span><span class="default">$balance</span><span class="keyword">)</span><span class="keyword">;</span></td></tr>
<tr class="covered-by-large-tests popin"><td data-title="2 tests cover line 22" data-content="&lt;ul&gt;&lt;li&gt;BankAccountTest::testBalanceCannotBecomeNegative2&lt;/li&gt;&lt;li&gt;BankAccountTest::testDepositWithdrawMoney&lt;/li&gt;&lt;/ul&gt;" data-placement="top" data-html="true"><div align="right"><a name="22"></a><a href="#22">22</a></div></td><td class="codeLine"><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="default">$this</span><span class="default">-&gt;</span><span class="default">setBalance</span><span class="keyword">(</span><span class="default">$this</span><span class="default">-&gt;</span><span class="default">getBalance</span><span class="keyword">(</span><span class="keyword">)</span><span class="default">&nbsp;</span><span class="keyword">+</span><span class="default">&nbsp;</span><span class="default">$balance</span><span class="keyword">)</span><span class="keyword">;</span></td></tr>
<tr><td><div align="right"><a name="23"></a><a href="#23">23</a></div></td><td class="codeLine"></td></tr>
<tr class="covered-by-large-tests popin" data-title="1 test covers line 24" data-content="&lt;ul&gt;&lt;li&gt;BankAccountTest::testDepositWithdrawMoney&lt;/li&gt;&lt;/ul&gt;" data-placement="bottom" data-html="true"><td><div align="right"><a name="24"></a><a href="#24">24</a></div></td><td class="codeLine"><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">return</span><span class="default">&nbsp;</span><span class="default">$this</span><span class="default">-&gt;</span><span class="default">getBalance</span><span class="keyword">(</span><span class="keyword">)</span><span class="keyword">;</span></td></tr>
<tr class="covered-by-large-tests popin"><td data-title="1 test covers line 24" data-content="&lt;ul&gt;&lt;li&gt;BankAccountTest::testDepositWithdrawMoney&lt;/li&gt;&lt;/ul&gt;" data-placement="top" data-html="true"><div align="right"><a name="24"></a><a href="#24">24</a></div></td><td class="codeLine"><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">return</span><span class="default">&nbsp;</span><span class="default">$this</span><span class="default">-&gt;</span><span class="default">getBalance</span><span class="keyword">(</span><span class="keyword">)</span><span class="keyword">;</span></td></tr>
<tr class="warning"><td><div align="right"><a name="25"></a><a href="#25">25</a></div></td><td class="codeLine"><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">}</span></td></tr>
<tr><td><div align="right"><a name="26"></a><a href="#26">26</a></div></td><td class="codeLine"></td></tr>
<tr><td><div align="right"><a name="27"></a><a href="#27">27</a></div></td><td class="codeLine"><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">public</span><span class="default">&nbsp;</span><span class="keyword">function</span><span class="default">&nbsp;</span><span class="default">withdrawMoney</span><span class="keyword">(</span><span class="default">$balance</span><span class="keyword">)</span></td></tr>
<tr><td><div align="right"><a name="28"></a><a href="#28">28</a></div></td><td class="codeLine"><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">{</span></td></tr>
<tr class="covered-by-large-tests popin" data-title="2 tests cover line 29" data-content="&lt;ul&gt;&lt;li&gt;BankAccountTest::testBalanceCannotBecomeNegative&lt;/li&gt;&lt;li&gt;BankAccountTest::testDepositWithdrawMoney&lt;/li&gt;&lt;/ul&gt;" data-placement="bottom" data-html="true"><td><div align="right"><a name="29"></a><a href="#29">29</a></div></td><td class="codeLine"><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="default">$this</span><span class="default">-&gt;</span><span class="default">setBalance</span><span class="keyword">(</span><span class="default">$this</span><span class="default">-&gt;</span><span class="default">getBalance</span><span class="keyword">(</span><span class="keyword">)</span><span class="default">&nbsp;</span><span class="keyword">-</span><span class="default">&nbsp;</span><span class="default">$balance</span><span class="keyword">)</span><span class="keyword">;</span></td></tr>
<tr class="covered-by-large-tests popin"><td data-title="2 tests cover line 29" data-content="&lt;ul&gt;&lt;li&gt;BankAccountTest::testBalanceCannotBecomeNegative&lt;/li&gt;&lt;li&gt;BankAccountTest::testDepositWithdrawMoney&lt;/li&gt;&lt;/ul&gt;" data-placement="top" data-html="true"><div align="right"><a name="29"></a><a href="#29">29</a></div></td><td class="codeLine"><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="default">$this</span><span class="default">-&gt;</span><span class="default">setBalance</span><span class="keyword">(</span><span class="default">$this</span><span class="default">-&gt;</span><span class="default">getBalance</span><span class="keyword">(</span><span class="keyword">)</span><span class="default">&nbsp;</span><span class="keyword">-</span><span class="default">&nbsp;</span><span class="default">$balance</span><span class="keyword">)</span><span class="keyword">;</span></td></tr>
<tr><td><div align="right"><a name="30"></a><a href="#30">30</a></div></td><td class="codeLine"></td></tr>
<tr class="covered-by-large-tests popin" data-title="1 test covers line 31" data-content="&lt;ul&gt;&lt;li&gt;BankAccountTest::testDepositWithdrawMoney&lt;/li&gt;&lt;/ul&gt;" data-placement="bottom" data-html="true"><td><div align="right"><a name="31"></a><a href="#31">31</a></div></td><td class="codeLine"><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">return</span><span class="default">&nbsp;</span><span class="default">$this</span><span class="default">-&gt;</span><span class="default">getBalance</span><span class="keyword">(</span><span class="keyword">)</span><span class="keyword">;</span></td></tr>
<tr class="covered-by-large-tests popin"><td data-title="1 test covers line 31" data-content="&lt;ul&gt;&lt;li&gt;BankAccountTest::testDepositWithdrawMoney&lt;/li&gt;&lt;/ul&gt;" data-placement="top" data-html="true"><div align="right"><a name="31"></a><a href="#31">31</a></div></td><td class="codeLine"><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">return</span><span class="default">&nbsp;</span><span class="default">$this</span><span class="default">-&gt;</span><span class="default">getBalance</span><span class="keyword">(</span><span class="keyword">)</span><span class="keyword">;</span></td></tr>
<tr class="warning"><td><div align="right"><a name="32"></a><a href="#32">32</a></div></td><td class="codeLine"><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">}</span></td></tr>
<tr><td><div align="right"><a name="33"></a><a href="#33">33</a></div></td><td class="codeLine"><span class="keyword">}</span></td></tr>
@@ -241,9 +241,9 @@
</a>
</footer>
</div>
<script src=".js/jquery.min.js" type="text/javascript"></script>
<script src=".js/popper.min.js" type="text/javascript"></script>
<script src=".js/bootstrap.min.js" type="text/javascript"></script>
<script src=".js/file.js" type="text/javascript"></script>
<script src="_js/jquery.min.js" type="text/javascript"></script>
<script src="_js/popper.min.js" type="text/javascript"></script>
<script src="_js/bootstrap.min.js" type="text/javascript"></script>
<script src="_js/file.js" type="text/javascript"></script>
</body>
</html>

View File

@@ -4,10 +4,10 @@
<meta charset="UTF-8">
<title>Dashboard for %s</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href=".css/bootstrap.min.css" rel="stylesheet" type="text/css">
<link href=".css/nv.d3.min.css" rel="stylesheet" type="text/css">
<link href=".css/style.css" rel="stylesheet" type="text/css">
<link href=".css/custom.css" rel="stylesheet" type="text/css">
<link href="_css/bootstrap.min.css" rel="stylesheet" type="text/css">
<link href="_css/nv.d3.min.css" rel="stylesheet" type="text/css">
<link href="_css/style.css" rel="stylesheet" type="text/css">
<link href="_css/custom.css" rel="stylesheet" type="text/css">
</head>
<body>
<header>
@@ -143,9 +143,9 @@
</p>
</footer>
</div>
<script src=".js/jquery.min.js" type="text/javascript"></script>
<script src=".js/d3.min.js" type="text/javascript"></script>
<script src=".js/nv.d3.min.js" type="text/javascript"></script>
<script src="_js/jquery.min.js" type="text/javascript"></script>
<script src="_js/d3.min.js" type="text/javascript"></script>
<script src="_js/nv.d3.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function() {
nv.addGraph(function() {

View File

@@ -4,10 +4,10 @@
<meta charset="UTF-8">
<title>Code Coverage for %s</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href=".css/bootstrap.min.css" rel="stylesheet" type="text/css">
<link href=".css/octicons.css" rel="stylesheet" type="text/css">
<link href=".css/style.css" rel="stylesheet" type="text/css">
<link href=".css/custom.css" rel="stylesheet" type="text/css">
<link href="_css/bootstrap.min.css" rel="stylesheet" type="text/css">
<link href="_css/octicons.css" rel="stylesheet" type="text/css">
<link href="_css/style.css" rel="stylesheet" type="text/css">
<link href="_css/custom.css" rel="stylesheet" type="text/css">
</head>
<body>
<header>
@@ -70,7 +70,7 @@
</tr>
<tr>
<td class="danger"><img src=".icons/file-code.svg" class="octicon" /><a href="BankAccount.php.html">BankAccount.php</a></td>
<td class="danger"><img src="_icons/file-code.svg" class="octicon" /><a href="BankAccount.php.html">BankAccount.php</a></td>
<td class="danger big"> <div class="progress">
<div class="progress-bar bg-danger" role="progressbar" aria-valuenow="50.00" aria-valuemin="0" aria-valuemax="100" style="width: 50.00%">
<span class="sr-only">50.00% covered (danger)</span>

View File

@@ -4,10 +4,10 @@
<meta charset="UTF-8">
<title>Dashboard for %s</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href=".css/bootstrap.min.css" rel="stylesheet" type="text/css">
<link href=".css/nv.d3.min.css" rel="stylesheet" type="text/css">
<link href=".css/style.css" rel="stylesheet" type="text/css">
<link href=".css/custom.css" rel="stylesheet" type="text/css">
<link href="_css/bootstrap.min.css" rel="stylesheet" type="text/css">
<link href="_css/nv.d3.min.css" rel="stylesheet" type="text/css">
<link href="_css/style.css" rel="stylesheet" type="text/css">
<link href="_css/custom.css" rel="stylesheet" type="text/css">
</head>
<body>
<header>
@@ -141,9 +141,9 @@
</p>
</footer>
</div>
<script src=".js/jquery.min.js" type="text/javascript"></script>
<script src=".js/d3.min.js" type="text/javascript"></script>
<script src=".js/nv.d3.min.js" type="text/javascript"></script>
<script src="_js/jquery.min.js" type="text/javascript"></script>
<script src="_js/d3.min.js" type="text/javascript"></script>
<script src="_js/nv.d3.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function() {
nv.addGraph(function() {

View File

@@ -4,10 +4,10 @@
<meta charset="UTF-8">
<title>Code Coverage for %s</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href=".css/bootstrap.min.css" rel="stylesheet" type="text/css">
<link href=".css/octicons.css" rel="stylesheet" type="text/css">
<link href=".css/style.css" rel="stylesheet" type="text/css">
<link href=".css/custom.css" rel="stylesheet" type="text/css">
<link href="_css/bootstrap.min.css" rel="stylesheet" type="text/css">
<link href="_css/octicons.css" rel="stylesheet" type="text/css">
<link href="_css/style.css" rel="stylesheet" type="text/css">
<link href="_css/custom.css" rel="stylesheet" type="text/css">
</head>
<body>
<header>
@@ -70,7 +70,7 @@
</tr>
<tr>
<td class="warning"><img src=".icons/file-code.svg" class="octicon" /><a href="source_with_class_and_anonymous_function.php.html">source_with_class_and_anonymous_function.php</a></td>
<td class="warning"><img src="_icons/file-code.svg" class="octicon" /><a href="source_with_class_and_anonymous_function.php.html">source_with_class_and_anonymous_function.php</a></td>
<td class="warning big"> <div class="progress">
<div class="progress-bar bg-warning" role="progressbar" aria-valuenow="87.50" aria-valuemin="0" aria-valuemax="100" style="width: 87.50%">
<span class="sr-only">87.50% covered (warning)</span>

View File

@@ -4,10 +4,10 @@
<meta charset="UTF-8">
<title>Code Coverage for %s%esource_with_class_and_anonymous_function.php</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href=".css/bootstrap.min.css" rel="stylesheet" type="text/css">
<link href=".css/octicons.css" rel="stylesheet" type="text/css">
<link href=".css/style.css" rel="stylesheet" type="text/css">
<link href=".css/custom.css" rel="stylesheet" type="text/css">
<link href="_css/bootstrap.min.css" rel="stylesheet" type="text/css">
<link href="_css/octicons.css" rel="stylesheet" type="text/css">
<link href="_css/style.css" rel="stylesheet" type="text/css">
<link href="_css/custom.css" rel="stylesheet" type="text/css">
</head>
<body>
<header>
@@ -132,18 +132,18 @@
<tr><td><div align="right"><a name="4"></a><a href="#4">4</a></div></td><td class="codeLine"><span class="keyword">{</span></td></tr>
<tr><td><div align="right"><a name="5"></a><a href="#5">5</a></div></td><td class="codeLine"><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">public</span><span class="default">&nbsp;</span><span class="keyword">static</span><span class="default">&nbsp;</span><span class="keyword">function</span><span class="default">&nbsp;</span><span class="default">runAnonymous</span><span class="keyword">(</span><span class="keyword">)</span></td></tr>
<tr><td><div align="right"><a name="6"></a><a href="#6">6</a></div></td><td class="codeLine"><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">{</span></td></tr>
<tr class="covered-by-large-tests popin" data-title="1 test covers line 7" data-content="&lt;ul&gt;&lt;li&gt;ClassWithAnonymousFunction&lt;/li&gt;&lt;/ul&gt;" data-placement="bottom" data-html="true"><td><div align="right"><a name="7"></a><a href="#7">7</a></div></td><td class="codeLine"><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="default">$filter</span><span class="default">&nbsp;</span><span class="keyword">=</span><span class="default">&nbsp;</span><span class="keyword">[</span><span class="default">'abc124'</span><span class="keyword">,</span><span class="default">&nbsp;</span><span class="default">'abc123'</span><span class="keyword">,</span><span class="default">&nbsp;</span><span class="default">'123'</span><span class="keyword">]</span><span class="keyword">;</span></td></tr>
<tr class="covered-by-large-tests popin"><td data-title="1 test covers line 7" data-content="&lt;ul&gt;&lt;li&gt;ClassWithAnonymousFunction&lt;/li&gt;&lt;/ul&gt;" data-placement="top" data-html="true"><div align="right"><a name="7"></a><a href="#7">7</a></div></td><td class="codeLine"><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="default">$filter</span><span class="default">&nbsp;</span><span class="keyword">=</span><span class="default">&nbsp;</span><span class="keyword">[</span><span class="default">'abc124'</span><span class="keyword">,</span><span class="default">&nbsp;</span><span class="default">'abc123'</span><span class="keyword">,</span><span class="default">&nbsp;</span><span class="default">'123'</span><span class="keyword">]</span><span class="keyword">;</span></td></tr>
<tr><td><div align="right"><a name="8"></a><a href="#8">8</a></div></td><td class="codeLine"></td></tr>
<tr class="covered-by-large-tests popin" data-title="1 test covers line 9" data-content="&lt;ul&gt;&lt;li&gt;ClassWithAnonymousFunction&lt;/li&gt;&lt;/ul&gt;" data-placement="bottom" data-html="true"><td><div align="right"><a name="9"></a><a href="#9">9</a></div></td><td class="codeLine"><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="default">array_walk</span><span class="keyword">(</span></td></tr>
<tr class="covered-by-large-tests popin"><td data-title="1 test covers line 9" data-content="&lt;ul&gt;&lt;li&gt;ClassWithAnonymousFunction&lt;/li&gt;&lt;/ul&gt;" data-placement="top" data-html="true"><div align="right"><a name="9"></a><a href="#9">9</a></div></td><td class="codeLine"><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="default">array_walk</span><span class="keyword">(</span></td></tr>
<tr class="danger"><td><div align="right"><a name="10"></a><a href="#10">10</a></div></td><td class="codeLine"><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="default">$filter</span><span class="keyword">,</span></td></tr>
<tr><td><div align="right"><a name="11"></a><a href="#11">11</a></div></td><td class="codeLine"><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">function</span><span class="default">&nbsp;</span><span class="keyword">(</span><span class="keyword">&amp;</span><span class="default">$val</span><span class="keyword">,</span><span class="default">&nbsp;</span><span class="default">$key</span><span class="keyword">)</span><span class="default">&nbsp;</span><span class="keyword">{</span></td></tr>
<tr class="covered-by-large-tests popin" data-title="1 test covers line 12" data-content="&lt;ul&gt;&lt;li&gt;ClassWithAnonymousFunction&lt;/li&gt;&lt;/ul&gt;" data-placement="bottom" data-html="true"><td><div align="right"><a name="12"></a><a href="#12">12</a></div></td><td class="codeLine"><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="default">$val</span><span class="default">&nbsp;</span><span class="keyword">=</span><span class="default">&nbsp;</span><span class="default">preg_replace</span><span class="keyword">(</span><span class="default">'|[^0-9]|'</span><span class="keyword">,</span><span class="default">&nbsp;</span><span class="default">''</span><span class="keyword">,</span><span class="default">&nbsp;</span><span class="default">$val</span><span class="keyword">)</span><span class="keyword">;</span></td></tr>
<tr class="covered-by-large-tests popin" data-title="1 test covers line 13" data-content="&lt;ul&gt;&lt;li&gt;ClassWithAnonymousFunction&lt;/li&gt;&lt;/ul&gt;" data-placement="bottom" data-html="true"><td><div align="right"><a name="13"></a><a href="#13">13</a></div></td><td class="codeLine"><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">}</span></td></tr>
<tr class="covered-by-large-tests popin" data-title="1 test covers line 14" data-content="&lt;ul&gt;&lt;li&gt;ClassWithAnonymousFunction&lt;/li&gt;&lt;/ul&gt;" data-placement="bottom" data-html="true"><td><div align="right"><a name="14"></a><a href="#14">14</a></div></td><td class="codeLine"><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">)</span><span class="keyword">;</span></td></tr>
<tr class="covered-by-large-tests popin"><td data-title="1 test covers line 12" data-content="&lt;ul&gt;&lt;li&gt;ClassWithAnonymousFunction&lt;/li&gt;&lt;/ul&gt;" data-placement="top" data-html="true"><div align="right"><a name="12"></a><a href="#12">12</a></div></td><td class="codeLine"><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="default">$val</span><span class="default">&nbsp;</span><span class="keyword">=</span><span class="default">&nbsp;</span><span class="default">preg_replace</span><span class="keyword">(</span><span class="default">'|[^0-9]|'</span><span class="keyword">,</span><span class="default">&nbsp;</span><span class="default">''</span><span class="keyword">,</span><span class="default">&nbsp;</span><span class="default">$val</span><span class="keyword">)</span><span class="keyword">;</span></td></tr>
<tr class="covered-by-large-tests popin"><td data-title="1 test covers line 13" data-content="&lt;ul&gt;&lt;li&gt;ClassWithAnonymousFunction&lt;/li&gt;&lt;/ul&gt;" data-placement="top" data-html="true"><div align="right"><a name="13"></a><a href="#13">13</a></div></td><td class="codeLine"><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">}</span></td></tr>
<tr class="covered-by-large-tests popin"><td data-title="1 test covers line 14" data-content="&lt;ul&gt;&lt;li&gt;ClassWithAnonymousFunction&lt;/li&gt;&lt;/ul&gt;" data-placement="top" data-html="true"><div align="right"><a name="14"></a><a href="#14">14</a></div></td><td class="codeLine"><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">)</span><span class="keyword">;</span></td></tr>
<tr><td><div align="right"><a name="15"></a><a href="#15">15</a></div></td><td class="codeLine"></td></tr>
<tr><td><div align="right"><a name="16"></a><a href="#16">16</a></div></td><td class="codeLine"><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="comment">//&nbsp;Should&nbsp;be&nbsp;covered</span></td></tr>
<tr class="covered-by-large-tests popin" data-title="1 test covers line 17" data-content="&lt;ul&gt;&lt;li&gt;ClassWithAnonymousFunction&lt;/li&gt;&lt;/ul&gt;" data-placement="bottom" data-html="true"><td><div align="right"><a name="17"></a><a href="#17">17</a></div></td><td class="codeLine"><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="default">$extravar</span><span class="default">&nbsp;</span><span class="keyword">=</span><span class="default">&nbsp;</span><span class="default">true</span><span class="keyword">;</span></td></tr>
<tr class="covered-by-large-tests popin" data-title="1 test covers line 18" data-content="&lt;ul&gt;&lt;li&gt;ClassWithAnonymousFunction&lt;/li&gt;&lt;/ul&gt;" data-placement="bottom" data-html="true"><td><div align="right"><a name="18"></a><a href="#18">18</a></div></td><td class="codeLine"><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">}</span></td></tr>
<tr class="covered-by-large-tests popin"><td data-title="1 test covers line 17" data-content="&lt;ul&gt;&lt;li&gt;ClassWithAnonymousFunction&lt;/li&gt;&lt;/ul&gt;" data-placement="top" data-html="true"><div align="right"><a name="17"></a><a href="#17">17</a></div></td><td class="codeLine"><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="default">$extravar</span><span class="default">&nbsp;</span><span class="keyword">=</span><span class="default">&nbsp;</span><span class="default">true</span><span class="keyword">;</span></td></tr>
<tr class="covered-by-large-tests popin"><td data-title="1 test covers line 18" data-content="&lt;ul&gt;&lt;li&gt;ClassWithAnonymousFunction&lt;/li&gt;&lt;/ul&gt;" data-placement="top" data-html="true"><div align="right"><a name="18"></a><a href="#18">18</a></div></td><td class="codeLine"><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="keyword">}</span></td></tr>
<tr><td><div align="right"><a name="19"></a><a href="#19">19</a></div></td><td class="codeLine"><span class="keyword">}</span></td></tr>
</tbody>
@@ -164,9 +164,9 @@
</a>
</footer>
</div>
<script src=".js/jquery.min.js" type="text/javascript"></script>
<script src=".js/popper.min.js" type="text/javascript"></script>
<script src=".js/bootstrap.min.js" type="text/javascript"></script>
<script src=".js/file.js" type="text/javascript"></script>
<script src="_js/jquery.min.js" type="text/javascript"></script>
<script src="_js/popper.min.js" type="text/javascript"></script>
<script src="_js/bootstrap.min.js" type="text/javascript"></script>
<script src="_js/file.js" type="text/javascript"></script>
</body>
</html>

View File

@@ -4,10 +4,10 @@
<meta charset="UTF-8">
<title>Dashboard for %s</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href=".css/bootstrap.min.css" rel="stylesheet" type="text/css">
<link href=".css/nv.d3.min.css" rel="stylesheet" type="text/css">
<link href=".css/style.css" rel="stylesheet" type="text/css">
<link href=".css/custom.css" rel="stylesheet" type="text/css">
<link href="_css/bootstrap.min.css" rel="stylesheet" type="text/css">
<link href="_css/nv.d3.min.css" rel="stylesheet" type="text/css">
<link href="_css/style.css" rel="stylesheet" type="text/css">
<link href="_css/custom.css" rel="stylesheet" type="text/css">
</head>
<body>
<header>
@@ -139,9 +139,9 @@
</p>
</footer>
</div>
<script src=".js/jquery.min.js" type="text/javascript"></script>
<script src=".js/d3.min.js" type="text/javascript"></script>
<script src=".js/nv.d3.min.js" type="text/javascript"></script>
<script src="_js/jquery.min.js" type="text/javascript"></script>
<script src="_js/d3.min.js" type="text/javascript"></script>
<script src="_js/nv.d3.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function() {
nv.addGraph(function() {

View File

@@ -4,10 +4,10 @@
<meta charset="UTF-8">
<title>Code Coverage for %s</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href=".css/bootstrap.min.css" rel="stylesheet" type="text/css">
<link href=".css/octicons.css" rel="stylesheet" type="text/css">
<link href=".css/style.css" rel="stylesheet" type="text/css">
<link href=".css/custom.css" rel="stylesheet" type="text/css">
<link href="_css/bootstrap.min.css" rel="stylesheet" type="text/css">
<link href="_css/octicons.css" rel="stylesheet" type="text/css">
<link href="_css/style.css" rel="stylesheet" type="text/css">
<link href="_css/custom.css" rel="stylesheet" type="text/css">
</head>
<body>
<header>
@@ -65,7 +65,7 @@
</tr>
<tr>
<td class="danger"><img src=".icons/file-code.svg" class="octicon" /><a href="source_with_ignore.php.html">source_with_ignore.php</a></td>
<td class="danger"><img src="_icons/file-code.svg" class="octicon" /><a href="source_with_ignore.php.html">source_with_ignore.php</a></td>
<td class="danger big"> <div class="progress">
<div class="progress-bar bg-danger" role="progressbar" aria-valuenow="50.00" aria-valuemin="0" aria-valuemax="100" style="width: 50.00%">
<span class="sr-only">50.00% covered (danger)</span>

View File

@@ -2,12 +2,12 @@
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Code Coverage for %s/source_with_ignore.php</title>
<title>Code Coverage for %s%esource_with_ignore.php</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href=".css/bootstrap.min.css" rel="stylesheet" type="text/css">
<link href=".css/octicons.css" rel="stylesheet" type="text/css">
<link href=".css/style.css" rel="stylesheet" type="text/css">
<link href=".css/custom.css" rel="stylesheet" type="text/css">
<link href="_css/bootstrap.min.css" rel="stylesheet" type="text/css">
<link href="_css/octicons.css" rel="stylesheet" type="text/css">
<link href="_css/style.css" rel="stylesheet" type="text/css">
<link href="_css/custom.css" rel="stylesheet" type="text/css">
</head>
<body>
<header>
@@ -133,7 +133,7 @@
<table id="code" class="table table-borderless table-condensed">
<tbody>
<tr><td><div align="right"><a name="1"></a><a href="#1">1</a></div></td><td class="codeLine"><span class="default">&lt;?php</span></td></tr>
<tr class="covered-by-large-tests popin" data-title="1 test covers line 2" data-content="&lt;ul&gt;&lt;li&gt;FileWithIgnoredLines&lt;/li&gt;&lt;/ul&gt;" data-placement="bottom" data-html="true"><td><div align="right"><a name="2"></a><a href="#2">2</a></div></td><td class="codeLine"><span class="keyword">if</span><span class="default">&nbsp;</span><span class="keyword">(</span><span class="default">$neverHappens</span><span class="keyword">)</span><span class="default">&nbsp;</span><span class="keyword">{</span></td></tr>
<tr class="covered-by-large-tests popin"><td data-title="1 test covers line 2" data-content="&lt;ul&gt;&lt;li&gt;FileWithIgnoredLines&lt;/li&gt;&lt;/ul&gt;" data-placement="top" data-html="true"><div align="right"><a name="2"></a><a href="#2">2</a></div></td><td class="codeLine"><span class="keyword">if</span><span class="default">&nbsp;</span><span class="keyword">(</span><span class="default">$neverHappens</span><span class="keyword">)</span><span class="default">&nbsp;</span><span class="keyword">{</span></td></tr>
<tr><td><div align="right"><a name="3"></a><a href="#3">3</a></div></td><td class="codeLine"><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="comment">//&nbsp;@codeCoverageIgnoreStart</span></td></tr>
<tr><td><div align="right"><a name="4"></a><a href="#4">4</a></div></td><td class="codeLine"><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="default">print</span><span class="default">&nbsp;</span><span class="default">'*'</span><span class="keyword">;</span></td></tr>
<tr><td><div align="right"><a name="5"></a><a href="#5">5</a></div></td><td class="codeLine"><span class="default">&nbsp;&nbsp;&nbsp;&nbsp;</span><span class="comment">//&nbsp;@codeCoverageIgnoreEnd</span></td></tr>
@@ -188,9 +188,9 @@
</a>
</footer>
</div>
<script src=".js/jquery.min.js" type="text/javascript"></script>
<script src=".js/popper.min.js" type="text/javascript"></script>
<script src=".js/bootstrap.min.js" type="text/javascript"></script>
<script src=".js/file.js" type="text/javascript"></script>
<script src="_js/jquery.min.js" type="text/javascript"></script>
<script src="_js/popper.min.js" type="text/javascript"></script>
<script src="_js/bootstrap.min.js" type="text/javascript"></script>
<script src="_js/file.js" type="text/javascript"></script>
</body>
</html>

View File

@@ -12,7 +12,7 @@
<package full="" name="" sub="" category=""/>
<namespace name=""/>
<method name="getBalance" signature="getBalance()" start="6" end="9" crap="1" executable="1" executed="1" coverage="100"/>
<method name="setBalance" signature="setBalance($balance)" start="11" end="18" crap="6.00" executable="5" executed="0" coverage="0"/>
<method name="setBalance" signature="setBalance($balance)" start="11" end="18" crap="6" executable="5" executed="0" coverage="0"/>
<method name="depositMoney" signature="depositMoney($balance)" start="20" end="25" crap="1" executable="2" executed="2" coverage="100"/>
<method name="withdrawMoney" signature="withdrawMoney($balance)" start="27" end="32" crap="1" executable="2" executed="2" coverage="100"/>
</class>

View File

@@ -2,7 +2,7 @@
<phpunit xmlns="https://schema.phpunit.de/coverage/1.0">
<build time="%s" phpunit="%s" coverage="%s">
<runtime name="%s" version="%s" url="%s"/>
<driver name="%s" version="%s"/>
<driver%S/>
</build>
<project source="%s">
<tests>

View File

@@ -2,7 +2,7 @@
<phpunit xmlns="https://schema.phpunit.de/coverage/1.0">
<build time="%s" phpunit="%s" coverage="%s">
<runtime name="%s" version="%s" url="%s"/>
<driver name="%s" version="%s"/>
<driver%S/>
</build>
<project source="%s">
<tests>

View File

@@ -2,7 +2,7 @@
<phpunit xmlns="https://schema.phpunit.de/coverage/1.0">
<build time="%s" phpunit="%s" coverage="%s">
<runtime name="%s" version="%s" url="%s"/>
<driver name="%s" version="%s"/>
<driver%S/>
</build>
<project source="%s">
<tests>

View File

@@ -0,0 +1,23 @@
<?php
namespace SebastianBergmann\CodeCoverage\TestFixture;
use stdClass;
use function array_filter;
use const ARRAY_FILTER_USE_BOTH;
class C
{
public function m(): void
{
$o = new stdClass;
array_filter(
['a' => 1, 'b' => 2, 'c' => 3, 'd' => 4],
static function ($v, $k)
{
return $k === 'b' || $v === 4;
},
ARRAY_FILTER_USE_BOTH
);
}
}

View File

@@ -1,6 +1,5 @@
<?php
require __DIR__ . '/../vendor/autoload.php';
require __DIR__ . '/TestCase.php';
define(
'TEST_FILES_PATH',

View File

@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
/*
* This file is part of the php-code-coverage package.
*
@@ -7,29 +7,25 @@
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace SebastianBergmann\CodeCoverage\Report;
use SebastianBergmann\CodeCoverage\Driver\Driver;
use SebastianBergmann\CodeCoverage\CodeCoverage;
use SebastianBergmann\CodeCoverage\Filter;
use SebastianBergmann\CodeCoverage\TestCase;
use SebastianBergmann\CodeCoverage\Node\Builder;
use SebastianBergmann\CodeCoverage\TestCase;
class BuilderTest extends TestCase
{
protected $factory;
protected function setUp()
protected function setUp(): void
{
$this->factory = new Builder;
}
public function testSomething()
public function testSomething(): void
{
$root = $this->getCoverageForBankAccount()->getReport();
$expectedPath = rtrim(TEST_FILES_PATH, DIRECTORY_SEPARATOR);
$expectedPath = \rtrim(TEST_FILES_PATH, \DIRECTORY_SEPARATOR);
$this->assertEquals($expectedPath, $root->getName());
$this->assertEquals($expectedPath, $root->getPath());
$this->assertEquals(10, $root->getNumExecutableLines());
@@ -116,11 +112,11 @@ class BuilderTest extends TestCase
'fullPackage' => '',
'category' => '',
'package' => '',
'subpackage' => ''
'subpackage' => '',
],
'link' => 'BankAccount.php.html#2',
'className' => 'BankAccount'
]
'className' => 'BankAccount',
],
],
$root->getClasses()
);
@@ -128,22 +124,22 @@ class BuilderTest extends TestCase
$this->assertEquals([], $root->getFunctions());
}
public function testNotCrashParsing()
public function testNotCrashParsing(): void
{
$coverage = $this->getCoverageForCrashParsing();
$root = $coverage->getReport();
$root = $coverage->getReport();
$expectedPath = rtrim(TEST_FILES_PATH, DIRECTORY_SEPARATOR);
$expectedPath = \rtrim(TEST_FILES_PATH, \DIRECTORY_SEPARATOR);
$this->assertEquals($expectedPath, $root->getName());
$this->assertEquals($expectedPath, $root->getPath());
$this->assertEquals(2, $root->getNumExecutableLines());
$this->assertEquals(0, $root->getNumExecutedLines());
$data = $coverage->getData();
$expectedFile = $expectedPath . DIRECTORY_SEPARATOR . 'Crash.php';
$data = $coverage->getData();
$expectedFile = $expectedPath . \DIRECTORY_SEPARATOR . 'Crash.php';
$this->assertSame([$expectedFile => [1 => [], 2 => []]], $data);
}
public function testBuildDirectoryStructure()
public function testBuildDirectoryStructure(): void
{
$s = \DIRECTORY_SEPARATOR;
@@ -159,20 +155,20 @@ class BuilderTest extends TestCase
'src' => [
'Money.php/f' => [],
'MoneyBag.php/f' => [],
'Foo' => [
'Foo' => [
'Bar' => [
'Baz' => [
'Foo.php/f' => [],
],
],
],
]
],
],
$method->invoke(
$this->factory,
[
"src{$s}Money.php" => [],
"src{$s}MoneyBag.php" => [],
"src{$s}Money.php" => [],
"src{$s}MoneyBag.php" => [],
"src{$s}Foo{$s}Bar{$s}Baz{$s}Foo.php" => [],
]
)
@@ -182,7 +178,7 @@ class BuilderTest extends TestCase
/**
* @dataProvider reducePathsProvider
*/
public function testReducePaths($reducedPaths, $commonPath, $paths)
public function testReducePaths($reducedPaths, $commonPath, $paths): void
{
$method = new \ReflectionMethod(
Builder::class,
@@ -203,45 +199,45 @@ class BuilderTest extends TestCase
yield [
[],
".",
[]
'.',
[],
];
$prefixes = ["C:$s", "$s"];
foreach($prefixes as $p){
foreach ($prefixes as $p) {
yield [
[
"Money.php" => []
'Money.php' => [],
],
"{$p}home{$s}sb{$s}Money{$s}",
[
"{$p}home{$s}sb{$s}Money{$s}Money.php" => []
]
"{$p}home{$s}sb{$s}Money{$s}Money.php" => [],
],
];
yield [
[
"Money.php" => [],
"MoneyBag.php" => []
'Money.php' => [],
'MoneyBag.php' => [],
],
"{$p}home{$s}sb{$s}Money",
[
"{$p}home{$s}sb{$s}Money{$s}Money.php" => [],
"{$p}home{$s}sb{$s}Money{$s}MoneyBag.php" => []
]
"{$p}home{$s}sb{$s}Money{$s}MoneyBag.php" => [],
],
];
yield [
[
"Money.php" => [],
"MoneyBag.php" => [],
'Money.php' => [],
'MoneyBag.php' => [],
"Cash.phar{$s}Cash.php" => [],
],
"{$p}home{$s}sb{$s}Money",
[
"{$p}home{$s}sb{$s}Money{$s}Money.php" => [],
"{$p}home{$s}sb{$s}Money{$s}MoneyBag.php" => [],
"{$p}home{$s}sb{$s}Money{$s}Money.php" => [],
"{$p}home{$s}sb{$s}Money{$s}MoneyBag.php" => [],
"phar://{$p}home{$s}sb{$s}Money{$s}Cash.phar{$s}Cash.php" => [],
],
];

View File

@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
/*
* This file is part of the php-code-coverage package.
*
@@ -7,7 +7,6 @@
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace SebastianBergmann\CodeCoverage\Report;
use SebastianBergmann\CodeCoverage\TestCase;
@@ -17,7 +16,7 @@ use SebastianBergmann\CodeCoverage\TestCase;
*/
class CloverTest extends TestCase
{
public function testCloverForBankAccountTest()
public function testCloverForBankAccountTest(): void
{
$clover = new Clover;
@@ -27,7 +26,7 @@ class CloverTest extends TestCase
);
}
public function testCloverForFileWithIgnoredLines()
public function testCloverForFileWithIgnoredLines(): void
{
$clover = new Clover;
@@ -37,7 +36,7 @@ class CloverTest extends TestCase
);
}
public function testCloverForClassWithAnonymousFunction()
public function testCloverForClassWithAnonymousFunction(): void
{
$clover = new Clover;

View File

@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
/*
* This file is part of the php-code-coverage package.
*
@@ -7,15 +7,10 @@
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace SebastianBergmann\CodeCoverage;
require __DIR__ . '/../_files/BankAccount.php';
require __DIR__ . '/../_files/BankAccountTest.php';
use SebastianBergmann\CodeCoverage\Driver\Driver;
use SebastianBergmann\CodeCoverage\Driver\PHPDBG;
use SebastianBergmann\CodeCoverage\Driver\Xdebug;
use SebastianBergmann\Environment\Runtime;
/**
* @covers SebastianBergmann\CodeCoverage\CodeCoverage
@@ -27,193 +22,32 @@ class CodeCoverageTest extends TestCase
*/
private $coverage;
protected function setUp()
protected function setUp(): void
{
$runtime = new Runtime;
if (!$runtime->canCollectCodeCoverage()) {
$this->markTestSkipped('No code coverage driver available');
}
$this->coverage = new CodeCoverage;
}
public function testCanBeConstructedForXdebugWithoutGivenFilterObject()
{
if (PHP_SAPI == 'phpdbg') {
$this->markTestSkipped('Requires PHP CLI and Xdebug');
}
$this->assertAttributeInstanceOf(
Xdebug::class,
'driver',
$this->coverage
);
$this->assertAttributeInstanceOf(
Filter::class,
'filter',
$this->coverage
);
}
public function testCanBeConstructedForXdebugWithGivenFilterObject()
{
if (PHP_SAPI == 'phpdbg') {
$this->markTestSkipped('Requires PHP CLI and Xdebug');
}
$filter = new Filter;
$coverage = new CodeCoverage(null, $filter);
$this->assertAttributeInstanceOf(
Xdebug::class,
'driver',
$coverage
);
$this->assertSame($filter, $coverage->filter());
}
public function testCanBeConstructedForPhpdbgWithoutGivenFilterObject()
{
if (PHP_SAPI != 'phpdbg') {
$this->markTestSkipped('Requires PHPDBG');
}
$this->assertAttributeInstanceOf(
PHPDBG::class,
'driver',
$this->coverage
);
$this->assertAttributeInstanceOf(
Filter::class,
'filter',
$this->coverage
);
}
public function testCanBeConstructedForPhpdbgWithGivenFilterObject()
{
if (PHP_SAPI != 'phpdbg') {
$this->markTestSkipped('Requires PHPDBG');
}
$filter = new Filter;
$coverage = new CodeCoverage(null, $filter);
$this->assertAttributeInstanceOf(
PHPDBG::class,
'driver',
$coverage
);
$this->assertSame($filter, $coverage->filter());
}
public function testCannotStopWithInvalidSecondArgument()
public function testCannotStopWithInvalidSecondArgument(): void
{
$this->expectException(Exception::class);
$this->coverage->stop(true, null);
}
public function testCannotAppendWithInvalidArgument()
public function testCannotAppendWithInvalidArgument(): void
{
$this->expectException(Exception::class);
$this->coverage->append([], null);
}
public function testSetCacheTokens()
{
$this->coverage->setCacheTokens(true);
$this->assertAttributeEquals(true, 'cacheTokens', $this->coverage);
}
public function testSetCheckForUnintentionallyCoveredCode()
{
$this->coverage->setCheckForUnintentionallyCoveredCode(true);
$this->assertAttributeEquals(
true,
'checkForUnintentionallyCoveredCode',
$this->coverage
);
}
public function testSetCheckForMissingCoversAnnotation()
{
$this->coverage->setCheckForMissingCoversAnnotation(true);
$this->assertAttributeEquals(
true,
'checkForMissingCoversAnnotation',
$this->coverage
);
}
public function testSetForceCoversAnnotation()
{
$this->coverage->setForceCoversAnnotation(true);
$this->assertAttributeEquals(
true,
'forceCoversAnnotation',
$this->coverage
);
}
public function testSetCheckForUnexecutedCoveredCode()
{
$this->coverage->setCheckForUnexecutedCoveredCode(true);
$this->assertAttributeEquals(
true,
'checkForUnexecutedCoveredCode',
$this->coverage
);
}
public function testSetAddUncoveredFilesFromWhitelist()
{
$this->coverage->setAddUncoveredFilesFromWhitelist(true);
$this->assertAttributeEquals(
true,
'addUncoveredFilesFromWhitelist',
$this->coverage
);
}
public function testSetProcessUncoveredFilesFromWhitelist()
{
$this->coverage->setProcessUncoveredFilesFromWhitelist(true);
$this->assertAttributeEquals(
true,
'processUncoveredFilesFromWhitelist',
$this->coverage
);
}
public function testSetIgnoreDeprecatedCode()
{
$this->coverage->setIgnoreDeprecatedCode(true);
$this->assertAttributeEquals(
true,
'ignoreDeprecatedCode',
$this->coverage
);
}
public function testClear()
{
$this->coverage->clear();
$this->assertAttributeEquals(null, 'currentId', $this->coverage);
$this->assertAttributeEquals([], 'data', $this->coverage);
$this->assertAttributeEquals([], 'tests', $this->coverage);
}
public function testCollect()
public function testCollect(): void
{
$coverage = $this->getCoverageForBankAccount();
@@ -227,13 +61,13 @@ class CodeCoverageTest extends TestCase
'BankAccountTest::testBalanceIsInitiallyZero' => ['size' => 'unknown', 'status' => -1],
'BankAccountTest::testBalanceCannotBecomeNegative' => ['size' => 'unknown', 'status' => -1],
'BankAccountTest::testBalanceCannotBecomeNegative2' => ['size' => 'unknown', 'status' => -1],
'BankAccountTest::testDepositWithdrawMoney' => ['size' => 'unknown', 'status' => -1]
'BankAccountTest::testDepositWithdrawMoney' => ['size' => 'unknown', 'status' => -1],
],
$coverage->getTests()
);
}
public function testMerge()
public function testMerge(): void
{
$coverage = $this->getCoverageForBankAccountForFirstTwoTests();
$coverage->merge($this->getCoverageForBankAccountForLastTwoTests());
@@ -244,7 +78,7 @@ class CodeCoverageTest extends TestCase
);
}
public function testMergeReverseOrder()
public function testMergeReverseOrder(): void
{
$coverage = $this->getCoverageForBankAccountForLastTwoTests();
$coverage->merge($this->getCoverageForBankAccountForFirstTwoTests());
@@ -255,7 +89,7 @@ class CodeCoverageTest extends TestCase
);
}
public function testMerge2()
public function testMerge2(): void
{
$coverage = new CodeCoverage(
$this->createMock(Driver::class),
@@ -270,7 +104,7 @@ class CodeCoverageTest extends TestCase
);
}
public function testGetLinesToBeIgnored()
public function testGetLinesToBeIgnored(): void
{
$this->assertEquals(
[
@@ -307,7 +141,7 @@ class CodeCoverageTest extends TestCase
35,
36,
37,
38
38,
],
$this->getLinesToBeIgnored()->invoke(
$this->coverage,
@@ -316,7 +150,7 @@ class CodeCoverageTest extends TestCase
);
}
public function testGetLinesToBeIgnored2()
public function testGetLinesToBeIgnored2(): void
{
$this->assertEquals(
[1, 5],
@@ -327,7 +161,7 @@ class CodeCoverageTest extends TestCase
);
}
public function testGetLinesToBeIgnored3()
public function testGetLinesToBeIgnored3(): void
{
$this->assertEquals(
[
@@ -341,7 +175,7 @@ class CodeCoverageTest extends TestCase
15,
16,
19,
20
20,
],
$this->getLinesToBeIgnored()->invoke(
$this->coverage,
@@ -350,7 +184,7 @@ class CodeCoverageTest extends TestCase
);
}
public function testGetLinesToBeIgnoredOneLineAnnotations()
public function testGetLinesToBeIgnoredOneLineAnnotations(): void
{
$this->assertEquals(
[
@@ -382,7 +216,7 @@ class CodeCoverageTest extends TestCase
32,
33,
34,
37
37,
],
$this->getLinesToBeIgnored()->invoke(
$this->coverage,
@@ -391,22 +225,7 @@ class CodeCoverageTest extends TestCase
);
}
/**
* @return \ReflectionMethod
*/
private function getLinesToBeIgnored()
{
$getLinesToBeIgnored = new \ReflectionMethod(
'SebastianBergmann\CodeCoverage\CodeCoverage',
'getLinesToBeIgnored'
);
$getLinesToBeIgnored->setAccessible(true);
return $getLinesToBeIgnored;
}
public function testGetLinesToBeIgnoredWhenIgnoreIsDisabled()
public function testGetLinesToBeIgnoredWhenIgnoreIsDisabled(): void
{
$this->coverage->setDisableIgnoredLines(true);
@@ -431,7 +250,7 @@ class CodeCoverageTest extends TestCase
34,
35,
36,
37
37,
],
$this->getLinesToBeIgnored()->invoke(
$this->coverage,
@@ -440,7 +259,33 @@ class CodeCoverageTest extends TestCase
);
}
public function testAppendThrowsExceptionIfCoveredCodeWasNotExecuted()
public function testUseStatementsAreIgnored(): void
{
$this->assertEquals(
[
1,
2,
3,
4,
5,
6,
7,
8,
9,
10,
13,
16,
23,
24,
],
$this->getLinesToBeIgnored()->invoke(
$this->coverage,
TEST_FILES_PATH . 'source_with_use_statements.php'
)
);
}
public function testAppendThrowsExceptionIfCoveredCodeWasNotExecuted(): void
{
$this->coverage->filter()->addDirectoryToWhitelist(TEST_FILES_PATH);
$this->coverage->setCheckForUnexecutedCoveredCode(true);
@@ -448,15 +293,15 @@ class CodeCoverageTest extends TestCase
$data = [
TEST_FILES_PATH . 'BankAccount.php' => [
29 => -1,
31 => -1
]
31 => -1,
],
];
$linesToBeCovered = [
TEST_FILES_PATH . 'BankAccount.php' => [
22,
24
]
24,
],
];
$linesToBeUsed = [];
@@ -466,7 +311,7 @@ class CodeCoverageTest extends TestCase
$this->coverage->append($data, 'File1.php', true, $linesToBeCovered, $linesToBeUsed);
}
public function testAppendThrowsExceptionIfUsedCodeWasNotExecuted()
public function testAppendThrowsExceptionIfUsedCodeWasNotExecuted(): void
{
$this->coverage->filter()->addDirectoryToWhitelist(TEST_FILES_PATH);
$this->coverage->setCheckForUnexecutedCoveredCode(true);
@@ -474,26 +319,41 @@ class CodeCoverageTest extends TestCase
$data = [
TEST_FILES_PATH . 'BankAccount.php' => [
29 => -1,
31 => -1
]
31 => -1,
],
];
$linesToBeCovered = [
TEST_FILES_PATH . 'BankAccount.php' => [
29,
31
]
31,
],
];
$linesToBeUsed = [
TEST_FILES_PATH . 'BankAccount.php' => [
22,
24
]
24,
],
];
$this->expectException(CoveredCodeNotExecutedException::class);
$this->coverage->append($data, 'File1.php', true, $linesToBeCovered, $linesToBeUsed);
}
/**
* @return \ReflectionMethod
*/
private function getLinesToBeIgnored()
{
$getLinesToBeIgnored = new \ReflectionMethod(
'SebastianBergmann\CodeCoverage\CodeCoverage',
'getLinesToBeIgnored'
);
$getLinesToBeIgnored->setAccessible(true);
return $getLinesToBeIgnored;
}
}

View File

@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
/*
* This file is part of the php-code-coverage package.
*
@@ -7,7 +7,6 @@
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace SebastianBergmann\CodeCoverage\Report;
use SebastianBergmann\CodeCoverage\TestCase;
@@ -17,7 +16,7 @@ use SebastianBergmann\CodeCoverage\TestCase;
*/
class Crap4jTest extends TestCase
{
public function testForBankAccountTest()
public function testForBankAccountTest(): void
{
$crap4j = new Crap4j;
@@ -27,7 +26,7 @@ class Crap4jTest extends TestCase
);
}
public function testForFileWithIgnoredLines()
public function testForFileWithIgnoredLines(): void
{
$crap4j = new Crap4j;
@@ -37,7 +36,7 @@ class Crap4jTest extends TestCase
);
}
public function testForClassWithAnonymousFunction()
public function testForClassWithAnonymousFunction(): void
{
$crap4j = new Crap4j;

View File

@@ -0,0 +1,51 @@
<?php declare(strict_types=1);
/*
* This file is part of the php-code-coverage 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.
*/
namespace SebastianBergmann\CodeCoverage\tests\Exception;
use PHPUnit\Framework\TestCase;
use SebastianBergmann\CodeCoverage\RuntimeException;
use SebastianBergmann\CodeCoverage\UnintentionallyCoveredCodeException;
final class UnintentionallyCoveredCodeExceptionTest extends TestCase
{
public function testCanConstructWithEmptyArray(): void
{
$unintentionallyCoveredUnits = [];
$exception = new UnintentionallyCoveredCodeException($unintentionallyCoveredUnits);
$this->assertInstanceOf(RuntimeException::class, $exception);
$this->assertSame($unintentionallyCoveredUnits, $exception->getUnintentionallyCoveredUnits());
$this->assertSame('', $exception->getMessage());
}
public function testCanConstructWithNonEmptyArray(): void
{
$unintentionallyCoveredUnits = [
'foo',
'bar',
'baz',
];
$exception = new UnintentionallyCoveredCodeException($unintentionallyCoveredUnits);
$this->assertInstanceOf(RuntimeException::class, $exception);
$this->assertSame($unintentionallyCoveredUnits, $exception->getUnintentionallyCoveredUnits());
$expected = <<<TXT
- foo
- bar
- baz
TXT;
$this->assertSame($expected, $exception->getMessage());
}
}

View File

@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
/*
* This file is part of the php-code-coverage package.
*
@@ -7,7 +7,6 @@
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace SebastianBergmann\CodeCoverage;
use PHPUnit\Framework\TestCase;
@@ -25,9 +24,9 @@ class FilterTest extends TestCase
*/
private $files = [];
protected function setUp()
protected function setUp(): void
{
$this->filter = unserialize('O:37:"SebastianBergmann\CodeCoverage\Filter":0:{}');
$this->filter = \unserialize('O:37:"SebastianBergmann\CodeCoverage\Filter":0:{}');
$this->files = [
TEST_FILES_PATH . 'BankAccount.php',
@@ -70,8 +69,9 @@ class FilterTest extends TestCase
TEST_FILES_PATH . 'source_with_ignore.php',
TEST_FILES_PATH . 'source_with_namespace.php',
TEST_FILES_PATH . 'source_with_oneline_annotations.php',
TEST_FILES_PATH . 'source_with_use_statements.php',
TEST_FILES_PATH . 'source_without_ignore.php',
TEST_FILES_PATH . 'source_without_namespace.php'
TEST_FILES_PATH . 'source_without_namespace.php',
];
}
@@ -79,7 +79,7 @@ class FilterTest extends TestCase
* @covers SebastianBergmann\CodeCoverage\Filter::addFileToWhitelist
* @covers SebastianBergmann\CodeCoverage\Filter::getWhitelist
*/
public function testAddingAFileToTheWhitelistWorks()
public function testAddingAFileToTheWhitelistWorks(): void
{
$this->filter->addFileToWhitelist($this->files[0]);
@@ -93,7 +93,7 @@ class FilterTest extends TestCase
* @covers SebastianBergmann\CodeCoverage\Filter::removeFileFromWhitelist
* @covers SebastianBergmann\CodeCoverage\Filter::getWhitelist
*/
public function testRemovingAFileFromTheWhitelistWorks()
public function testRemovingAFileFromTheWhitelistWorks(): void
{
$this->filter->addFileToWhitelist($this->files[0]);
$this->filter->removeFileFromWhitelist($this->files[0]);
@@ -106,12 +106,12 @@ class FilterTest extends TestCase
* @covers SebastianBergmann\CodeCoverage\Filter::getWhitelist
* @depends testAddingAFileToTheWhitelistWorks
*/
public function testAddingADirectoryToTheWhitelistWorks()
public function testAddingADirectoryToTheWhitelistWorks(): void
{
$this->filter->addDirectoryToWhitelist(TEST_FILES_PATH);
$whitelist = $this->filter->getWhitelist();
sort($whitelist);
\sort($whitelist);
$this->assertEquals($this->files, $whitelist);
}
@@ -120,7 +120,7 @@ class FilterTest extends TestCase
* @covers SebastianBergmann\CodeCoverage\Filter::addFilesToWhitelist
* @covers SebastianBergmann\CodeCoverage\Filter::getWhitelist
*/
public function testAddingFilesToTheWhitelistWorks()
public function testAddingFilesToTheWhitelistWorks(): void
{
$facade = new FileIteratorFacade;
@@ -132,7 +132,7 @@ class FilterTest extends TestCase
$this->filter->addFilesToWhitelist($files);
$whitelist = $this->filter->getWhitelist();
sort($whitelist);
\sort($whitelist);
$this->assertEquals($this->files, $whitelist);
}
@@ -142,7 +142,7 @@ class FilterTest extends TestCase
* @covers SebastianBergmann\CodeCoverage\Filter::getWhitelist
* @depends testAddingADirectoryToTheWhitelistWorks
*/
public function testRemovingADirectoryFromTheWhitelistWorks()
public function testRemovingADirectoryFromTheWhitelistWorks(): void
{
$this->filter->addDirectoryToWhitelist(TEST_FILES_PATH);
$this->filter->removeDirectoryFromWhitelist(TEST_FILES_PATH);
@@ -153,7 +153,7 @@ class FilterTest extends TestCase
/**
* @covers SebastianBergmann\CodeCoverage\Filter::isFile
*/
public function testIsFile()
public function testIsFile(): void
{
$this->assertFalse($this->filter->isFile('vfs://root/a/path'));
$this->assertFalse($this->filter->isFile('xdebug://debug-eval'));
@@ -167,7 +167,7 @@ class FilterTest extends TestCase
/**
* @covers SebastianBergmann\CodeCoverage\Filter::isFiltered
*/
public function testWhitelistedFileIsNotFiltered()
public function testWhitelistedFileIsNotFiltered(): void
{
$this->filter->addFileToWhitelist($this->files[0]);
$this->assertFalse($this->filter->isFiltered($this->files[0]));
@@ -176,7 +176,7 @@ class FilterTest extends TestCase
/**
* @covers SebastianBergmann\CodeCoverage\Filter::isFiltered
*/
public function testNotWhitelistedFileIsFiltered()
public function testNotWhitelistedFileIsFiltered(): void
{
$this->filter->addFileToWhitelist($this->files[0]);
$this->assertTrue($this->filter->isFiltered($this->files[1]));
@@ -186,7 +186,7 @@ class FilterTest extends TestCase
* @covers SebastianBergmann\CodeCoverage\Filter::isFiltered
* @covers SebastianBergmann\CodeCoverage\Filter::isFile
*/
public function testNonFilesAreFiltered()
public function testNonFilesAreFiltered(): void
{
$this->assertTrue($this->filter->isFiltered('vfs://root/a/path'));
$this->assertTrue($this->filter->isFiltered('xdebug://debug-eval'));
@@ -195,4 +195,19 @@ class FilterTest extends TestCase
$this->assertTrue($this->filter->isFiltered('assert code'));
$this->assertTrue($this->filter->isFiltered('regexp code'));
}
/**
* @covers SebastianBergmann\CodeCoverage\Filter::addFileToWhitelist
* @covers SebastianBergmann\CodeCoverage\Filter::getWhitelist
*
* @ticket https://github.com/sebastianbergmann/php-code-coverage/issues/664
*/
public function testTryingToAddFileThatDoesNotExistDoesNotChangeFilter(): void
{
$filter = new Filter;
$filter->addFileToWhitelist('does_not_exist');
$this->assertEmpty($filter->getWhitelistedFiles());
}
}

View File

@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
/*
* This file is part of the php-code-coverage package.
*
@@ -7,7 +7,6 @@
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace SebastianBergmann\CodeCoverage\Report\Html;
use SebastianBergmann\CodeCoverage\TestCase;
@@ -16,14 +15,14 @@ class HTMLTest extends TestCase
{
private static $TEST_REPORT_PATH_SOURCE;
public static function setUpBeforeClass()
public static function setUpBeforeClass(): void
{
parent::setUpBeforeClass();
self::$TEST_REPORT_PATH_SOURCE = TEST_FILES_PATH . 'Report' . DIRECTORY_SEPARATOR . 'HTML';
self::$TEST_REPORT_PATH_SOURCE = TEST_FILES_PATH . 'Report' . \DIRECTORY_SEPARATOR . 'HTML';
}
protected function tearDown()
protected function tearDown(): void
{
parent::tearDown();
@@ -35,13 +34,13 @@ class HTMLTest extends TestCase
foreach ($tmpFilesIterator as $path => $fileInfo) {
/* @var \SplFileInfo $fileInfo */
$pathname = $fileInfo->getPathname();
$fileInfo->isDir() ? rmdir($pathname) : unlink($pathname);
$fileInfo->isDir() ? \rmdir($pathname) : \unlink($pathname);
}
}
public function testForBankAccountTest()
public function testForBankAccountTest(): void
{
$expectedFilesPath = self::$TEST_REPORT_PATH_SOURCE . DIRECTORY_SEPARATOR . 'CoverageForBankAccount';
$expectedFilesPath = self::$TEST_REPORT_PATH_SOURCE . \DIRECTORY_SEPARATOR . 'CoverageForBankAccount';
$report = new Facade;
$report->process($this->getCoverageForBankAccount(), self::$TEST_TMP_PATH);
@@ -49,9 +48,9 @@ class HTMLTest extends TestCase
$this->assertFilesEquals($expectedFilesPath, self::$TEST_TMP_PATH);
}
public function testForFileWithIgnoredLines()
public function testForFileWithIgnoredLines(): void
{
$expectedFilesPath = self::$TEST_REPORT_PATH_SOURCE . DIRECTORY_SEPARATOR . 'CoverageForFileWithIgnoredLines';
$expectedFilesPath = self::$TEST_REPORT_PATH_SOURCE . \DIRECTORY_SEPARATOR . 'CoverageForFileWithIgnoredLines';
$report = new Facade;
$report->process($this->getCoverageForFileWithIgnoredLines(), self::$TEST_TMP_PATH);
@@ -59,10 +58,10 @@ class HTMLTest extends TestCase
$this->assertFilesEquals($expectedFilesPath, self::$TEST_TMP_PATH);
}
public function testForClassWithAnonymousFunction()
public function testForClassWithAnonymousFunction(): void
{
$expectedFilesPath =
self::$TEST_REPORT_PATH_SOURCE . DIRECTORY_SEPARATOR . 'CoverageForClassWithAnonymousFunction';
self::$TEST_REPORT_PATH_SOURCE . \DIRECTORY_SEPARATOR . 'CoverageForClassWithAnonymousFunction';
$report = new Facade;
$report->process($this->getCoverageForClassWithAnonymousFunction(), self::$TEST_TMP_PATH);
@@ -74,14 +73,14 @@ class HTMLTest extends TestCase
* @param string $expectedFilesPath
* @param string $actualFilesPath
*/
private function assertFilesEquals($expectedFilesPath, $actualFilesPath)
private function assertFilesEquals($expectedFilesPath, $actualFilesPath): void
{
$expectedFilesIterator = new \FilesystemIterator($expectedFilesPath);
$actualFilesIterator = new \RegexIterator(new \FilesystemIterator($actualFilesPath), '/.html/');
$this->assertEquals(
iterator_count($expectedFilesIterator),
iterator_count($actualFilesIterator),
\iterator_count($expectedFilesIterator),
\iterator_count($actualFilesIterator),
'Generated files and expected files not match'
);
@@ -89,13 +88,13 @@ class HTMLTest extends TestCase
/* @var \SplFileInfo $fileInfo */
$filename = $fileInfo->getFilename();
$actualFile = $actualFilesPath . DIRECTORY_SEPARATOR . $filename;
$actualFile = $actualFilesPath . \DIRECTORY_SEPARATOR . $filename;
$this->assertFileExists($actualFile);
$this->assertStringMatchesFormatFile(
$fileInfo->getPathname(),
str_replace(PHP_EOL, "\n", file_get_contents($actualFile)),
\str_replace(\PHP_EOL, "\n", \file_get_contents($actualFile)),
"${filename} not match"
);
}

View File

@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
/*
* This file is part of the php-code-coverage package.
*
@@ -7,7 +7,6 @@
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace SebastianBergmann\CodeCoverage\Report;
use SebastianBergmann\CodeCoverage\TestCase;
@@ -17,33 +16,33 @@ use SebastianBergmann\CodeCoverage\TestCase;
*/
class TextTest extends TestCase
{
public function testTextForBankAccountTest()
public function testTextForBankAccountTest(): void
{
$text = new Text(50, 90, false, false);
$this->assertStringMatchesFormatFile(
TEST_FILES_PATH . 'BankAccount-text.txt',
str_replace(PHP_EOL, "\n", $text->process($this->getCoverageForBankAccount()))
\str_replace(\PHP_EOL, "\n", $text->process($this->getCoverageForBankAccount()))
);
}
public function testTextForFileWithIgnoredLines()
public function testTextForFileWithIgnoredLines(): void
{
$text = new Text(50, 90, false, false);
$this->assertStringMatchesFormatFile(
TEST_FILES_PATH . 'ignored-lines-text.txt',
str_replace(PHP_EOL, "\n", $text->process($this->getCoverageForFileWithIgnoredLines()))
\str_replace(\PHP_EOL, "\n", $text->process($this->getCoverageForFileWithIgnoredLines()))
);
}
public function testTextForClassWithAnonymousFunction()
public function testTextForClassWithAnonymousFunction(): void
{
$text = new Text(50, 90, false, false);
$this->assertStringMatchesFormatFile(
TEST_FILES_PATH . 'class-with-anonymous-function-text.txt',
str_replace(PHP_EOL, "\n", $text->process($this->getCoverageForClassWithAnonymousFunction()))
\str_replace(\PHP_EOL, "\n", $text->process($this->getCoverageForClassWithAnonymousFunction()))
);
}
}

View File

@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
/*
* This file is part of the php-code-coverage package.
*
@@ -7,7 +7,6 @@
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace SebastianBergmann\CodeCoverage;
use PHPUnit\Framework\TestCase;
@@ -17,7 +16,7 @@ use PHPUnit\Framework\TestCase;
*/
class UtilTest extends TestCase
{
public function testPercent()
public function testPercent(): void
{
$this->assertEquals(100, Util::percent(100, 0));
$this->assertEquals(100, Util::percent(100, 100));

View File

@@ -1,4 +1,4 @@
<?php
<?php declare(strict_types=1);
/*
* This file is part of the php-code-coverage package.
*
@@ -7,7 +7,6 @@
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace SebastianBergmann\CodeCoverage\Report\Xml;
use SebastianBergmann\CodeCoverage\TestCase;
@@ -16,14 +15,14 @@ class XmlTest extends TestCase
{
private static $TEST_REPORT_PATH_SOURCE;
public static function setUpBeforeClass()
public static function setUpBeforeClass(): void
{
parent::setUpBeforeClass();
self::$TEST_REPORT_PATH_SOURCE = TEST_FILES_PATH . 'Report' . DIRECTORY_SEPARATOR . 'XML';
self::$TEST_REPORT_PATH_SOURCE = TEST_FILES_PATH . 'Report' . \DIRECTORY_SEPARATOR . 'XML';
}
protected function tearDown()
protected function tearDown(): void
{
parent::tearDown();
@@ -31,13 +30,13 @@ class XmlTest extends TestCase
foreach ($tmpFilesIterator as $path => $fileInfo) {
/* @var \SplFileInfo $fileInfo */
unlink($fileInfo->getPathname());
\unlink($fileInfo->getPathname());
}
}
public function testForBankAccountTest()
public function testForBankAccountTest(): void
{
$expectedFilesPath = self::$TEST_REPORT_PATH_SOURCE . DIRECTORY_SEPARATOR . 'CoverageForBankAccount';
$expectedFilesPath = self::$TEST_REPORT_PATH_SOURCE . \DIRECTORY_SEPARATOR . 'CoverageForBankAccount';
$xml = new Facade('1.0.0');
$xml->process($this->getCoverageForBankAccount(), self::$TEST_TMP_PATH);
@@ -45,9 +44,9 @@ class XmlTest extends TestCase
$this->assertFilesEquals($expectedFilesPath, self::$TEST_TMP_PATH);
}
public function testForFileWithIgnoredLines()
public function testForFileWithIgnoredLines(): void
{
$expectedFilesPath = self::$TEST_REPORT_PATH_SOURCE . DIRECTORY_SEPARATOR . 'CoverageForFileWithIgnoredLines';
$expectedFilesPath = self::$TEST_REPORT_PATH_SOURCE . \DIRECTORY_SEPARATOR . 'CoverageForFileWithIgnoredLines';
$xml = new Facade('1.0.0');
$xml->process($this->getCoverageForFileWithIgnoredLines(), self::$TEST_TMP_PATH);
@@ -55,9 +54,9 @@ class XmlTest extends TestCase
$this->assertFilesEquals($expectedFilesPath, self::$TEST_TMP_PATH);
}
public function testForClassWithAnonymousFunction()
public function testForClassWithAnonymousFunction(): void
{
$expectedFilesPath = self::$TEST_REPORT_PATH_SOURCE . DIRECTORY_SEPARATOR . 'CoverageForClassWithAnonymousFunction';
$expectedFilesPath = self::$TEST_REPORT_PATH_SOURCE . \DIRECTORY_SEPARATOR . 'CoverageForClassWithAnonymousFunction';
$xml = new Facade('1.0.0');
$xml->process($this->getCoverageForClassWithAnonymousFunction(), self::$TEST_TMP_PATH);
@@ -69,14 +68,14 @@ class XmlTest extends TestCase
* @param string $expectedFilesPath
* @param string $actualFilesPath
*/
private function assertFilesEquals($expectedFilesPath, $actualFilesPath)
private function assertFilesEquals($expectedFilesPath, $actualFilesPath): void
{
$expectedFilesIterator = new \FilesystemIterator($expectedFilesPath);
$actualFilesIterator = new \FilesystemIterator($actualFilesPath);
$this->assertEquals(
iterator_count($expectedFilesIterator),
iterator_count($actualFilesIterator),
\iterator_count($expectedFilesIterator),
\iterator_count($actualFilesIterator),
'Generated files and expected files not match'
);
@@ -84,13 +83,13 @@ class XmlTest extends TestCase
/* @var \SplFileInfo $fileInfo */
$filename = $fileInfo->getFilename();
$actualFile = $actualFilesPath . DIRECTORY_SEPARATOR . $filename;
$actualFile = $actualFilesPath . \DIRECTORY_SEPARATOR . $filename;
$this->assertFileExists($actualFile);
$this->assertStringMatchesFormatFile(
$fileInfo->getPathname(),
file_get_contents($actualFile),
\file_get_contents($actualFile),
"${filename} not match"
);
}