Yii 2 Advance Template Codeception Test

Hi,

First of all, I’m really existed to see Yii2 finally in beta stage. I have created a new project with composer, and was trying out the codeception test framework. But I keep getting the following error


  [ReflectionException]

  Class db does not exist


Exception trace:

 () at G:\PhpstormProjects\Antpolise CRM\vendor\yiisoft\yii2\di\Container.php:408

 ReflectionClass->__construct() at G:\PhpstormProjects\Antpolise CRM\vendor\yiisoft\yii2\di\Container.php:408

 yii\di\Container->getDependencies() at G:\PhpstormProjects\Antpolise CRM\vendor\yiisoft\yii2\di\Container.php:354

 yii\di\Container->build() at G:\PhpstormProjects\Antpolise CRM\vendor\yiisoft\yii2\di\Container.php:147

 yii\di\Container->get() at G:\PhpstormProjects\Antpolise CRM\vendor\yiisoft\yii2\di\Instance.php:145

 yii\di\Instance->get() at G:\PhpstormProjects\Antpolise CRM\vendor\yiisoft\yii2\di\Instance.php:119

 yii\di\Instance::ensure() at G:\PhpstormProjects\Antpolise CRM\vendor\yiisoft\yii2\test\DbFixture.php:38

 yii\test\DbFixture->init() at G:\PhpstormProjects\Antpolise CRM\vendor\yiisoft\yii2\test\ActiveFixture.php:57

 yii\test\ActiveFixture->init() at G:\PhpstormProjects\Antpolise CRM\vendor\yiisoft\yii2\base\Object.php:106

 yii\base\Object->__construct() at n/a:n/a

 ReflectionClass->newInstanceArgs() at G:\PhpstormProjects\Antpolise CRM\vendor\yiisoft\yii2\di\Container.php:365

 yii\di\Container->build() at G:\PhpstormProjects\Antpolise CRM\vendor\yiisoft\yii2\di\Container.php:147

 yii\di\Container->get() at G:\PhpstormProjects\Antpolise CRM\vendor\yiisoft\yii2\BaseYii.php:341

 yii\BaseYii::createObject() at G:\PhpstormProjects\Antpolise CRM\vendor\yiisoft\yii2\test\FixtureTrait.php:194

 common\tests\_helpers\FixtureHelper->createFixtures() at G:\PhpstormProjects\Antpolise CRM\vendor\yiisoft\yii2\test\FixtureTrait.php:131

 common\tests\_helpers\FixtureHelper->getFixtures() at G:\PhpstormProjects\Antpolise CRM\vendor\yiisoft\yii2\test\FixtureTrait.php:84

 common\tests\_helpers\FixtureHelper->loadFixtures() at G:\PhpstormProjects\Antpolise CRM\common\tests\_helpers\FixtureHelper.php:37

 common\tests\_helpers\FixtureHelper->_beforeSuite() at G:\PhpstormProjects\Antpolise CRM\vendor\codeception\codeception\src\Codeception\Subscriber\Module.php:32

 Codeception\Subscriber\Module->beforeSuite() at n/a:n/a

 call_user_func() at G:\PhpstormProjects\Antpolise CRM\vendor\symfony\event-dispatcher\Symfony\Component\EventDispatcher\EventDispatcher.php:164

 Symfony\Component\EventDispatcher\EventDispatcher->doDispatch() at G:\PhpstormProjects\Antpolise CRM\vendor\symfony\event-dispatcher\Symfony\Component\EventDispatcher\EventDispatcher.php:53

 Symfony\Component\EventDispatcher\EventDispatcher->dispatch() at G:\PhpstormProjects\Antpolise CRM\vendor\codeception\codeception\src\Codeception\SuiteManager.php:180

 Codeception\SuiteManager->run() at G:\PhpstormProjects\Antpolise CRM\vendor\codeception\codeception\src\Codeception\Codecept.php:173

 Codeception\Codecept->runSuite() at G:\PhpstormProjects\Antpolise CRM\vendor\codeception\codeception\src\Codeception\Codecept.php:153

 Codeception\Codecept->run() at G:\PhpstormProjects\Antpolise CRM\vendor\codeception\codeception\src\Codeception\Command\Run.php:195

 Codeception\Command\Run->runSuites() at G:\PhpstormProjects\Antpolise CRM\vendor\codeception\codeception\src\Codeception\Command\Run.php:146

 Codeception\Command\Run->execute() at G:\PhpstormProjects\Antpolise CRM\vendor\symfony\console\Symfony\Component\Console\Command\Command.php:252

 Symfony\Component\Console\Command\Command->run() at G:\PhpstormProjects\Antpolise CRM\vendor\symfony\console\Symfony\Component\Console\Application.php:894

 Symfony\Component\Console\Application->doRunCommand() at G:\PhpstormProjects\Antpolise CRM\vendor\symfony\console\Symfony\Component\Console\Application.php:193

 Symfony\Component\Console\Application->doRun() at G:\PhpstormProjects\Antpolise CRM\vendor\symfony\console\Symfony\Component\Console\Application.php:124

 Symfony\Component\Console\Application->run() at G:\PhpstormProjects\Antpolise CRM\vendor\codeception\codeception\codecept:27

I’m running the test in frontend folder and I have added db params in common/config. What does this actually means?

Cheers,

Chris Sim

Make sure you have added ‘class’ => ‘yii\db\Connection’.

Sorry for my stupidity, but where do I add it? in which config file?

===========

I think I have found out the params. Thanks!

===========

Cheers,

Chris Sim

so where is that? I’ve faced same issue today

What version of codeception do you use? Only codeception 1.8.* works with yii2. I think, you try to use codeception 2.0.0-RC