gre*_*reg 12 testing phpunit symfony
我尝试为我的应用程序编写功能测试但是我收到以下错误:
InvalidArgumentException: The option "test_case" must be set.
Run Code Online (Sandbox Code Playgroud)
我试着谷歌搜索它,但发现字面上没有线索.
我的代码:
class WhateverTest extends WebTestCase {
public function testWhatever() {
$client = static::createClient();
$crawler = $client->request('GET', '/home');
$this->assertEquals(1, 1);
}
Run Code Online (Sandbox Code Playgroud)
在phpunit.xml中设置了内核
<php>
<server name="KERNEL_DIR" value="app/" />
</php>
Run Code Online (Sandbox Code Playgroud)
我AppKernel只有两个功能:registerBundles()和registerContainerConfiguration
Tom*_*ski 45
检查WebTestCase您正在使用的课程.很可能你正在使用
use Symfony\Bundle\FrameworkBundle\Tests\Functional\WebTestCase
你应该使用
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
所以只需改变这一行就应该是好的
| 归档时间: |
|
| 查看次数: |
4987 次 |
| 最近记录: |