gpt4 book ai didi

codeception - 如何修复 codeception 中的这个 DEPRECATION 错误?

转载 作者:行者123 更新时间:2023-12-02 04:24:15 25 4
gpt4 key购买 nike

我正在使用 codeception,当我尝试检查 dbconnection 时它显示错误:

> DEPRECATION: Calling the
> "Symfony\Component\EventDispatcher\EventDispatcherInterface::dispatch()"
> method with the event name as first argument is deprecated since
> Symfony 4.3, pass it second and provide the event object first
> instead.
> C:\xampp\htdocs\affiliate_codeception\codeception\vendor\symfony\event-dispatcher\EventDispatcher.php:58"

我该如何解决这个问题?

<?php 
class adminTest extends \Codeception\Test\Unit
{
/**
* @var \UnitTester
*/
protected $tester;

protected function _before()
{
}

protected function _after()
{
}

// tests
public function testSomeFeature()
{

}
public function tryToTest(UnitTester $I)
{
$I->amConnectedToDatabase('testdb');
//$I->seeInDatabase('users', ['name' => 'Davert', 'email' => 'davert@mail.com']);
}
}

最佳答案

更改vendor/codeception/phpunit-wrapper/src/Listener.php中的代码:

搜索

 dispatcher->dispatch(

对于它们中的每一个,交换第一个和第二个参数。

例如,第一次出现的是:

 public function startTestSuite(\PHPUnit\Framework\TestSuite $suite)
{
$this->dispatcher->dispatch('suite.start', new SuiteEvent($suite));
}

将其更改为:

 public function startTestSuite(\PHPUnit\Framework\TestSuite $suite)
{
$this->dispatcher->dispatch(new SuiteEvent($suite), 'suite.start');
}

关于codeception - 如何修复 codeception 中的这个 DEPRECATION 错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56395956/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com