我通过从引导文件切换到扩展来解决了这个问题。例子:在 codeception.yml 中:extensions: enabled: - Bootstrapper该类可lib/Bootstrapper.php通过 Composer 的类列表功能找到composer.json:{ "autoload": { "classmap": [ "lib/" ] }}看起来像这样:<?phpuse Codeception\Events;use Codeception\Extension;class Bootstrapper extends Extension { public static $events = [ Events::SUITE_BEFORE => 'beforeSuite', ]; public function beforeSuite() { $module = 'PhpBrowser'; if ($this->hasModule('WebDriver')) { $module = 'WebDriver'; } /* expose info, if we're in real-browser context */ define('IS_REAL_BROWSER', $module === 'WebDriver'); /* make sure the helper functions are loaded */ require_once __DIR__.'/../tests/acceptance/_helpers.php'; }}
- 2 回答
- 0 关注
- 221 浏览
添加回答
举报
0/150
提交
取消
