Skip to content

Commit 55cbb85

Browse files
committed
ErrorSuppressionTest: prevent 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 8b5e6e9 commit 55cbb85

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
@@ -501,15 +501,15 @@ public function dataNestedSuppressLine()
501501

502502
// Process with line suppression nested within disable/enable suppression.
503503
'disable/enable: slash comment, next line nested single line suppression' => [
504-
'before' => '// phpcs:disable'.PHP_EOL.'// phpcs:ignore',
504+
'before' => '// phpcs:disable'."\n".'// phpcs:ignore',
505505
'after' => '// phpcs:enable',
506506
],
507507
'disable/enable: slash comment, with @, next line nested single line suppression' => [
508-
'before' => '// @phpcs:disable'.PHP_EOL.'// @phpcs:ignore',
508+
'before' => '// @phpcs:disable'."\n".'// @phpcs:ignore',
509509
'after' => '// @phpcs:enable',
510510
],
511511
'disable/enable: hash comment, next line nested single line suppression' => [
512-
'before' => '# @phpcs:disable'.PHP_EOL.'# @phpcs:ignore',
512+
'before' => '# @phpcs:disable'."\n".'# @phpcs:ignore',
513513
'after' => '# @phpcs:enable',
514514
],
515515
];
@@ -671,7 +671,7 @@ public function dataSuppressFile()
671671
'ignoreFile: start of file, hash comment, with @' => ['before' => '# @phpcs:ignoreFile'],
672672
'ignoreFile: start of file, single-line star comment' => ['before' => '/* phpcs:ignoreFile */'],
673673
'ignoreFile: start of file, multi-line star comment' => [
674-
'before' => '/*'.PHP_EOL.' phpcs:ignoreFile'.PHP_EOL.' */',
674+
'before' => '/*'."\n".' phpcs:ignoreFile'."\n".' */',
675675
],
676676
'ignoreFile: start of file, single-line docblock comment' => ['before' => '/** phpcs:ignoreFile */'],
677677

@@ -752,18 +752,18 @@ public function dataDisableSelected()
752752
'expectedErrors' => 1,
753753
],
754754
'disable: single sniff, docblock' => [
755-
'before' => '/**'.PHP_EOL.' * phpcs:disable Generic.Commenting.Todo'.PHP_EOL.' */ ',
755+
'before' => '/**'."\n".' * phpcs:disable Generic.Commenting.Todo'."\n".' */ ',
756756
'expectedErrors' => 1,
757757
],
758758
'disable: single sniff, docblock, with @' => [
759-
'before' => '/**'.PHP_EOL.' * @phpcs:disable Generic.Commenting.Todo'.PHP_EOL.' */ ',
759+
'before' => '/**'."\n".' * @phpcs:disable Generic.Commenting.Todo'."\n".' */ ',
760760
'expectedErrors' => 1,
761761
],
762762

763763
// Multiple sniffs.
764764
'disable: multiple sniffs in one comment' => ['before' => '// phpcs:disable Generic.Commenting.Todo,Generic.PHP.LowerCaseConstant'],
765765
'disable: multiple sniff in multiple comments' => [
766-
'before' => '// phpcs:disable Generic.Commenting.Todo'.PHP_EOL.'// phpcs:disable Generic.PHP.LowerCaseConstant',
766+
'before' => '// phpcs:disable Generic.Commenting.Todo'."\n".'// phpcs:disable Generic.PHP.LowerCaseConstant',
767767
],
768768

769769
// Selectiveness variations.
@@ -780,17 +780,17 @@ public function dataDisableSelected()
780780

781781
// Wrong category/sniff/code.
782782
'disable: wrong error code and category' => [
783-
'before' => '/**'.PHP_EOL.' * phpcs:disable Generic.PHP.LowerCaseConstant.Upper,Generic.Comments'.PHP_EOL.' */ ',
783+
'before' => '/**'."\n".' * phpcs:disable Generic.PHP.LowerCaseConstant.Upper,Generic.Comments'."\n".' */ ',
784784
'expectedErrors' => 1,
785785
'expectedWarnings' => 1,
786786
],
787787
'disable: wrong category, docblock' => [
788-
'before' => '/**'.PHP_EOL.' * phpcs:disable Generic.Files'.PHP_EOL.' */ ',
788+
'before' => '/**'."\n".' * phpcs:disable Generic.Files'."\n".' */ ',
789789
'expectedErrors' => 1,
790790
'expectedWarnings' => 1,
791791
],
792792
'disable: wrong category, docblock, with @' => [
793-
'before' => '/**'.PHP_EOL.' * @phpcs:disable Generic.Files'.PHP_EOL.' */ ',
793+
'before' => '/**'."\n".' * @phpcs:disable Generic.Files'."\n".' */ ',
794794
'expectedErrors' => 1,
795795
'expectedWarnings' => 1,
796796
],
@@ -1047,7 +1047,7 @@ public function dataIgnoreSelected()
10471047
'expectedWarnings' => 1,
10481048
],
10491049
'disable: single sniff; ignore: single sniff' => [
1050-
'before' => '// phpcs:disable Generic.Commenting.Todo'.PHP_EOL.'// phpcs:ignore Generic.PHP.LowerCaseConstant',
1050+
'before' => '// phpcs:disable Generic.Commenting.Todo'."\n".'// phpcs:ignore Generic.PHP.LowerCaseConstant',
10511051
'expectedErrors' => 1,
10521052
'expectedWarnings' => 0,
10531053
],

0 commit comments

Comments
 (0)