dqt66847 2011-03-31 11:03
浏览 60
已采纳

从Zend Studio 8运行phpUnit测试套件时出现奇怪的错误

Zend Studio 8 has phpUnit integration and a dedicated view, which is great, so I would like to use it... but:

When I run my phpunit.xml on the command line, the tests are executed just fine, when I try to run phpunit.xml in Zend Studio as unit test, I get the following fatal error:

Fatal error: Uncaught exception 'PHPUnit_Framework_Error' with message 'Assigning the return value of new by reference is deprecated' in C:\Program Files (x86)\Zend\ZendServer\bin\PEAR\PEAR\Config.php:650

Stack trace:

#0 C:\Program Files (x86)\Zend\ZendServer\bin\PEAR\PEAR\RunTest.php(22): ZendPHPUnitErrorHandler->handle(8192, 'Assigning the r...', 'C:\Program File...', 650, Array)
#1 C:\Program Files (x86)\Zend\ZendServer\bin\PEAR\PEAR\RunTest.php(22): require_once()
#2 C:\Program Files (x86)\Zend\ZendServer\bin\PEAR\PHPUnit\Extensions\PhptTestCase.php(49): require_once('C:\Program File...')
#3 C:\Program Files (x86)\Zend\Zend Studio - 8.0.0\plugins\com.zend.php.phpunit_8.0.0.v20101001-0100esources\ZendPHPUnit.php(103): require_once('C:\Program File...')
#4 {main} thrown in C:\Program Files (x86)\Zend\ZendServer\bin\PEAR\PEAR\Config.php on line 650

I really don't have a clue what that means... why should some deprecated code in the PEAR config keep my tests from running?

[edit] Some additional information:

My colleague who has neither PEAR nor phpunit installed, can run unit tests from Zend Studio 8 just fine but he can't run any from the CLI. So it seems that Zend Studio not only integrates with phpUnit but comes bundled with a version of it. I wanted the newest version and that's why I installed PEAR and then via PEAR I installed phpUnit. As a consequence, the phpUnit library of Zend Studio was outdated and I had to replace the file 'ZendPHPUnit.php' in the Zend Studio plugin folder with a version of a Zend Forum user. This lead to correct inclusion of the phpUnit classes and the current problem. [/edit]

  • 写回答

1条回答 默认 最新

  • dongtuoleng8624 2011-03-31 11:25
    关注

    Line 650 in PEAR\Config.php does

    $this->_registry['default'] = &new PEAR_Registry(
        $this->configuration['default']['php_dir']
    );
    

    This will raise an E_DEPRECATED message depending on whether you have enabled error_reporting to include that level. The error handlers of PHPUnit and ZendPHPUnit will convert those to PHPUnit_Framework_Exceptions.

    Because PHP will raise E_DEPRECATED already at compile time, the only way to suppress these errors is in php.ini. My assumption is, that your PHPUnit you run from CLI is using a different php.ini than that your Zend Studio and in that php.ini the error level is not low enough to raise E_DEPRECATED.

    If you can provide a reproducable example, we might be able to make more sense of it. In any case, try to update your PEAR installation to the latest version.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 基于卷积神经网络的声纹识别
  • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 stm32开发clion时遇到的编译问题