Skip to content

Commit 1df5e91

Browse files
committed
Cookbook/Console/ConsoleCommand : Adding option/argument example in test
See comments in the PR symfony#2792 I made on 2.1 branch
1 parent 74ed0f2 commit 1df5e91

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

cookbook/console/console_command.rst

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,13 @@ instead of
104104

105105
$command = $application->find('demo:greet');
106106
$commandTester = new CommandTester($command);
107-
$commandTester->execute(array('command' => $command->getName()));
107+
$commandTester->execute(
108+
array(
109+
'command' => $command->getName(),
110+
'name' => 'Fabien',
111+
'--yell' => true,
112+
)
113+
);
108114

109115
$this->assertRegExp('/.../', $commandTester->getDisplay());
110116

@@ -133,7 +139,13 @@ you can extend your test from
133139

134140
$command = $application->find('demo:greet');
135141
$commandTester = new CommandTester($command);
136-
$commandTester->execute(array('command' => $command->getName()));
142+
$commandTester->execute(
143+
array(
144+
'command' => $command->getName(),
145+
'name' => 'Fabien',
146+
'--yell' => true,
147+
)
148+
);
137149

138150
$this->assertRegExp('/.../', $commandTester->getDisplay());
139151

0 commit comments

Comments
 (0)