3

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.

3 Answers 3

11

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
Sign up to request clarification or add additional context in comments.

Comments

0
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).

Comments

0

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"

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.