TagComparatorTest.php 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <?php
  2. /*
  3. * This file is part of PHP CS Fixer.
  4. *
  5. * (c) Fabien Potencier <fabien@symfony.com>
  6. * Dariusz Rumiński <dariusz.ruminski@gmail.com>
  7. *
  8. * This source file is subject to the MIT license that is bundled
  9. * with this source code in the file LICENSE.
  10. */
  11. namespace PhpCsFixer\Tests\DocBlock;
  12. use PhpCsFixer\DocBlock\Line;
  13. use PhpCsFixer\DocBlock\Tag;
  14. use PhpCsFixer\DocBlock\TagComparator;
  15. use PhpCsFixer\Tests\TestCase;
  16. /**
  17. * @author Graham Campbell <graham@alt-three.com>
  18. *
  19. * @internal
  20. *
  21. * @covers \PhpCsFixer\DocBlock\TagComparator
  22. */
  23. final class TagComparatorTest extends TestCase
  24. {
  25. /**
  26. * @param string $first
  27. * @param string $second
  28. * @param bool $expected
  29. *
  30. * @dataProvider provideComparatorCases
  31. */
  32. public function testComparatorTogether($first, $second, $expected)
  33. {
  34. $tag1 = new Tag(new Line('* @'.$first));
  35. $tag2 = new Tag(new Line('* @'.$second));
  36. $this->assertSame($expected, TagComparator::shouldBeTogether($tag1, $tag2));
  37. }
  38. public function provideComparatorCases()
  39. {
  40. return [
  41. ['return', 'return', true],
  42. ['param', 'param', true],
  43. ['return', 'param', false],
  44. ['var', 'foo', false],
  45. ['api', 'deprecated', false],
  46. ['author', 'copyright', true],
  47. ['author', 'since', false],
  48. ['link', 'see', true],
  49. ['category', 'package', true],
  50. ];
  51. }
  52. }