4
votes

I created a phpunit test file , when I try to run it via phpstorm, I get the message:

Unable to attach test reporter to test framework or test framework quit unexpectedly 

seems the following command is executed:

 /usr/local/bin/php /private/var/folders/4b/qrnw7nbd6llgmhrss5rf1_880000gt/T/ide-phpunit.php  --configuration /Users/Shared/sites/pac/app/app/phpunit.xml.dist BackendControllerTest /Users/Shared/sites/pac/app/modules/Pac/Backend/Tests/Controller/BackendControllerTest.php
Testing started at 23:22 ...

Process finished with exit code 0

when i execute this via command line , i get much more output

PHPUnit 3.6.11 by Sebastian Bergmann.

...etc...

 FAILURES!
Tests: 2, Assertions: 2, Failures: 1.

seems phpunit isn't executed in phpstorm? shouldn't there be some sort of error message instead of finishing with exit code 0? Paths to php & phpunit (same) in phpstorms configuration should be ok (both installed via homebrew in /usr/local/bin, path added to phpstorm)

osx 10.7.4 php 5.3.14 PHPUnit 3.6.11

Thanks for helping me!
Matthias

3
Which PhpStorm version? tried to update it?KingCrunch
it's phpstorm 4.0.1. but i doubt it's a version thing, more a configuration / system settings thing, but i don't know how to debug this. in phpstorm it just exits with zero.kertal
Make sure that your Terminal environment is the same as for the GUI applications, see apple.stackexchange.com/q/51677 for details. PhpStorm needs to use the same configuration files as when you run from the Terminal. Also check if PhpStorm (or the user you are running it from) has permissions to execute php and access files used in the tests.CrazyCoder
thanks @ CrazyCoder, different Terminal environment led me to the problems's solution. my phpunit php works now in both environments, it even worked. but my old app checked for some $_SERVER variables that didn't exist in the phpstorm execution, that lead to a silent exit instead of executing the test. wanna write an answer to my question, CrazyCoder? like "check your Terminal & Gui App environment, stupid!" Some people might not be aware that these might differkertal

3 Answers

4
votes

On Mac OS X environment variables available in Terminal and for the normal applications can be different, check the related question for the solution how to make them similar.

Note that this solution will not work on Mountain Lion (10.8).

0
votes

Do you edit include_path in your php.ini?

I have the simillar situation to you.After I added pear's include path,it works.

Look at this.

0
votes

On MacOSX, I was struggling with a simialair problem for quite a while.

The reason in my case turned out to be a PHP-upgrade script, that had messed with some permissions.

What I did:

  • Made sure I had the right to read and execute with my own account in pear bin_dir and php_dir
  • Make sure the php_dir is in the include_path

To find these directories you can issue

# pear config-show

(Look for the bin_dir and php_dir)

This meant I would do the commands:

# (sudo) chmod -R 755 <bin_dir>
# (sudo) chmod -R 755 <php_dir>

More coding - Less IDE-config!