gpt4 book ai didi

symfony 功能测试 webtestcase 不起作用

转载 作者:行者123 更新时间:2023-11-28 19:41:34 25 4
gpt4 key购买 nike

我尝试为我的应用编写功能测试,但出现以下错误:

InvalidArgumentException: The option "test_case" must be set.

我尝试用谷歌搜索它,但几乎没有发现任何线索。

我的代码:

class WhateverTest extends WebTestCase {
public function testWhatever() {
$client = static::createClient();
$crawler = $client->request('GET', '/home');
$this->assertEquals(1, 1);
}

在 phpunit.xml 中设置了内核

<php>
<server name="KERNEL_DIR" value="app/" />
</php>

我的 AppKernel 只有两个函数:registerBundles()registerContainerConfiguration

最佳答案

检查您使用的是哪个 WebTestCase 类。很可能你正在使用

使用 Symfony\Bundle\FrameworkBundle\Tests\Functional\WebTestCase

你应该使用

使用 Symfony\Bundle\FrameworkBundle\Test\WebTestCase;

所以只需更改这一行就可以了

关于symfony 功能测试 webtestcase 不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29604352/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com