4
votes

How can I make PHPStorm to use always the phpunit.xml in a project's directory by default.

The variable {PROJECT_DIRECTORY} is not working (was only guessed)

Click Path: Default Settings -> Languages & Frameworks -> PHP -> PHP Unit

Screen

edit @LazyOne commented, that the path is automatically translated. But it is not:

  • Edited the default settings in some project A, select phpunit.xml from that project
  • Opened another project
  • Checked Default Settings
  • The path of "some project A" is used
2
1) What screen you are editing (how did you get there)? is this project-specific settings or what? 2) Use full path -- as long as path is inside project then IDE will store with variables but you will always see full/translated path - LazyOne
are you moving your project regularly? i just use static paths... - jossif
@LazyOne I used the global settings. What you are saying about automatic path translation is very interesting. I did not try even that. - Alex
@LazyOne Does not seem to work - Alex
What do you mean by "global"? If it is File | Default Settings... then yeah , it will not work. Maybe try just ./phpunit.xml ..? Not really sure here... - LazyOne

2 Answers

3
votes

It works by typing

$PROJECT_DIR$/phpunit.xml

in the default project.

Verified by deleting my project's .idea folder - after opening, it has the correct path.

0
votes

You can (and should) use absolute paths. PHPStorm is intelligent and stores the path relative to the project root internally. You can proof that by throwing a glance at the XML files stored in the .idea folder:

configuration_file_path="$PROJECT_DIR$/tests/phpunit.xml.dist"

...that's the relevant attribute in my case, whereas my manual configuration points to an absolute path.