diff --git a/moodle/ruleset.xml b/moodle/ruleset.xml index 9d9157f9..08858ba8 100644 --- a/moodle/ruleset.xml +++ b/moodle/ruleset.xml @@ -10,6 +10,7 @@ + diff --git a/moodle/tests/fixtures/generic_classes_openingclassbrace.php b/moodle/tests/fixtures/generic_classes_openingclassbrace.php new file mode 100644 index 00000000..d7e49c52 --- /dev/null +++ b/moodle/tests/fixtures/generic_classes_openingclassbrace.php @@ -0,0 +1,31 @@ +verify_cs_results(); } + public function test_generic_classes_openingclassbrace() { + + // Define the standard, sniff and fixture to use. + $this->set_standard('moodle'); + $this->set_sniff('Generic.Classes.OpeningBraceSameLine'); + $this->set_fixture(__DIR__ . '/fixtures/generic_classes_openingclassbrace.php'); + + // Define expected results (errors and warnings). Format, array of: + // - line => number of problems, or + // - line => array of contents for message / source problem matching. + // - line => string of contents for message / source problem matching (only 1). + $this->set_errors([ + 5 => 'Expected 1 space before opening brace; found 0', + 8 => 'Expected 1 space before opening brace; found 0', + 11 => 'Expected 1 space before opening brace; found 3', + 14 => 'Expected 1 space before opening brace; found 3', + 19 => 'Opening brace should be on the same line as the declaration for class test05', + ]); + + $this->set_warnings([]); + + // Let's do all the hard work! + $this->verify_cs_results(); + } + public function test_generic_whitespace_scopeindent() { // Define the standard, sniff and fixture to use. diff --git a/tests/behat/ui.feature b/tests/behat/ui.feature index 9c825947..b48e3780 100644 --- a/tests/behat/ui.feature +++ b/tests/behat/ui.feature @@ -42,7 +42,7 @@ Feature: Codechecker UI works as expected | path | exclude | seen | notseen | | local/codechecker/moodle/tests | */tests/fixtures/* | Files found: 3 | Invalid path | | local/codechecker/moodle/tests | */tests/fixtures/* | moodlestandard_test.php | Invalid path | - | local/codechecker/moodle/tests/ | *PHPC*, *moodle_* | Files found: 30 | Invalid path | + | local/codechecker/moodle/tests/ | *PHPC*, *moodle_* | Files found: 31 | Invalid path | | local/codechecker/moodle/tests/ | *PHPC*, *moodle_* | Line 1 of the opening comment | moodle_php | | local/codechecker/moodle/tests/ | *PHPC*, *moodle_* | Inline comments must end | /phpcompat | | local/codechecker/moodle/tests/ | *PHPC*, *moodle_* | Inline comments must end | /phpcompat |