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 2020长安杯与连接网探
  • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么
  • ¥15 banner广告展示设置多少时间不怎么会消耗用户价值
  • ¥16 mybatis的代理对象无法通过@Autowired装填
  • ¥15 可见光定位matlab仿真
  • ¥15 arduino 四自由度机械臂
  • ¥15 wordpress 产品图片 GIF 没法显示
  • ¥15 求三国群英传pl国战时间的修改方法
  • ¥15 matlab代码代写,需写出详细代码,代价私
  • ¥15 ROS系统搭建请教(跨境电商用途)