From 88ff4f1df16c6834f361d42d6663370264571b31 Mon Sep 17 00:00:00 2001 From: Rodrigo Primo Date: Thu, 21 Dec 2023 20:50:12 -0300 Subject: [PATCH] Generic/OpeningBraceSameLine: improve code coverage This commit improves the test code coverage for the Generic.Classes.OpeningBraceSameLine sniff. There was one line that was not exercised by tests that handle cases where the opening and closing brace for the class are on the same line as the class name. --- .../Classes/OpeningBraceSameLineUnitTest.inc | 5 ++++ .../OpeningBraceSameLineUnitTest.inc.fixed | 5 ++++ .../Classes/OpeningBraceSameLineUnitTest.php | 25 ++++++++++--------- 3 files changed, 23 insertions(+), 12 deletions(-) diff --git a/src/Standards/Generic/Tests/Classes/OpeningBraceSameLineUnitTest.inc b/src/Standards/Generic/Tests/Classes/OpeningBraceSameLineUnitTest.inc index fd3abc030e..ce9a69f8d9 100644 --- a/src/Standards/Generic/Tests/Classes/OpeningBraceSameLineUnitTest.inc +++ b/src/Standards/Generic/Tests/Classes/OpeningBraceSameLineUnitTest.inc @@ -93,3 +93,8 @@ class Test_Class_Bad_G enum Test_Enum { } + +class Test_Class_Good_D {} + +class Test_Class_Bad_H +{} diff --git a/src/Standards/Generic/Tests/Classes/OpeningBraceSameLineUnitTest.inc.fixed b/src/Standards/Generic/Tests/Classes/OpeningBraceSameLineUnitTest.inc.fixed index a755ae4725..0d5f6b63f3 100644 --- a/src/Standards/Generic/Tests/Classes/OpeningBraceSameLineUnitTest.inc.fixed +++ b/src/Standards/Generic/Tests/Classes/OpeningBraceSameLineUnitTest.inc.fixed @@ -93,3 +93,8 @@ class Test_Class_Bad_G enum Test_Enum { } + +class Test_Class_Good_D {} + +class Test_Class_Bad_H { +} diff --git a/src/Standards/Generic/Tests/Classes/OpeningBraceSameLineUnitTest.php b/src/Standards/Generic/Tests/Classes/OpeningBraceSameLineUnitTest.php index c72d133751..a2df57736f 100644 --- a/src/Standards/Generic/Tests/Classes/OpeningBraceSameLineUnitTest.php +++ b/src/Standards/Generic/Tests/Classes/OpeningBraceSameLineUnitTest.php @@ -32,18 +32,19 @@ public function getErrorList() { return [ - 19 => 2, - 23 => 1, - 28 => 2, - 34 => 1, - 38 => 1, - 41 => 1, - 44 => 1, - 47 => 1, - 70 => 1, - 79 => 1, - 90 => 1, - 94 => 1, + 19 => 2, + 23 => 1, + 28 => 2, + 34 => 1, + 38 => 1, + 41 => 1, + 44 => 1, + 47 => 1, + 70 => 1, + 79 => 1, + 90 => 1, + 94 => 1, + 100 => 1, ]; }//end getErrorList()