PhpdocNoPackageFixerTest.php 1.5 KB

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