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

时间:2019-05-31 13:24:07

标签: codeigniter phpunit 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"

我该如何解决?

<code>
<?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']);
    }
}
</code>

1 个答案:

答案 0 :(得分:0)

更改供应商中的代码def load(path): print(f"loading pkl: {os.path.abspath(path)}") assert os.path.isfile(path) try: with open(path, "rb") as f: content = pickle.load(f) except UnicodeDecodeError: # pickle was created with python 2.7 with open(path, "rb") as f: content = pickle.load(f, encoding='latin1') return content

搜索

/codeception/phpunit-wrapper/src/Listener.php

对于每个参数,交换第一个和第二个参数。

例如 ,第一次出现的是:

 dispatcher->dispatch(

更改为:

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