简体   繁体   English

PhpStorm 中的 PHPUnit

[英]PHPUnit in PhpStorm

PHPUnit in PhpStorm. PhpStorm 中的 PHPUnit。 Everything working great, but why do I have this error?一切正常,但为什么会出现此错误?

在此处输入图片说明

The Framework shown in red, and the IDE error says: Framework显示为红色,IDE 错误提示:

Undefined namespace Framework.未定义的命名空间框架。

How to get rid of it ?如何摆脱它?

Phpunit introduced the namespace PHPUnit\\Framework\\TestCase with Version 6, early 2017 (see https://github.com/sebastianbergmann/phpunit/wiki/Release-Announcement-for-PHPUnit-6.0.0 ). Phpunit 在 2017 年初的版本 6 中引入了命名空间PHPUnit\\Framework\\TestCase (参见https://github.com/sebastianbergmann/phpunit/wiki/Release-Announcement-for-PHPUnit-6.0.0 )。

Check your PhpStorm settings, probably you configured a version prior to 6.0.0, so PhpStorm doesn't know that namespace.检查您的 PhpStorm 设置,可能您配置了 6.0.0 之前的版本,因此 PhpStorm 不知道该命名空间。

I had the same error.我有同样的错误。 using phpunit.phar file使用 phpunit.phar 文件

I fixed adding the file as External library screenshot我修复了将文件添加为外部库屏幕截图

I have several versions of phar so I just selected "exclude phar from project" in the other files.我有几个版本的 phar,所以我只是在其他文件中选择了“从项目中排除 phar”。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM