[英]Symfony2 error 500 instead of 404 in test environment
I have a Behat test of a given controller action, here is the code (Symfony2.5) 我有给定控制器动作的Behat测试,这是代码(Symfony2.5)
public function sendContactFormAction(Request $request, TrainingCenter $trainingCenter)
{
if (!$trainingCenter->isInstituteProfileVisible()) {
throw $this->createNotFoundException(sprintf('The center "%s" (%d) is not visble.', $trainingCenter->getName(), $trainingCenter->getId()));
}
if (!$trainingCenter->canBeContactedFromProfile()) {
throw new AccessDeniedHttpException(sprintf('The center "%s" (%d) can\'t be contacted by email.', $trainingCenter->getName(), $trainingCenter->getId()));
}
It works well in our development workstations but on our integration platform (Jenkins), those throws
statements raise 500 exceptions instead of 404 or 403, I can't find why. 它在我们的开发工作站上运行良好,但是在我们的集成平台(Jenkins)上,这些
throws
语句引发500个异常,而不是404或403,我找不到原因。
Well it fact it was due to a notice generated by the jmsserializer bundle in the MetaClass deserialise function. 好吧,这实际上是由于MetaClass反序列化函数中的jmsserializer软件包生成的通知所致。 After clearing all the cache and refactored a bit the tests it now works.
清除所有缓存并重构了一些测试后,它现在可以工作了。 Thanks.
谢谢。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.