Skip to content

Commit c2e3c45

Browse files
authored
Fix testing commands that do not resolve 'OutputStyle::class' from the container. (#32687)
1 parent 6b83045 commit c2e3c45

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/Illuminate/Foundation/Testing/PendingCommand.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,10 +131,10 @@ public function run()
131131
{
132132
$this->hasExecuted = true;
133133

134-
$this->mockConsoleOutput();
134+
$mock = $this->mockConsoleOutput();
135135

136136
try {
137-
$exitCode = $this->app[Kernel::class]->call($this->command, $this->parameters);
137+
$exitCode = $this->app[Kernel::class]->call($this->command, $this->parameters, $mock);
138138
} catch (NoMatchingExpectationException $e) {
139139
if ($e->getMethodName() === 'askQuestion') {
140140
$this->test->fail('Unexpected question "'.$e->getActualArguments()[0]->getQuestion().'" was asked.');
@@ -156,7 +156,7 @@ public function run()
156156
/**
157157
* Mock the application's console output.
158158
*
159-
* @return void
159+
* @return \Mockery\MockInterface
160160
*/
161161
protected function mockConsoleOutput()
162162
{
@@ -181,6 +181,8 @@ protected function mockConsoleOutput()
181181
$this->app->bind(OutputStyle::class, function () use ($mock) {
182182
return $mock;
183183
});
184+
185+
return $mock;
184186
}
185187

186188
/**

0 commit comments

Comments
 (0)