ComposerFileTest.php 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. <?php
  2. declare(strict_types=1);
  3. /*
  4. * This file is part of PHP CS Fixer.
  5. *
  6. * (c) Fabien Potencier <fabien@symfony.com>
  7. * Dariusz Rumiński <dariusz.ruminski@gmail.com>
  8. *
  9. * This source file is subject to the MIT license that is bundled
  10. * with this source code in the file LICENSE.
  11. */
  12. namespace PhpCsFixer\Tests\AutoReview;
  13. use PHPUnit\Framework\TestCase;
  14. /**
  15. * @internal
  16. *
  17. * @coversNothing
  18. *
  19. * @group covers-nothing
  20. * @group auto-review
  21. */
  22. final class ComposerFileTest extends TestCase
  23. {
  24. public function testScriptsHaveDescriptions(): void
  25. {
  26. $composerJsonContent = file_get_contents(__DIR__.'/../../composer.json');
  27. $composerJson = json_decode($composerJsonContent, true, 512, JSON_THROW_ON_ERROR);
  28. $scripts = array_keys($composerJson['scripts']);
  29. $descriptions = array_keys($composerJson['scripts-descriptions']);
  30. self::assertSame([], array_diff($scripts, $descriptions), 'There should be no scripts with missing description.');
  31. self::assertSame([], array_diff($descriptions, $scripts), 'There should be no superfluous description for not defined scripts.');
  32. }
  33. }