Php 在测试环境中,Symfony2错误为500而不是404
我有一个给定控制器动作的行为测试,下面是代码Symfony2.5Php 在测试环境中,Symfony2错误为500而不是404,php,symfony,jenkins,behat,error-code,Php,Symfony,Jenkins,Behat,Error Code,我有一个给定控制器动作的行为测试,下面是代码Symfony2.5 public function sendContactFormAction(Request $request, TrainingCenter $trainingCenter) { if (!$trainingCenter->isInstituteProfileVisible()) { throw $this->createNotFoundException(sprintf('The center
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()));
}
它在我们的开发工作站上运行良好,但在我们的集成平台Jenkins上,那些抛出语句引发了500个异常,而不是404或403,我找不到原因。事实上,这是由于元类反序列化函数中的jmsserializer包生成的通知。在清除所有缓存并重构一点测试之后,它现在可以工作了。谢谢。您查看日志了吗?Symfony和web服务器/php都有。