AttributeAnalysisTest.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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\AttributeAnalysis;
  15. /**
  16. * @covers \PhpCsFixer\Tokenizer\Analyzer\Analysis\AttributeAnalysis
  17. *
  18. * @internal
  19. */
  20. final class AttributeAnalysisTest extends TestCase
  21. {
  22. public function testAttribute(): void
  23. {
  24. $attributes = [
  25. ['start' => 3, 'end' => 12, 'name' => 'AB\Baz'],
  26. ['start' => 14, 'end' => 32, 'name' => '\A\B\Qux'],
  27. ];
  28. $analysis = new AttributeAnalysis(2, 34, 3, 34, $attributes);
  29. self::assertSame(2, $analysis->getStartIndex());
  30. self::assertSame(34, $analysis->getEndIndex());
  31. self::assertSame(3, $analysis->getOpeningBracketIndex());
  32. self::assertSame(34, $analysis->getClosingBracketIndex());
  33. self::assertSame($attributes, $analysis->getAttributes());
  34. }
  35. }