iranianpep/code-jetter

View on GitHub
tests/BaseMapperTest.php

Summary

Maintainability
F
4 days
Test Coverage

File BaseMapperTest.php has 328 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

namespace CodeJetter\tests;

use CodeJetter\components\geolocation\mappers\StateMapper;
Severity: Minor
Found in tests/BaseMapperTest.php - About 3 hrs to fix

    Method testRemoveTablePrefixAndSuffix has 54 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function testRemoveTablePrefixAndSuffix()
        {
            $stateMapper = new StateMapper();
    
            $inputOutputs = [
    Severity: Major
    Found in tests/BaseMapperTest.php - About 2 hrs to fix

      Method testGetTableAlias has 54 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function testGetTableAlias()
          {
              $stateMapper = new StateMapper();
      
              $inputOutputs = [
      Severity: Major
      Found in tests/BaseMapperTest.php - About 2 hrs to fix

        Method testGetClassNameByTableName has 51 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function testGetClassNameByTableName()
            {
                $stateMapper = new StateMapper();
        
                $inputOutputs = [
        Severity: Major
        Found in tests/BaseMapperTest.php - About 2 hrs to fix

          Method testMapRowsToObjects has 40 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function testMapRowsToObjects()
              {
                  $app = App::getInstance();
                  $app->init();
          
          
          Severity: Minor
          Found in tests/BaseMapperTest.php - About 1 hr to fix

            Method testGetTableNameByClassName has 34 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function testGetTableNameByClassName()
                {
                    $stateMapper = new StateMapper();
            
                    $inputOutputs = [
            Severity: Minor
            Found in tests/BaseMapperTest.php - About 1 hr to fix

              Method testGetExcludeArchivedCriteria has 27 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function testGetExcludeArchivedCriteria()
                  {
                      $app = App::getInstance();
                      $app->init('dev');
              
              
              Severity: Minor
              Found in tests/BaseMapperTest.php - About 1 hr to fix

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

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

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

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

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

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

                Similar blocks of code found in 2 locations. Consider refactoring.
                Open

                    public function testGetTableAlias()
                    {
                        $stateMapper = new StateMapper();
                
                        $inputOutputs = [
                Severity: Major
                Found in tests/BaseMapperTest.php and 1 other location - About 1 day to fix
                tests/BaseMapperTest.php on lines 148..206

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 273.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 2 locations. Consider refactoring.
                Open

                    public function testRemoveTablePrefixAndSuffix()
                    {
                        $stateMapper = new StateMapper();
                
                        $inputOutputs = [
                Severity: Major
                Found in tests/BaseMapperTest.php and 1 other location - About 1 day to fix
                tests/BaseMapperTest.php on lines 208..266

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 273.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 4 locations. Consider refactoring.
                Open

                    public function testGetMappersNamespace()
                    {
                        $app = App::getInstance();
                        $app->init();
                
                
                Severity: Major
                Found in tests/BaseMapperTest.php and 3 other locations - About 1 hr to fix
                tests/BaseMapperTest.php on lines 268..285
                tests/BaseModelTest.php on lines 42..59
                tests/BaseModelTest.php on lines 61..78

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 102.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                Similar blocks of code found in 4 locations. Consider refactoring.
                Open

                    public function testGetMappersPath()
                    {
                        $app = App::getInstance();
                        $app->init();
                
                
                Severity: Major
                Found in tests/BaseMapperTest.php and 3 other locations - About 1 hr to fix
                tests/BaseMapperTest.php on lines 287..304
                tests/BaseModelTest.php on lines 42..59
                tests/BaseModelTest.php on lines 61..78

                Duplicated Code

                Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                Tuning

                This issue has a mass of 102.

                We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                Refactorings

                Further Reading

                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/BaseMapperTest.php by phpcodesniffer

                Line exceeds 120 characters; contains 195 characters
                Open

                            $this->assertEquals($inputOutput['output'], $stateMapper->removeTablePrefixAndSuffix($inputOutput['input']['name'], $inputOutput['input']['prefix'], $inputOutput['input']['suffix']));
                Severity: Minor
                Found in tests/BaseMapperTest.php by phpcodesniffer

                Line exceeds 120 characters; contains 182 characters
                Open

                            $this->assertEquals($inputOutput['output'], $stateMapper->getTableAlias($inputOutput['input']['name'], $inputOutput['input']['prefix'], $inputOutput['input']['suffix']));
                Severity: Minor
                Found in tests/BaseMapperTest.php by phpcodesniffer

                Line exceeds 120 characters; contains 228 characters
                Open

                            $this->assertEquals($inputOutput['output'], $stateMapper->getClassNameByTableName($inputOutput['input']['name'], $inputOutput['input']['namespace'], $inputOutput['input']['prefix'], $inputOutput['input']['suffix']));
                Severity: Minor
                Found in tests/BaseMapperTest.php by phpcodesniffer

                There are no issues that match your filters.

                Category
                Status