From 6b37c7e7beac101eae0a63fbd4271bff46c65d97 Mon Sep 17 00:00:00 2001 From: Andrew Nicols Date: Tue, 19 Mar 2024 16:31:22 +0800 Subject: [PATCH] Accept Standard Before/After Behat tags --- moodle/Tests/Util/DocblocksTest.php | 40 +++++++++++++++++++++++++++++ moodle/Util/Docblocks.php | 13 ++++++++++ 2 files changed, 53 insertions(+) diff --git a/moodle/Tests/Util/DocblocksTest.php b/moodle/Tests/Util/DocblocksTest.php index 9b14ba9..4483130 100644 --- a/moodle/Tests/Util/DocblocksTest.php +++ b/moodle/Tests/Util/DocblocksTest.php @@ -196,6 +196,46 @@ function exampleFunction(string $param): void {}', function exampleFunction(string $param): void {}', true, ], + 'Behat test file: Valid' => [ + 'lib/tests/behat/behat_example.php', + ' [ + 'lib/tests/test_behat.php', + ' true, 'Then' => true, 'When' => true, + 'BeforeFeature' => true, + 'BeforeScenario' => true, + 'BeforeStep' => true, + 'AfterFeature' => true, + 'AfterScenario' => true, + 'AfterStep' => true, // PHPUnit tags. 'codeCoverageIgnore' => true, @@ -118,6 +124,13 @@ abstract class Docblocks 'Given' => ['#.*/tests/behat/.*#'], 'Then' => ['#.*/tests/behat/.*#'], 'When' => ['#.*/tests/behat/.*#'], + 'BeforeFeature' => ['#.*/tests/behat/.*#'], + 'BeforeScenario' => ['#.*/tests/behat/.*#'], + 'BeforeStep' => ['#.*/tests/behat/.*#'], + 'AfterFeature' => ['#.*/tests/behat/.*#'], + 'AfterScenario' => ['#.*/tests/behat/.*#'], + 'AfterStep' => ['#.*/tests/behat/.*#'], + 'covers' => ['#.*/tests/.*_test.php#'], 'coversDefaultClass' => ['#.*/tests/.*_test.php#'], 'coversNothing' => ['#.*/tests/.*_test.php#'],