yii2 testing using codeception
Asked Answered
S

2

6

I am writing a simple test case. I installed codeception using composer. My test cases are located in root folder inside test case folder

when i try to run the following code

namespace app\tests\testcases;

use yii\codeception\TestCase;

class SomeMyTest extends TestCase
{

public function testOne()
{
    echo "here";
}



}

when i try to run the code in a browser i get the following error

 Fatal error: Class 'yii\codeception\TestCase' not found 

There is this file called as yiisoft\yii2-codeception\TestCase.php in my project

What am i doing wrong? Can anyone help.?

Serilda answered 20/1, 2015 at 8:18 Comment(4)
I followed instruction given in [link]github.com/yiisoft/yii2-app-basic/tree/master/tests[/link]. I get the following error. [Codeception\Exception\Configuration] Configuration file could not be found. Run bootstrap to initialize Codeception. build [-c|--config[="..."]]Serilda
Do we need to add any settings to config file of yii ton use te test feature?Serilda
I feel its something to do with the configuration file. Did anyone used this before?Serilda
Did you run the "codecept bootstrap" command?Matisse
N
1

https://github.com/yiisoft/yii2-codeception

composer require yiisoft/yii2-codeception --dev
Nombril answered 4/11, 2020 at 16:40 Comment(0)
P
0

Install codeception using this commands

composer require codeception/codeception
composer require codeception/specify
composer require codeception/verify

More at https://www.yiiframework.com/doc/guide/2.0/en/test-environment-setup

Pyorrhea answered 16/11, 2018 at 9:26 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.