PHPUnit 7.2和Codeception 2.4不兼容 [英] PHPUnit 7.2 and Codeception 2.4 are incompatible

查看:137
本文介绍了PHPUnit 7.2和Codeception 2.4不兼容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试使用Laravel框架5.6安装CodeCeption

Trying to install CodeCeption with Laravel framework 5.6

我收到此错误.

我要安装的步骤是 1.作曲者需要代码接收/代码接收--dev 2. php ./vendor/bin/codecept引导程序

Steps i followed to install are 1. composer require codeception/codeception --dev 2. php ./vendor/bin/codecept bootstrap

我遇到的错误是

Fatal error: Declaration of Codeception\Test\Unit::getDependencies() must be compatible with PHPUnit\Framework\TestCase::getDependencies(): array in /vendor/codeception/codeception/src/Codeception/Test/Unit.php on line 14

有人可以告诉您如何解决此问题或将其降级并使其与Laravel 5.6一起使用吗?

Can someone tell how to fix this or downgrade and get it work with Laravel 5.6?

推荐答案

在Codeception/Test/Unit.php第133行中,将getDependencies函数更改为具有数组返回类型. : array

In Codeception/Test/Unit.php line no 133, change the getDependencies function to have a array return type. : array

更改后,getDependencies函数应如下所示.

After the change the getDependencies function should look like this.

public function getDependencies(): array
{
    $names = [];
    foreach ($this->getMetadata()->getDependencies() as $required) {
        if ((strpos($required, ':') === false) and method_exists($this, $required)) {
            $required = get_class($this) . ":$required";
        }
        $names[] = $required;
    }
    return $names;
}

这篇关于PHPUnit 7.2和Codeception 2.4不兼容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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