简体   繁体   English

PHPUnit与PHP 7.0不兼容的版本

[英]PHPUnit incompatible version with PHP 7.0

I'm trying to run unit tests using PHPUnit in a CI/CD setup. 我正在尝试在CI / CD设置中使用PHPUnit运行单元测试。 The problem is that I'm getting the following error: 问题是我遇到以下错误:

PHPUnit testing framework version 6 or greater is required when running on PHP 7.0 or greater. Run the command 'composer run-script drupal-phpunit-upgrade' in order to fix this.

But I have the correct version of PHPUnit with PHP 7.2.14. 但是我有带有PHP 7.2.14的正确版本的PHPUnit。 I tried running the suggested command but nothing works. 我尝试运行建议的命令,但没有任何效果。

vendor/bin/phpunit --version
PHPUnit 6.5.13 by Sebastian Bergmann and contributors.

Hope someone with experience has an idea. 希望有经验的人有个主意。

Regards. 问候。

Probably version of PHP for cli and cgi could be different. clicgi的PHP版本可能有所不同。 As you are running phpunit from console, try also run php -v to find out which version is used for console. 当您从控制台运行phpunit时,请尝试同时运行php -v以找出哪个版本用于控制台。

Also, you error message suggest you: 另外,您的错误消息建议您:

Run the command 'composer run-script drupal-phpunit-upgrade' in order to fix this.

Probably that will fix your issue 可能会解决您的问题

I found out what the issue was... It seems that there was a previous installation of PHPUnit, with a version of 4.5, somewhere on the server outside my Drupal project. 我发现问题出在哪里……似乎以前在Drupal项目之外的服务器上的某个位置安装了PHPUnit,版本为4.5。 I manually updated that version to and now it works. 我手动将该版本更新为,现在可以使用了。

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

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