Browse Source

Drop src/Test namespace

Dariusz Ruminski 4 years ago
parent
commit
07ebb828c8

+ 0 - 15
.composer-require-checker.json

@@ -1,20 +1,5 @@
 {
     "symbol-whitelist" : [
-        "LegacyPHPUnit\\TestCase",
-        "PhpCsFixer\\PhpunitConstraintIsIdenticalString\\Constraint\\IsIdenticalString",
-        "PhpCsFixer\\Tests\\Test\\Constraint\\SameStringsConstraint",
-        "PhpCsFixer\\Tests\\Test\\IsIdenticalConstraint",
-        "PHPUnit\\Framework\\Constraint\\IsIdentical",
-        "PHPUnit\\Framework\\TestCase",
-        "PHPUnit\\Runner\\Version",
-        "PHPUnitGoodPractices\\Polyfill\\PolyfillTrait",
-        "PHPUnitGoodPractices\\Traits\\ExpectationViaCodeOverAnnotationTrait",
-        "PHPUnitGoodPractices\\Traits\\ExpectOverSetExceptionTrait",
-        "PHPUnitGoodPractices\\Traits\\IdentityOverEqualityTrait",
-        "PHPUnitGoodPractices\\Traits\\ProphecyOverMockObjectTrait",
-        "PHPUnitGoodPractices\\Traits\\ProphesizeOnlyInterfaceTrait",
-        "Prophecy\\Argument",
-        "Prophecy\\PhpUnit\\ProphecyTrait",
         "Symfony\\Component\\EventDispatcher\\Event",
         "Symfony\\Contracts\\EventDispatcher\\Event",
         "Symfony\\Contracts\\EventDispatcher\\EventDispatcherInterface",

+ 1 - 12
.gitattributes

@@ -1,15 +1,3 @@
-# @TODO 3.0 replace following `tests/... export-ignore` with single `tests/ export-ignore`
-/tests/**/*Test.php export-ignore
-/tests/AbstractDoctrineAnnotationFixerTestCase.php export-ignore
-/tests/Console/TestToolInfo.php export-ignore
-/tests/Differ/AbstractDifferTestCase.php export-ignore
-/tests/Differ/DummyTestSplFileInfo.php export-ignore
-/tests/Fixtures/ export-ignore
-/tests/Linter/AbstractLinterTestCase.php export-ignore
-/tests/Report/AbstractReporterTestCase.php export-ignore
-/tests/Test/AbstractFixerWithAliasedOptionsTestCase.php export-ignore
-/tests/Test/AbstractTransformerTestCase.php export-ignore
-
 /.* export-ignore
 /benchmark.sh export-ignore
 /box.json.dist export-ignore
@@ -17,6 +5,7 @@
 /phpmd.xml export-ignore
 /phpstan.neon export-ignore
 /phpunit.xml.dist export-ignore
+/tests/ export-ignore
 
 *       text=auto eol=lf
 *.json  text whitespace=blank-at-eol,blank-at-eof,space-before-tab,tab-in-indent,tabwidth=4

+ 2 - 13
.github/workflows/sca.yml

@@ -102,16 +102,5 @@ jobs:
 
       - name: Check - ensure test files are not present in the archive
         run: |
-          # @TODO remove listed exceptions at 3.0
-          git archive -o /dev/null HEAD -v 2>&1 | grep tests | grep \.php |
-            grep -v tests/Test/AbstractFixerTestCase.php |
-            grep -v tests/Test/AbstractIntegrationCaseFactory.php |
-            grep -v tests/Test/AbstractIntegrationTestCase.php |
-            grep -v tests/Test/Assert/AssertTokensTrait.php |
-            grep -v tests/Test/IntegrationCase.php |
-            grep -v tests/Test/IntegrationCaseFactory.php |
-            grep -v tests/Test/IntegrationCaseFactoryInterface.php |
-            grep -v tests/Test/InternalIntegrationCaseFactory.php |
-            grep -v tests/Test/IsIdenticalConstraint.php |
-            grep -v tests/TestCase.php \
-          && (echo "UNKNOWN FILES DETECTED" && exit 1) || echo "NO UNKNOWN FILES"
+          git archive -o /dev/null HEAD -v 2>&1 | grep tests | grep \.php \
+          && (echo "Test files detected in archive" && exit 1) || echo "No test files detected in archive"

+ 1 - 0
UPGRADE-v3.md

@@ -132,6 +132,7 @@ Code BC changes
     - `next()`
     - `rewind()`
     - `valid()`
+- namespace `PhpCsFixer\Test\` and each class in it has been removed, as it served pure development purpose and should not be part of production code - reach out to community if you are willing to help building dev package
 
 ### Interface changes
 

+ 1 - 15
composer.json

@@ -50,8 +50,6 @@
     "suggest": {
         "ext-dom": "For handling output formats in XML",
         "ext-mbstring": "For handling non-UTF8 characters.",
-        "php-cs-fixer/phpunit-constraint-isidenticalstring": "For IsIdenticalString constraint.",
-        "php-cs-fixer/phpunit-constraint-xmlmatchesxsd": "For XmlMatchesXsd constraint.",
         "symfony/polyfill-mbstring": "When enabling `ext-mbstring` is not possible."
     },
     "config": {
@@ -60,19 +58,7 @@
     "autoload": {
         "psr-4": {
             "PhpCsFixer\\": "src/"
-        },
-        "classmap": [
-            "tests/Test/AbstractFixerTestCase.php",
-            "tests/Test/AbstractIntegrationCaseFactory.php",
-            "tests/Test/AbstractIntegrationTestCase.php",
-            "tests/Test/Assert/AssertTokensTrait.php",
-            "tests/Test/IntegrationCase.php",
-            "tests/Test/IntegrationCaseFactory.php",
-            "tests/Test/IntegrationCaseFactoryInterface.php",
-            "tests/Test/InternalIntegrationCaseFactory.php",
-            "tests/Test/IsIdenticalConstraint.php",
-            "tests/TestCase.php"
-        ]
+        }
     },
     "autoload-dev": {
         "psr-4": {

+ 0 - 1
phpstan.neon

@@ -11,7 +11,6 @@ parameters:
     excludes_analyse:
         - tests/Fixtures
     ignoreErrors:
-        - '/^Return typehint of method PhpCsFixer\\Tests\\Test\\.+::createIsIdenticalStringConstraint\(\) has invalid type PHPUnit_Framework_Constraint_IsIdentical\.$/'
         - '/^Class (Symfony\\Contracts\\EventDispatcher\\Event|Symfony\\Component\\EventDispatcher\\Event) not found.$/'
         - '/^Constant T_NAME_(RELATIVE|FULLY_QUALIFIED|QUALIFIED) not found\.$/'
         - '/Instantiated class .*TraversableContains is abstract/'

+ 0 - 36
src/Test/AbstractFixerTestCase.php

@@ -1,36 +0,0 @@
-<?php
-
-/*
- * This file is part of PHP CS Fixer.
- *
- * (c) Fabien Potencier <fabien@symfony.com>
- *     Dariusz Rumiński <dariusz.ruminski@gmail.com>
- *
- * This source file is subject to the MIT license that is bundled
- * with this source code in the file LICENSE.
- */
-
-namespace PhpCsFixer\Test;
-
-use PhpCsFixer\Tests\Test\AbstractFixerTestCase as BaseAbstractFixerTestCase;
-
-/**
- * @TODO 3.0 While removing, remove loading `tests/Test` from `autoload` section of `composer.json`.
- *
- * @deprecated since v2.4
- */
-abstract class AbstractFixerTestCase extends BaseAbstractFixerTestCase
-{
-    public function __construct($name = null, array $data = [], $dataName = '')
-    {
-        @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
-        );
-
-        parent::__construct($name, $data, $dataName);
-    }
-}

+ 0 - 36
src/Test/AbstractIntegrationTestCase.php

@@ -1,36 +0,0 @@
-<?php
-
-/*
- * This file is part of PHP CS Fixer.
- *
- * (c) Fabien Potencier <fabien@symfony.com>
- *     Dariusz Rumiński <dariusz.ruminski@gmail.com>
- *
- * This source file is subject to the MIT license that is bundled
- * with this source code in the file LICENSE.
- */
-
-namespace PhpCsFixer\Test;
-
-use PhpCsFixer\Tests\Test\AbstractIntegrationTestCase as BaseAbstractIntegrationTestCase;
-
-/**
- * @TODO 3.0 While removing, remove loading `tests/Test` from `autoload` section of `composer.json`.
- *
- * @deprecated since v2.4
- */
-abstract class AbstractIntegrationTestCase extends BaseAbstractIntegrationTestCase
-{
-    public function __construct($name = null, array $data = [], $dataName = '')
-    {
-        @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
-        );
-
-        parent::__construct($name, $data, $dataName);
-    }
-}

+ 0 - 136
src/Test/IntegrationCase.php

@@ -1,136 +0,0 @@
-<?php
-
-/*
- * This file is part of PHP CS Fixer.
- *
- * (c) Fabien Potencier <fabien@symfony.com>
- *     Dariusz Rumiński <dariusz.ruminski@gmail.com>
- *
- * This source file is subject to the MIT license that is bundled
- * with this source code in the file LICENSE.
- */
-
-namespace PhpCsFixer\Test;
-
-use PhpCsFixer\RuleSet\RuleSet;
-use PhpCsFixer\Tests\Test\IntegrationCase as BaseIntegrationCase;
-
-/**
- * @author Dariusz Rumiński <dariusz.ruminski@gmail.com>
- *
- * @TODO 3.0 While removing, remove loading `tests/Test` from `autoload` section of `composer.json`.
- *
- * @deprecated since v2.4
- */
-final class IntegrationCase
-{
-    /**
-     * @var BaseIntegrationCase
-     */
-    private $base;
-
-    /**
-     * @param string      $fileName
-     * @param string      $title
-     * @param string      $expectedCode
-     * @param null|string $inputCode
-     */
-    public function __construct(
-        $fileName,
-        $title,
-        array $settings,
-        array $requirements,
-        array $config,
-        RuleSet $ruleset,
-        $expectedCode,
-        $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 $this->base->hasInputCode();
-    }
-
-    public function getConfig()
-    {
-        return $this->base->getConfig();
-    }
-
-    public function getExpectedCode()
-    {
-        return $this->base->getExpectedCode();
-    }
-
-    public function getFileName()
-    {
-        return $this->base->getFileName();
-    }
-
-    public function getInputCode()
-    {
-        return $this->base->getInputCode();
-    }
-
-    public function getRequirement($name)
-    {
-        return $this->base->getRequirement($name);
-    }
-
-    public function getRequirements()
-    {
-        return $this->base->getRequirements();
-    }
-
-    public function getRuleset()
-    {
-        return $this->base->getRuleset();
-    }
-
-    public function getSettings()
-    {
-        return $this->base->getSettings();
-    }
-
-    public function getTitle()
-    {
-        return $this->base->getTitle();
-    }
-
-    /**
-     * @return bool
-     *
-     * @deprecated since v2.1, on ~2.1 line IntegrationTest check whether different priorities are required is done automatically, this method will be removed on v3.0
-     */
-    public function shouldCheckPriority()
-    {
-        @trigger_error(
-            sprintf(
-                'The "%s" method is deprecated. You should stop using it, as it will be removed in 3.0 version.',
-                __METHOD__
-            ),
-            E_USER_DEPRECATED
-        );
-
-        $settings = $this->base->getSettings();
-
-        return isset($settings['checkPriority']) ? $settings['checkPriority'] : true;
-    }
-}

+ 0 - 4
tests/AutoReview/ProjectCodeTest.php

@@ -171,8 +171,6 @@ final class ProjectCodeTest extends TestCase
             \PhpCsFixer\AbstractPhpdocTypesFixer::class => ['tags'],
             \PhpCsFixer\AbstractFixer::class => ['configuration', 'configurationDefinition', 'whitespacesConfig'],
             \PhpCsFixer\AbstractProxyFixer::class => ['proxyFixers'],
-            \PhpCsFixer\Test\AbstractFixerTestCase::class => ['fixer', 'linter'],
-            \PhpCsFixer\Test\AbstractIntegrationTestCase::class => ['linter'],
         ];
 
         $extraProps = array_diff(
@@ -536,8 +534,6 @@ final class ProjectCodeTest extends TestCase
                     || ($doc && \count($doc->getAnnotationsOfType('internal')))
                     || \in_array($className, [
                         \PhpCsFixer\Finder::class,
-                        \PhpCsFixer\Test\AbstractFixerTestCase::class,
-                        \PhpCsFixer\Test\AbstractIntegrationTestCase::class,
                         \PhpCsFixer\Tests\Test\AbstractFixerTestCase::class,
                         \PhpCsFixer\Tests\Test\AbstractIntegrationTestCase::class,
                         \PhpCsFixer\Tokenizer\Tokens::class,

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