Browse Source

Merge branch '2.3'

# Conflicts:
#	src/Test/AbstractFixerTestCase.php
#	src/Test/AbstractIntegrationTestCase.php
#	src/Test/IntegrationCase.php
#	tests/Fixer/Basic/NonPrintableCharacterFixerTest.php
Dariusz Ruminski 7 years ago
parent
commit
99135fef77

+ 8 - 1
composer.json

@@ -49,7 +49,14 @@
         "sort-packages": true
     },
     "autoload": {
-        "psr-4": { "PhpCsFixer\\": "src/" }
+        "psr-4": { "PhpCsFixer\\": "src/" },
+        "classmap": [
+            "tests/Test/Assert/AssertTokensTrait.php",
+            "tests/Test/AbstractFixerTestCase.php",
+            "tests/Test/AbstractIntegrationTestCase.php",
+            "tests/Test/IntegrationCase.php",
+            "tests/Test/IntegrationCaseFactory.php"
+        ]
     },
     "autoload-dev": {
         "psr-4": { "PhpCsFixer\\Tests\\": "tests/" }

+ 1 - 1
doc/COOKBOOK-FIXERS.md

@@ -107,7 +107,7 @@ Now let us create the test file at
 
 namespace PhpCsFixer\Tests\Fixer\Comment;
 
-use PhpCsFixer\Test\AbstractFixerTestCase;
+use PhpCsFixer\Tests\Test\AbstractFixerTestCase;
 
 /**
  * @author Your name <your@email.com>

+ 15 - 233
src/Test/AbstractFixerTestCase.php

@@ -12,243 +12,25 @@
 
 namespace PhpCsFixer\Test;
 
-use GeckoPackages\PHPUnit\Constraints\SameStringsConstraint;
-use PhpCsFixer\Fixer\FixerInterface;
-use PhpCsFixer\FixerFactory;
-use PhpCsFixer\Linter\Linter;
-use PhpCsFixer\Linter\LinterInterface;
-use PhpCsFixer\RuleSet;
-use PhpCsFixer\Test\Assert\AssertTokensTrait;
-use PhpCsFixer\Tokenizer\Token;
-use PhpCsFixer\Tokenizer\Tokens;
-use PhpCsFixer\Utils;
-use PHPUnit\Framework\TestCase;
-use Prophecy\Argument;
+use PhpCsFixer\Tests\Test\AbstractFixerTestCase as BaseAbstractFixerTestCase;
 
 /**
- * @author Dariusz Rumiński <dariusz.ruminski@gmail.com>
+ * @TODO 3.0 While removing, `gecko-packages/gecko-php-unit` shall be moved from `require` to `require-dev` and removed from `.composer-require-checker.json`.
+ * @TODO 3.0 While removing, remove from `.composer-require-checker.json`.
+ * @TODO 3.0 While removing, remove loading `tests/Test` from `autoload` section of `composer.json`.
+ *
+ * @deprecated since v2.4
  */
-abstract class AbstractFixerTestCase extends TestCase
+abstract class AbstractFixerTestCase extends BaseAbstractFixerTestCase
 {
-    use AssertTokensTrait;
-
-    /**
-     * @var LinterInterface
-     */
-    protected $linter;
-
-    /**
-     * @var null|FixerInterface
-     */
-    protected $fixer;
-
-    /**
-     * @var null|string
-     */
-    private $fixerClassName;
-
-    protected function setUp()
-    {
-        $this->linter = $this->getLinter();
-        $this->fixer = $this->createFixer();
-
-        // @todo remove at 3.0 together with env var itself
-        if (getenv('PHP_CS_FIXER_TEST_USE_LEGACY_TOKENIZER')) {
-            Tokens::setLegacyMode(true);
-        }
-    }
-
-    protected function tearDown()
-    {
-        // @todo remove at 3.0
-        Tokens::setLegacyMode(false);
-    }
-
-    /**
-     * @return FixerInterface
-     */
-    protected function createFixer()
-    {
-        $fixerClassName = $this->getFixerClassName();
-
-        return new $fixerClassName();
-    }
-
-    /**
-     * Create fixer factory with all needed fixers registered.
-     *
-     * @return FixerFactory
-     */
-    protected function createFixerFactory()
-    {
-        return FixerFactory::create()->registerBuiltInFixers();
-    }
-
-    /**
-     * @return string
-     */
-    protected function getFixerName()
-    {
-        $reflection = new \ReflectionClass($this);
-
-        $name = preg_replace('/FixerTest$/', '', $reflection->getShortName());
-
-        return Utils::camelCaseToUnderscore($name);
-    }
-
-    /**
-     * @param string $filename
-     *
-     * @return \SplFileInfo
-     */
-    protected function getTestFile($filename = __FILE__)
-    {
-        static $files = [];
-
-        if (!isset($files[$filename])) {
-            $files[$filename] = new \SplFileInfo($filename);
-        }
-
-        return $files[$filename];
-    }
-
-    /**
-     * Tests if a fixer fixes a given string to match the expected result.
-     *
-     * It is used both if you want to test if something is fixed or if it is not touched by the fixer.
-     * It also makes sure that the expected output does not change when run through the fixer. That means that you
-     * do not need two test cases like [$expected] and [$expected, $input] (where $expected is the same in both cases)
-     * as the latter covers both of them.
-     * This method throws an exception if $expected and $input are equal to prevent test cases that accidentally do
-     * not test anything.
-     *
-     * @param string            $expected The expected fixer output
-     * @param null|string       $input    The fixer input, or null if it should intentionally be equal to the output
-     * @param null|\SplFileInfo $file     The file to fix, or null if unneeded
-     */
-    protected function doTest($expected, $input = null, \SplFileInfo $file = null)
-    {
-        if ($expected === $input) {
-            throw new \InvalidArgumentException('Input parameter must not be equal to expected parameter.');
-        }
-
-        $file = $file ?: $this->getTestFile();
-        $fileIsSupported = $this->fixer->supports($file);
-
-        if (null !== $input) {
-            $this->assertNull($this->lintSource($input));
-
-            Tokens::clearCache();
-            $tokens = Tokens::fromCode($input);
-
-            if ($fileIsSupported) {
-                $this->assertTrue($this->fixer->isCandidate($tokens), 'Fixer must be a candidate for input code.');
-                $this->assertFalse($tokens->isChanged(), 'Fixer must not touch Tokens on candidate check.');
-                $fixResult = $this->fixer->fix($file, $tokens);
-                $this->assertNull($fixResult, '->fix method must return null.');
-            }
-
-            $this->assertThat(
-                $tokens->generateCode(),
-                new SameStringsConstraint($expected),
-                'Code build on input code must match expected code.'
-            );
-            $this->assertTrue($tokens->isChanged(), 'Tokens collection built on input code must be marked as changed after fixing.');
-
-            $tokens->clearEmptyTokens();
-
-            $this->assertSame(
-                count($tokens),
-                count(array_unique(array_map(function (Token $token) {
-                    return spl_object_hash($token);
-                }, $tokens->toArray()))),
-                'Token items inside Tokens collection must be unique.'
-            );
-
-            Tokens::clearCache();
-            $expectedTokens = Tokens::fromCode($expected);
-            $this->assertTokens($expectedTokens, $tokens);
-        }
-
-        $this->assertNull($this->lintSource($expected));
-
-        Tokens::clearCache();
-        $tokens = Tokens::fromCode($expected);
-
-        if ($fileIsSupported) {
-            $fixResult = $this->fixer->fix($file, $tokens);
-            $this->assertNull($fixResult, '->fix method must return null.');
-        }
-
-        $this->assertThat(
-            $tokens->generateCode(),
-            new SameStringsConstraint($expected),
-            'Code build on expected code must not change.'
+    public function __construct()
+    {
+        @trigger_error(
+            sprintf(
+                'The "%s" class is deprecated. You should stop using it, as it will be removed in 3.0 version.',
+                __CLASS__
+            ),
+            E_USER_DEPRECATED
         );
-        $this->assertFalse($tokens->isChanged(), 'Tokens collection built on expected code must not be marked as changed after fixing.');
-    }
-
-    /**
-     * @param string $source
-     *
-     * @return null|string
-     */
-    protected function lintSource($source)
-    {
-        try {
-            $this->linter->lintSource($source)->check();
-        } catch (\Exception $e) {
-            return $e->getMessage()."\n\nSource:\n$source";
-        }
-    }
-
-    /**
-     * @return LinterInterface
-     */
-    private function getLinter()
-    {
-        static $linter = null;
-
-        if (null === $linter) {
-            if (getenv('SKIP_LINT_TEST_CASES')) {
-                $linterProphecy = $this->prophesize(\PhpCsFixer\Linter\LinterInterface::class);
-                $linterProphecy
-                    ->lintSource(Argument::type('string'))
-                    ->willReturn($this->prophesize(\PhpCsFixer\Linter\LintingResultInterface::class)->reveal());
-
-                $linter = $linterProphecy->reveal();
-            } else {
-                $linter = new Linter();
-            }
-        }
-
-        return $linter;
-    }
-
-    /**
-     * @return string
-     */
-    private function getFixerClassName()
-    {
-        if (null !== $this->fixerClassName) {
-            return $this->fixerClassName;
-        }
-
-        try {
-            $fixers = $this->createFixerFactory()
-                ->useRuleSet(new RuleSet([$this->getFixerName() => true]))
-                ->getFixers()
-            ;
-        } catch (\UnexpectedValueException $e) {
-            throw new \UnexpectedValueException('Cannot determine fixer class, perhaps you forget to override `getFixerName` or `createFixerFactory` method?', 0, $e);
-        }
-
-        if (1 !== count($fixers)) {
-            throw new \UnexpectedValueException(sprintf('Determine fixer class should result in one fixer, got "%d". Perhaps you configured the fixer to "false" ?', count($fixers)));
-        }
-
-        $this->fixerClassName = get_class($fixers[0]);
-
-        return $this->fixerClassName;
     }
 }

+ 12 - 347
src/Test/AbstractIntegrationTestCase.php

@@ -12,360 +12,25 @@
 
 namespace PhpCsFixer\Test;
 
-use GeckoPackages\PHPUnit\Constraints\SameStringsConstraint;
-use PhpCsFixer\Cache\NullCacheManager;
-use PhpCsFixer\Differ\SebastianBergmannDiffer;
-use PhpCsFixer\Error\Error;
-use PhpCsFixer\Error\ErrorsManager;
-use PhpCsFixer\FileRemoval;
-use PhpCsFixer\Fixer\FixerInterface;
-use PhpCsFixer\FixerFactory;
-use PhpCsFixer\Linter\Linter;
-use PhpCsFixer\Linter\LinterInterface;
-use PhpCsFixer\Runner\Runner;
-use PhpCsFixer\Tokenizer\Tokens;
-use PhpCsFixer\WhitespacesFixerConfig;
-use PHPUnit\Framework\TestCase;
-use Prophecy\Argument;
-use Symfony\Component\Filesystem\Exception\IOException;
-use Symfony\Component\Filesystem\Filesystem;
-use Symfony\Component\Finder\Finder;
+use PhpCsFixer\Tests\Test\AbstractIntegrationTestCase as BaseAbstractIntegrationTestCase;
 
 /**
- * Integration test base class.
+ * @TODO 3.0 While removing, `gecko-packages/gecko-php-unit` shall be moved from `require` to `require-dev` and removed from `.composer-require-checker.json`.
+ * @TODO 3.0 While removing, remove from `.composer-require-checker.json`.
+ * @TODO 3.0 While removing, remove loading `tests/Test` from `autoload` section of `composer.json`.
  *
- * This test searches for '.test' fixture files in the given directory.
- * Each fixture file will be parsed and tested against the expected result.
- *
- * Fixture files have the following format:
- *
- * --TEST--
- * Example test description.
- * --RULESET--
- * {"@PSR2": true, "strict": true}
- * --CONFIG--*
- * {"indent": "    ", "lineEnding": "\n"}
- * --SETTINGS--*
- * {"key": "value"} # optional extension point for custom IntegrationTestCase class
- * --REQUIREMENTS--*
- * {"php": 50600**}
- * --EXPECT--
- * Expected code after fixing
- * --INPUT--*
- * Code to fix
- *
- *   * Section or any line in it may be omitted.
- *  ** PHP minimum version. Default to current running php version (no effect).
- *
- * @author SpacePossum
+ * @deprecated since v2.4
  */
-abstract class AbstractIntegrationTestCase extends TestCase
+abstract class AbstractIntegrationTestCase extends BaseAbstractIntegrationTestCase
 {
-    /**
-     * @var LinterInterface
-     */
-    protected $linter;
-
-    /**
-     * @var FileRemoval
-     */
-    private static $fileRemoval;
-
-    public static function setUpBeforeClass()
-    {
-        $tmpFile = static::getTempFile();
-        self::$fileRemoval = new FileRemoval();
-        self::$fileRemoval->observe($tmpFile);
-
-        if (!is_file($tmpFile)) {
-            $dir = dirname($tmpFile);
-
-            if (!is_dir($dir)) {
-                $fs = new Filesystem();
-                $fs->mkdir($dir, 0766);
-            }
-        }
-    }
-
-    public static function tearDownAfterClass()
-    {
-        $tmpFile = static::getTempFile();
-
-        self::$fileRemoval->delete($tmpFile);
-    }
-
-    protected function setUp()
-    {
-        $this->linter = $this->getLinter();
-
-        // @todo remove at 3.0 together with env var itself
-        if (getenv('PHP_CS_FIXER_TEST_USE_LEGACY_TOKENIZER')) {
-            Tokens::setLegacyMode(true);
-        }
-    }
-
-    protected function tearDown()
-    {
-        // @todo remove at 3.0
-        Tokens::setLegacyMode(false);
-    }
-
-    /**
-     * @dataProvider getTests
-     *
-     * @see doTest()
-     *
-     * @param IntegrationCase $case
-     */
-    public function testIntegration(IntegrationCase $case)
-    {
-        $this->doTest($case);
-    }
-
-    /**
-     * Creates test data by parsing '.test' files.
-     *
-     * @return IntegrationCase[][]
-     */
-    public function getTests()
-    {
-        $fixturesDir = realpath(static::getFixturesDir());
-        if (!is_dir($fixturesDir)) {
-            throw new \UnexpectedValueException(sprintf('Given fixture dir "%s" is not a directory.', $fixturesDir));
-        }
-
-        $factory = new IntegrationCaseFactory();
-        $tests = [];
-
-        foreach (Finder::create()->files()->in($fixturesDir) as $file) {
-            if ('test' !== $file->getExtension()) {
-                continue;
-            }
-
-            $tests[] = [
-                $factory->create($file),
-            ];
-        }
-
-        return $tests;
-    }
-
-    /**
-     * Returns the full path to directory which contains the tests.
-     *
-     * @return string
-     */
-    protected static function getFixturesDir()
+    public function __construct()
     {
-        throw new \BadMethodCallException('Method "getFixturesDir" must be overridden by the extending class.');
-    }
-
-    /**
-     * Returns the full path to the temporary file where the test will write to.
-     *
-     * @return string
-     */
-    protected static function getTempFile()
-    {
-        throw new \BadMethodCallException('Method "getTempFile" must be overridden by the extending class.');
-    }
-
-    /**
-     * Applies the given fixers on the input and checks the result.
-     *
-     * It will write the input to a temp file. The file will be fixed by a Fixer instance
-     * configured with the given fixers. The result is compared with the expected output.
-     * It checks if no errors were reported during the fixing.
-     *
-     * @param IntegrationCase $case
-     */
-    protected function doTest(IntegrationCase $case)
-    {
-        if (PHP_VERSION_ID < $case->getRequirement('php')) {
-            $this->markTestSkipped(sprintf('PHP %d (or later) is required for "%s", current "%d".', $case->getRequirement('php'), $case->getFileName(), PHP_VERSION_ID));
-        }
-
-        $input = $case->getInputCode();
-        $expected = $case->getExpectedCode();
-
-        $input = $case->hasInputCode() ? $input : $expected;
-
-        $tmpFile = static::getTempFile();
-
-        if (false === @file_put_contents($tmpFile, $input)) {
-            throw new IOException(sprintf('Failed to write to tmp. file "%s".', $tmpFile));
-        }
-
-        $errorsManager = new ErrorsManager();
-        $fixers = $this->createFixers($case);
-        $runner = new Runner(
-            new \ArrayIterator([new \SplFileInfo($tmpFile)]),
-            $fixers,
-            new SebastianBergmannDiffer(),
-            null,
-            $errorsManager,
-            $this->linter,
-            false,
-            new NullCacheManager()
-        );
-
-        Tokens::clearCache();
-        $result = $runner->fix();
-        $changed = array_pop($result);
-
-        if (!$errorsManager->isEmpty()) {
-            $errors = $errorsManager->getExceptionErrors();
-            $this->assertEmpty($errors, sprintf('Errors reported during fixing of file "%s": %s', $case->getFileName(), $this->implodeErrors($errors)));
-
-            $errors = $errorsManager->getInvalidErrors();
-            $this->assertEmpty($errors, sprintf('Errors reported during linting before fixing file "%s": %s.', $case->getFileName(), $this->implodeErrors($errors)));
-
-            $errors = $errorsManager->getLintErrors();
-            $this->assertEmpty($errors, sprintf('Errors reported during linting after fixing file "%s": %s.', $case->getFileName(), $this->implodeErrors($errors)));
-        }
-
-        if (!$case->hasInputCode()) {
-            $this->assertEmpty(
-                $changed,
-                sprintf(
-                    "Expected no changes made to test \"%s\" in \"%s\".\nFixers applied:\n%s.\nDiff.:\n%s.",
-                    $case->getTitle(),
-                    $case->getFileName(),
-                    $changed === null ? '[None]' : implode(',', $changed['appliedFixers']),
-                    $changed === null ? '[None]' : $changed['diff']
-                )
-            );
-
-            return;
-        }
-
-        $this->assertNotEmpty($changed, sprintf('Expected changes made to test "%s" in "%s".', $case->getTitle(), $case->getFileName()));
-        $fixedInputCode = file_get_contents($tmpFile);
-        $this->assertThat(
-            $fixedInputCode,
-            new SameStringsConstraint($expected),
+        @trigger_error(
             sprintf(
-                "Expected changes do not match result for \"%s\" in \"%s\".\nFixers applied:\n%s.",
-                $case->getTitle(),
-                $case->getFileName(),
-                $changed === null ? '[None]' : implode(',', $changed['appliedFixers'])
-            )
+                'The "%s" class is deprecated. You should stop using it, as it will be removed in 3.0 version.',
+                __CLASS__
+            ),
+            E_USER_DEPRECATED
         );
-
-        if (1 < count($fixers)) {
-            $tmpFile = static::getTempFile();
-            if (false === @file_put_contents($tmpFile, $input)) {
-                throw new IOException(sprintf('Failed to write to tmp. file "%s".', $tmpFile));
-            }
-
-            $runner = new Runner(
-                new \ArrayIterator([new \SplFileInfo($tmpFile)]),
-                array_reverse($fixers),
-                new SebastianBergmannDiffer(),
-                null,
-                $errorsManager,
-                $this->linter,
-                false,
-                new NullCacheManager()
-            );
-
-            Tokens::clearCache();
-            $runner->fix();
-            $fixedInputCodeWithReversedFixers = file_get_contents($tmpFile);
-
-            // If output is different depends on rules order - we need to verify that the rules are ordered by priority.
-            // If not, any order is valid.
-            if ($fixedInputCode !== $fixedInputCodeWithReversedFixers) {
-                $this->assertGreaterThan(
-                    1,
-                    count(array_unique(array_map(
-                        function (FixerInterface $fixer) {
-                            return $fixer->getPriority();
-                        },
-                        $fixers
-                    ))),
-                    sprintf(
-                        'Rules priorities are not differential enough. If rules would be used in reverse order then final output would be different than the expected one. For that, different priorities must be set up for used rules to ensure stable order of them. In "%s".',
-                        $case->getFileName()
-                    )
-                );
-            }
-        }
-
-        // run the test again with the `expected` part, this should always stay the same
-        $this->testIntegration(
-            new IntegrationCase(
-                $case->getFileName(),
-                $case->getTitle().' "--EXPECT-- part run"',
-                $case->getSettings(),
-                $case->getRequirements(),
-                $case->getConfig(),
-                $case->getRuleset(),
-                $case->getExpectedCode(),
-                null
-            )
-        );
-    }
-
-    /**
-     * @param IntegrationCase $case
-     *
-     * @return FixerInterface[]
-     */
-    private function createFixers(IntegrationCase $case)
-    {
-        $config = $case->getConfig();
-
-        return FixerFactory::create()
-            ->registerBuiltInFixers()
-            ->useRuleSet($case->getRuleset())
-            ->setWhitespacesConfig(
-                new WhitespacesFixerConfig($config['indent'], $config['lineEnding'])
-            )
-            ->getFixers();
-    }
-
-    /**
-     * @param Error[] $errors
-     *
-     * @return string
-     */
-    private function implodeErrors(array $errors)
-    {
-        $errorStr = '';
-        foreach ($errors as $error) {
-            $errorStr .= sprintf("%d: %s\n", $error->getType(), $error->getFilePath());
-        }
-
-        return $errorStr;
-    }
-
-    /**
-     * @return LinterInterface
-     */
-    private function getLinter()
-    {
-        static $linter = null;
-
-        if (null === $linter) {
-            if (getenv('SKIP_LINT_TEST_CASES')) {
-                $linterProphecy = $this->prophesize(\PhpCsFixer\Linter\LinterInterface::class);
-                $linterProphecy
-                    ->lintSource(Argument::type('string'))
-                    ->willReturn($this->prophesize(\PhpCsFixer\Linter\LintingResultInterface::class)->reveal());
-                $linterProphecy
-                    ->lintFile(Argument::type('string'))
-                    ->willReturn($this->prophesize(\PhpCsFixer\Linter\LintingResultInterface::class)->reveal());
-                $linterProphecy
-                    ->isAsync()
-                    ->willReturn(false);
-
-                $linter = $linterProphecy->reveal();
-            } else {
-                $linter = new Linter();
-            }
-        }
-
-        return $linter;
     }
 }

+ 39 - 80
src/Test/IntegrationCase.php

@@ -13,55 +13,23 @@
 namespace PhpCsFixer\Test;
 
 use PhpCsFixer\RuleSet;
+use PhpCsFixer\Tests\Test\IntegrationCase as BaseIntegrationCase;
 
 /**
  * @author Dariusz Rumiński <dariusz.ruminski@gmail.com>
+ *
+ * @TODO 3.0 While removing, `gecko-packages/gecko-php-unit` shall be moved from `require` to `require-dev` and removed from `.composer-require-checker.json`.
+ * @TODO 3.0 While removing, remove from `.composer-require-checker.json`.
+ * @TODO 3.0 While removing, remove loading `tests/Test` from `autoload` section of `composer.json`.
+ *
+ * @deprecated since v2.4
  */
 final class IntegrationCase
 {
     /**
-     * @var array
-     */
-    private $config;
-
-    /**
-     * @var string
-     */
-    private $expectedCode;
-
-    /**
-     * @var string
-     */
-    private $fileName;
-
-    /**
-     * @var null|string
-     */
-    private $inputCode;
-
-    /**
-     * Env requirements (possible keys: php).
-     *
-     * @var array
-     */
-    private $requirements;
-
-    /**
-     * @var RuleSet
+     * @var BaseIntegrationCase
      */
-    private $ruleset;
-
-    /**
-     * Settings how to perform the test (possible keys: none in base class, use as extension point for custom IntegrationTestCase).
-     *
-     * @var array
-     */
-    private $settings;
-
-    /**
-     * @var string
-     */
-    private $title;
+    private $base;
 
     /**
      * @param string      $fileName
@@ -83,84 +51,73 @@ final class IntegrationCase
         $expectedCode,
         $inputCode
     ) {
-        $this->fileName = $fileName;
-        $this->title = $title;
-        $this->settings = $settings;
-        $this->requirements = $requirements;
-        $this->config = $config;
-        $this->ruleset = $ruleset;
-        $this->expectedCode = $expectedCode;
-        $this->inputCode = $inputCode;
+        $this->base = new BaseIntegrationCase(
+            $fileName,
+            $title,
+            $settings,
+            $requirements,
+            $config,
+            $ruleset,
+            $expectedCode,
+            $inputCode
+        );
+        @trigger_error(
+            sprintf(
+                'The "%s" class is deprecated. You should stop using it, as it will be removed in 3.0 version.',
+                __CLASS__
+            ),
+            E_USER_DEPRECATED
+        );
     }
 
     public function hasInputCode()
     {
-        return null !== $this->inputCode;
+        return $this->base->hasInputCode();
     }
 
     public function getConfig()
     {
-        return $this->config;
+        return $this->base->getConfig();
     }
 
     public function getExpectedCode()
     {
-        return $this->expectedCode;
+        return $this->base->getExpectedCode();
     }
 
     public function getFileName()
     {
-        return $this->fileName;
+        return $this->base->getFileName();
     }
 
     public function getInputCode()
     {
-        return $this->inputCode;
+        return $this->base->getInputCode();
     }
 
-    /**
-     * @param string $name
-     *
-     * @return mixed
-     */
     public function getRequirement($name)
     {
-        if (!is_string($name)) {
-            throw new \InvalidArgumentException(sprintf(
-                'Requirement key must be a string, got "%s".',
-                is_object($name) ? get_class($name) : gettype($name).'#'.$name
-            ));
-        }
-
-        if (!array_key_exists($name, $this->requirements)) {
-            throw new \InvalidArgumentException(sprintf(
-                'Unknown requirement key "%s", expected any of "%s".',
-                $name,
-                implode('","', array_keys($this->requirements))
-            ));
-        }
-
-        return $this->requirements[$name];
+        return $this->base->getRequirement($name);
     }
 
     public function getRequirements()
     {
-        return $this->requirements;
+        return $this->base->getRequirements();
     }
 
     public function getRuleset()
     {
-        return $this->ruleset;
+        return $this->base->getRuleset();
     }
 
     public function getSettings()
     {
-        return $this->settings;
+        return $this->base->getSettings();
     }
 
     public function getTitle()
     {
-        return $this->title;
+        return $this->base->getTitle();
     }
 
     /**
@@ -178,6 +135,8 @@ final class IntegrationCase
             E_USER_DEPRECATED
         );
 
-        return isset($this->settings['checkPriority']) ? $this->settings['checkPriority'] : true;
+        $settings = $this->base->getSettings();
+
+        return isset($settings['checkPriority']) ? $settings['checkPriority'] : true;
     }
 }

+ 1 - 1
tests/AbstractDoctrineAnnotationFixerTestCase.php

@@ -12,7 +12,7 @@
 
 namespace PhpCsFixer\Tests;
 
-use PhpCsFixer\Test\AbstractFixerTestCase;
+use PhpCsFixer\Tests\Test\AbstractFixerTestCase;
 
 /**
  * @internal

+ 4 - 5
tests/AutoReview/ProjectCodeTest.php

@@ -53,8 +53,6 @@ final class ProjectCodeTest extends TestCase
         \PhpCsFixer\Runner\FileFilterIterator::class,
         \PhpCsFixer\Runner\FileLintingIterator::class,
         \PhpCsFixer\StdinFileInfo::class,
-        \PhpCsFixer\Test\Assert\AssertTokensTrait::class,
-        \PhpCsFixer\Test\IntegrationCaseFactory::class,
         \PhpCsFixer\Tokenizer\Transformers::class,
     ];
 
@@ -64,6 +62,7 @@ final class ProjectCodeTest extends TestCase
             self::$classesWithoutTests,
             function ($class) { return !class_exists($class) && !trait_exists($class); }
         );
+
         $this->assertSame([], $unknownClasses);
     }
 
@@ -236,13 +235,13 @@ final class ProjectCodeTest extends TestCase
      *
      * @dataProvider provideTestClasses
      */
-    public function testThatTestClassesAreAbstractOrFinal($className)
+    public function testThatTestClassesAreTraitOrAbstractOrFinal($className)
     {
         $rc = new \ReflectionClass($className);
 
         $this->assertTrue(
-            $rc->isAbstract() || $rc->isFinal(),
-            sprintf('Test class %s should be abstract or final.', $className)
+            $rc->isTrait() || $rc->isAbstract() || $rc->isFinal(),
+            sprintf('Test class %s should be trait, abstract or final.', $className)
         );
     }
 

+ 1 - 1
tests/Fixer/Alias/EregToPregFixerTest.php

@@ -12,7 +12,7 @@
 
 namespace PhpCsFixer\Tests\Fixer\Alias;
 
-use PhpCsFixer\Test\AbstractFixerTestCase;
+use PhpCsFixer\Tests\Test\AbstractFixerTestCase;
 
 /**
  * @author Matteo Beccati <matteo@beccati.com>

+ 1 - 1
tests/Fixer/Alias/MbStrFunctionsFixerTest.php

@@ -12,7 +12,7 @@
 
 namespace PhpCsFixer\Tests\Fixer\Alias;
 
-use PhpCsFixer\Test\AbstractFixerTestCase;
+use PhpCsFixer\Tests\Test\AbstractFixerTestCase;
 
 /**
  * @author Filippo Tessarotto <zoeslam@gmail.com>

+ 1 - 1
tests/Fixer/Alias/NoAliasFunctionsFixerTest.php

@@ -12,7 +12,7 @@
 
 namespace PhpCsFixer\Tests\Fixer\Alias;
 
-use PhpCsFixer\Test\AbstractFixerTestCase;
+use PhpCsFixer\Tests\Test\AbstractFixerTestCase;
 
 /**
  * @author Vladimir Reznichenko <kalessil@gmail.com>

Some files were not shown because too many files changed in this diff