2

我想使用 Symfony 控制台组件来制作这样的命令:

app/console config:set someConfigName=someValue anotherConfig=anotherValue

我发现了这个问题:Variable number of options for symfony/console component

但是破解 ArgvInput 并将其传递给 $app->run() 似乎无法维护。为了进行单元测试,我还必须破解 ArrayInput 和 StringInput,而且我不确定是否能够在测试中注入它们。

任何帮助表示赞赏。

4

1 回答 1

0

感觉有点傻。:-)

参数始终是空格分隔的字符串,key=value看起来像空格分隔的字符串。用 = 作为分隔符分解字符串,你就有了键和值。

于 2014-06-22T23:37:15.010 回答