The class YtResultPrinter has 11 public methods. Consider refactoring YtResultPrinter to keep number of public methods under 10. Open
class YtResultPrinter extends PHPUnit\TextUI\DefaultResultPrinter
{
/**
* Logs files to show.
*
- Read upRead up
- Exclude checks
TooManyPublicMethods
Since: 0.1
A class with too many public methods is probably a good suspect for refactoring, in order to reduce its complexity and find a way to have more fine grained objects.
By default it ignores methods starting with 'get' or 'set'.
Example
Source https://phpmd.org/rules/codesize.html#toomanypublicmethods
Function endTest
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public function endTest(Test $test, float $time): void
{
if ($this->debug) {
$time = round($time, 2);
echo " - $time second(s) | Assertions: " . $test->getNumAssertions();
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function showLogs
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
private function showLogs(): void
{
array_unshift($this->logFiles, '/var/log/php' . getenv('PHP_VER') . '-fpm.log');
foreach ($this->logFiles as $file) {
if (false === strpos($file, '/var/log')) {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Avoid unused parameters such as '$t'. Open
public function addError(Test $test, Throwable $t, float $time): void
- Read upRead up
- Exclude checks
UnusedFormalParameter
Since: 0.2
Avoid passing parameters to methods or constructors and then not using those parameters.
Example
class Foo
{
private function bar($howdy)
{
// $howdy is not used
}
}
Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter
Avoid unused parameters such as '$e'. Open
public function addWarning(Test $test, Warning $e, float $time): void
- Read upRead up
- Exclude checks
UnusedFormalParameter
Since: 0.2
Avoid passing parameters to methods or constructors and then not using those parameters.
Example
class Foo
{
private function bar($howdy)
{
// $howdy is not used
}
}
Source https://phpmd.org/rules/unusedcode.html#unusedformalparameter
Reference to undeclared property \YtResultPrinter->debug
Open
if ($this->debug) {
- Exclude checks
Reference to undeclared property \YtResultPrinter->lastTestFailed
Open
if (!$this->lastTestFailed) {
- Exclude checks
Call to undeclared method \YtResultPrinter::writeProgress
Open
$this->writeProgress('.');
- Exclude checks
Call to undeclared method \YtResultPrinter::writeWithColor
Open
$this->writeWithColor('bold,fg-yellow', str_repeat('+', 20) . " {$this->getTestName($test)} " . str_repeat('+', 20), true);
- Exclude checks
Call to method getName
from undeclared class \PHPUnit\Framework\Test
Open
$this->writeProgressWithColor('fg-red', '!!! Test ' . $test->getName() . ' error.');
- Exclude checks
Reference to undeclared property \YtResultPrinter->lastTestFailed
Open
$this->lastTestFailed = true;
- Exclude checks
Reference to undeclared property \YtResultPrinter->numAssertions
Open
$this->numAssertions += $test->getNumAssertions();
- Exclude checks
Checking instanceof against undeclared class \PHPUnit\Runner\PhptTestCase
Open
} elseif ($test instanceof PhptTestCase) {
- Exclude checks
Checking instanceof against undeclared class \PHPUnit\Framework\TestCase
Open
if ($test instanceof TestCase) {
- Exclude checks
Call to undeclared method \YtResultPrinter::write
Open
$this->write(PHP_EOL);
- Exclude checks
Reference to undeclared class \PHPUnit\TextUI\DefaultResultPrinter
Open
parent::printResult($result);
- Exclude checks
Call to method failureCount
from undeclared class \PHPUnit\Framework\TestResult
Open
if (getenv('SHOW_LOGS') || $result->errorCount() || $result->warningCount() || $result->failureCount()) {
- Exclude checks
Call to method getName
from undeclared class \PHPUnit\Framework\Test
Open
$this->writeProgressWithColor('fg-yellow', '! Test ' . $test->getName() . ' warning !!!.');
- Exclude checks
Parameter $test
has undeclared type \PHPUnit\Framework\Test
Open
public function addFailure(Test $test, AssertionFailedError $e, float $time): void
- Exclude checks
Reference to undeclared property \YtResultPrinter->lastTestFailed
Open
$this->lastTestFailed = true;
- Exclude checks
Parameter $test
has undeclared type \PHPUnit\Framework\Test
Open
public function startTest(Test $test): void
- Exclude checks
Call to method hasExpectationOnOutput
from undeclared class \PHPUnit\Framework\TestCase
Open
if (!$test->hasExpectationOnOutput() && ($out = $test->getActualOutput())) {
- Exclude checks
Call to method warningCount
from undeclared class \PHPUnit\Framework\TestResult
Open
if (getenv('SHOW_LOGS') || $result->errorCount() || $result->warningCount() || $result->failureCount()) {
- Exclude checks
Reference to undeclared property \YtResultPrinter->lastTestFailed
Open
$this->lastTestFailed = true;
- Exclude checks
Reference to undeclared class \PHPUnit\TextUI\DefaultResultPrinter
Open
parent::addIncompleteTest($test, $t, $time);
- Exclude checks
Parameter $test
has undeclared type \PHPUnit\Framework\Test
Open
public function addSkippedTest(Test $test, Throwable $t, float $time): void
- Exclude checks
Parameter $suite
has undeclared type \PHPUnit\Framework\TestSuite
Open
public function startTestSuite(TestSuite $suite): void
- Exclude checks
Reference to undeclared class \PHPUnit\TextUI\DefaultResultPrinter
Open
parent::startTestSuite($suite);
- Exclude checks
Call to undeclared method \YtResultPrinter::write
Open
$this->write(PHP_EOL);
- Exclude checks
Reference to undeclared property \YtResultPrinter->lastTestFailed
Open
$this->lastTestFailed = true;
- Exclude checks
Parameter $test
has undeclared type \PHPUnit\Framework\Test
Open
public function endTest(Test $test, float $time): void
- Exclude checks
Reference to undeclared property \YtResultPrinter->lastTestFailed
Open
$this->lastTestFailed = false;
- Exclude checks
Call to undeclared method \YtResultPrinter::write
Open
$this->write(PHP_EOL);
- Exclude checks
Class extends undeclared class \PHPUnit\TextUI\DefaultResultPrinter
Open
class YtResultPrinter extends PHPUnit\TextUI\DefaultResultPrinter
- Exclude checks
Parameter $result
has undeclared type \PHPUnit\Framework\TestResult
Open
public function printResult(TestResult $result): void
- Exclude checks
Parameter $e
has undeclared type \PHPUnit\Framework\Warning
Open
public function addWarning(Test $test, Warning $e, float $time): void
- Exclude checks
Call to method __toString
from undeclared class \PHPUnit\Framework\AssertionFailedError
Open
$this->writeProgressWithColor('bg-red, fg-black', '! Test ' . $this->getTestName($test) . ' failed !!!' . PHP_EOL . $e->__toString());
- Exclude checks
Call to undeclared method \YtResultPrinter::write
Open
$this->write(PHP_EOL);
- Exclude checks
Call to method getNumAssertions
from undeclared class \PHPUnit\Framework\Test
Open
echo " - $time second(s) | Assertions: " . $test->getNumAssertions();
- Exclude checks
Call to method errorCount
from undeclared class \PHPUnit\Framework\TestResult
Open
if (getenv('SHOW_LOGS') || $result->errorCount() || $result->warningCount() || $result->failureCount()) {
- Exclude checks
Call to method getName
from undeclared class \PHPUnit\Framework\Test
Open
printf("! Test %s is deemed risky.\n", $test->getName());
- Exclude checks
Call to undeclared method \YtResultPrinter::write
Open
$this->write($out);
- Exclude checks
Reference to undeclared property \YtResultPrinter->debug
Open
if ($this->debug) {
- Exclude checks
Parameter $test
has undeclared type \PHPUnit\Framework\Test
Open
public function addIncompleteTest(Test $test, Throwable $t, float $time): void
- Exclude checks
Reference to undeclared class \PHPUnit\TextUI\DefaultResultPrinter
Open
parent::endTestSuite($suite);
- Exclude checks
Call to method getName
from undeclared class \PHPUnit\Framework\Test
Open
return str_replace(['Tests\\', '\\'], ['', ' '], \get_class($test)) . ' -> ' . $test->getName();
- Exclude checks
Parameter $test
has undeclared type \PHPUnit\Framework\Test
Open
public function addRiskyTest(Test $test, Throwable $t, float $time): void
- Exclude checks
Reference to undeclared class \PHPUnit\TextUI\DefaultResultPrinter
Open
parent::addRiskyTest($test, $t, $time);
- Exclude checks
Call to method getActualOutput
from undeclared class \PHPUnit\Framework\TestCase
Open
if (!$test->hasExpectationOnOutput() && ($out = $test->getActualOutput())) {
- Exclude checks
Call to method getName
from undeclared class \PHPUnit\Framework\Test
Open
printf("addIncompleteTest: Test '%s' is incomplete.\n", $test->getName());
- Exclude checks
Call to undeclared method \YtResultPrinter::writeWithColor
Open
$this->writeWithColor('bold,fg-green', "\nLogs: $file");
- Exclude checks
Call to undeclared method \YtResultPrinter::write
Open
$this->write(str_repeat('+', 100));
- Exclude checks
Reference to undeclared property \YtResultPrinter->debug
Open
if ($this->debug) {
- Exclude checks
Parameter $test
has undeclared type \PHPUnit\Framework\Test
Open
public function addError(Test $test, Throwable $t, float $time): void
- Exclude checks
Parameter $test
has undeclared type \PHPUnit\Framework\Test
Open
public function addWarning(Test $test, Warning $e, float $time): void
- Exclude checks
Call to undeclared method \YtResultPrinter::writeProgressWithColor
Open
$this->writeProgressWithColor('fg-yellow', '! Test ' . $test->getName() . ' warning !!!.');
- Exclude checks
Parameter $e
has undeclared type \PHPUnit\Framework\AssertionFailedError
Open
public function addFailure(Test $test, AssertionFailedError $e, float $time): void
- Exclude checks
Call to undeclared method \YtResultPrinter::writeProgressWithColor
Open
$this->writeProgressWithColor('fg-cyan, bold', "! Test '{$this->getTestName($test)}' has been skipped. ($time second(s))\n" . PHP_EOL . trim($t->__toString()) . PHP_EOL);
- Exclude checks
Call to undeclared method \YtResultPrinter::write
Open
$this->write($this->getTestName($test));
- Exclude checks
Checking instanceof against undeclared class \PHPUnit\Framework\TestCase
Open
if ($test instanceof TestCase) {
- Exclude checks
Call to method getNumAssertions
from undeclared class \PHPUnit\Framework\TestCase
Open
$this->numAssertions += $test->getNumAssertions();
- Exclude checks
Reference to undeclared property \YtResultPrinter->numAssertions
Open
++$this->numAssertions;
- Exclude checks
Argument 1 (test)
is \PHPUnit\Framework\TestCase
but \YtResultPrinter::getTestName()
takes \PHPUnit\Framework\Test
defined at /code/tests/setup/printer.php:59
Open
$this->writeWithColor('bold,fg-yellow', str_repeat('+', 20) . " {$this->getTestName($test)} " . str_repeat('+', 20), true);
- Exclude checks
Call to undeclared method \YtResultPrinter::writeWithColor
Open
$this->writeWithColor('bold,fg-yellow', str_repeat('+', 100), true);
- Exclude checks
Parameter $test
has undeclared type \PHPUnit\Framework\Test
Open
public function getTestName(Test $test): string
- Exclude checks
Parameter $suite
has undeclared type \PHPUnit\Framework\TestSuite
Open
public function endTestSuite(TestSuite $suite): void
- Exclude checks
Call to undeclared method \YtResultPrinter::writeProgressWithColor
Open
$this->writeProgressWithColor('fg-red', '!!! Test ' . $test->getName() . ' error.');
- Exclude checks
Call to undeclared method \YtResultPrinter::writeProgressWithColor
Open
$this->writeProgressWithColor('bg-red, fg-black', '! Test ' . $this->getTestName($test) . ' failed !!!' . PHP_EOL . $e->__toString());
- Exclude checks
Avoid assigning values to variables in if clauses and the like (line '102', column '45'). Open
public function endTest(Test $test, float $time): void
{
if ($this->debug) {
$time = round($time, 2);
echo " - $time second(s) | Assertions: " . $test->getNumAssertions();
- Read upRead up
- Exclude checks
IfStatementAssignment
Since: 2.7.0
Assignments in if clauses and the like are considered a code smell. Assignments in PHP return the right operand as their result. In many cases, this is an expected behavior, but can lead to many difficult to spot bugs, especially when the right operand could result in zero, null or an empty string and the like.
Example
class Foo
{
public function bar($flag)
{
if ($foo = 'bar') { // possible typo
// ...
}
if ($baz = 0) { // always false
// ...
}
}
}
Source http://phpmd.org/rules/cleancode.html#ifstatementassignment
Remove this commented out code. Open
//printf("Ended all tests: %s.\n", $suite->getName());
- Read upRead up
- Exclude checks
Programmers should not comment out code as it bloats programs and reduces readability.
Unused code should be deleted and can be retrieved from source control history if required.
See
- MISRA C:2004, 2.4 - Sections of code should not be "commented out".
- MISRA C++:2008, 2-7-2 - Sections of code shall not be "commented out" using C-style comments.
- MISRA C++:2008, 2-7-3 - Sections of code should not be "commented out" using C++ comments.
- MISRA C:2012, Dir. 4.4 - Sections of code should not be "commented out"
Merge this if statement with the enclosing one. Open
if (!$test->hasExpectationOnOutput() && ($out = $test->getActualOutput())) {
- Read upRead up
- Exclude checks
Merging collapsible if
statements increases the code's readability.
Noncompliant Code Example
if (condition1) { if (condition2) { ... } }
Compliant Solution
if (condition1 && condition2) { ... }
Each class must be in a namespace of at least one level (a top-level vendor name) Open
class YtResultPrinter extends PHPUnit\TextUI\DefaultResultPrinter
- Exclude checks
Avoid variables with short names like $e. Configured minimum length is 3. Open
public function addWarning(Test $test, Warning $e, float $time): void
- Read upRead up
- Exclude checks
ShortVariable
Since: 0.2
Detects when a field, local, or parameter has a very short name.
Example
class Something {
private $q = 15; // VIOLATION - Field
public static function main( array $as ) { // VIOLATION - Formal
$r = 20 + $this->q; // VIOLATION - Local
for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
$r += $this->q;
}
}
}
Source https://phpmd.org/rules/naming.html#shortvariable
Avoid variables with short names like $e. Configured minimum length is 3. Open
public function addFailure(Test $test, AssertionFailedError $e, float $time): void
- Read upRead up
- Exclude checks
ShortVariable
Since: 0.2
Detects when a field, local, or parameter has a very short name.
Example
class Something {
private $q = 15; // VIOLATION - Field
public static function main( array $as ) { // VIOLATION - Formal
$r = 20 + $this->q; // VIOLATION - Local
for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
$r += $this->q;
}
}
}
Source https://phpmd.org/rules/naming.html#shortvariable
Avoid variables with short names like $t. Configured minimum length is 3. Open
public function addRiskyTest(Test $test, Throwable $t, float $time): void
- Read upRead up
- Exclude checks
ShortVariable
Since: 0.2
Detects when a field, local, or parameter has a very short name.
Example
class Something {
private $q = 15; // VIOLATION - Field
public static function main( array $as ) { // VIOLATION - Formal
$r = 20 + $this->q; // VIOLATION - Local
for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
$r += $this->q;
}
}
}
Source https://phpmd.org/rules/naming.html#shortvariable
Avoid variables with short names like $t. Configured minimum length is 3. Open
public function addSkippedTest(Test $test, Throwable $t, float $time): void
- Read upRead up
- Exclude checks
ShortVariable
Since: 0.2
Detects when a field, local, or parameter has a very short name.
Example
class Something {
private $q = 15; // VIOLATION - Field
public static function main( array $as ) { // VIOLATION - Formal
$r = 20 + $this->q; // VIOLATION - Local
for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
$r += $this->q;
}
}
}
Source https://phpmd.org/rules/naming.html#shortvariable
Avoid variables with short names like $t. Configured minimum length is 3. Open
public function addError(Test $test, Throwable $t, float $time): void
- Read upRead up
- Exclude checks
ShortVariable
Since: 0.2
Detects when a field, local, or parameter has a very short name.
Example
class Something {
private $q = 15; // VIOLATION - Field
public static function main( array $as ) { // VIOLATION - Formal
$r = 20 + $this->q; // VIOLATION - Local
for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
$r += $this->q;
}
}
}
Source https://phpmd.org/rules/naming.html#shortvariable
Avoid variables with short names like $t. Configured minimum length is 3. Open
public function addIncompleteTest(Test $test, Throwable $t, float $time): void
- Read upRead up
- Exclude checks
ShortVariable
Since: 0.2
Detects when a field, local, or parameter has a very short name.
Example
class Something {
private $q = 15; // VIOLATION - Field
public static function main( array $as ) { // VIOLATION - Formal
$r = 20 + $this->q; // VIOLATION - Local
for (int $i = 0; $i < 10; $i++) { // Not a Violation (inside FOR)
$r += $this->q;
}
}
}
Source https://phpmd.org/rules/naming.html#shortvariable
Spaces must be used to indent lines; tabs are not allowed Open
private $logFiles = [
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'/var/log/nginx/error.log',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'/var/log/fpm-php.www.log',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'cache/logs/Importer.log',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Get test name.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function getTestName(Test $test): string
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
// '/var/log/nginx/localhost_access.log',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'/var/log/mysql.err',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'cache/logs/webserviceErrors.log',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
];
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param PHPUnit\Framework\Test $test
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'cache/logs/system.log',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'/var/www/html/cache/logs/selenium.log',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'/var/log/php_error.log',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'/var/log/nginx/localhost_error.log',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'/var/log/mysql/error.log',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @var string[]
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
// 'cache/logs/webserviceDebug.log',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return string
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
// '/var/log/mysql/localhost_access.log',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
return str_replace(['Tests\\', '\\'], ['', ' '], \get_class($test)) . ' -> ' . $test->getName();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function startTest(Test $test): void
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return void
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->writeProgressWithColor('fg-red', '!!! Test ' . $test->getName() . ' error.');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param float $time
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param Throwable $t
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param PHPUnit\Framework\Test $test
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Logs files to show.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($this->debug) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'cache/logs/phpError.log',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return void
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'tests/records.log',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($this->debug) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param PHPUnit\Framework\Test $test
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return void
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return void
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
printf("addIncompleteTest: Test '%s' is incomplete.\n", $test->getName());
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$time = round($time, 2);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
'cache/logs/errors.log',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
// 'cache/logs/request.log',
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->write($this->getTestName($test));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!$test->hasExpectationOnOutput() && ($out = $test->getActualOutput())) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->write(PHP_EOL);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
//printf("Ended all tests: %s.\n", $suite->getName());
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return void
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$time = round($time, 2);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->writeProgressWithColor('fg-yellow', '! Test ' . $test->getName() . ' warning !!!.');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($this->debug) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
echo " - $time second(s) | Assertions: " . $test->getNumAssertions();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->writeProgress('.');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($test instanceof TestCase) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->numAssertions += $test->getNumAssertions();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->writeWithColor('bold,fg-yellow', str_repeat('+', 100), true);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param PHPUnit\Framework\TestResult $result
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param PHPUnit\Framework\TestSuite $suite
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->lastTestFailed = true;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Incomplete test.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$time = round($time, 2);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (!$this->lastTestFailed) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return void
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
parent::startTestSuite($suite);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function endTestSuite(TestSuite $suite): void
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->write(PHP_EOL);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param Warning $e
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Line exceeds 120 characters; contains 142 characters Open
$this->writeProgressWithColor('bg-red, fg-black', '! Test ' . $this->getTestName($test) . ' failed !!!' . PHP_EOL . $e->__toString());
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$time = round($time, 2);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param float $time
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
} elseif ($test instanceof PhptTestCase) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
++$this->numAssertions;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Start test suite.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* End test suite.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
parent::endTestSuite($suite);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function addFailure(Test $test, AssertionFailedError $e, float $time): void
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->lastTestFailed = true;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param float $time
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return void
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
array_unshift($this->logFiles, '/var/log/php' . getenv('PHP_VER') . '-fpm.log');
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$content = file_get_contents($file);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->writeWithColor('bold,fg-yellow', str_repeat('+', 20) . " {$this->getTestName($test)} " . str_repeat('+', 20), true);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function startTestSuite(TestSuite $suite): void
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->lastTestFailed = true;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->writeProgressWithColor('bg-red, fg-black', '! Test ' . $this->getTestName($test) . ' failed !!!' . PHP_EOL . $e->__toString());
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
printf("! Test %s is deemed risky.\n", $test->getName());
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($content) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Print result.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param PHPUnit\Framework\Test $test
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param PHPUnit\Framework\Test $test
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return void
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* An error occurred.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param float $time
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param AssertionFailedError $e
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return void
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->write(PHP_EOL);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
private function showLogs(): void
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function endTest(Test $test, float $time): void
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function printResult(TestResult $result): void
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* A warning occurred.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->write(PHP_EOL);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
parent::addRiskyTest($test, $t, $time);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param PHPUnit\Framework\Test $test
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return void
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param PHPUnit\Framework\Test $test
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param float $time
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function addRiskyTest(Test $test, Throwable $t, float $time): void
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param Throwable $t
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->lastTestFailed = true;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if ($test instanceof TestCase) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* A failure occurred.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param float $time
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param float $time
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Line exceeds 120 characters; contains 143 characters Open
$this->writeWithColor('bold,fg-yellow', str_repeat('+', 20) . " {$this->getTestName($test)} " . str_repeat('+', 20), true);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (getenv('SHOW_LOGS') || $result->errorCount() || $result->warningCount() || $result->failureCount()) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->showLogs();
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param Throwable $t
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$time = round($time, 2);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param PHPUnit\Framework\Test $test
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
foreach ($this->logFiles as $file) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return void
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*/
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Skipped test.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @return void
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* A test started.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* A test ended.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
{
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->lastTestFailed = false;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->write($out);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
parent::printResult($result);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param PHPUnit\Framework\TestSuite $suite
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param PHPUnit\Framework\Test $test
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function addError(Test $test, Throwable $t, float $time): void
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function addWarning(Test $test, Warning $e, float $time): void
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function addIncompleteTest(Test $test, Throwable $t, float $time): void
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Risky test.
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* @param Throwable $t
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
echo $content;
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->writeWithColor('bold,fg-green', "\nLogs: $file");
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
*
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$time = round($time, 2);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (false === strpos($file, '/var/log')) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->write(str_repeat('+', 100));
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
public function addSkippedTest(Test $test, Throwable $t, float $time): void
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$this->writeProgressWithColor('fg-cyan, bold', "! Test '{$this->getTestName($test)}' has been skipped. ($time second(s))\n" . PHP_EOL . trim($t->__toString()) . PHP_EOL);
- Exclude checks
Line exceeds 120 characters; contains 178 characters Open
$this->writeProgressWithColor('fg-cyan, bold', "! Test '{$this->getTestName($test)}' has been skipped. ($time second(s))\n" . PHP_EOL . trim($t->__toString()) . PHP_EOL);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
$file = realpath(ROOT_DIRECTORY . DIRECTORY_SEPARATOR . $file);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
if (file_exists($file)) {
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
}
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
parent::addIncompleteTest($test, $t, $time);
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
/**
- Exclude checks
Spaces must be used to indent lines; tabs are not allowed Open
* Show tests logs.
- Exclude checks