Search code examples
phpphpstormyii2codeceptionyii2-advanced-app

Phpstorm and Yii2 advanced template


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.

Solution

  • 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