InvalidForEnvFixerConfigurationExceptionTest.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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\ConfigurationException;
  13. use PhpCsFixer\ConfigurationException\InvalidFixerConfigurationException;
  14. use PhpCsFixer\ConfigurationException\InvalidForEnvFixerConfigurationException;
  15. use PhpCsFixer\Console\Command\FixCommandExitStatusCalculator;
  16. use PhpCsFixer\Tests\TestCase;
  17. /**
  18. * @internal
  19. *
  20. * @covers \PhpCsFixer\ConfigurationException\InvalidForEnvFixerConfigurationException
  21. */
  22. final class InvalidForEnvFixerConfigurationExceptionTest extends TestCase
  23. {
  24. public function testDefaults(): void
  25. {
  26. $fixerName = 'hal';
  27. $message = 'I cannot do that, Andreas!';
  28. $exception = new InvalidForEnvFixerConfigurationException(
  29. $fixerName,
  30. $message
  31. );
  32. self::assertInstanceOf(InvalidFixerConfigurationException::class, $exception);
  33. self::assertSame(sprintf('[%s] %s', $fixerName, $message), $exception->getMessage());
  34. self::assertSame(FixCommandExitStatusCalculator::EXIT_STATUS_FLAG_HAS_INVALID_FIXER_CONFIG, $exception->getCode());
  35. self::assertSame($fixerName, $exception->getFixerName());
  36. self::assertNull($exception->getPrevious());
  37. }
  38. }