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

标签 codeception

我正在使用 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/

相关文章:

php - Codeception - 无法在 Firefox 中保存和加载 session 快照

laravel-4 - Codeception中的验收测试是否应该在测试环境中运行? (Laravel4 +代码接收)

php - Codeception:保持登录状态

php - 如何使 fillField() 用于功能测试 Codeception + Laravel 5.2

html - <br/> 之后文本的 XPath

codeception - 如何在一个命令中运行多个 codeception 套件(但不是全部)?

java - 如何在远程服务器上使用 selenium 运行代码接收验收测试

codeception - 如何在 Codeception WebDriver 中为 PayPal in-context 编写正确的验收测试?

git - Composer 更新 - 没有获得最新版本

php - yii2 单元测试在 null 上调用成员函数 getDb() 时出错