用PHPUnit测试symfony控制台命令

59 阅读1分钟

在这个例子中,我们要用PHPUnit来测试一个控制台命令。

Composer.json

这就是我们的设置的样子。

{

CustomerCommand

你可以通过运行$ bin/console customer --id=1 命令来测试它。

namespace PhpunitBundle\Command;
services:

CustomerCommandTest

namespace tests\PhpunitBundle\Command;