1
votes

Can someone with a working Zend/PHPUnit installation tell me how PHPUnit.bat should read?

I have installed PEAR and PHPUnit, but PHPUnit.bat appears to have an error in its code.

Having worked through a few issues, I no longer get 'PHPUnit is not a recognised command' error. But if I now call "PHPUnit" in the command line nothing at all happens except the command prompt reappears. Indicating some code may have run.

I did some reading and PEAR should be calling a .bat file in 'c:\zend\zendServer\bin'. I opened this and there is a very short block of code.

if "%PHPBIN%" == "" set PHPBIN=c:\zend\zendserver\bin\php.exe
if not exist "%PHPBIN%" if "%PHP_PEAR_PHP_BIN%" neq "" goto USE_PEAR_PATH
GOTO RUN
:USE_PEAR_PATH
set PHPBIN=%PHP_PEAR_PHP_BIN%
:RUN
"%PHPBIN%" "C:\Zend\zendServer\bin\\phpunit" %*

The final line looks incorrect, notably the double slash. I have tried various derivations such as 'bin\pear\phpunit etc', but are not sure where this should be pointing.

Can anyone with a working ZendServer/PHPUnit installation tell me how this line should read.

Also, I should also ask, is calling 'PHPunit' in the cmd line the best way to test if the package has installed correctly. Ideas appreciated. The PEAR install call suggested the install should be working fine.

UPDATE I just created a new project through the zend framework CLI tool and got a note that PHPUnit was not found in my include_path. I have both PEAR and PHP on my include path do I need something else?

UPDATE I found this post on a potential test Getting PHPUnit Working - Include Path not set correctly?, which provides a way to test phpUnit. I saved the suggested PHP script in my htdocs folder and tried to call it with PHPUnit. Once again no response, which seems to suggest that there is a n error in my PHPUnit.bat file.

1
For what it's worth, Start -> Run -> C:\\\\Windows opens C:\Windows.ta.speot.is
Thanks. This may suggest that a call to 'phpUnit' on the command line should do nothing. Does anyone know how I can test if it has installed correctly?Greg.Forbes
Here is blog post about installing phpunit and using it in Eclipse PDT, it might help blog.loftdigital.com/running-phpunit-tests-in-eclipse-pdtZdenek Machek

1 Answers

0
votes

Okay this has been a nightmare, but I think I have a solution for anyone facing the same issues.

Question One: how do I test if PHPUNit is working. Answer: typing PHPUnit into the cmd line will give you a list of all the commands and so acts as a good test as to whether the install has worked.

Question Two: What should PHPUnit.bat look like.

The text above is correct and the extra slash in PHP.bat does not affect the output as ta.speot.is notes.

Solution to get install working:

The issue in this case related to an anomaly with Zend Server. A change to the php config file PHP.ini does not seem to get picked up by the server. It appears that Zend stores the path variables somewhere else. I noted that the changes to the include_path had not been picked up and changed it through the GUI server interface provided with the install.

PHPUnit is now working correctly.

For those struggling with an install I would add two lessons to add to the huge range of posts on the topic.

1) if you have ever had Zend on your computer. Beware an uninstall leaves trace files that can complicate later installs.

2) There is PHPUnit.ini file that gets saved in the c:\windows directory be sure to delete this before starting the install.

3) The following link is an excellent set of instructions http://www.zendexperts.com/2011/06/21/how-to-install-zend-server-ce-pear-phpunit/.

The only change I would make is when using go-pear.php to install PEAR, do not activate errors as suggested in the post, otherwise the interface does not seem to work and issues a large number of errors in the PEAR php.

Hope this helps someone save a couple of days.