Codeception and Advanced Application template


(Jacob Moen) #1

It is really cool that the advanced app template has Codeception tests…

But how do you create new tests ?

I want to create a unit test in the common dir for the User model.

What directory exactly am I supposed to be in and what command do I need to be making? :)

I can build and run the existing tests but that is not really useful to me - I need to be able to create tests.

Codeception docs does not take the special layout that the advanced app has into account…


(Jacob Moen) #2

So, I navigated to tests/codeception/common and ran the following command:


codecept generate:phpunit unit models/UserTest



I assume that is what you need to do, right?


(Jacob Moen) #3

Or, if we want to use Codeception powered unit tests:


codecept generate:test unit models/UserTest

It looks like the unit tests shipped with the advanced template does not use Codeception style unit tests but phpunit style unit tests because I don’t see the overridden _before and _after methods, am I right?

I wish that the documentation for this was more complete ???


(Jacob Moen) #4

I take it that none of you guys are actually using Codeception ? :)


(Amir Duran) #5

Yep, exactly as I did it.


(Jacob Moen) #6

Thanks Duri :)

At least that makes two of us.


(Jacob Moen) #7

I am currently learning from Dektrium/yii2-user - they have some neat Codeception testing code :)