alexgr
(Alex)
November 18, 2015, 11:10am
1
Hello fellow Yii2 devs,
I am having diffulcties with setting up Codeception under the Yii2 Advanced App.
The README.md in [approot]/tests tells me to do this (step 3):
Create yii2_advanced_tests
database then update it by applying migrations:
codeception/bin/yii migrate
When I run that commmand, I get this issue:
I have been trying different things for quite some time now, but at a loss on how to fix this.
Anyone know what’s causing this?
I noticed the file [approot]/tests/codeception/config/config.php contains the ‘db’ component, like this:
That’s the literal file from GitHub, am I forgetting to include a class of some sort?
Thanks for your help,
Alex
jacmoe
(Jacob Moen)
November 18, 2015, 6:11pm
2
yourapp/common/config/config-local.php - or console/config/config-local.php - whatever - need to have the complete config.
Not just the dsn-override.
Fix the db for the rest of your application:
<?php
return [
'components' => [
'db' => [
'class' => 'yii\db\Connection',
'dsn' => 'mysql:host=HOST;dbname=DBNAME',
'username' => 'USER',
'password' => 'PASSWORD',
'charset' => 'utf8',
],//db
The config for the tests override the dsn so that you are using the test database, and not the ‘real’ database.
alexgr
(Alex)
November 19, 2015, 10:36am
3
Thanks that helped.
But I’m now getting this error, after having done:
Building Actor classes for suites: unit, acceptance, functional
PHP Fatal error: Call to undefined method Codeception\Lib\Generator\Actor::getGuy() in phar:///home/alex/codecept/src/Codeception/Command/Build.php on line 46
I thought this had to do with the Global version of codeception having a different version than the one in vendor/bin, but that’s not the case (am using version 2.0.5 of codeception).
Have I got a wrong configuration someplace else?
Thanks again for your help!
alexgr
(Alex)
November 21, 2015, 11:56am
4