From 77e171ee5f1a5b1a70e9a35a034a38a0fb6de3b4 Mon Sep 17 00:00:00 2001 From: jrfnl Date: Sun, 10 Dec 2023 02:28:59 +0100 Subject: [PATCH 1/2] Squiz/Heredoc: rename the test case file ... to allow for moving the git conflict/parse error test to a secondary test case file. --- ...redocUnitTest.inc => HeredocUnitTest.1.inc} | 0 .../Squiz/Tests/PHP/HeredocUnitTest.php | 18 +++++++++++++----- 2 files changed, 13 insertions(+), 5 deletions(-) rename src/Standards/Squiz/Tests/PHP/{HeredocUnitTest.inc => HeredocUnitTest.1.inc} (100%) diff --git a/src/Standards/Squiz/Tests/PHP/HeredocUnitTest.inc b/src/Standards/Squiz/Tests/PHP/HeredocUnitTest.1.inc similarity index 100% rename from src/Standards/Squiz/Tests/PHP/HeredocUnitTest.inc rename to src/Standards/Squiz/Tests/PHP/HeredocUnitTest.1.inc diff --git a/src/Standards/Squiz/Tests/PHP/HeredocUnitTest.php b/src/Standards/Squiz/Tests/PHP/HeredocUnitTest.php index 90f4cfab66..de2d71e48e 100644 --- a/src/Standards/Squiz/Tests/PHP/HeredocUnitTest.php +++ b/src/Standards/Squiz/Tests/PHP/HeredocUnitTest.php @@ -26,14 +26,22 @@ class HeredocUnitTest extends AbstractSniffUnitTest * The key of the array should represent the line number and the value * should represent the number of errors that should occur on that line. * + * @param string $testFile The name of the file being tested. + * * @return array */ - public function getErrorList() + public function getErrorList($testFile='') { - return [ - 2 => 1, - 8 => 1, - ]; + switch ($testFile) { + case 'HeredocUnitTest.1.inc': + return [ + 2 => 1, + 8 => 1, + ]; + + default: + return []; + }//end switch }//end getErrorList() From 87f52ede22dac3231eed470273fd28e70b190483 Mon Sep 17 00:00:00 2001 From: jrfnl Date: Sun, 10 Dec 2023 02:29:59 +0100 Subject: [PATCH 2/2] Squiz/Heredoc: move a test to its own file Move the git conflict/parse error test to its own file. Related to 143 --- .../Squiz/Tests/PHP/HeredocUnitTest.1.inc | 15 --------------- .../Squiz/Tests/PHP/HeredocUnitTest.2.inc | 17 +++++++++++++++++ 2 files changed, 17 insertions(+), 15 deletions(-) create mode 100644 src/Standards/Squiz/Tests/PHP/HeredocUnitTest.2.inc diff --git a/src/Standards/Squiz/Tests/PHP/HeredocUnitTest.1.inc b/src/Standards/Squiz/Tests/PHP/HeredocUnitTest.1.inc index 56f4393aed..d1863c0763 100644 --- a/src/Standards/Squiz/Tests/PHP/HeredocUnitTest.1.inc +++ b/src/Standards/Squiz/Tests/PHP/HeredocUnitTest.1.inc @@ -10,18 +10,3 @@ My name is "$name". I am printing some $foo->foo. Now, I am printing some {$foo->bar[1]}. This should not print a capital 'A': \x41 EOT; - -// The following function has a simulated git conflict for testing. -// This is not a merge conflict - it is a valid test case. -// Please do not remove. -function test() - { - $arr = array( - 'a' => 'a' -<<<<<<< HEAD - 'b' => 'b' -======= - 'c' => 'c' ->>>>>>> master - ); - } diff --git a/src/Standards/Squiz/Tests/PHP/HeredocUnitTest.2.inc b/src/Standards/Squiz/Tests/PHP/HeredocUnitTest.2.inc new file mode 100644 index 0000000000..eb0062f08e --- /dev/null +++ b/src/Standards/Squiz/Tests/PHP/HeredocUnitTest.2.inc @@ -0,0 +1,17 @@ + 'a' +<<<<<<< HEAD + 'b' => 'b' +======= + 'c' => 'c' +>>>>>>> master + ); + }