在phpnow中配置phpunit

前面都好了之后,在 D:\phpnow\php-5.2.14-Win32\PEAR 之外的地方执行 phpinfo 都会出现以下错误

Warning: require_once(File/Iterator/Autoload.php): failed to open stream: No such
file or directory in D:\Robin\Programes\php-5.3.1-Win32-VC6-x86\PEAR\PHPUnit\Autoload.php on line 45

 

在这里 http://www.cnblogs.com/dycsoft/archive/2013/04/02/2995083.html 找到解决方法。

具体到phpnow里,php.exe的缺省ini文件指向 c:\windows\php.ini,但那里并没有。在 D:\phpnow\php-5.2.14-Win32 下找到 php.ini-dist 改名为 php.ini,再次运行 php.exe 则会发现,ini文件已经指向这个文件了。看来是php.exe先在当前文件夹中寻找php.ini,如果找不到,则到 c:\windows下查找。如果都没有,则采用默认值。

修改 php.ini:

include_path = ".;c:\php\includes;D:\phpnow\php-5.2.14-Win32\PEAR"

 

做完以上工作,随便找个路径下运行phpunit,都出现了正确的结果。

==================================================

以下测试在yii下的test:

D:\>cd D:\phpnow\htdocs\xxexam\protected\tests

D:\phpnow\htdocs\xxexam\protected\tests>phpunit units\BBCodeTest.php

Warning: require_once(PHPUnit/Extensions/SeleniumTestCase.php): failed to open s
tream: No such file or directory in D:\phpnow\htdocs\yii-1.1.14.f0fee9\framework
\test\CWebTestCase.php on line 12

Fatal error: require_once(): Failed opening required 'PHPUnit/Extensions/Seleniu
mTestCase.php' (include_path='.;c:\php\includes;D:\phpnow\php-5.2.14-Win32\PEAR'
) in D:\phpnow\htdocs\yii-1.1.14.f0fee9\framework\test\CWebTestCase.php on line
12

 

不明所以。上网查了之后(http://www.yiiframework.com/forum/index.php/topic/16553-cant-get-phpunit-and-selenium-working-correctly/

明白了原来是yii使用了phpunit的Selenium扩展,而pear默认安装不包括它。按该贴子的某人建议,去 http://pear.phpunit.de/ 下载 PHPUnit_Selenium 并把相应文件夹拷贝到phpunit的extension文件夹下。再次运行 phpunit units\a.php ,oh no! what's the fuck!

D:\phpnow\htdocs\xxexam\protected\tests>phpunit units\BBCodeTest.php

Parse error: syntax error, unexpected T_FUNCTION, expecting ')' in D:\phpnow\php
-5.2.14-Win32\PEAR\PHPUnit\Extensions\SeleniumCommon\Autoload.php on line 48

这里居然出现了语法错误。实在不知如何继续。先放一放。。。

posted on 2013-12-11 00:56  anjo  阅读(389)  评论(0编辑  收藏  举报