如何在代码接收中解决此DEPRECATION错误?

问题描述 投票:2回答:1

我正在使用代码接收,当我尝试检查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' => '[email protected]']);
    }
}
codeception
1个回答
0
投票
更改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'); }
© www.soinside.com 2019 - 2024. All rights reserved.