Php API/Symfony请求http返回404

Php API/Symfony请求http返回404,php,apache,symfony,phpunit,Php,Apache,Symfony,Phpunit,我正在尝试测试一个以电子邮件为参数的操作。 以下是代码: $client = static::createClient(); $crawler = $client->request('GET', '/api/register/emailverification/', array('email' => 'email@gmail.com')); $response = $client->getResponse(); $thi

我正在尝试测试一个以电子邮件为参数的操作。 以下是代码:

$client = static::createClient();
$crawler = $client->request('GET', '/api/register/emailverification/',
                            array('email' => 'email@gmail.com'));
$response = $client->getResponse();

$this->assertEquals(200, $response->getStatusCode());
但它返回404错误


PS:当我在url中测试它时,它工作得很好

urlI中缺少主机我试图使用以下行添加它:$host=$client->getContainer()->getParameter(')$client->getContainer()->get('router')->getContext()->setBaseUrl($host);但还有其他错误:必须定义参数“”。