Skip to content

Commit 1de79b9

Browse files
committed
Fix for support Instance::of in configuration
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.
1 parent 536ecb4 commit 1de79b9

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/Codeception/Lib/Connector/Yii2.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -265,13 +265,16 @@ public function startApp()
265265
{
266266
codecept_debug('Starting application');
267267
$config = require($this->configFile);
268-
if (!isset($config['class'])) {
269-
$config['class'] = 'yii\web\Application';
268+
if (isset($config['class'])) {
269+
$applicationClass = $config['class'];
270+
unset($config['class']);
271+
} else {
272+
$applicationClass = 'yii\web\Application';
270273
}
271274

272275
$config = $this->mockMailer($config);
273276
/** @var \yii\web\Application $app */
274-
Yii::$app = Yii::createObject($config);
277+
Yii::$app = new $applicationClass($config);
275278
Yii::setLogger(new Logger());
276279
}
277280

0 commit comments

Comments
 (0)