我正在编写一些单元测试,需要在单元测试中调用一些命令才能创建测试数据库。但是,当我调用该命令时,它会将通知转储到屏幕上。有没有办法关闭它?我试图执行 --quiet,但它不会抑制通知。
$this->runConsole("doctrine:mongodb:schema:create", array("-q"=> null,"--env" => "test"));
……
protected function runConsole($command, Array $options = array())
{
$options = array_merge($options, array('command' => $command));
return $this->_application->run(new \Symfony\Component\Console\Input\ArrayInput($options));
}
我收到的通知:
[2013-02-07 16:24:43] doctrine.INFO: MongoDB query: {"deleteIndexes":true,"db":"xxxxxx","collection":"xxxxxx} [] []
[2013-02-07 16:24:43] doctrine.INFO: MongoDB query: {"deleteIndexes":true,"db":"xxxxxx","collection":"xxxxxx"} [] []
[2013-02-07 16:24:43] doctrine.INFO: MongoDB query: {"deleteIndexes":true,"db":"xxxxxx","collection":"xxxxxx"} [] []