![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/old/vendor/codeception/codeception/src/Codeception/Step/ |
<?php declare(strict_types=1); namespace Codeception\Step; use Codeception\Lib\ModuleContainer; use Codeception\Util\Template; use Exception; use function codecept_debug; use function ucfirst; class TryTo extends Assertion implements GeneratedStep { public function run(ModuleContainer $container = null): bool { $this->isTry = true; try { parent::run($container); } catch (Exception $e) { codecept_debug("Failed to perform: {$e->getMessage()}, skipping..."); return false; } return true; } public static function getTemplate(Template $template): ?Template { $action = $template->getVar('action'); if ((str_starts_with($action, 'have')) || (str_starts_with($action, 'am'))) { return null; // dont try on conditions } if (str_starts_with($action, 'wait')) { return null; // dont try on waiters } if (str_starts_with($action, 'grab')) { return null; // dont on grabbers } $conditionalDoc = "* [!] Test won't be stopped on fail. Error won't be logged \n " . $template->getVar('doc'); return $template ->place('doc', $conditionalDoc) ->place('action', 'tryTo' . ucfirst($action)) ->place('return', 'return ') ->place('return_type', ': bool') ->place('step', 'TryTo'); } }