无法在PHPStorm中运行PHPUnit测试 [英] Unable to run PHPUnit test in PHPStorm

查看:365
本文介绍了无法在PHPStorm中运行PHPUnit测试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用PHPStorm IDE在PHPUnit上运行测试套件。但是,其中一个测试因为以下问题而失败,

PHP警告:无法修改标头信息 - 标头已经由...发送



我通过添加 @runInSeparateProcess 注释来解决该问题。



我能够在终端中成功运行所有测试。但是当我尝试使用PHPStorm IDE运行测试时,我最终得到以下错误消息 -

  PHPUnit_Framework_Exception :Sebastian Bergmann编写的PHPUnit 4.2.5。 

用法:phpunit [options] UnitTest [UnitTest.php]
phpunit [options]< directory>
代码覆盖选项:

--coverage-clover< file>以Clover XML格式生成代码覆盖率报告。

...(基本上打印出phpunit --help的输出)



<这只能在运行相同的测试时才能看到,前面的错误信息是标题错误。



请协助我解决这个问题。任何帮助将不胜感激。



谢谢!

解决方案

最后设法解决它!我删除了运行配置中出现失败的测试的 @runInSeparateProcess 注释以及 - stderr 选项。相反,我在 phpunit.xml 中的 phpunit 标记中添加了 stderr =true选项, 。奇怪。



谢谢 Ian Bytchek 为您的时间和努力。 :)

I have a test suite running on PHPUnit using the PHPStorm IDE. But, one of the tests used to fail due to the following issue,
PHP Warning: Cannot modify header information - headers already sent by ...

I managed fixed that by adding the @runInSeparateProcess annotation.

I was able to run all the tests successfully in the terminal. But when I try to run the tests using the PHPStorm IDE, I end up getting the following error message -

PHPUnit_Framework_Exception : PHPUnit 4.2.5 by Sebastian Bergmann.

Usage: phpunit [options] UnitTest [UnitTest.php]
       phpunit [options] <directory>
Code Coverage Options:

--coverage-clover <file>  Generate code coverage report in Clover XML format.

...(basically prints out the output of phpunit --help)

This is seen only while running the same test that failed earlier with the header error message.

Please assist me to fix this issue. Any help will be greatly appreciated.

Thanks!

解决方案

Finally managed to fix it! I removed the @runInSeparateProcess annotation for the test that was failing and also the --stderr option in the run configurations. Instead, I added stderr="true" option in the phpunit tag present in the phpunit.xml and it worked. Strange.

Thank you Ian Bytchek for your time and effort. :)

这篇关于无法在PHPStorm中运行PHPUnit测试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆