PhpdocNoPackageFixerTest.php 1.9 KB

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