2

I am using PhpStorm with Yii2 advanced template. I have seen all Yii2 documents. Everything's fine. There's some questions about integrating Yii2 and PhpStorm (both are my favorites) that googling caused no good solution. Maybe many developers has same questions so that I want to ask here:


  1. I have installed codeception globally with composer then have build and run all tests included in advanced template with codeception. everything is OK. But when I want to write new (frontend, backend , ...) test in PhpStorm, there is no auto-complete for using codeception. Also when you open some existing default tests in PhpStorm such as SignupCest.php file, namespaces are undefined and PhpStorm cannot find referenced method in subject classes!

Any suggestion or solution?

updated

  1. Could anyone help with a complete tutorial on how to debug a yii2 project with Xdebug, PhpStorm and Chrome/Firefox? Although there are some tutorial on debugging pure Php projects/scripts but didn't find any on yii2.

1 Answer 1

5

In Settings in Language & Frameworks in PHP set Include path to codeception. Like this

For those Who want to know:

After that you included the codeception framework's path to your project you have to change PHPDoc Blocks for correct addressing of @param.

For example acceptance test

namespaces in SignupCest.php file:

From: @param \codeception_frontend\AcceptanceTester $I

To: @param AcceptanceTester $I

Sign up to request clarification or add additional context in comments.

2 Comments

I think you are right, I'm going to accept your answer, by the way what abou codeception_frontend . I mean this namespace referes to what? there is still undefined warning about that and no autocompletes are available. @vitalik_74
uhh.. I removed codeception_frontend and changed the PHPDoc block from @param \codeception_frontend\AcceptanceTester $I that generated automatically to @param $I AcceptanceTester and thats all. everything is fine now. TNX @vitalik_74

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.