Codecept test failed on advanced template

Hello. I need a help.

I have just installed yii2-advanced template.

try to run Codecept tests and get the following errors:

Frontend\tests.functional Tests (12) ------------------------------------------- ------------------------------------------------------------

Check about (functional\AboutCest::checkAbout) Error

Trying to check contact (functional\ContactCest::checkContact)… <pre>PHP User Error 'yii\base\ErrorException' with message 'Exception (Invalid Configuration) 'yii\base\InvalidConfigException' with message 'Th e directory does not exist: C:\Users\oleksii\projects\advanced\vendor\bin\/…/co deception/codeception/assets'

in C:\Users\oleksii\projects\advanced\vendor\yiisoft\yii2\web\AssetManager.php:2 11

I will be appreciate any help.

Thanks in advace.

if you read the error it says "Th e directory does not exist: C:\Users\oleksii\projects\advanced\vendor\bin\/../co deception/codeception/assets" make sure that directory exists and you have write permission for that directory

You are right!

I have reinstalled yii2 and try to run tests again and it says me the following error:

PHP User Error 'yii\base\ErrorException' with message 'Exception (Invalid Configuration)

'yii\base\InvalidConfigException' with message 'The directory does not exist: ./assets'

It is kind of the same but why they asks me to create directory on my root directory. It actually little bit break yii2 structure. Am I wrong?

Do you do the same (create assets directory in root direcroty)?

The C:\Users\oleksii\projects\advanced\vendor\bin\… is just the path to the ‘codecept’ binary, so it is already created.

The problem lies elsewhere.

Check the configuration files (in ‘testing’).

what I am referring to is the assets directory, not the vendor path how did you install codeception is it installed globally

I have the same problem, any luck?

Just installed fresh yii2 and try that running and getting same error ./advance not exist.

I just tested this, and it ran just fine.

I guess you didn’t set it up as described in the docs?

http://www.yiiframew…ment-setup.html


composer global require "codeception/codeception=2.1.*"

composer global require "codeception/specify=*"

composer global require "codeception/verify=*" 

Also, make sure that you’ve read the testing readme for the advanced app:

I have fixed this error. I have just created ‘assets’ folder in my root directory + granted 0775 access to it.

Thanks. I have read it. I fixed it just to creating ‘assets’ directory in my root(project) folder. I am also little bit confused about it because creating new directory in Yii2 projects will violate yii2 file structure. But that what my ERROR was and it is only way I have found.

I have installed it using composer.json as described in yii2-advanced documentation.

Yes, but did you run the init command as instructed?

To initialize the new Yii project, I mean.

It does not sound right that you needed to create an ‘assets’ directory at the root, because the advanced app has two web roots: frontend and backend.

Just found myself in the same problem when testing my backend functional test

I don’t know what exactly wrong but I fixed it by adding




'components'=>[

        'assetManager' =>[

            'basePath'=>'@backend/web/assets'

        ]

]



into


backend/config/test.php

1 Like