I've installed PHPUnit and everything seems to be working fine as when I run phpunit from the root php directory C:\wamp\bin\php\php5.4.16 it runs as expected.
However, the problem I am having is running PHPUnit from elsewhere within the command line, so I cannot run any tests because of this. I get the error
phpunit' is not recognized as an internal or external
command, operable program or batch file.
My path is set correctly C:\wamp\bin\php\php5.4.16 which is where php.exe is installed.
I have also tried re-installing, and am running version 3.7.24.
Anyone have any tips on what I may be doing wrong?
PHPUnit is not set in the PATH global variable. Try installing PHPUnit using PEAR. For win7 use this tutorial: http://designbyjeeba.blogspot.ro/2012/12/easy-way-to-install-pear-and-phpunit-in.html
If PEAR doesn't find any package to install (when trying to install anything using it) clear PEAR's cache:
pear clear-cache
I dont know the way you installed it, but i did it this way and it works fine for me.
Also i recommend installing DBUnit and PHPUnit selenium. Use the following commands:
pear install phpunit/PHPUnit_Selenium
pear install phpunit/DbUnit
For Linux use the commands given by PHP at the following link:
http://phpunit.de/manual/3.7/en/installation.html
Related
This question has been asked before, but the fixes don't work for me. I am running Windows 10 with WSL (Debian) and I am unable to run a QT program because of the error
texconv: error while loading shared libraries: libQt5Core.so.5: cannot open shared object file: No such file or directory
I found a post which discusses the same problem. I've tried tolos' and Envek's solutions, but they don't work for me. For me the file is under /usr/lib/x86_64-linux-gnu/ like tolos' was. I also sudo-ed the strip and recompiled the qt program (If that even matters), but it still doesn't work.
If it matters, my kernel version (checked with uname -r) is 4.4.0-18362-Microsoft and I have no issues running this qt program on my other PC that uses WSL Ubuntu. And I installed the qt stuff with this command: sudo apt-get install qt5-default qtbase5-dev
I had an image that I would run using docker run and which would successfully launch KStars -- an application that uses this libQt5core.so.5.
If I ran the very same image on a Kubernetes cluster then I would get an error message when launching KStars like libQt5Core.so.5: cannot open shared object file: No such file or directory or some such.
Putting this strip command into the Dockerfile and rebuilding the image allowed the application to load successfully in both environments.
sudo strip --remove-section=.note.ABI-tag /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
I got it working in the end. I upgraded from WSLv1 to WSLv2 and that solved it. Not sure why, but it must have been a WSLv1 Debian bug
I have the latest PhpStorm (2016.2) and PHPUnit phar (5.5.4). For some reason when I run a PHPUnit test in my project in PhpStorm, it is adding on --teamcity to the run command, resulting in a failure:
Testing started at 12:52 PM ...
Unit test suite invoked with a path to a non-unit test: --teamcity
Process finished with exit code 1
I have no idea where this --teamcity option is coming from, it happens no matter what test I run, and even when starting from a blank configuration. I also do NOT have the TeamCity plugin installed, I don't even use TeamCity.
Here's what the full command appears as:
/usr/local/Cellar/php70/7.0.9/bin/php /Users/name/bin/phpunit-5.5.4.phar --configuration /path/to/config/my-phpunit.xml ClassNameTest /Users/name/PhpstormProjects/path/to/tests/unit/app/ClassNameTest.php --teamcity
(sensitive information swapped out)
All I want to do is get rid of this --teamcity option, everything works if I run in a separate terminal window without that option. This only recently started happening, maybe after a PhpStorm update.
tl;dr
I only could resolve this by removing the system installed phpunit instance from my system (Linux):
sudo apt remove phpunit-*
Details
Even if the setting in PhpStorm was to use composer autoloader:
for some reason it ended up using TeamCity from /usr/share/php/PHPUnit/Util/Log/TeamCity.php:
Project's local PHPUnit was 6.2 while the system default was 5.1 -> they're incompatible.
I spent half a day struggling with this. The underlying issue is switching between PHPUnit versions (6.x.x -> 4.x.x). (Happened to me by switching branches)
A click on the refresh button in the PHPUnit preferences fixes it.
(Languages & Frameworks > PHP > PHPUnit)
Make sure the version of PHPUnit it thinks you have matches the one it reports.
This --teamcity option is used by PHPStorm to output tests result.
What you're facing is an issue caused by PHP7 and an old version of PHPUnit.
Remove your PHPUnit 5 and install the latest one (currently 6.2) with composer and use PHPUnit namespaces instead.
More info on this bug: https://github.com/sebastianbergmann/phpunit/issues/2460
Problem was internal to the project. PHPUnit does not contain that error message. Sorry!
I have an interesting issue with Graphicsmagick. I've installed grunt-responsive-images-converter, and successfully configure it. The problem is that it works only when I run it form Webstorm IDE, but when I run it in cmd I get this error:
Running "responsive_images:resize" (responsive_images) task
spawn ENOENT
Warning:
Please ensure GraphicsMagick is installed correctly.
brew install graphicsmagick or see http://www.graphicsmagick.org/download.html for more > > details.
Alternatively, set options.engine to 'im' to use ImageMagick.
Use --force to continue.
I've installed GraphicsMagick-1.3.19-Q16-win64-dll.exe with checked checkbox:"Update executable search path".
I don't know what can I do more, so please help :)
I am trying to install PhpUnit skeleton generator. I am also using PhpStorm 5.0.
I get the feeling that it does not install itself properly because when I try to run the skeleton generator it gives me an error saying:
'phpunit-skelgen.bat' not found at...
Also, it seems that pear does install it in my pear folder under the SebastianBergmann\PHPUnit\SkeletonGenerator folder, which seems odd since I would have expected it in the main pear folder.
Any ideas?
Problem solved.
That's because the phpunit-skelgen.bat file is actually installed in the php folder, not in pear. So just search for it in the root of the php installation folder.
I get Cannot open file "FooTest.php"
I am using PHP 5.4.0 and PHPUnit 3.6 on Windows
I have traced the issue back to PHPUnit\Util\Filesystem.php when it calls get_include_path which contains "." and the location to pear.
For some reason it doesn't resolve . to where the tests are as it resolves it locally to the PHPUnit location.
How do I get phpunit to recognise the location of the tests.
First make also sure your PHPUnit installation and all dependencies are up-to-date:
pear upgrade phpunit/PHPUnit --alldeps
In case your pear installation is messed up you can also obtain it from the github repository.
Depending on how your project and enviroment is set up make sure your current directory is your projects directory.
cd /your/projects/home/directory/
The common syntax to invoke phpunit is either
phpunit [switches] <your_unit_test.php>
or
phpunit [switches] <directory>
So, basically in case your tests are stored within directory YourUnitTests the easiest way to start it would be just to use
phpunit YourUnitTests