简体   繁体   中英

Unable to run PHPUnit test in PHPStorm

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. :)

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