0
我使用fosuserbundle进行身份验证。在测试过程中数据库内存中 - 迁移。无法登录
数据库设置为内存:
测试文件看起来像这样(只是操场,直到我解决):
当我运行测试我得到302重定向到登录,这不应该发生。 这可能是什么问题?
当我改变配置使用开发MySQL连接 - 它工作良好 - 响应是没有重定向和正文是正确的。
我使用fosuserbundle进行身份验证。在测试过程中数据库内存中 - 迁移。无法登录
数据库设置为内存:
测试文件看起来像这样(只是操场,直到我解决):
当我运行测试我得到302重定向到登录,这不应该发生。 这可能是什么问题?
当我改变配置使用开发MySQL连接 - 它工作良好 - 响应是没有重定向和正文是正确的。
好吧,我设法找出它为什么发生。
我挖掘到客户端类和它的doRequest方法。
protected function doRequest($request)
{
// avoid shutting down the Kernel if no request has been performed yet
// WebTestCase::createClient() boots the Kernel but do not handle a request
if ($this->hasPerformedRequest) {
$this->kernel->shutdown();
} else {
$this->hasPerformedRequest = true;
}
if ($this->profiler) {
$this->profiler = false;
$this->kernel->boot();
$this->kernel->getContainer()->get('profiler')->enable();
}
return parent::doRequest($request);
}
因此,内核正在关闭每个请求,数据库从内存中删除。这是我99%的猜测。
除了使用其他客户端库外,我无法做任何事情