HashToSlashCommentFixerTest.php 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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 SpacePossum
  15. *
  16. * @internal
  17. *
  18. * @covers \PhpCsFixer\Fixer\Comment\HashToSlashCommentFixer
  19. */
  20. final class HashToSlashCommentFixerTest 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. '<h1>This is an <?php //echo 123;?> example</h1>',
  37. '<h1>This is an <?php #echo 123;?> example</h1>',
  38. ],
  39. [
  40. '<?php
  41. //#test
  42. ',
  43. ],
  44. [
  45. '<?php
  46. /*
  47. #test
  48. */
  49. ',
  50. ],
  51. [
  52. '<?php
  53. // test
  54. ',
  55. '<?php
  56. # test
  57. ',
  58. ],
  59. [
  60. '<?php
  61. // test1
  62. //test2
  63. // test3
  64. // test 4
  65. ',
  66. '<?php
  67. # test1
  68. #test2
  69. # test3
  70. # test 4
  71. ',
  72. ],
  73. [
  74. '<?php // a',
  75. '<?php # a',
  76. ],
  77. [
  78. '<?php /* start-end */',
  79. ],
  80. ];
  81. }
  82. }