Skip to content

Commit

Permalink
Fix testing commands that do not resolve 'OutputStyle::class' from th…
Browse files Browse the repository at this point in the history
…e container. (#32687)
  • Loading branch information
olsgreen authored May 7, 2020
1 parent 6b83045 commit c2e3c45
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/Illuminate/Foundation/Testing/PendingCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -131,10 +131,10 @@ public function run()
{
$this->hasExecuted = true;

$this->mockConsoleOutput();
$mock = $this->mockConsoleOutput();

try {
$exitCode = $this->app[Kernel::class]->call($this->command, $this->parameters);
$exitCode = $this->app[Kernel::class]->call($this->command, $this->parameters, $mock);
} catch (NoMatchingExpectationException $e) {
if ($e->getMethodName() === 'askQuestion') {
$this->test->fail('Unexpected question "'.$e->getActualArguments()[0]->getQuestion().'" was asked.');
Expand All @@ -156,7 +156,7 @@ public function run()
/**
* Mock the application's console output.
*
* @return void
* @return \Mockery\MockInterface
*/
protected function mockConsoleOutput()
{
Expand All @@ -181,6 +181,8 @@ protected function mockConsoleOutput()
$this->app->bind(OutputStyle::class, function () use ($mock) {
return $mock;
});

return $mock;
}

/**
Expand Down

0 comments on commit c2e3c45

Please sign in to comment.