codeception Пользовательские (свои, нестандартные) параметры в конфиге yml и их переопределение через параметры команды
Primary tabs
В codeception.yml (лежит в корне вашего проекта), добавим новый пользовательский параметр init_style, получим что-то вроде:
namespace: App\Tests paths: tests: tests output: tests/_output data: tests/_data support: tests/_support envs: tests/_envs actor_suffix: Tester extensions: enabled: - Codeception\Extension\RunFailed params: - .env.test init_style: "full"
Далее внутри Cest-а использовать этот параметр можно как-то так:
if (\Codeception\Configuration::config()['init_style'] == 'full') { ....
Например:
protected function initMe(FunctionalTester $I, \Codeception\Scenario $scenario) { if (!$this->inited) { $this->functionalTester = $I; $this->client = self::createClient(); if (\Codeception\Configuration::config()['init_style'] == 'full') { $this->refreshMigrate(); $this->createRoles(); $this->createPermissions(); $this->createAdminUser(self::USER['password']); } $this->inited = true; } }
При запуске теста параметр можно переопределить так:
cept run -o "init_style: quick" tests/functional/ExpCest.php
- Log in to post comments
- 1989 reads