iranianpep/code-jetter

View on GitHub
tests/UserAuthenticationTest.php

Summary

Maintainability
A
1 hr
Test Coverage

Method testLogin has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        public function testLogin()
        {
            $app = App::getInstance();
            $app->init('dev');

Severity: Minor
Found in tests/UserAuthenticationTest.php - About 1 hr to fix

    Avoid using static access to class '\CodeJetter\core\App' in method 'testIsLoggedIn'.
    Open

                $app = App::getInstance();
    Severity: Minor
    Found in tests/UserAuthenticationTest.php by phpmd

    StaticAccess

    Since: 1.4.0

    Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

    Example

    class Foo
    {
        public function bar()
        {
            Bar::baz();
        }
    }

    Source https://phpmd.org/rules/cleancode.html#staticaccess

    Avoid using static access to class '\CodeJetter\core\App' in method 'testLogin'.
    Open

                $app = App::getInstance();
    Severity: Minor
    Found in tests/UserAuthenticationTest.php by phpmd

    StaticAccess

    Since: 1.4.0

    Static access causes unexchangeable dependencies to other classes and leads to hard to test code. Avoid using static access at all costs and instead inject dependencies through the constructor. The only case when static access is acceptable is when used for factory methods.

    Example

    class Foo
    {
        public function bar()
        {
            Bar::baz();
        }
    }

    Source https://phpmd.org/rules/cleancode.html#staticaccess

    A file should declare new symbols (classes, functions, constants, etc.) and cause no other side effects, or it should execute logic with side effects, but should not do both. The first symbol is defined on line 12 and the first side effect is on line 10.
    Open

    <?php

    Expected 0 spaces before opening brace; 4 found
    Open

        {

    Line indented incorrectly; expected 8 spaces, found 12
    Open

                }

    Line indented incorrectly; expected 4 spaces, found 8
    Open

            }

    Line indented incorrectly; expected 0 spaces, found 4
    Open

        }

    Line indented incorrectly; expected 4 spaces, found 8
    Open

            }

    Line indented incorrectly; expected 4 spaces, found 8
    Open

            public function testLogin()

    Line indented incorrectly; expected 4 spaces, found 8
    Open

            }

    Line indented incorrectly; expected 0 spaces, found 4
    Open

        class UserAuthenticationTest extends \PHPUnit_Framework_TestCase

    Line indented incorrectly; expected 4 spaces, found 8
    Open

            public function testIsUserActive()

    Line indented incorrectly; expected 8 spaces, found 12
    Open

                foreach ($inputOutputs as $inputOutput) {

    Line indented incorrectly; expected 4 spaces, found 8
    Open

            public function testIsLoggedIn()

    There are no issues that match your filters.

    Category
    Status