Help with PhpUnit test generation with bootstrap

First of all i would like to say that i love PhpStorm and i already bought 1.0 version, but right now i'm using latest EAP releases (current is 98.521).

I can't generate a test from context menu command "Generate PhpUnit test...". The content of the file i'm trying to generate test for is:

class ptPropelSpool extends Swift_PropelSpool {

When i'm trying to generate it says:

Error: (E_ERROR) Class 'Swift_PropelSpool' not found

This is expected behavior because i need to include the file with this class. Usually i use test/unit/bootstrap.php to load all necessary files.
The question is:
Is it possible to tell PhpStorm to use boostrap file when it generates phpunit test?

Any help appreciated!

Comment actions Permalink

Hi Artem,

PhpStorm does not use phpunit command -- it is done via custom php script that uses this functionality by directly using appropriate PHPUnit classes and methods. Because of that it ignores any xml config files (and, as result, bootsrtap file) which you may have.

Right now I see 2 ways:
1) Use appropriate phpunit command manually from command prompt/shell (there you can specify which config/bootstrap files to use).
2) Add all libraries required to include_path in your php.ini. Then you should be able to use it from PhpStorm (have not tested it myself)

Comment actions Permalink

Ok... as i see there is no OOTB feature... hope it will be implemented in future. Thank you for your fast reply...


Please sign in to leave a comment.