refinery29/test-util

View on GitHub
test/TestHelperTest.php

Summary

Maintainability
D
2 days
Test Coverage

File TestHelperTest.php has 519 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

/*
 * Copyright (c) 2016 Refinery29, Inc.
 *
Severity: Major
Found in test/TestHelperTest.php - About 1 day to fix

    TestHelperTest has 49 functions (exceeds 20 allowed). Consider refactoring.
    Open

    final class TestHelperTest extends Framework\TestCase
    {
        use TestHelper;
    
        public function testCanGetFakerStatically()
    Severity: Minor
    Found in test/TestHelperTest.php - About 6 hrs to fix

      The class TestHelperTest has 49 non-getter- and setter-methods. Consider refactoring TestHelperTest to keep number of methods under 25.
      Open

      final class TestHelperTest extends Framework\TestCase
      {
          use TestHelper;
      
          public function testCanGetFakerStatically()
      Severity: Minor
      Found in test/TestHelperTest.php by phpmd

      TooManyMethods

      Since: 0.1

      A class with too many 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'.

      The default was changed from 10 to 25 in PHPMD 2.3.

      Example

      Source https://phpmd.org/rules/codesize.html#toomanymethods

      The class TestHelperTest has 48 public methods. Consider refactoring TestHelperTest to keep number of public methods under 10.
      Open

      final class TestHelperTest extends Framework\TestCase
      {
          use TestHelper;
      
          public function testCanGetFakerStatically()
      Severity: Minor
      Found in test/TestHelperTest.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

      The class TestHelperTest has an overall complexity of 53 which is very high. The configured complexity threshold is 50.
      Open

      final class TestHelperTest extends Framework\TestCase
      {
          use TestHelper;
      
          public function testCanGetFakerStatically()
      Severity: Minor
      Found in test/TestHelperTest.php by phpmd

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

          public function testProvideCombinedDataFromYieldsCombinedValuesFromMultipleDataProviders()
          {
              $valuesOne = [
                  1,
                  2,
      Severity: Minor
      Found in test/TestHelperTest.php - About 1 hr to fix

        The class TestHelperTest has 48 public methods and attributes. Consider reducing the number of public items to less than 45.
        Open

        final class TestHelperTest extends Framework\TestCase
        {
            use TestHelper;
        
            public function testCanGetFakerStatically()
        Severity: Minor
        Found in test/TestHelperTest.php by phpmd

        ExcessivePublicCount

        Since: 0.1

        A large number of public methods and attributes declared in a class can indicate the class may need to be broken up as increased effort will be required to thoroughly test it.

        Example

        public class Foo {
            public $value;
            public $something;
            public $var;
            // [... more more public attributes ...]
        
            public function doWork() {}
            public function doMoreWork() {}
            public function doWorkAgain() {}
            // [... more more public methods ...]
        }

        Source https://phpmd.org/rules/codesize.html#excessivepubliccount

        The class TestHelperTest has a coupling between objects value of 21. Consider to reduce the number of dependencies under 13.
        Open

        final class TestHelperTest extends Framework\TestCase
        {
            use TestHelper;
        
            public function testCanGetFakerStatically()
        Severity: Minor
        Found in test/TestHelperTest.php by phpmd

        CouplingBetweenObjects

        Since: 1.1.0

        A class with too many dependencies has negative impacts on several quality aspects of a class. This includes quality criteria like stability, maintainability and understandability

        Example

        class Foo {
            /**
             * @var \foo\bar\X
             */
            private $x = null;
        
            /**
             * @var \foo\bar\Y
             */
            private $y = null;
        
            /**
             * @var \foo\bar\Z
             */
            private $z = null;
        
            public function setFoo(\Foo $foo) {}
            public function setBar(\Bar $bar) {}
            public function setBaz(\Baz $baz) {}
        
            /**
             * @return \SplObjectStorage
             * @throws \OutOfRangeException
             * @throws \InvalidArgumentException
             * @throws \ErrorException
             */
            public function process(\Iterator $it) {}
        
            // ...
        }

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

        Missing class import via use statement (line '121', column '27').
        Open

                $reflection = new \ReflectionClass(Provider\Color::class);
        Severity: Minor
        Found in test/TestHelperTest.php by phpmd

        MissingImport

        Since: 2.7.0

        Importing all external classes in a file through use statements makes them clearly visible.

        Example

        function make() {
            return new \stdClass();
        }

        Source http://phpmd.org/rules/cleancode.html#MissingImport

        Missing class import via use statement (line '104', column '27').
        Open

                $reflection = new \ReflectionClass($faker);
        Severity: Minor
        Found in test/TestHelperTest.php by phpmd

        MissingImport

        Since: 2.7.0

        Importing all external classes in a file through use statements makes them clearly visible.

        Example

        function make() {
            return new \stdClass();
        }

        Source http://phpmd.org/rules/cleancode.html#MissingImport

        Avoid excessively long variable names like $classNamesNeitherAbstractNorFinal. Keep variable name length under 20.
        Open

                $classNamesNeitherAbstractNorFinal = [
        Severity: Minor
        Found in test/TestHelperTest.php by phpmd

        LongVariable

        Since: 0.2

        Detects when a field, formal or local variable is declared with a long name.

        Example

        class Something {
            protected $reallyLongIntName = -3; // VIOLATION - Field
            public static function main( array $interestingArgumentsList[] ) { // VIOLATION - Formal
                $otherReallyLongName = -5; // VIOLATION - Local
                for ($interestingIntIndex = 0; // VIOLATION - For
                     $interestingIntIndex < 10;
                     $interestingIntIndex++ ) {
                }
            }
        }

        Source https://phpmd.org/rules/naming.html#longvariable

        There are no issues that match your filters.

        Category
        Status