EnumAnalysisTest.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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\Tokenizer\Analyzer\Analysis;
  13. use PhpCsFixer\Tests\TestCase;
  14. use PhpCsFixer\Tokenizer\Analyzer\Analysis\CaseAnalysis;
  15. use PhpCsFixer\Tokenizer\Analyzer\Analysis\EnumAnalysis;
  16. /**
  17. * @covers \PhpCsFixer\Tokenizer\Analyzer\Analysis\EnumAnalysis
  18. *
  19. * @internal
  20. */
  21. final class EnumAnalysisTest extends TestCase
  22. {
  23. public function testEnumAnalysis(): void
  24. {
  25. $analysis = new EnumAnalysis(10, 11, 15, []);
  26. self::assertSame(10, $analysis->getIndex());
  27. self::assertSame(11, $analysis->getOpenIndex());
  28. self::assertSame(15, $analysis->getCloseIndex());
  29. self::assertSame([], $analysis->getCases());
  30. }
  31. public function testEnumAnalysis2(): void
  32. {
  33. $caseAnalysis = new CaseAnalysis(20, 21);
  34. $analysis = new EnumAnalysis(15, 17, 190, [$caseAnalysis]);
  35. self::assertSame(15, $analysis->getIndex());
  36. self::assertSame(17, $analysis->getOpenIndex());
  37. self::assertSame(190, $analysis->getCloseIndex());
  38. self::assertSame([$caseAnalysis], $analysis->getCases());
  39. }
  40. }