refinery29/test-util

View on GitHub

Showing 5 of 40 total issues

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

      Method assertClassesSatisfy has 73 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function assertClassesSatisfy(callable $specification, $path, array $excludeDirectories = [], $message = null)
          {
              if (!\is_string($path)) {
                  throw new \InvalidArgumentException(\sprintf(
                      'Path needs to be specified as a string, got "%s".',
      Severity: Major
      Found in src/TestHelper.php - About 2 hrs to fix

        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

          Function provideCombinedDataFrom has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              final protected function provideCombinedDataFrom(DataProvider\DataProviderInterface ...$dataProviders)
              {
                  /**
                   * @link https://stackoverflow.com/a/15973172
                   */
          Severity: Minor
          Found in src/TestHelper.php - About 25 mins to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

          Severity
          Category
          Status
          Source
          Language