Bootstrap file in phpunit.xml


I'm very happy with PhpStorm and I'm gonna buy it when the test period is over. However the only problem I have is getting PHPUnit running. I have worked with the same tests folder (including test classes, phpunit.xml and bootstrap.php) from command line and NetBeans 6.9.x without any problem.

PhpStorm does not include the bootstrap file defined in phpunit.xml. F.e.:

<phpunit backupGlobals="false"          bootstrap="tests/bootstrap.php"          backupStaticAttributes="true"          colors="false"          convertErrorsToExceptions="true"          convertNoticesToExceptions="true"          convertWarningsToExceptions="true"          processIsolation="false"          syntaxCheck="true" />

This is a phpunit.xml from a small project. In other projects I have child tags within phpunit (whitelist, logging, testsuite etc.)

My environment:
MacOS 10.6.4
PhpStorm 2.0 EAP Build PS-98.108
JDK 1.16.0:20
PHP 5.3.1
PHPUnit 3.4.15

Hello, my name is Lera. I am PHPUnit support developer and maintainer.

So, you do have your tests, phpunit.xml and bootstrap.xml in the same folder (called tests), right? If no, please describe your file structure.

Seems I need some more information to understand the problem. So wouldn't you be so kind to answers to the following questions as well:

1) Do you customize working directory in run configuration? If no, then setting bootstrap to bootstrap="bootstrap.php" should do
2) Tell what is your customization for working directory - if any
3) Do tests run fine without bootstrap setting?

4) What exact error message do you get in console?

It would be also very useful, if you quote the command you use to run these tests from command line (I'm mainly interested what is you working directory in this case - I mean where do you invoke phpunit from).

Thank you in advance.


Thank you for your answer.

The setting Custom Working Directory helped me! It works now. I was thinking it was "ignoring the bootstrap file" as there was no feedback from PhpStorm or PHPUnit that the bootstrap file is not found. It just dives directly into testing. As the testing was ok, but the bootstrap file is not.

Setting the Custom Working Directory to the directory/path from where the relative paths in phpunit.xml point.

The cli command was:

phpunit --configuration tests/phpunit.xml TranslationsTest tests/TranslationsTest.php


Please sign in to leave a comment.