简体   繁体   中英

How to setup PHPUnit 3.5.15 and Zend framework 1.11.10?

After spending 1 good day I still unable to resolve the following error:

Testing Note: PHPUnit was not found in your include_path, therefore no testing actions will be created.

This error appears when I create a new Zend-project.

What i have tried so far:

  1. Updated Pear to the latest version.
  2. changed config to autodiscover as described on the readme of phpunit.
  3. Also I changed the include path of my php.ini file to the following:

include_path=".;S:\\PHP\\PEAR;S:\\PHP\\PEAR\\PHPUnit;S:\\Framework\\ZendFramework-1.11.10\\library;S:\\PHP\\PEAR\\PEAR"

However I am still receiving the error.

What does work is the commandline phpunit , the correct php.ini is loaded (checked by phpinfo()) so what am I missing?

Additional information

C:\Users\Dev\Desktop>php --ini
Configuration File (php.ini) Path: C:\Windows
Loaded Configuration File:         S:\PHP\php.ini
Scan for additional .ini files in: (none)
Additional .ini files parsed:      (none)

Instalation information:

  • Apache 2.2.19
  • php 5.3.6
  • mysql 5.5.15

I did not install xammp or wammp just manual install to learn.

php.ini that load :=> http://pastebin.com/bpqKhF7U

Update!

Php include_path is ambiguous the error you receive is because your .zf.ini is wrongly configured (mine was)

.zf.ini can be found @ users home folder

It looks like this:

php.include_path=".;S:\\xampp\\php\\;S:\\xampp\\php\\PEAR;S:\\xampp\\php\\PEAR\\PHPUnit"

After changing this parameter to the right locations the error did not occur anymore!.

PHP command line interpreter in windows can use a different php.ini file, see my answer to this question testing zend with phpunit gives me "The mysql driver is not currently installed"

You should check that the phpunit is available on your path, what happen if you type phpunit in a command prompt? Is phpunit in your path?

Anyway the best method to install PHPUnit is the pear method , it should take care of any aspect. I always used that method (Linux and Mac) and everything worked with no need to change the path nor the php.ini file. Don't know if this is also true for Windows.

Update

There is more than one way to change the loaded ini file see all of them here

The easiest way could be with an environment variable:

PHPRC=path of your current apache php.ini file

or with a registry setting

[HKEY_LOCAL_MACHINE\SOFTWARE\PHP], value of IniFilePath (Windows only)

In this way you should be able to load the same file for the apache version. Or you can keep CLI configuration separated and replicate your include_path setting in S:\\PHP\\php.ini

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM