1
votes

I would like to have different configuration files for PHPUnit for my

  1. Unit Tests: no database available, no cache, no everything
  2. integration tests: everything is there AND to be able to execute these tests in PhpStorm all together or separated per file with automatically the right configuration.

There are several opportunities, which do not work for all needs:

Option 1: Multiple phpunit.xml files
In PhpStorm can only set one PHPUnit default configuration, for executing a single test file, this will not work.

Option 2: Using a PHPUnit_Framework_BaseTestListener::startTestSuite($suite).
This works with a single phpunit.xml and if you are just executing the whole test suite, this works. But when you want to execute a single test file in PhpStorm, you do not have a $suite available and can not load the right configuration.

How do you handle different test configurations with PhpStorm?

1

1 Answers

1
votes

Because there seems to be no offical possiblity on PHPStorm, I figured out a way by using a PHPUnit TestListener:

http://www.sebastianviereck.de/en/run-phpunit-unit-integrations-test-configurations-phpstorm/