iranianpep/code-jetter

View on GitHub
tests/ValidatorTest.php

Summary

Maintainability
F
6 days
Test Coverage

File ValidatorTest.php has 929 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

namespace CodeJetter\tests;

use CodeJetter\core\App;
Severity: Major
Found in tests/ValidatorTest.php - About 2 days to fix

    Method testValidatePassword has 176 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

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

      Method testValidateURL has 87 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

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

        Method testValidateMoney has 87 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

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

          The class ValidatorTest has 13 public methods. Consider refactoring ValidatorTest to keep number of public methods under 10.
          Open

          class ValidatorTest extends \PHPUnit_Framework_TestCase
          {
              public function testValidateEmail()
              {
                  $app = App::getInstance();
          Severity: Minor
          Found in tests/ValidatorTest.php by phpmd

          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

          Method testValidateUsername has 71 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

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

            Method testValidateSize has 71 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

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

              Method testValidateRequired has 67 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

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

                Method testValidateId has 66 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

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

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

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

                    Method testValidateWhiteList has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

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

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

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

                        Method testIsAllRequired has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

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

                          Method testGetFilteredInputs has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              public function testGetFilteredInputs()
                              {
                                  $dummyInput1 = new Input('name');
                                  $dummyInput2 = new Input('email');
                          
                          
                          Severity: Minor
                          Found in tests/ValidatorTest.php - About 1 hr to fix

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                                    $app = App::getInstance();
                            Severity: Minor
                            Found in tests/ValidatorTest.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 13 and the first side effect is on line 11.
                            Open

                            <?php
                            Severity: Minor
                            Found in tests/ValidatorTest.php by phpcodesniffer

                            There are no issues that match your filters.

                            Category
                            Status