PhpdocNoPackageFixerTest.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  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\Fixer\Phpdoc;
  12. use PhpCsFixer\Test\AbstractFixerTestCase;
  13. /**
  14. * @author Graham Campbell <graham@alt-three.com>
  15. *
  16. * @internal
  17. *
  18. * @covers \PhpCsFixer\AbstractProxyFixer
  19. * @covers \PhpCsFixer\Fixer\Phpdoc\PhpdocNoPackageFixer
  20. */
  21. final class PhpdocNoPackageFixerTest extends AbstractFixerTestCase
  22. {
  23. public function testFixPackage()
  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()
  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()
  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()
  72. {
  73. $expected = <<<'EOF'
  74. <?php
  75. /**
  76. * @var package
  77. */
  78. EOF;
  79. $this->doTest($expected);
  80. }
  81. }