Browse Source

chore: add missing tests for non-documentation classes (#7848)

Kuba Werłos 1 year ago
parent
commit
e1b66dd775

+ 17 - 6
src/Console/SelfUpdate/GithubClient.php

@@ -19,12 +19,12 @@ namespace PhpCsFixer\Console\SelfUpdate;
  */
 final class GithubClient implements GithubClientInterface
 {
+    private string $url = 'https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/tags';
+
     public function getTags(): array
     {
-        $url = 'https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/tags';
-
         $result = @file_get_contents(
-            $url,
+            $this->url,
             false,
             stream_context_create([
                 'http' => [
@@ -34,18 +34,29 @@ final class GithubClient implements GithubClientInterface
         );
 
         if (false === $result) {
-            throw new \RuntimeException(sprintf('Failed to load tags at "%s".', $url));
+            throw new \RuntimeException(sprintf('Failed to load tags at "%s".', $this->url));
         }
 
+        /**
+         * @var list<array{
+         *     name: string,
+         *     zipball_url: string,
+         *     tarball_url: string,
+         *     commit: array{sha: string, url: string},
+         * }>
+         */
         $result = json_decode($result, true);
         if (JSON_ERROR_NONE !== json_last_error()) {
             throw new \RuntimeException(sprintf(
                 'Failed to read response from "%s" as JSON: %s.',
-                $url,
+                $this->url,
                 json_last_error_msg()
             ));
         }
 
-        return $result;
+        return array_map(
+            static fn (array $tagData): string => $tagData['name'],
+            $result
+        );
     }
 }

+ 1 - 6
src/Console/SelfUpdate/GithubClientInterface.php

@@ -20,12 +20,7 @@ namespace PhpCsFixer\Console\SelfUpdate;
 interface GithubClientInterface
 {
     /**
-     * @return list<array{
-     *     name: string,
-     *     zipball_url: string,
-     *     tarball_url: string,
-     *     commit: array{sha: string, url: string},
-     * }>
+     * @return list<string>
      */
     public function getTags(): array;
 }

+ 1 - 3
src/Console/SelfUpdate/NewVersionChecker.php

@@ -82,9 +82,7 @@ final class NewVersionChecker implements NewVersionCheckerInterface
             return;
         }
 
-        foreach ($this->githubClient->getTags() as $tag) {
-            $version = $tag['name'];
-
+        foreach ($this->githubClient->getTags() as $version) {
             try {
                 $this->versionParser->normalize($version);
 

+ 0 - 8
tests/AutoReview/ProjectCodeTest.php

@@ -19,20 +19,16 @@ use PhpCsFixer\AbstractPhpdocTypesFixer;
 use PhpCsFixer\AbstractProxyFixer;
 use PhpCsFixer\Console\Command\DocumentationCommand;
 use PhpCsFixer\Console\Command\FixCommand;
-use PhpCsFixer\Console\SelfUpdate\GithubClient;
 use PhpCsFixer\DocBlock\Annotation;
 use PhpCsFixer\DocBlock\DocBlock;
-use PhpCsFixer\Doctrine\Annotation\DocLexer;
 use PhpCsFixer\Documentation\DocumentationLocator;
 use PhpCsFixer\Documentation\FixerDocumentGenerator;
 use PhpCsFixer\Documentation\RstUtils;
 use PhpCsFixer\Documentation\RuleSetDocumentationGenerator;
-use PhpCsFixer\ExecutorWithoutErrorHandlerException;
 use PhpCsFixer\Fixer\AbstractPhpUnitFixer;
 use PhpCsFixer\Fixer\PhpUnit\PhpUnitNamespacedFixer;
 use PhpCsFixer\FixerFactory;
 use PhpCsFixer\Preg;
-use PhpCsFixer\Runner\FileCachingLintingIterator;
 use PhpCsFixer\Tests\Test\AbstractFixerTestCase;
 use PhpCsFixer\Tests\Test\AbstractIntegrationTestCase;
 use PhpCsFixer\Tests\TestCase;
@@ -77,13 +73,9 @@ final class ProjectCodeTest extends TestCase
      * @var string[]
      */
     private static $classesWithoutTests = [
-        DocLexer::class,
         DocumentationCommand::class,
         DocumentationLocator::class,
-        ExecutorWithoutErrorHandlerException::class,
-        FileCachingLintingIterator::class,
         FixerDocumentGenerator::class,
-        GithubClient::class,
         RstUtils::class,
         RuleSetDocumentationGenerator::class,
     ];

+ 44 - 0
tests/Console/SelfUpdate/GithubClientTest.php

@@ -0,0 +1,44 @@
+<?php
+
+declare(strict_types=1);
+
+/*
+ * 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\Tests\Console\SelfUpdate;
+
+use PhpCsFixer\Console\SelfUpdate\GithubClient;
+use PhpCsFixer\Tests\TestCase;
+
+/**
+ * @internal
+ *
+ * @covers \PhpCsFixer\Console\SelfUpdate\GithubClient
+ */
+final class GithubClientTest extends TestCase
+{
+    public function testGettingTags(): void
+    {
+        $githubClient = new GithubClient();
+
+        \Closure::bind(static function (GithubClient $githubClient): void {
+            $githubClient->url = __DIR__.'/../../Fixtures/api_github_com_tags.json';
+        }, null, $githubClient)($githubClient);
+
+        self::assertSame(
+            [
+                'v3.48.0',
+                'v3.47.1',
+                'v3.47.0',
+            ],
+            $githubClient->getTags()
+        );
+    }
+}

+ 31 - 279
tests/Console/SelfUpdate/NewVersionCheckerTest.php

@@ -105,285 +105,37 @@ final class NewVersionCheckerTest extends TestCase
             public function getTags(): array
             {
                 return [
-                    [
-                        'name' => 'v3.0.0-RC',
-                        'zipball_url' => 'https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/v3.0.0-RC',
-                        'tarball_url' => 'https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/tarball/v3.0.0-RC',
-                        'commit' => [
-                            'sha' => 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
-                            'url' => 'https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/commits/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
-                        ],
-                    ],
-                    [
-                        'name' => 'v2.4.1',
-                        'zipball_url' => 'https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/v2.4.1',
-                        'tarball_url' => 'https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/tarball/v2.4.1',
-                        'commit' => [
-                            'sha' => 'b4983586c8e7b1f99ec05dd1e75c8b673315da70',
-                            'url' => 'https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/commits/b4983586c8e7b1f99ec05dd1e75c8b673315da70',
-                        ],
-                    ],
-                    [
-                        'name' => 'v2.4.0',
-                        'zipball_url' => 'https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/v2.4.0',
-                        'tarball_url' => 'https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/tarball/v2.4.0',
-                        'commit' => [
-                            'sha' => '63661f3add3609e90e4ab8115113e189ae547bb4',
-                            'url' => 'https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/commits/63661f3add3609e90e4ab8115113e189ae547bb4',
-                        ],
-                    ],
-                    [
-                        'name' => 'v2.3.3',
-                        'zipball_url' => 'https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/v2.3.3',
-                        'tarball_url' => 'https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/tarball/v2.3.3',
-                        'commit' => [
-                            'sha' => 'cd1e6c47cd692c2deb8f160bb80b8feb3b265d29',
-                            'url' => 'https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/commits/cd1e6c47cd692c2deb8f160bb80b8feb3b265d29',
-                        ],
-                    ],
-                    [
-                        'name' => 'v2.3.2',
-                        'zipball_url' => 'https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/v2.3.2',
-                        'tarball_url' => 'https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/tarball/v2.3.2',
-                        'commit' => [
-                            'sha' => '597745f744bcce1aed59dfd1bb4603de2a06cda9',
-                            'url' => 'https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/commits/597745f744bcce1aed59dfd1bb4603de2a06cda9',
-                        ],
-                    ],
-                    [
-                        'name' => 'v2.3.1',
-                        'zipball_url' => 'https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/v2.3.1',
-                        'tarball_url' => 'https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/tarball/v2.3.1',
-                        'commit' => [
-                            'sha' => 'd5257f7433bb490299c4f300d95598fd911a8ab0',
-                            'url' => 'https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/commits/d5257f7433bb490299c4f300d95598fd911a8ab0',
-                        ],
-                    ],
-                    [
-                        'name' => 'v2.3.0',
-                        'zipball_url' => 'https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/v2.3.0',
-                        'tarball_url' => 'https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/tarball/v2.3.0',
-                        'commit' => [
-                            'sha' => 'ab8c61329ddd896e287a84c7663d06cf1bed3907',
-                            'url' => 'https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/commits/ab8c61329ddd896e287a84c7663d06cf1bed3907',
-                        ],
-                    ],
-                    [
-                        'name' => 'v2.2.6',
-                        'zipball_url' => 'https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/v2.2.6',
-                        'tarball_url' => 'https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/tarball/v2.2.6',
-                        'commit' => [
-                            'sha' => 'c1cc52c242f17c4d52d9601159631da488fac7a4',
-                            'url' => 'https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/commits/c1cc52c242f17c4d52d9601159631da488fac7a4',
-                        ],
-                    ],
-                    [
-                        'name' => 'v2.2.5',
-                        'zipball_url' => 'https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/v2.2.5',
-                        'tarball_url' => 'https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/tarball/v2.2.5',
-                        'commit' => [
-                            'sha' => '27c2cd9d4abd2178b5b585fa2c3cca656d377c69',
-                            'url' => 'https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/commits/27c2cd9d4abd2178b5b585fa2c3cca656d377c69',
-                        ],
-                    ],
-                    [
-                        'name' => 'v2.2.4',
-                        'zipball_url' => 'https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/v2.2.4',
-                        'tarball_url' => 'https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/tarball/v2.2.4',
-                        'commit' => [
-                            'sha' => '5191e01d0fa0f579eb709350306cd11ad6427ca6',
-                            'url' => 'https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/commits/5191e01d0fa0f579eb709350306cd11ad6427ca6',
-                        ],
-                    ],
-                    [
-                        'name' => 'v2.2.3',
-                        'zipball_url' => 'https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/v2.2.3',
-                        'tarball_url' => 'https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/tarball/v2.2.3',
-                        'commit' => [
-                            'sha' => '8f33cf3da0da94b67b9cd696b2b9dda81c928f72',
-                            'url' => 'https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/commits/8f33cf3da0da94b67b9cd696b2b9dda81c928f72',
-                        ],
-                    ],
-                    [
-                        'name' => 'v2.2.2',
-                        'zipball_url' => 'https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/v2.2.2',
-                        'tarball_url' => 'https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/tarball/v2.2.2',
-                        'commit' => [
-                            'sha' => '362d7bd3df3521966ae0fc82bb67c000c5f25059',
-                            'url' => 'https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/commits/362d7bd3df3521966ae0fc82bb67c000c5f25059',
-                        ],
-                    ],
-                    [
-                        'name' => 'v2.2.1',
-                        'zipball_url' => 'https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/v2.2.1',
-                        'tarball_url' => 'https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/tarball/v2.2.1',
-                        'commit' => [
-                            'sha' => 'aff95e090fdaf57c20d32d7728b090f2015bfcef',
-                            'url' => 'https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/commits/aff95e090fdaf57c20d32d7728b090f2015bfcef',
-                        ],
-                    ],
-                    [
-                        'name' => 'v2.2.0',
-                        'zipball_url' => 'https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/v2.2.0',
-                        'tarball_url' => 'https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/tarball/v2.2.0',
-                        'commit' => [
-                            'sha' => 'd6f17423412d33df6b69c9aaf12037b91703533b',
-                            'url' => 'https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/commits/d6f17423412d33df6b69c9aaf12037b91703533b',
-                        ],
-                    ],
-                    [
-                        'name' => 'v2.1.3',
-                        'zipball_url' => 'https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/v2.1.3',
-                        'tarball_url' => 'https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/tarball/v2.1.3',
-                        'commit' => [
-                            'sha' => 'd30ca69f8bed931b5c630407f0a98306e33c2c39',
-                            'url' => 'https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/commits/d30ca69f8bed931b5c630407f0a98306e33c2c39',
-                        ],
-                    ],
-                    [
-                        'name' => 'v2.1.2',
-                        'zipball_url' => 'https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/v2.1.2',
-                        'tarball_url' => 'https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/tarball/v2.1.2',
-                        'commit' => [
-                            'sha' => 'c7de769d7b44f2c9de68e1f678b65efd8126f60b',
-                            'url' => 'https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/commits/c7de769d7b44f2c9de68e1f678b65efd8126f60b',
-                        ],
-                    ],
-                    [
-                        'name' => 'v2.1.1',
-                        'zipball_url' => 'https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/v2.1.1',
-                        'tarball_url' => 'https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/tarball/v2.1.1',
-                        'commit' => [
-                            'sha' => 'e0e33ce4eaf59ba77ead9ce45256692aa29ecb38',
-                            'url' => 'https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/commits/e0e33ce4eaf59ba77ead9ce45256692aa29ecb38',
-                        ],
-                    ],
-                    [
-                        'name' => 'v2.1.0',
-                        'zipball_url' => 'https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/v2.1.0',
-                        'tarball_url' => 'https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/tarball/v2.1.0',
-                        'commit' => [
-                            'sha' => '2c69f4d424f85062fe40f7689797d6d32c76b711',
-                            'url' => 'https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/commits/2c69f4d424f85062fe40f7689797d6d32c76b711',
-                        ],
-                    ],
-                    [
-                        'name' => 'v2.0.1',
-                        'zipball_url' => 'https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/v2.0.1',
-                        'tarball_url' => 'https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/tarball/v2.0.1',
-                        'commit' => [
-                            'sha' => '863ad254da1e44904c8bf8fbcc9f5624834fc71a',
-                            'url' => 'https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/commits/863ad254da1e44904c8bf8fbcc9f5624834fc71a',
-                        ],
-                    ],
-                    [
-                        'name' => 'v2.0.0',
-                        'zipball_url' => 'https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/v2.0.0',
-                        'tarball_url' => 'https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/tarball/v2.0.0',
-                        'commit' => [
-                            'sha' => 'f3baf72eb2f58bf275b372540f5b47d25aed910f',
-                            'url' => 'https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/commits/f3baf72eb2f58bf275b372540f5b47d25aed910f',
-                        ],
-                    ],
-                    [
-                        'name' => 'v2.0.0-beta',
-                        'zipball_url' => 'https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/v2.0.0-beta',
-                        'tarball_url' => 'https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/tarball/v2.0.0-beta',
-                        'commit' => [
-                            'sha' => '962b2c537063b670aca2d6f3fb839d2c103def38',
-                            'url' => 'https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/commits/962b2c537063b670aca2d6f3fb839d2c103def38',
-                        ],
-                    ],
-                    [
-                        'name' => 'v2.0.0-alpha',
-                        'zipball_url' => 'https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/v2.0.0-alpha',
-                        'tarball_url' => 'https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/tarball/v2.0.0-alpha',
-                        'commit' => [
-                            'sha' => 'd0d76b434728fcf522270b67b454ed7e84e850ed',
-                            'url' => 'https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/commits/d0d76b434728fcf522270b67b454ed7e84e850ed',
-                        ],
-                    ],
-                    [
-                        'name' => 'v2.0.0-RC',
-                        'zipball_url' => 'https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/v2.0.0-RC',
-                        'tarball_url' => 'https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/tarball/v2.0.0-RC',
-                        'commit' => [
-                            'sha' => 'f88ef17f44fa442e1dd98deb7da0d943be9c8fa8',
-                            'url' => 'https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/commits/f88ef17f44fa442e1dd98deb7da0d943be9c8fa8',
-                        ],
-                    ],
-                    [
-                        'name' => 'v1.14.0-beta',
-                        'zipball_url' => 'https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/v1.14.0-beta',
-                        'tarball_url' => 'https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/tarball/v1.14.0-beta',
-                        'commit' => [
-                            'sha' => 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
-                            'url' => 'https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/commits/xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
-                        ],
-                    ],
-                    [
-                        'name' => 'v1.13.2',
-                        'zipball_url' => 'https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/v1.13.2',
-                        'tarball_url' => 'https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/tarball/v1.13.2',
-                        'commit' => [
-                            'sha' => '106313aa0d501782260e48ac04a1c671b5d418ea',
-                            'url' => 'https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/commits/106313aa0d501782260e48ac04a1c671b5d418ea',
-                        ],
-                    ],
-                    [
-                        'name' => 'v1.13.1',
-                        'zipball_url' => 'https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/v1.13.1',
-                        'tarball_url' => 'https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/tarball/v1.13.1',
-                        'commit' => [
-                            'sha' => '0ea4f7ed06ca55da1d8fc45da26ff87f261c4088',
-                            'url' => 'https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/commits/0ea4f7ed06ca55da1d8fc45da26ff87f261c4088',
-                        ],
-                    ],
-                    [
-                        'name' => 'v1.13.0',
-                        'zipball_url' => 'https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/v1.13.0',
-                        'tarball_url' => 'https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/tarball/v1.13.0',
-                        'commit' => [
-                            'sha' => 'ac04a510bed5407e91664f8a37b9d58072d96768',
-                            'url' => 'https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/commits/ac04a510bed5407e91664f8a37b9d58072d96768',
-                        ],
-                    ],
-                    [
-                        'name' => 'v1.12.4',
-                        'zipball_url' => 'https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/v1.12.4',
-                        'tarball_url' => 'https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/tarball/v1.12.4',
-                        'commit' => [
-                            'sha' => 'c5a9d66dd27f02a3ffba4ec451ce27702604cdc8',
-                            'url' => 'https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/commits/c5a9d66dd27f02a3ffba4ec451ce27702604cdc8',
-                        ],
-                    ],
-                    [
-                        'name' => 'v1.12.3',
-                        'zipball_url' => 'https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/v1.12.3',
-                        'tarball_url' => 'https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/tarball/v1.12.3',
-                        'commit' => [
-                            'sha' => '78a820c16d13f593303511461eefa939502fb2de',
-                            'url' => 'https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/commits/78a820c16d13f593303511461eefa939502fb2de',
-                        ],
-                    ],
-                    [
-                        'name' => 'v1.12.2',
-                        'zipball_url' => 'https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/v1.12.2',
-                        'tarball_url' => 'https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/tarball/v1.12.2',
-                        'commit' => [
-                            'sha' => 'baa7112bef3b86c65fcfaae9a7a50436e3902b41',
-                            'url' => 'https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/commits/baa7112bef3b86c65fcfaae9a7a50436e3902b41',
-                        ],
-                    ],
-                    [
-                        'name' => 'v1.12.1',
-                        'zipball_url' => 'https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/v1.12.1',
-                        'tarball_url' => 'https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/tarball/v1.12.1',
-                        'commit' => [
-                            'sha' => 'd33ee60f3d3e6152888b7f3a385f49e5c43bf1bf',
-                            'url' => 'https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/commits/d33ee60f3d3e6152888b7f3a385f49e5c43bf1bf',
-                        ],
-                    ],
+                    'v3.0.0-RC',
+                    'v2.4.1',
+                    'v2.4.0',
+                    'v2.3.3',
+                    'v2.3.2',
+                    'v2.3.1',
+                    'v2.3.0',
+                    'v2.2.6',
+                    'v2.2.5',
+                    'v2.2.4',
+                    'v2.2.3',
+                    'v2.2.2',
+                    'v2.2.1',
+                    'v2.2.0',
+                    'v2.1.3',
+                    'v2.1.2',
+                    'v2.1.1',
+                    'v2.1.0',
+                    'v2.0.1',
+                    'v2.0.0',
+                    'v2.0.0-beta',
+                    'v2.0.0-alpha',
+                    'v2.0.0-RC',
+                    'v1.14.0-beta',
+                    'v1.13.2',
+                    'v1.13.1',
+                    'v1.13.0',
+                    'v1.12.4',
+                    'v1.12.3',
+                    'v1.12.2',
+                    'v1.12.1',
                 ];
             }
         };

+ 56 - 0
tests/Doctrine/Annotation/DocLexerTest.php

@@ -0,0 +1,56 @@
+<?php
+
+declare(strict_types=1);
+
+/*
+ * 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\Tests\Doctrine\Annotation;
+
+use PhpCsFixer\Doctrine\Annotation\DocLexer;
+use PhpCsFixer\Doctrine\Annotation\Token;
+use PhpCsFixer\Tests\TestCase;
+
+/**
+ * @internal
+ *
+ * @covers \PhpCsFixer\Doctrine\Annotation\DocLexer
+ */
+final class DocLexerTest extends TestCase
+{
+    public function testCreateFromEmptyPhpdocComment(): void
+    {
+        $lexer = new DocLexer();
+        $lexer->setInput('/** @Foo("bar": 42) */');
+
+        /** @var list<array{DocLexer::T_*, string, int}> */
+        $expectedContents = [
+            [DocLexer::T_NONE, '/', 0],
+            [DocLexer::T_AT, '@', 4],
+            [DocLexer::T_IDENTIFIER, 'Foo', 5],
+            [DocLexer::T_OPEN_PARENTHESIS, '(', 8],
+            [DocLexer::T_STRING, 'bar', 9],
+            [DocLexer::T_COLON, ':', 14],
+            [DocLexer::T_INTEGER, '42', 16],
+            [DocLexer::T_CLOSE_PARENTHESIS, ')', 18],
+            [DocLexer::T_NONE, '/', 21],
+        ];
+
+        foreach ($expectedContents as $expectedContent) {
+            $token = $lexer->peek();
+            self::assertInstanceOf(Token::class, $token);
+            self::assertSame($expectedContent[0], $token->getType());
+            self::assertSame($expectedContent[1], $token->getContent());
+            self::assertSame($expectedContent[2], $token->getPosition());
+        }
+
+        self::assertNull($lexer->peek());
+    }
+}

+ 33 - 0
tests/ExecutorWithoutErrorHandlerExceptionTest.php

@@ -0,0 +1,33 @@
+<?php
+
+declare(strict_types=1);
+
+/*
+ * 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\Tests;
+
+use PhpCsFixer\ExecutorWithoutErrorHandlerException;
+
+/**
+ * @internal
+ *
+ * @covers \PhpCsFixer\ExecutorWithoutErrorHandlerException
+ */
+final class ExecutorWithoutErrorHandlerExceptionTest extends TestCase
+{
+    public function testIsRuntimeException(): void
+    {
+        $exception = new ExecutorWithoutErrorHandlerException('foo', 123);
+
+        self::assertSame('foo', $exception->getMessage());
+        self::assertSame(123, $exception->getCode());
+    }
+}

+ 32 - 0
tests/Fixtures/api_github_com_tags.json

@@ -0,0 +1,32 @@
+[
+    {
+        "name": "v3.48.0",
+        "zipball_url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/refs/tags/v3.48.0",
+        "tarball_url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/tarball/refs/tags/v3.48.0",
+        "commit": {
+            "sha": "a92472c6fb66349de25211f31c77eceae3df024e",
+            "url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/commits/a92472c6fb66349de25211f31c77eceae3df024e"
+        },
+        "node_id": "MDM6UmVmNDM0NDI1NzpyZWZzL3RhZ3MvdjMuNDguMA=="
+    },
+    {
+        "name": "v3.47.1",
+        "zipball_url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/refs/tags/v3.47.1",
+        "tarball_url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/tarball/refs/tags/v3.47.1",
+        "commit": {
+            "sha": "173c60d1eff911c9c54322704623a45561d3241d",
+            "url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/commits/173c60d1eff911c9c54322704623a45561d3241d"
+        },
+        "node_id": "MDM6UmVmNDM0NDI1NzpyZWZzL3RhZ3MvdjMuNDcuMQ=="
+    },
+    {
+        "name": "v3.47.0",
+        "zipball_url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/zipball/refs/tags/v3.47.0",
+        "tarball_url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/tarball/refs/tags/v3.47.0",
+        "commit": {
+            "sha": "184dd992fe49169a18300dba4435212db55220f7",
+            "url": "https://api.github.com/repos/PHP-CS-Fixer/PHP-CS-Fixer/commits/184dd992fe49169a18300dba4435212db55220f7"
+        },
+        "node_id": "MDM6UmVmNDM0NDI1NzpyZWZzL3RhZ3MvdjMuNDcuMA=="
+    }
+]

+ 112 - 0
tests/Runner/FileCachingLintingIteratorTest.php

@@ -0,0 +1,112 @@
+<?php
+
+declare(strict_types=1);
+
+/*
+ * 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\Tests\Runner;
+
+use PhpCsFixer\Linter\LinterInterface;
+use PhpCsFixer\Linter\LintingResultInterface;
+use PhpCsFixer\Runner\FileCachingLintingIterator;
+use PhpCsFixer\Tests\TestCase;
+
+/**
+ * @internal
+ *
+ * @covers \PhpCsFixer\Runner\FileCachingLintingIterator
+ */
+final class FileCachingLintingIteratorTest extends TestCase
+{
+    public function testLintingEmpty(): void
+    {
+        $iterator = new \ArrayIterator([]);
+
+        $fileCachingLintingIterator = new FileCachingLintingIterator(
+            $iterator,
+            $this->createLinterDouble()
+        );
+
+        self::assertNull($fileCachingLintingIterator->current());
+        self::assertSame($iterator, $fileCachingLintingIterator->getInnerIterator());
+        self::assertFalse($fileCachingLintingIterator->valid());
+    }
+
+    public function testLintingNonEmpty(): void
+    {
+        $files = [
+            new \SplFileInfo(__FILE__),
+            new \SplFileInfo(__FILE__),
+            new \SplFileInfo(__FILE__),
+        ];
+
+        $lintingResult = new class() implements LintingResultInterface {
+            public function check(): void
+            {
+                throw new \LogicException('Not implemented.');
+            }
+        };
+
+        $iterator = new \ArrayIterator($files);
+
+        $fileCachingLintingIterator = new FileCachingLintingIterator(
+            $iterator,
+            $this->createLinterDouble($lintingResult)
+        );
+
+        self::assertLintingIteratorIteration($fileCachingLintingIterator, $lintingResult, ...$files);
+        $fileCachingLintingIterator->rewind();
+        self::assertLintingIteratorIteration($fileCachingLintingIterator, $lintingResult, ...$files);
+    }
+
+    private static function assertLintingIteratorIteration(
+        FileCachingLintingIterator $fileCachingLintingIterator,
+        LintingResultInterface $lintingResultInterface,
+        \SplFileInfo ...$files
+    ): void {
+        $iterations = 0;
+
+        foreach ($fileCachingLintingIterator as $index => $lintedFile) {
+            self::assertSame($lintingResultInterface, $fileCachingLintingIterator->currentLintingResult());
+            self::assertSame($files[$index], $lintedFile);
+            ++$iterations;
+        }
+
+        self::assertSame(\count($files), $iterations);
+    }
+
+    private function createLinterDouble(?LintingResultInterface $lintingResult = null): LinterInterface
+    {
+        return new class($lintingResult) implements LinterInterface {
+            private ?LintingResultInterface $lintingResult;
+
+            public function __construct(?LintingResultInterface $lintingResult)
+            {
+                $this->lintingResult = $lintingResult;
+            }
+
+            public function isAsync(): bool
+            {
+                throw new \LogicException('Not implemented.');
+            }
+
+            public function lintFile(string $path): LintingResultInterface
+            {
+                return $this->lintingResult;
+            }
+
+            public function lintSource(string $source): LintingResultInterface
+            {
+                throw new \LogicException('Not implemented.');
+            }
+        };
+    }
+}