phpintellij-ideaphpunitintellij-idea-2016

How to create separate project to test PHP application in IntelliJ 2016?


I have a project that is written in PHP with IntelliJ. I need to create a new IntelliJ project that contains only tests for the PHP application. I can't use classes from the application in the tests project. How can I add other project as a dependency for my project that contains the tests?

I have tried using IntelliJ module settings but I don't see the dependencies tab.


Solution

  • I'm not sure if it works exactly like that in IntelliJ, but in PhpStorm 2016 you can do as follows:

    Open Project view (View -> Tool Windows -> Project) and locate External libraries at the bottom:

    Project view

    Press F4 or right click -> Configure PHP Include Paths. You should see this window:

    enter image description here

    Press the + icon at the bottom of the window and locate the directory with the classes that you want to test. IntelliJ should add them as a library, which means all autocompletion features will include the classes, but you will be warned when you try to edit these files.