[英]Use PHPUnit on PhpStorm IDE
I've developed a simple test class usign PHPUnit on my PhpStorm IDE. 我在PhpStorm IDE上开发了一个简单的测试类,使用PHPUnit。
This is the configuration of my IDE: 这是我的IDE的配置:
And this is my Test class: 这是我的测试课:
namespace test\controllers;
class AuthTest extends \PHPUnit_Framework_TestCase {
protected function setUp() {
parent::setUp(); // TODO: Change the autogenerated stub
echo "start";
}
protected function tearDown()
{
parent::tearDown(); // TODO: Change the autogenerated stub
echo "end";
}
public function testProva() {
$tot = 5;
$this->assertEquals($tot, 5);
}
}
EDIT: 编辑:
This is the configuration of my test run: 这是我的测试运行的配置:
When I Run the class (class name: AuthTest, file name: AuthTest.php) I obtain the following error: Process finished with exit code 255
But when I run the same class by command line phpunit path/test/folder/
it works fine. 当我运行类(类名:AuthTest,文件名:AuthTest.php)时,出现以下错误: Process finished with exit code 255
但是当我通过命令行phpunit path/test/folder/
运行同一类时,它运行正常。
What is wrong? 怎么了?
PhpStorm v7.x does not support PhpUnit 4.x (only 3.6 ..or maybe 3.7 MAX) . PhpStorm v7.x不支持PhpUnit 4.x(仅3.6 ..或3.7 MAX) 。
PhpStorm uses special helper/wrapper script for integration purposes (so that IDE receives test progress/results in understandable format (much-much easier that parsing PHPUnit native output, which does not provide much details needed for IDE)). PhpStorm使用特殊的帮助程序/包装器脚本进行集成(以便IDE以易于理解的格式接收测试进度/结果(比解析PHPUnit本机输出要容易得多,因为它没有提供IDE所需的太多详细信息)。 This wrapper in PhpStorm v7.x does not support PHPUnit v4.x. PhpStorm v7.x中的此包装器不支持PHPUnitv4.x。
For PhpUnit 4.x support you should try v8 EAP build (or wait for v8 official release -- 1-2 months from now, approximately). 对于PhpUnit 4.x支持,您应该尝试v8 EAP构建 (或等待v8正式发布-从现在开始大约1-2个月)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.