Skip to content

Commit

Permalink
Fix for support Instance::of in configuration
Browse files Browse the repository at this point in the history
Using createObject with \yii\di\Instance::of in configuration does not work.
Creating an instance of the application in the suggested way solves the problem.
  • Loading branch information
antonovsky committed Nov 17, 2020
1 parent 528e125 commit 01bf59e
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/Codeception/Lib/Connector/Yii2.php
Original file line number Diff line number Diff line change
Expand Up @@ -265,13 +265,16 @@ public function startApp()
{
codecept_debug('Starting application');
$config = require($this->configFile);
if (!isset($config['class'])) {
$config['class'] = 'yii\web\Application';
if (isset($config['class'])) {
$applicationClass = $config['class'];
unset($config['class']);
} else {
$applicationClass = 'yii\web\Application';
}

$config = $this->mockMailer($config);
/** @var \yii\web\Application $app */
Yii::$app = Yii::createObject($config);
Yii::$app = new $applicationClass($config);
Yii::setLogger(new Logger());
}

Expand Down

0 comments on commit 01bf59e

Please sign in to comment.