我正在使用代码接收,当我尝试检查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]']);
}
}
搜索
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'); }