iranianpep/code-jetter

View on GitHub
tests/RouterTest.php

Summary

Maintainability
D
1 day
Test Coverage

Method testRegexMatch has 135 lines of code (exceeds 25 allowed). Consider refactoring.
Open

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

Severity: Major
Found in tests/RouterTest.php - About 5 hrs to fix

    Method testGetAccessRole has 130 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function testGetAccessRole()
        {
            $app = App::getInstance();
            $app->init('dev');
    
    
    Severity: Major
    Found in tests/RouterTest.php - About 5 hrs to fix

      File RouterTest.php has 287 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      <?php
      
      namespace CodeJetter\tests;
      
      use CodeJetter\core\App;
      Severity: Minor
      Found in tests/RouterTest.php - About 2 hrs to fix

        The method testGetAccessRole() has 142 lines of code. Current threshold is set to 100. Avoid really long methods.
        Open

            public function testGetAccessRole()
            {
                $app = App::getInstance();
                $app->init('dev');
        
        
        Severity: Minor
        Found in tests/RouterTest.php by phpmd

        The method testRegexMatch() has 142 lines of code. Current threshold is set to 100. Avoid really long methods.
        Open

            public function testRegexMatch()
            {
                $app = App::getInstance();
                $app->init('dev');
        
        
        Severity: Minor
        Found in tests/RouterTest.php by phpmd

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

                $app = App::getInstance();
        Severity: Minor
        Found in tests/RouterTest.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 'testRegexMatch'.
        Open

                $app = App::getInstance();
        Severity: Minor
        Found in tests/RouterTest.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
        Severity: Minor
        Found in tests/RouterTest.php by phpcodesniffer

        There are no issues that match your filters.

        Category
        Status