问题
I have tried connecting to pear.phpunit.de and three other similar connections using PEAR, but could not due to connection timeout, after updating connection also in PEAR, no progress.
Also, I have tried installing PHPunit without PEAR by changing @PHPBIN@ in phpunit.php file and renaming it, then cannot run it as an executable file in DOS (chmod does'nt work in DOS, was written in steps, which i followed)
Is there any other simple way to get PHPUnit working in Windows under Wamp server. Please respond, all things hanging on it presently.
回答1:
Try:
pear clear-cache
pear update-channels
pear install --alldeps phpunit/PHPUnit
If PHPUnit installs, but you still can't run a unit test, you might have to move the phpunit file down one directory. So if your php.exe file is in C:\wamp\bin\php\php5.2.11\ you should have something like this:
C:\wamp\bin\php\php5.2.11\phpunit.bat
C:\wamp\bin\php\php5.2.11\phpunit
C:\wamp\bin\php\php5.2.11\PEAR\phpunits
回答2:
Try the below link if it works I have PHPUnit up and running in Windows XP with no issues.
Installing PHPUnit
回答3:
pear config-set temp_dir D:\temp
the problem is that whitespaces in the path of the temp dir prevents pear from installing the package.
Also try to empty the pear cache directory (somewhere in %appdata% local temp).
回答4:
You can refer this link for PHPUnit installation on windows.
Installing PHPUnit On Windows
回答5:
As of December 31 2014 pear.phpunit.de will be shut down, so here is another way of configuring PHPUnit on your machine:
- First, make sure that you are able to execute "php --version" from Command Prompt without getting an error. If you do get an error, add the path to "php.exe" to your PATH environment variable (mine is under "C:\xampp\php" for example)
- Download "phpunit.phar" from https://phar.phpunit.de/phpunit.phar
- Move this file to a folder in which you wish to keep the phpunit installation (I'll use "C:\phpunit" in this example)
- Create a new text file under "C:\phpunit\" and rename it to "phpunit.cmd"
Right-click and open "phpunit.cmd" in edit mode, copy>paste the following line and save the file:
@php"%~dp0\phpunit.phar" %*
At this point you should have "phpunit.cmd" and "phpunit.phar" under "C:\phpunit"
- Go to your system variables and edit your PATH variable
Add this line to the very beginning of your PATH variable and don't forget the semicolon:
C:\phpunit;
Click OK to save the edit, Open Command Prompt and type "phpunit --version"
来源:https://stackoverflow.com/questions/4181916/problem-installing-phpunit-in-windows-using-pear-and-without-pear-also