Changes
Title
unchanged
Configuring PhpStorm IDE for Yii 2
Category
unchanged
Tips
Yii version
unchanged
2.0
Tags
unchanged
IDE,PhpStorm,IntelliJ IDEA
Content
changed
[...]
- **[Yii2 Support](https://plugins.jetbrains.com/plugin/9388-yii2-support)** adds many useful tools that improve working with Yii. It makes working with class configuration, DI and views easier.
- **[Yii2 Inspections](https://plugins.jetbrains.com/plugin/9400-yii2-inspections)** is a very useful plugin that adds Yii specific code inspections to PHPStorm. It helps for example to manage `@property` annotations for getters and setters as well as translation messages.
- **[Php Inspections (EA Extended)](https://plugins.jetbrains.com/plugin/7622-php-inspections-ea-extended-)** is not directly Yii related but has a lot of additional code inspections that help you write better code. There is also a [payeid version](https://plugins.jetbrains.com/plugin/10215-php-inspections-ea-ultimate-) that has even more features, especially security related inspections.[...]
`composer.json` - *right click* - Composer - Init Composer ...
# PHPUnit and Codeception
PHPStorm has integrations for PHPUnit as well as Codeception, so you can run your tests directly from the IDE.
Settings for that can be found at *Run* - *Edit Configurations...*.
To add your Codeception tests, click the <kbd>+</kbd> button, select *Codeception*. Then enter the following details:
- Name: "Codeception tests" - or whatever you want to name it
- Test Scope: *Defined in the Configuration file*
- Use alternative configuration file: "codeception.yml"
- In case PHPStorm asks you to do it, configure a PHP Interpreter in PHPStorm settings
- Configure Codeception binary as `vendor/bin/codecept`
You can now run your tests directly from PHPStorm.
For PHPUnit the steps are similar but Yii application templates do not provide PHPUnit tests by default so the options depend on your setup.