Skip to content

Commit

Permalink
Add success and failure command assertions
Browse files Browse the repository at this point in the history
  • Loading branch information
roberto-aguilar committed Nov 1, 2021
1 parent b3329fa commit 011e9cf
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions src/Illuminate/Testing/PendingCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
use Mockery;
use Mockery\Exception\NoMatchingExpectationException;
use PHPUnit\Framework\TestCase as PHPUnitTestCase;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Helper\Table;
use Symfony\Component\Console\Input\ArrayInput;
use Symfony\Component\Console\Output\BufferedOutput;
Expand Down Expand Up @@ -192,6 +193,30 @@ public function assertExitCode($exitCode)
return $this;
}

/**
* Assert that the command has the success exit code.
*
* @return $this
*/
public function assertSuccessExitCode()
{
$this->expectedExitCode = Command::SUCCESS;

return $this;
}

/**
* Assert that the command has the failure exit code.
*
* @return $this
*/
public function assertFailureExitCode()
{
$this->expectedExitCode = Command::FAILURE;

return $this;
}

/**
* Execute the command.
*
Expand Down

0 comments on commit 011e9cf

Please sign in to comment.