From bd6957b4ac688097aff822530348ce1c49ddd2bb Mon Sep 17 00:00:00 2001 From: Bill Ruddock Date: Sun, 14 Jul 2024 00:26:31 +0100 Subject: [PATCH 1/2] Squiz/CSS/ShorthandSize: rename test case file to allow for adding more --- ...itTest.css => ShorthandSizeUnitTest.1.css} | 0 ...ixed => ShorthandSizeUnitTest.1.css.fixed} | 0 .../Squiz/Tests/CSS/ShorthandSizeUnitTest.php | 34 ++++++++++++------- 3 files changed, 21 insertions(+), 13 deletions(-) rename src/Standards/Squiz/Tests/CSS/{ShorthandSizeUnitTest.css => ShorthandSizeUnitTest.1.css} (100%) rename src/Standards/Squiz/Tests/CSS/{ShorthandSizeUnitTest.css.fixed => ShorthandSizeUnitTest.1.css.fixed} (100%) diff --git a/src/Standards/Squiz/Tests/CSS/ShorthandSizeUnitTest.css b/src/Standards/Squiz/Tests/CSS/ShorthandSizeUnitTest.1.css similarity index 100% rename from src/Standards/Squiz/Tests/CSS/ShorthandSizeUnitTest.css rename to src/Standards/Squiz/Tests/CSS/ShorthandSizeUnitTest.1.css diff --git a/src/Standards/Squiz/Tests/CSS/ShorthandSizeUnitTest.css.fixed b/src/Standards/Squiz/Tests/CSS/ShorthandSizeUnitTest.1.css.fixed similarity index 100% rename from src/Standards/Squiz/Tests/CSS/ShorthandSizeUnitTest.css.fixed rename to src/Standards/Squiz/Tests/CSS/ShorthandSizeUnitTest.1.css.fixed diff --git a/src/Standards/Squiz/Tests/CSS/ShorthandSizeUnitTest.php b/src/Standards/Squiz/Tests/CSS/ShorthandSizeUnitTest.php index 91ba7fb092..7394b77c2f 100644 --- a/src/Standards/Squiz/Tests/CSS/ShorthandSizeUnitTest.php +++ b/src/Standards/Squiz/Tests/CSS/ShorthandSizeUnitTest.php @@ -26,22 +26,30 @@ final class ShorthandSizeUnitTest 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 [ - 8 => 1, - 9 => 1, - 10 => 1, - 11 => 1, - 12 => 1, - 13 => 1, - 15 => 1, - 16 => 1, - 17 => 1, - 21 => 1, - ]; + switch ($testFile) { + case 'ShorthandSizeUnitTest.1.css': + return [ + 8 => 1, + 9 => 1, + 10 => 1, + 11 => 1, + 12 => 1, + 13 => 1, + 15 => 1, + 16 => 1, + 17 => 1, + 21 => 1, + ]; + + default: + return []; + }//end switch }//end getErrorList() From 2ea2cb3b7bef8449446a9ed01bed0533e8d536c2 Mon Sep 17 00:00:00 2001 From: Bill Ruddock Date: Sun, 14 Jul 2024 00:31:13 +0100 Subject: [PATCH 2/2] Squiz/CSS/ShorthandSize: move parse error test to its own file --- src/Standards/Squiz/Tests/CSS/ShorthandSizeUnitTest.1.css | 4 ---- .../Squiz/Tests/CSS/ShorthandSizeUnitTest.1.css.fixed | 4 ---- src/Standards/Squiz/Tests/CSS/ShorthandSizeUnitTest.2.css | 3 +++ 3 files changed, 3 insertions(+), 8 deletions(-) create mode 100644 src/Standards/Squiz/Tests/CSS/ShorthandSizeUnitTest.2.css diff --git a/src/Standards/Squiz/Tests/CSS/ShorthandSizeUnitTest.1.css b/src/Standards/Squiz/Tests/CSS/ShorthandSizeUnitTest.1.css index cfc4503c41..c3d07ef5c4 100644 --- a/src/Standards/Squiz/Tests/CSS/ShorthandSizeUnitTest.1.css +++ b/src/Standards/Squiz/Tests/CSS/ShorthandSizeUnitTest.1.css @@ -39,7 +39,3 @@ 2px /* phpcs:disable Standard.Category.SniffName -- for reasons */ 4px; } - -/* Intentional parse error. Live coding resilience. This has to be the last test in the file. */ -#live-coding { - margin: 8px 8px 8px 8px diff --git a/src/Standards/Squiz/Tests/CSS/ShorthandSizeUnitTest.1.css.fixed b/src/Standards/Squiz/Tests/CSS/ShorthandSizeUnitTest.1.css.fixed index 3472cb1743..36297dd60d 100644 --- a/src/Standards/Squiz/Tests/CSS/ShorthandSizeUnitTest.1.css.fixed +++ b/src/Standards/Squiz/Tests/CSS/ShorthandSizeUnitTest.1.css.fixed @@ -35,7 +35,3 @@ 2px /* phpcs:disable Standard.Category.SniffName -- for reasons */ 4px; } - -/* Intentional parse error. Live coding resilience. This has to be the last test in the file. */ -#live-coding { - margin: 8px 8px 8px 8px diff --git a/src/Standards/Squiz/Tests/CSS/ShorthandSizeUnitTest.2.css b/src/Standards/Squiz/Tests/CSS/ShorthandSizeUnitTest.2.css new file mode 100644 index 0000000000..2a91cf71a3 --- /dev/null +++ b/src/Standards/Squiz/Tests/CSS/ShorthandSizeUnitTest.2.css @@ -0,0 +1,3 @@ +/* Intentional parse error. Live coding resilience. */ +#live-coding { + margin: 8px 8px 8px 8px