diff --git a/src/Codeception/Step/TryTo.php b/src/Codeception/Step/TryTo.php index 95505835f6..cca9eea2b2 100644 --- a/src/Codeception/Step/TryTo.php +++ b/src/Codeception/Step/TryTo.php @@ -46,6 +46,8 @@ public static function getTemplate(Template $template): ?Template return $template ->place('doc', $conditionalDoc) ->place('action', 'tryTo' . ucfirst($action)) + ->place('return', 'return ') + ->place('return_type', ': bool') ->place('step', 'TryTo'); } } diff --git a/tests/data/retries/tests/_support/Helper/Retry.php b/tests/data/retries/tests/_support/Helper/Retry.php index fe97d4e662..fba78cf64f 100644 --- a/tests/data/retries/tests/_support/Helper/Retry.php +++ b/tests/data/retries/tests/_support/Helper/Retry.php @@ -16,7 +16,7 @@ public function _before(\Codeception\TestInterface $test) $this->time = microtime(true); } - public function failAt($amount = 3) + public function failAt($amount = 3): void { if ($this->fails < $amount) { ++$this->fails; diff --git a/tests/data/retries/tests/retry.suite.yml b/tests/data/retries/tests/retry.suite.yml index 0253ef7d76..d0ae7dc981 100644 --- a/tests/data/retries/tests/retry.suite.yml +++ b/tests/data/retries/tests/retry.suite.yml @@ -2,6 +2,7 @@ actor: RetryTester modules: enabled: - \Helper\Retry + - Asserts step_decorators: - Codeception\Step\Retry - Codeception\Step\TryTo \ No newline at end of file diff --git a/tests/data/retries/tests/retry/TryToCest.php b/tests/data/retries/tests/retry/TryToCest.php index 458617d848..cceb5599b4 100644 --- a/tests/data/retries/tests/retry/TryToCest.php +++ b/tests/data/retries/tests/retry/TryToCest.php @@ -7,6 +7,7 @@ class TryToCest #[Group('ignore')] public function ignoreFailure(RetryTester $I) { - $I->tryToFailAt(1); + $result = $I->tryToFailAt(1); + $I->assertFalse($result, 'tryTo must return false on failure'); } }