0

私はいくつかの単体テストを書いていますが、テストデータベースを作成するために単体テストでいくつかのコマンドを呼び出す必要があります。ただし、コマンドを呼び出すと、通知が画面にダンプされます。これを止める方法はありますか?--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"} [] []
4

2 に答える 2

0

app / configディレクトリにconfig_test.ymlを追加し、次の行を追加しました(config_dev.ymlからコピーされます)。

monolog:
    handlers:
       main:
           type:  stream
           path:  "%kernel.logs_dir%/%kernel.environment%.log"
           level: debug
       firephp:
           type:  firephp
           level: info
于 2013-02-08T17:04:04.453 に答える
0

CommandTesterコマンドをテストするために使用します。詳細については、こちらをご覧ください。

http://symfony.com/doc/current/components/console/introduction.html#testing-commands

于 2013-02-07T18:15:53.920 に答える