YetiForceCompany/YetiForceCRM

View on GitHub
tests/Base.php

Summary

Maintainability
A
0 mins
Test Coverage
A
100%

The method Base::onNotSuccessfulTest() calls the typical debug function print_r() which is mostly only used during development.
Open

            \print_r($this->logs);
Severity: Minor
Found in tests/Base.php by phpmd

DevelopmentCodeFragment

Since: 2.3.0

Functions like vardump(), printr() etc. are normally only used during development and therefore such calls in production code are a good indicator that they were just forgotten.

Example

class SuspectCode {

    public function doSomething(array $items)
    {
        foreach ($items as $i => $item) {
            // …

            if ('qafoo' == $item) var_dump($i);

            // …
        }
    }
}

Source https://phpmd.org/rules/design.html#developmentcodefragment

Reference to static property logToFile from undeclared class \App\Log
Open

        \App\Log::$logToFile = false;
Severity: Critical
Found in tests/Base.php by phan

Class extends undeclared class \PHPUnit\Framework\TestCase
Open

abstract class Base extends TestCase
Severity: Critical
Found in tests/Base.php by phan

Reference to static property logToFile from undeclared class \App\Log
Open

        $this->logToFile = \App\Log::$logToFile;
Severity: Critical
Found in tests/Base.php by phan

Reference to static property logToFile from undeclared class \App\Log
Open

        \App\Log::$logToFile = $this->logToFile;
Severity: Critical
Found in tests/Base.php by phan

Remove this commented out code.
Open

            //var_export(array_shift($t->getTrace()));
Severity: Major
Found in tests/Base.php by sonar-php

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"

Avoid variables with short names like $t. Configured minimum length is 3.
Open

    protected function onNotSuccessfulTest(\Throwable $t): void
Severity: Minor
Found in tests/Base.php by phpmd

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

    /** @var mixed Last logs. */
Severity: Minor
Found in tests/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    /**
Severity: Minor
Found in tests/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

            echo "\n+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n";
Severity: Minor
Found in tests/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * @return void
Severity: Minor
Found in tests/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    protected function disableLogs(): void
Severity: Minor
Found in tests/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    protected function onNotSuccessfulTest(\Throwable $t): void
Severity: Minor
Found in tests/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * Disable system logs.
Severity: Minor
Found in tests/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * Enable system logs.
Severity: Minor
Found in tests/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * @return void
Severity: Minor
Found in tests/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * @codeCoverageIgnore
Severity: Minor
Found in tests/Base.php by phpcodesniffer

Line exceeds 120 characters; contains 129 characters
Open

            echo "\n+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++\n";
Severity: Minor
Found in tests/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    {
Severity: Minor
Found in tests/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    public $logs;
Severity: Minor
Found in tests/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    /** @var bool Last logs. */
Severity: Minor
Found in tests/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * This method is called when a test method did not execute successfully.
Severity: Minor
Found in tests/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

            echo "\n+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++  LOGS:\n";
Severity: Minor
Found in tests/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

            //var_export(array_shift($t->getTrace()));
Severity: Minor
Found in tests/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        \App\Log::$logToFile = $this->logToFile;
Severity: Minor
Found in tests/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     *
Severity: Minor
Found in tests/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     */
Severity: Minor
Found in tests/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     */
Severity: Minor
Found in tests/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

            \print_r($this->logs);
Severity: Minor
Found in tests/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    {
Severity: Minor
Found in tests/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    private $logToFile;
Severity: Minor
Found in tests/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    }
Severity: Minor
Found in tests/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        \App\Log::$logToFile = false;
Severity: Minor
Found in tests/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    }
Severity: Minor
Found in tests/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    protected function enableLogs(): void
Severity: Minor
Found in tests/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     * @param \Throwable $t
Severity: Minor
Found in tests/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     *
Severity: Minor
Found in tests/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    {
Severity: Minor
Found in tests/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     *
Severity: Minor
Found in tests/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    }
Severity: Minor
Found in tests/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        if (isset($this->logs)) {
Severity: Minor
Found in tests/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        }
Severity: Minor
Found in tests/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     */
Severity: Minor
Found in tests/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        $this->logToFile = \App\Log::$logToFile;
Severity: Minor
Found in tests/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    /**
Severity: Minor
Found in tests/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

        throw $t;
Severity: Minor
Found in tests/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

    /**
Severity: Minor
Found in tests/Base.php by phpcodesniffer

Spaces must be used to indent lines; tabs are not allowed
Open

     *
Severity: Minor
Found in tests/Base.php by phpcodesniffer

There are no issues that match your filters.

Category
Status