在Symfony2中进行Behat测试,显示不需要的调试信息

时间:2013-02-01 16:12:08

标签: symfony symfony-2.1 behat

当我在Symfony2项目中运行Behat测试时,我得到了许多不需要的调试行,如下所示:

[2013-02-01 17:07:50] request.INFO: Matched route "homepage" (parameters: "_controller": "Symfony\Bundle\FrameworkBundle\Controller\RedirectController::redirectAction", "route": "Acme_tasks_tasks", "permanent": "true", "_route": "homepage") [] []
[2013-02-01 17:07:51] security.DEBUG: Read SecurityContext from the session [] []
[2013-02-01 17:07:51] security.DEBUG: Reloading user from user provider. [] []
[2013-02-01 17:07:51] security.DEBUG: Username "john" was reloaded from user provider. [] []
[2013-02-01 17:07:51] security.DEBUG: Write SecurityContext in the session [] []

我的behat.yml看起来像这样:

default:
  formatter:
    name: progress
  extensions:
    Behat\Symfony2Extension\Extension:
      mink_driver: true
      kernel:
        env: test
        debug: false
    Behat\MinkExtension\Extension:
      base_url: 'http://local.acme.ch/app_test.php/'
      default_session: symfony2
      javascript_session: selenium
      selenium:
        host: 33.33.33.1
        port: 4444

正如您所看到的,我已经关闭了内核的调试模式。所有这些东西都来自哪里?

我的安装基于Behat的Symfony2 Extension。

2 个答案:

答案 0 :(得分:1)

修正了它! This answer最终帮助了我。

我必须在我的config_test.yml中禁用monolog:

#config_test.yml
monolog:
    handlers:
        main:
            type: test

在我使用php app/console cache:clear --env=test清除了我的测试环境的缓存之后,这是有用的。

答案 1 :(得分:0)

当使用水貂和硒时,您的客户正在通过前端控制器app_test.php访问您的应用程序。

您需要调整此app_test.php文件:

$kernel = new AppKernel('test', false);