1
votes

The answer may be simple just 'cause I'm not finding anything with basic google hunting.

Using PhpStorm 7.0 with PHPUnit for testing in each subcategory of Function, Unit, and Integration, I have a alternative configuration file defined, custom working directory defined, and environment variables.

When I create a new testing class within a defined directory (for example, I add a class in wamp/integration/Classes/, where my integration directory is defined as /wamp/tests/integration), how do I make that new class automatically adopt the environment variables and alternative config file from the parent configuration of the Integration Tests?

Use case: While writing these tests I'll run just that test class individually (instead of all Integration tests), but it only runs properly after I've manually entered the environment variables, alt config file and the custom working directory- which is stupidly time consuming.

There has got to be a quick/easy way to do this automatically that I'm missing.

2
1) There is a "Defaults" section in "Manage Configurations" screen which allows to set up some common defaults -- but that's one for whole project. 2) Instead of creating new config from scratch, why not copy existing one (the most closest for your needs) and alter what is required?LazyOne
Previously I had just been letting it generate its own by right clicking in the test class and running it- but copying the config sounds like the way to go! Thanks!Kate

2 Answers

0
votes

As specified in the comments by LazyOne, the best way to do this is to copy the previously existing config file and change the necessary parts to reflect the new class you're testing.

0
votes

This worked for me:

  • Create a test config that tests all files.
  • To test one file: Right click on file in Project tab and select "Run with your_test_config_name".