Php 在WebTestCase Symfony中未找到AsserCals

Php 在WebTestCase Symfony中未找到AsserCals,php,symfony,unit-testing,web-testing,Php,Symfony,Unit Testing,Web Testing,我有一个WebTestCase类: use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; use Symfony\Bundle\FrameworkBundle\Client; class ApiAdminInvoiceControllerTest extends WebTestCase { public function test() { ... $this->assertArrayHas

我有一个WebTestCase类:

use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
use Symfony\Bundle\FrameworkBundle\Client;

class ApiAdminInvoiceControllerTest extends WebTestCase
{
    public function test()
    {
        ...
        $this->assertArrayHasKey('id', $array);
        ...
    }
}

我在所有断言中都有此错误:
未找到方法“assertArrayHasKey”

尝试使用PHPUnit\Framework\TestCase;作为基类

尝试使用PHPUnit\Framework\TestCase;作为基类

但是扩展了
PHPUnit\Framework\TestCase
,那么为什么要更改基类呢?好的。对不起,我没注意到。您的phpunit版本是什么?但是扩展了
phpunit\Framework\TestCase
,那么为什么要更改基类呢?好的。对不起,我没注意到。你的phpunit版本是什么?