Closed nazieb closed 9 years ago
Where is PHPUnit installed? This normally happens when ST2 can't find a copy of PHPUnit to run.
On 18 Mar 2014, at 11:12, Ainun Nazieb notifications@github.com wrote:
Hello, I'm using ST2 on OSX 10.9.2.
After I wrote my tests and the phpunit.xml, and "Run Tests..." from right-click menu, the console log appears in the bottom and shows the phpunit command but not the results.
When I copy the command and paste it on the Terminal, it works fine. What possibly did I do wrong? Because when I click "Open Class Being Tested" and "Open phpunit.xml" they just works well.
Here's the screenshot of the console:
Sorry for bad English
— Reply to this email directly or view it on GitHub.
PHP Unit is installed on /usr/local/bin/phpunit
How to make the ST2 to find that path?
@nazieb I just ran into this. If you open the console (^`, or View → Show Console) after the failed test run you may see an error. For me the problem was that Sublime couldn't find phpunit (as @stuartherbert suggests).
To fix this, you want to be sure PHPUnit is in your $PATH
, and that Sublime can see that $PATH
.
To see what Sublime thinks your $PATH
is, fire up the console, then type import os
and then os.environ['PATH']
. It should list the full path that Sublime searches.
If /usr/local/bin
is not in there, make sure that your shell sets it properly, then quit Sublime and restart it with the subl
commandline tool, or use the SublimeFixMacPath plugin if you invoke Sublime from Finder.
Going through those steps (so that Sublime could see phpunit in my path) got tests running properly for me.
@jboonstra Thanks, that's exactly what I was looking for. However, I had one last problem about locating Autoload.php, it then have been solved this way: http://stackoverflow.com/a/19018541/705982
@jboonstra thanx for the fixmaxpath
tip ,i just installed and add an extra path to global phpunit which is ~/.composer/vendor/bin/
.
running os.environ['PATH']
gives me '~/.composer/vendor/bin/:/usr/local/bin:/usr/bin:/usr/local/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/usr/local/git/bin'
which means its working but now i can't run the phpunit plugin unless i have the phpunit installed locally ,any solution for that ?
What do you mean by 'installed locally'? It should be sufficient to have PHPUnit installed in the $PATH that Sublime sees. Do you have it installed in one of those locations, or elsewhere?
locally means in the project folder ,and as i mentioned above i installed it globally and as u can see ST sees the . composer
path even b4 the usr/local/bin
so it should work ,but for some reason it doesn't :(.
I've just added support for checking for vendor/bin/phpunit, and using that copy of phpunit if it exists. Hopefully that will fix this for you :)
I was not able to get this PHPUnit plugin working without a third party plugin on OSX (Fix Mac Path). Here is what I tried first.
OSX 10.11.4 (El Capitan) Sublime Text 3 PHPUnit plugin via package manager PHPUnit global install via composer
I'm still getting the following error in the Sublime Text console when I try to run a test
/bin/sh: phpunit: command not found
I have phpunit installed via composer globally
$ ls ~/.composer/vendor/bin/
phpunit
However it's still not recognizing the globally installed phpunit install. I see that the plugin has been updated to account for this location. However it does not appear to be working.
>>> import os
>>> os.environ['PATH']
'/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin'
In order to get this PHPUnit plugin working I had to follow the instructions here for ST3 FixMacPath: https://github.com/int3h/SublimeFixMacPath
After the FixMacPath install and adding the "~/.composer/vendor/bin" directory PHPUnit now works.
>>> import os
>>> os.environ['PATH']
'~/.composer/vendor/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin'
Hello, I'm using ST2 on OSX 10.9.2.
After I wrote my tests and the phpunit.xml, and "Run Tests..." from right-click menu, the console log appears in the bottom and shows the phpunit command but not the results.
When I copy the command and paste it on the Terminal, it works fine. What possibly did I do wrong? Because when I click "Open Class Being Tested" and "Open phpunit.xml" they just works well.
Here's the screenshot of the console:
Sorry for bad English