NoTrailingWhitespaceInCommentFixerTest.php 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  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\Comment;
  12. use PhpCsFixer\Tests\Test\AbstractFixerTestCase;
  13. /**
  14. * @author Dariusz Rumiński <dariusz.ruminski@gmail.com>
  15. *
  16. * @internal
  17. *
  18. * @covers \PhpCsFixer\Fixer\Comment\NoTrailingWhitespaceInCommentFixer
  19. */
  20. final class NoTrailingWhitespaceInCommentFixerTest extends AbstractFixerTestCase
  21. {
  22. /**
  23. * @param string $expected
  24. * @param null|string $input
  25. *
  26. * @dataProvider provideFixCases
  27. */
  28. public function testFix($expected, $input = null)
  29. {
  30. $this->doTest($expected, $input);
  31. }
  32. public function provideFixCases()
  33. {
  34. return [
  35. [
  36. '<?php
  37. // This is'.'
  38. //'.'
  39. //'.'
  40. // multiline comment.
  41. //',
  42. '<?php
  43. // This is '.'
  44. // '.'
  45. // '.'
  46. // multiline comment. '.'
  47. // ',
  48. ],
  49. [
  50. '<?php
  51. /*
  52. * This is another'.'
  53. *'.'
  54. *'.'
  55. * multiline comment.'.'
  56. */',
  57. '<?php
  58. /* '.'
  59. * This is another '.'
  60. * '.'
  61. * '.'
  62. * multiline comment. '.'
  63. */',
  64. ],
  65. [
  66. '<?php
  67. /**
  68. * Summary'.'
  69. *'.'
  70. *'.'
  71. * Description.'.'
  72. *
  73. * @annotation
  74. * Foo
  75. */',
  76. '<?php
  77. /** '.'
  78. * Summary '.'
  79. * '.'
  80. * '.'
  81. * Description. '.'
  82. * '.'
  83. * @annotation '.'
  84. * Foo '.'
  85. */',
  86. ],
  87. ];
  88. }
  89. }