PhpdocNoPackageFixerTest.php 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  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\Fixer\Phpdoc;
  13. use PhpCsFixer\Tests\Test\AbstractFixerTestCase;
  14. /**
  15. * @author Graham Campbell <hello@gjcampbell.co.uk>
  16. *
  17. * @internal
  18. *
  19. * @covers \PhpCsFixer\Fixer\Phpdoc\PhpdocNoPackageFixer
  20. *
  21. * @extends AbstractFixerTestCase<\PhpCsFixer\Fixer\Phpdoc\PhpdocNoPackageFixer>
  22. */
  23. final class PhpdocNoPackageFixerTest extends AbstractFixerTestCase
  24. {
  25. public function testFixPackage(): void
  26. {
  27. $expected = <<<'EOF'
  28. <?php
  29. /**
  30. */
  31. EOF;
  32. $input = <<<'EOF'
  33. <?php
  34. /**
  35. * @package Foo\Bar
  36. */
  37. EOF;
  38. $this->doTest($expected, $input);
  39. }
  40. public function testFixSubpackage(): void
  41. {
  42. $expected = <<<'EOF'
  43. <?php
  44. /**
  45. */
  46. EOF;
  47. $input = <<<'EOF'
  48. <?php
  49. /**
  50. * @subpackage Foo\Bar\Baz
  51. */
  52. EOF;
  53. $this->doTest($expected, $input);
  54. }
  55. public function testFixMany(): void
  56. {
  57. $expected = <<<'EOF'
  58. <?php
  59. /**
  60. * Hello!
  61. */
  62. EOF;
  63. $input = <<<'EOF'
  64. <?php
  65. /**
  66. * Hello!
  67. * @package
  68. * @subpackage
  69. */
  70. EOF;
  71. $this->doTest($expected, $input);
  72. }
  73. public function testDoNothing(): void
  74. {
  75. $expected = <<<'EOF'
  76. <?php
  77. /**
  78. * @var package
  79. */
  80. EOF;
  81. $this->doTest($expected);
  82. }
  83. }