Yii2 install, configure, and run coding tests

I write this because the official yii2 documentation is still incomplete, and the coding documentation itself refers to the official yii2 documents .. :).

I have a few questions:

  • My yii2 root directory has a "tests / code generation" directory, does this mean that coding is already installed in my project?
  • vendor / yiisoft has another "yii2-codeception" code directory, what is it?
  • The documentation says to create the yii2_basic_tests database and perform the migration, but the migration script only creates the migration table, is this correct?
  • does integration with yii2 provide some web interface or should i run tests from console scripts?

Can someone explain to me how to install and configure code generation in the base yii2 application step by step?

thank

Alessandro

+4
source share
2 answers

I do like this:

composer global require "codeception/codeception=2.0.*" "codeception/specify=*" "codeception/verify=*"

And further:

ln -s ~/.composer/vendor/bin/codecept /usr/local/bin/codecept

Then i can do globally

codecept run
+10
source

First make sure you read this several times http://www.yiiframework.com/doc-2.0/guide-test-environment-setup.html

After that, the actual tests are easily configured. Make sure that the codecept command works as it is written in the last line of the link above. After installing the Yii application, you need to go to the test folder and run

codecept build

to initialize the tests. Then run

codecept run

to run actual tests.

You can run

codecept run --coverage-html

.

, , , , .

+5

All Articles