PageRenderTime 57ms CodeModel.GetById 28ms RepoModel.GetById 1ms app.codeStats 0ms

/src/Symfony/Component/Console/Tests/ApplicationTest.php

https://github.com/Exercise/symfony
PHP | 470 lines | 375 code | 75 blank | 20 comment | 0 complexity | b8f6c1ba917de3c32f93514de2ebafb3 MD5 | raw file
  1. <?php
  2. /*
  3. * This file is part of the Symfony package.
  4. *
  5. * (c) Fabien Potencier <fabien@symfony.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Symfony\Component\Console\Tests;
  11. use Symfony\Component\Console\Application;
  12. use Symfony\Component\Console\Input\ArrayInput;
  13. use Symfony\Component\Console\Input\InputArgument;
  14. use Symfony\Component\Console\Input\InputOption;
  15. use Symfony\Component\Console\Output\NullOutput;
  16. use Symfony\Component\Console\Output\Output;
  17. use Symfony\Component\Console\Tester\ApplicationTester;
  18. class ApplicationTest extends \PHPUnit_Framework_TestCase
  19. {
  20. static protected $fixturesPath;
  21. static public function setUpBeforeClass()
  22. {
  23. self::$fixturesPath = realpath(__DIR__.'/Fixtures/');
  24. require_once self::$fixturesPath.'/FooCommand.php';
  25. require_once self::$fixturesPath.'/Foo1Command.php';
  26. require_once self::$fixturesPath.'/Foo2Command.php';
  27. require_once self::$fixturesPath.'/Foo3Command.php';
  28. }
  29. protected function normalizeLineBreaks($text)
  30. {
  31. return str_replace(PHP_EOL, "\n", $text);
  32. }
  33. /**
  34. * Replaces the dynamic placeholders of the command help text with a static version.
  35. * The placeholder %command.full_name% includes the script path that is not predictable
  36. * and can not be tested against.
  37. */
  38. protected function ensureStaticCommandHelp(Application $application)
  39. {
  40. foreach ($application->all() as $command) {
  41. $command->setHelp(str_replace('%command.full_name%', 'app/console %command.name%', $command->getHelp()));
  42. }
  43. }
  44. public function testConstructor()
  45. {
  46. $application = new Application('foo', 'bar');
  47. $this->assertEquals('foo', $application->getName(), '__construct() takes the application name as its first argument');
  48. $this->assertEquals('bar', $application->getVersion(), '__construct() takes the application version as its first argument');
  49. $this->assertEquals(array('help', 'list'), array_keys($application->all()), '__construct() registered the help and list commands by default');
  50. }
  51. public function testSetGetName()
  52. {
  53. $application = new Application();
  54. $application->setName('foo');
  55. $this->assertEquals('foo', $application->getName(), '->setName() sets the name of the application');
  56. }
  57. public function testSetGetVersion()
  58. {
  59. $application = new Application();
  60. $application->setVersion('bar');
  61. $this->assertEquals('bar', $application->getVersion(), '->setVersion() sets the version of the application');
  62. }
  63. public function testGetLongVersion()
  64. {
  65. $application = new Application('foo', 'bar');
  66. $this->assertEquals('<info>foo</info> version <comment>bar</comment>', $application->getLongVersion(), '->getLongVersion() returns the long version of the application');
  67. }
  68. public function testHelp()
  69. {
  70. $application = new Application();
  71. $this->assertStringEqualsFile(self::$fixturesPath.'/application_gethelp.txt', $this->normalizeLineBreaks($application->getHelp()), '->setHelp() returns a help message');
  72. }
  73. public function testAll()
  74. {
  75. $application = new Application();
  76. $commands = $application->all();
  77. $this->assertEquals('Symfony\\Component\\Console\\Command\\HelpCommand', get_class($commands['help']), '->all() returns the registered commands');
  78. $application->add(new \FooCommand());
  79. $commands = $application->all('foo');
  80. $this->assertEquals(1, count($commands), '->all() takes a namespace as its first argument');
  81. }
  82. public function testRegister()
  83. {
  84. $application = new Application();
  85. $command = $application->register('foo');
  86. $this->assertEquals('foo', $command->getName(), '->register() registers a new command');
  87. }
  88. public function testAdd()
  89. {
  90. $application = new Application();
  91. $application->add($foo = new \FooCommand());
  92. $commands = $application->all();
  93. $this->assertEquals($foo, $commands['foo:bar'], '->add() registers a command');
  94. $application = new Application();
  95. $application->addCommands(array($foo = new \FooCommand(), $foo1 = new \Foo1Command()));
  96. $commands = $application->all();
  97. $this->assertEquals(array($foo, $foo1), array($commands['foo:bar'], $commands['foo:bar1']), '->addCommands() registers an array of commands');
  98. }
  99. public function testHasGet()
  100. {
  101. $application = new Application();
  102. $this->assertTrue($application->has('list'), '->has() returns true if a named command is registered');
  103. $this->assertFalse($application->has('afoobar'), '->has() returns false if a named command is not registered');
  104. $application->add($foo = new \FooCommand());
  105. $this->assertTrue($application->has('afoobar'), '->has() returns true if an alias is registered');
  106. $this->assertEquals($foo, $application->get('foo:bar'), '->get() returns a command by name');
  107. $this->assertEquals($foo, $application->get('afoobar'), '->get() returns a command by alias');
  108. try {
  109. $application->get('foofoo');
  110. $this->fail('->get() throws an \InvalidArgumentException if the command does not exist');
  111. } catch (\Exception $e) {
  112. $this->assertInstanceOf('\InvalidArgumentException', $e, '->get() throws an \InvalidArgumentException if the command does not exist');
  113. $this->assertEquals('The command "foofoo" does not exist.', $e->getMessage(), '->get() throws an \InvalidArgumentException if the command does not exist');
  114. }
  115. $application = new Application();
  116. $application->add($foo = new \FooCommand());
  117. // simulate --help
  118. $r = new \ReflectionObject($application);
  119. $p = $r->getProperty('wantHelps');
  120. $p->setAccessible(true);
  121. $p->setValue($application, true);
  122. $command = $application->get('foo:bar');
  123. $this->assertEquals('Symfony\Component\Console\Command\HelpCommand', get_class($command), '->get() returns the help command if --help is provided as the input');
  124. }
  125. public function testGetNamespaces()
  126. {
  127. $application = new Application();
  128. $application->add(new \FooCommand());
  129. $application->add(new \Foo1Command());
  130. $this->assertEquals(array('foo'), $application->getNamespaces(), '->getNamespaces() returns an array of unique used namespaces');
  131. }
  132. public function testFindNamespace()
  133. {
  134. $application = new Application();
  135. $application->add(new \FooCommand());
  136. $this->assertEquals('foo', $application->findNamespace('foo'), '->findNamespace() returns the given namespace if it exists');
  137. $this->assertEquals('foo', $application->findNamespace('f'), '->findNamespace() finds a namespace given an abbreviation');
  138. $application->add(new \Foo2Command());
  139. $this->assertEquals('foo', $application->findNamespace('foo'), '->findNamespace() returns the given namespace if it exists');
  140. try {
  141. $application->findNamespace('f');
  142. $this->fail('->findNamespace() throws an \InvalidArgumentException if the abbreviation is ambiguous');
  143. } catch (\Exception $e) {
  144. $this->assertInstanceOf('\InvalidArgumentException', $e, '->findNamespace() throws an \InvalidArgumentException if the abbreviation is ambiguous');
  145. $this->assertEquals('The namespace "f" is ambiguous (foo, foo1).', $e->getMessage(), '->findNamespace() throws an \InvalidArgumentException if the abbreviation is ambiguous');
  146. }
  147. try {
  148. $application->findNamespace('bar');
  149. $this->fail('->findNamespace() throws an \InvalidArgumentException if no command is in the given namespace');
  150. } catch (\Exception $e) {
  151. $this->assertInstanceOf('\InvalidArgumentException', $e, '->findNamespace() throws an \InvalidArgumentException if no command is in the given namespace');
  152. $this->assertEquals('There are no commands defined in the "bar" namespace.', $e->getMessage(), '->findNamespace() throws an \InvalidArgumentException if no command is in the given namespace');
  153. }
  154. }
  155. public function testFind()
  156. {
  157. $application = new Application();
  158. $application->add(new \FooCommand());
  159. $this->assertEquals('FooCommand', get_class($application->find('foo:bar')), '->find() returns a command if its name exists');
  160. $this->assertEquals('Symfony\Component\Console\Command\HelpCommand', get_class($application->find('h')), '->find() returns a command if its name exists');
  161. $this->assertEquals('FooCommand', get_class($application->find('f:bar')), '->find() returns a command if the abbreviation for the namespace exists');
  162. $this->assertEquals('FooCommand', get_class($application->find('f:b')), '->find() returns a command if the abbreviation for the namespace and the command name exist');
  163. $this->assertEquals('FooCommand', get_class($application->find('a')), '->find() returns a command if the abbreviation exists for an alias');
  164. $application->add(new \Foo1Command());
  165. $application->add(new \Foo2Command());
  166. try {
  167. $application->find('f');
  168. $this->fail('->find() throws an \InvalidArgumentException if the abbreviation is ambiguous for a namespace');
  169. } catch (\Exception $e) {
  170. $this->assertInstanceOf('\InvalidArgumentException', $e, '->find() throws an \InvalidArgumentException if the abbreviation is ambiguous for a namespace');
  171. $this->assertRegExp('/Command "f" is not defined./', $e->getMessage(), '->find() throws an \InvalidArgumentException if the abbreviation is ambiguous for a namespace');
  172. }
  173. try {
  174. $application->find('a');
  175. $this->fail('->find() throws an \InvalidArgumentException if the abbreviation is ambiguous for an alias');
  176. } catch (\Exception $e) {
  177. $this->assertInstanceOf('\InvalidArgumentException', $e, '->find() throws an \InvalidArgumentException if the abbreviation is ambiguous for an alias');
  178. $this->assertEquals('Command "a" is ambiguous (afoobar, afoobar1 and 1 more).', $e->getMessage(), '->find() throws an \InvalidArgumentException if the abbreviation is ambiguous for an alias');
  179. }
  180. try {
  181. $application->find('foo:b');
  182. $this->fail('->find() throws an \InvalidArgumentException if the abbreviation is ambiguous for a command');
  183. } catch (\Exception $e) {
  184. $this->assertInstanceOf('\InvalidArgumentException', $e, '->find() throws an \InvalidArgumentException if the abbreviation is ambiguous for a command');
  185. $this->assertEquals('Command "foo:b" is ambiguous (foo:bar, foo:bar1).', $e->getMessage(), '->find() throws an \InvalidArgumentException if the abbreviation is ambiguous for a command');
  186. }
  187. }
  188. public function testFindAlternativeCommands()
  189. {
  190. $application = new Application();
  191. $application->add(new \FooCommand());
  192. $application->add(new \Foo1Command());
  193. $application->add(new \Foo2Command());
  194. try {
  195. $application->find($commandName = 'Unknow command');
  196. $this->fail('->find() throws an \InvalidArgumentException if command does not exist');
  197. } catch (\Exception $e) {
  198. $this->assertInstanceOf('\InvalidArgumentException', $e, '->find() throws an \InvalidArgumentException if command does not exist');
  199. $this->assertEquals(sprintf('Command "%s" is not defined.', $commandName), $e->getMessage(), '->find() throws an \InvalidArgumentException if command does not exist, without alternatives');
  200. }
  201. try {
  202. $application->find($commandName = 'foo');
  203. $this->fail('->find() throws an \InvalidArgumentException if command does not exist');
  204. } catch (\Exception $e) {
  205. $this->assertInstanceOf('\InvalidArgumentException', $e, '->find() throws an \InvalidArgumentException if command does not exist');
  206. $this->assertRegExp(sprintf('/Command "%s" is not defined./', $commandName), $e->getMessage(), '->find() throws an \InvalidArgumentException if command does not exist, with alternatives');
  207. $this->assertRegExp('/foo:bar/', $e->getMessage(), '->find() throws an \InvalidArgumentException if command does not exist, with alternative : "foo:bar"');
  208. $this->assertRegExp('/foo1:bar/', $e->getMessage(), '->find() throws an \InvalidArgumentException if command does not exist, with alternative : "foo1:bar"');
  209. $this->assertRegExp('/foo:bar1/', $e->getMessage(), '->find() throws an \InvalidArgumentException if command does not exist, with alternative : "foo:bar1"');
  210. }
  211. // Test if "foo1" command throw an "\InvalidArgumentException" and does not contain
  212. // "foo:bar" as alternative because "foo1" is too far from "foo:bar"
  213. try {
  214. $application->find($commandName = 'foo1');
  215. $this->fail('->find() throws an \InvalidArgumentException if command does not exist');
  216. } catch (\Exception $e) {
  217. $this->assertInstanceOf('\InvalidArgumentException', $e, '->find() throws an \InvalidArgumentException if command does not exist');
  218. $this->assertRegExp(sprintf('/Command "%s" is not defined./', $commandName), $e->getMessage(), '->find() throws an \InvalidArgumentException if command does not exist, with alternatives');
  219. $this->assertFalse(strpos($e->getMessage(), 'foo:bar'), '->find() throws an \InvalidArgumentException if command does not exist, without "foo:bar" alternative');
  220. }
  221. }
  222. public function testFindAlternativeNamespace()
  223. {
  224. $application = new Application();
  225. $application->add(new \FooCommand());
  226. $application->add(new \Foo1Command());
  227. $application->add(new \Foo2Command());
  228. $application->add(new \foo3Command());
  229. try {
  230. $application->find('Unknow-namespace:Unknow-command');
  231. $this->fail('->find() throws an \InvalidArgumentException if namespace does not exist');
  232. } catch (\Exception $e) {
  233. $this->assertInstanceOf('\InvalidArgumentException', $e, '->find() throws an \InvalidArgumentException if namespace does not exist');
  234. $this->assertEquals('There are no commands defined in the "Unknow-namespace" namespace.', $e->getMessage(), '->find() throws an \InvalidArgumentException if namespace does not exist, without alternatives');
  235. }
  236. try {
  237. $application->find('foo2:command');
  238. $this->fail('->find() throws an \InvalidArgumentException if namespace does not exist');
  239. } catch (\Exception $e) {
  240. $this->assertInstanceOf('\InvalidArgumentException', $e, '->find() throws an \InvalidArgumentException if namespace does not exist');
  241. $this->assertRegExp('/There are no commands defined in the "foo2" namespace./', $e->getMessage(), '->find() throws an \InvalidArgumentException if namespace does not exist, with alternative');
  242. $this->assertRegExp('/foo/', $e->getMessage(), '->find() throws an \InvalidArgumentException if namespace does not exist, with alternative : "foo"');
  243. $this->assertRegExp('/foo1/', $e->getMessage(), '->find() throws an \InvalidArgumentException if namespace does not exist, with alternative : "foo1"');
  244. $this->assertRegExp('/foo3/', $e->getMessage(), '->find() throws an \InvalidArgumentException if namespace does not exist, with alternative : "foo3"');
  245. }
  246. }
  247. public function testSetCatchExceptions()
  248. {
  249. $application = $this->getMock('Symfony\Component\Console\Application', array('getTerminalWidth'));
  250. $application->setAutoExit(false);
  251. $application->expects($this->any())
  252. ->method('getTerminalWidth')
  253. ->will($this->returnValue(120));
  254. $tester = new ApplicationTester($application);
  255. $application->setCatchExceptions(true);
  256. $tester->run(array('command' => 'foo'), array('decorated' => false));
  257. $this->assertStringEqualsFile(self::$fixturesPath.'/application_renderexception1.txt', $this->normalizeLineBreaks($tester->getDisplay()), '->setCatchExceptions() sets the catch exception flag');
  258. $application->setCatchExceptions(false);
  259. try {
  260. $tester->run(array('command' => 'foo'), array('decorated' => false));
  261. $this->fail('->setCatchExceptions() sets the catch exception flag');
  262. } catch (\Exception $e) {
  263. $this->assertInstanceOf('\Exception', $e, '->setCatchExceptions() sets the catch exception flag');
  264. $this->assertEquals('Command "foo" is not defined.', $e->getMessage(), '->setCatchExceptions() sets the catch exception flag');
  265. }
  266. }
  267. public function testAsText()
  268. {
  269. $application = new Application();
  270. $application->add(new \FooCommand);
  271. $this->ensureStaticCommandHelp($application);
  272. $this->assertStringEqualsFile(self::$fixturesPath.'/application_astext1.txt', $this->normalizeLineBreaks($application->asText()), '->asText() returns a text representation of the application');
  273. $this->assertStringEqualsFile(self::$fixturesPath.'/application_astext2.txt', $this->normalizeLineBreaks($application->asText('foo')), '->asText() returns a text representation of the application');
  274. }
  275. public function testAsXml()
  276. {
  277. $application = new Application();
  278. $application->add(new \FooCommand);
  279. $this->ensureStaticCommandHelp($application);
  280. $this->assertXmlStringEqualsXmlFile(self::$fixturesPath.'/application_asxml1.txt', $application->asXml(), '->asXml() returns an XML representation of the application');
  281. $this->assertXmlStringEqualsXmlFile(self::$fixturesPath.'/application_asxml2.txt', $application->asXml('foo'), '->asXml() returns an XML representation of the application');
  282. }
  283. public function testRenderException()
  284. {
  285. $application = $this->getMock('Symfony\Component\Console\Application', array('getTerminalWidth'));
  286. $application->setAutoExit(false);
  287. $application->expects($this->any())
  288. ->method('getTerminalWidth')
  289. ->will($this->returnValue(120));
  290. $tester = new ApplicationTester($application);
  291. $tester->run(array('command' => 'foo'), array('decorated' => false));
  292. $this->assertStringEqualsFile(self::$fixturesPath.'/application_renderexception1.txt', $this->normalizeLineBreaks($tester->getDisplay()), '->renderException() renders a pretty exception');
  293. $tester->run(array('command' => 'foo'), array('decorated' => false, 'verbosity' => Output::VERBOSITY_VERBOSE));
  294. $this->assertContains('Exception trace', $tester->getDisplay(), '->renderException() renders a pretty exception with a stack trace when verbosity is verbose');
  295. $tester->run(array('command' => 'list', '--foo' => true), array('decorated' => false));
  296. $this->assertStringEqualsFile(self::$fixturesPath.'/application_renderexception2.txt', $this->normalizeLineBreaks($tester->getDisplay()), '->renderException() renders the command synopsis when an exception occurs in the context of a command');
  297. $application->add(new \Foo3Command);
  298. $tester = new ApplicationTester($application);
  299. $tester->run(array('command' => 'foo3:bar'), array('decorated' => false));
  300. $this->assertStringEqualsFile(self::$fixturesPath.'/application_renderexception3.txt', $this->normalizeLineBreaks($tester->getDisplay()), '->renderException() renders a pretty exceptions with previous exceptions');
  301. $application = $this->getMock('Symfony\Component\Console\Application', array('getTerminalWidth'));
  302. $application->setAutoExit(false);
  303. $application->expects($this->any())
  304. ->method('getTerminalWidth')
  305. ->will($this->returnValue(32));
  306. $tester = new ApplicationTester($application);
  307. $application = $this->getMock('Symfony\Component\Console\Application', array('getTerminalWidth'));
  308. $application->setAutoExit(false);
  309. $application->expects($this->any())
  310. ->method('getTerminalWidth')
  311. ->will($this->returnValue(32));
  312. $tester = new ApplicationTester($application);
  313. $tester->run(array('command' => 'foo'), array('decorated' => false));
  314. $this->assertStringEqualsFile(self::$fixturesPath.'/application_renderexception4.txt', $this->normalizeLineBreaks($tester->getDisplay()), '->renderException() wraps messages when they are bigger than the terminal');
  315. }
  316. public function testRun()
  317. {
  318. $application = new Application();
  319. $application->setAutoExit(false);
  320. $application->setCatchExceptions(false);
  321. $application->add($command = new \Foo1Command());
  322. $_SERVER['argv'] = array('cli.php', 'foo:bar1');
  323. ob_start();
  324. $application->run();
  325. ob_end_clean();
  326. $this->assertSame('Symfony\Component\Console\Input\ArgvInput', get_class($command->input), '->run() creates an ArgvInput by default if none is given');
  327. $this->assertSame('Symfony\Component\Console\Output\ConsoleOutput', get_class($command->output), '->run() creates a ConsoleOutput by default if none is given');
  328. $application = new Application();
  329. $application->setAutoExit(false);
  330. $application->setCatchExceptions(false);
  331. $this->ensureStaticCommandHelp($application);
  332. $tester = new ApplicationTester($application);
  333. $tester->run(array(), array('decorated' => false));
  334. $this->assertStringEqualsFile(self::$fixturesPath.'/application_run1.txt', $this->normalizeLineBreaks($tester->getDisplay()), '->run() runs the list command if no argument is passed');
  335. $tester->run(array('--help' => true), array('decorated' => false));
  336. $this->assertStringEqualsFile(self::$fixturesPath.'/application_run2.txt', $this->normalizeLineBreaks($tester->getDisplay()), '->run() runs the help command if --help is passed');
  337. $tester->run(array('-h' => true), array('decorated' => false));
  338. $this->assertStringEqualsFile(self::$fixturesPath.'/application_run2.txt', $this->normalizeLineBreaks($tester->getDisplay()), '->run() runs the help command if -h is passed');
  339. $tester->run(array('command' => 'list', '--help' => true), array('decorated' => false));
  340. $this->assertStringEqualsFile(self::$fixturesPath.'/application_run3.txt', $this->normalizeLineBreaks($tester->getDisplay()), '->run() displays the help if --help is passed');
  341. $tester->run(array('command' => 'list', '-h' => true), array('decorated' => false));
  342. $this->assertStringEqualsFile(self::$fixturesPath.'/application_run3.txt', $this->normalizeLineBreaks($tester->getDisplay()), '->run() displays the help if -h is passed');
  343. $tester->run(array('--ansi' => true));
  344. $this->assertTrue($tester->getOutput()->isDecorated(), '->run() forces color output if --ansi is passed');
  345. $tester->run(array('--no-ansi' => true));
  346. $this->assertFalse($tester->getOutput()->isDecorated(), '->run() forces color output to be disabled if --no-ansi is passed');
  347. $tester->run(array('--version' => true), array('decorated' => false));
  348. $this->assertStringEqualsFile(self::$fixturesPath.'/application_run4.txt', $this->normalizeLineBreaks($tester->getDisplay()), '->run() displays the program version if --version is passed');
  349. $tester->run(array('-V' => true), array('decorated' => false));
  350. $this->assertStringEqualsFile(self::$fixturesPath.'/application_run4.txt', $this->normalizeLineBreaks($tester->getDisplay()), '->run() displays the program version if -v is passed');
  351. $tester->run(array('command' => 'list', '--quiet' => true));
  352. $this->assertSame('', $tester->getDisplay(), '->run() removes all output if --quiet is passed');
  353. $tester->run(array('command' => 'list', '-q' => true));
  354. $this->assertSame('', $tester->getDisplay(), '->run() removes all output if -q is passed');
  355. $tester->run(array('command' => 'list', '--verbose' => true));
  356. $this->assertSame(Output::VERBOSITY_VERBOSE, $tester->getOutput()->getVerbosity(), '->run() sets the output to verbose if --verbose is passed');
  357. $tester->run(array('command' => 'list', '-v' => true));
  358. $this->assertSame(Output::VERBOSITY_VERBOSE, $tester->getOutput()->getVerbosity(), '->run() sets the output to verbose if -v is passed');
  359. $application = new Application();
  360. $application->setAutoExit(false);
  361. $application->setCatchExceptions(false);
  362. $application->add(new \FooCommand());
  363. $tester = new ApplicationTester($application);
  364. $tester->run(array('command' => 'foo:bar', '--no-interaction' => true), array('decorated' => false));
  365. $this->assertSame('called'.PHP_EOL, $tester->getDisplay(), '->run() does not call interact() if --no-interaction is passed');
  366. $tester->run(array('command' => 'foo:bar', '-n' => true), array('decorated' => false));
  367. $this->assertSame('called'.PHP_EOL, $tester->getDisplay(), '->run() does not call interact() if -n is passed');
  368. }
  369. /**
  370. * @expectedException \LogicException
  371. * @dataProvider getAddingAlreadySetDefinitionElementData
  372. */
  373. public function testAddingAlreadySetDefinitionElementData($def)
  374. {
  375. $application = new Application();
  376. $application->setAutoExit(false);
  377. $application->setCatchExceptions(false);
  378. $application
  379. ->register('foo')
  380. ->setDefinition(array($def))
  381. ->setCode(function (InputInterface $input, OutputInterface $output) {})
  382. ;
  383. $input = new ArrayInput(array('command' => 'foo'));
  384. $output = new NullOutput();
  385. $application->run($input, $output);
  386. }
  387. public function getAddingAlreadySetDefinitionElementData()
  388. {
  389. return array(
  390. array(new InputArgument('command', InputArgument::REQUIRED)),
  391. array(new InputOption('quiet', '', InputOption::VALUE_NONE)),
  392. array(new InputOption('query', 'q', InputOption::VALUE_NONE)),
  393. );
  394. }
  395. }