Skip to content

Commit 119d4cf

Browse files
committed
ErrorSuppressionTest: prevent potential Internal errors
... about a mismatch in line endings when the code "template" is defined using a heredoc with Linux line endings, while the code snippets being inserted into the code "template" were using line endings matching the OS on which the tests were being run.
1 parent b63cedf commit 119d4cf

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

tests/Core/ErrorSuppressionTest.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -510,15 +510,15 @@ public static function dataNestedSuppressLine()
510510

511511
// Process with line suppression nested within disable/enable suppression.
512512
'disable/enable: slash comment, next line nested single line suppression' => [
513-
'before' => '// phpcs:disable'.PHP_EOL.'// phpcs:ignore',
513+
'before' => "// phpcs:disable\n// phpcs:ignore",
514514
'after' => '// phpcs:enable',
515515
],
516516
'disable/enable: slash comment, with @, next line nested single line suppression' => [
517-
'before' => '// @phpcs:disable'.PHP_EOL.'// @phpcs:ignore',
517+
'before' => "// @phpcs:disable\n// @phpcs:ignore",
518518
'after' => '// @phpcs:enable',
519519
],
520520
'disable/enable: hash comment, next line nested single line suppression' => [
521-
'before' => '# @phpcs:disable'.PHP_EOL.'# @phpcs:ignore',
521+
'before' => "# @phpcs:disable\n# @phpcs:ignore",
522522
'after' => '# @phpcs:enable',
523523
],
524524
];
@@ -689,7 +689,7 @@ public static function dataSuppressFile()
689689
'before' => '/* phpcs:ignoreFile */',
690690
],
691691
'ignoreFile: start of file, multi-line star comment' => [
692-
'before' => '/*'.PHP_EOL.' phpcs:ignoreFile'.PHP_EOL.' */',
692+
'before' => "/*\n phpcs:ignoreFile\n */",
693693
],
694694
'ignoreFile: start of file, single-line docblock comment' => [
695695
'before' => '/** phpcs:ignoreFile */',
@@ -771,11 +771,11 @@ public static function dataDisableSelected()
771771
'expectedErrors' => 1,
772772
],
773773
'disable: single sniff, docblock' => [
774-
'before' => '/**'.PHP_EOL.' * phpcs:disable Generic.Commenting.Todo'.PHP_EOL.' */ ',
774+
'before' => "/**\n * phpcs:disable Generic.Commenting.Todo\n */ ",
775775
'expectedErrors' => 1,
776776
],
777777
'disable: single sniff, docblock, with @' => [
778-
'before' => '/**'.PHP_EOL.' * @phpcs:disable Generic.Commenting.Todo'.PHP_EOL.' */ ',
778+
'before' => "/**\n * @phpcs:disable Generic.Commenting.Todo\n */ ",
779779
'expectedErrors' => 1,
780780
],
781781

@@ -784,7 +784,7 @@ public static function dataDisableSelected()
784784
'before' => '// phpcs:disable Generic.Commenting.Todo,Generic.PHP.LowerCaseConstant',
785785
],
786786
'disable: multiple sniff in multiple comments' => [
787-
'before' => '// phpcs:disable Generic.Commenting.Todo'.PHP_EOL.'// phpcs:disable Generic.PHP.LowerCaseConstant',
787+
'before' => "// phpcs:disable Generic.Commenting.Todo\n// phpcs:disable Generic.PHP.LowerCaseConstant",
788788
],
789789

790790
// Selectiveness variations.
@@ -805,17 +805,17 @@ public static function dataDisableSelected()
805805

806806
// Wrong category/sniff/code.
807807
'disable: wrong error code and category' => [
808-
'before' => '/**'.PHP_EOL.' * phpcs:disable Generic.PHP.LowerCaseConstant.Upper,Generic.Comments'.PHP_EOL.' */ ',
808+
'before' => "/**\n * phpcs:disable Generic.PHP.LowerCaseConstant.Upper,Generic.Comments\n */ ",
809809
'expectedErrors' => 1,
810810
'expectedWarnings' => 1,
811811
],
812812
'disable: wrong category, docblock' => [
813-
'before' => '/**'.PHP_EOL.' * phpcs:disable Generic.Files'.PHP_EOL.' */ ',
813+
'before' => "/**\n * phpcs:disable Generic.Files\n */ ",
814814
'expectedErrors' => 1,
815815
'expectedWarnings' => 1,
816816
],
817817
'disable: wrong category, docblock, with @' => [
818-
'before' => '/**'.PHP_EOL.' * @phpcs:disable Generic.Files'.PHP_EOL.' */ ',
818+
'before' => "/**\n * @phpcs:disable Generic.Files\n */ ",
819819
'expectedErrors' => 1,
820820
'expectedWarnings' => 1,
821821
],
@@ -1070,7 +1070,7 @@ public static function dataIgnoreSelected()
10701070
'expectedWarnings' => 1,
10711071
],
10721072
'disable: single sniff; ignore: single sniff' => [
1073-
'before' => '// phpcs:disable Generic.Commenting.Todo'.PHP_EOL.'// phpcs:ignore Generic.PHP.LowerCaseConstant',
1073+
'before' => "// phpcs:disable Generic.Commenting.Todo\n// phpcs:ignore Generic.PHP.LowerCaseConstant",
10741074
'expectedErrors' => 1,
10751075
'expectedWarnings' => 0,
10761076
],

0 commit comments

Comments
 (0)