Skip to content

Commit

Permalink
Check that from is actually provided
Browse files Browse the repository at this point in the history
  • Loading branch information
ciaranmcnulty committed May 27, 2018
1 parent b9cb5bc commit d03ad31
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Command/AssertBackwardsCompatible.php
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ public function execute(InputInterface $input, OutputInterface $output) : int
// @todo fix flaky assumption about the path of the source repo...
$sourceRepo = CheckedOutRepository::fromPath(getcwd());

$fromRevision = $input->hasOption('from')
$fromRevision = $input->hasParameterOption('from')
? $this->parseRevisionFromInput($input, $sourceRepo)
: $this->determineFromRevisionFromRepository($sourceRepo, $stdErr);

Expand Down
4 changes: 4 additions & 0 deletions test/unit/Command/AssertBackwardsCompatibleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ public function testExecuteWhenRevisionsAreProvidedAsOptions() : void
$toSha = sha1('toRevision', false);

$this->input->expects(self::any())->method('hasOption')->willReturn(true);
$this->input->expects(self::any())->method('hasParameterOption')->willReturn(true);
$this->input->expects(self::any())->method('getOption')->willReturnMap([
['from', $fromSha],
['to', $toSha],
Expand Down Expand Up @@ -160,6 +161,7 @@ public function testExecuteReturnsNonZeroExitCodeWhenChangesAreDetected() : void
$toSha = sha1('toRevision', false);

$this->input->expects(self::any())->method('hasOption')->willReturn(true);
$this->input->expects(self::any())->method('hasParameterOption')->willReturn(true);
$this->input->expects(self::any())->method('getOption')->willReturnMap([
['from', $fromSha],
['to', $toSha],
Expand Down Expand Up @@ -222,6 +224,7 @@ public function testProvidingMarkdownOptionWritesMarkdownOutput() : void
$toSha = sha1('toRevision', false);

$this->input->expects(self::any())->method('hasOption')->willReturn(true);
$this->input->expects(self::any())->method('hasParameterOption')->willReturn(true);
$this->input->expects(self::any())->method('getOption')->willReturnMap([
['from', $fromSha],
['to', $toSha],
Expand Down Expand Up @@ -349,6 +352,7 @@ public function testExecuteFailsIfCheckedOutRepositoryDoesNotExist() : void
$toSha = sha1('toRevision', false);

$this->input->expects(self::any())->method('hasOption')->willReturn(true);
$this->input->expects(self::any())->method('hasParameterOption')->willReturn(true);
$this->input->expects(self::any())->method('getOption')->willReturnMap([
['from', $fromSha],
['to', $toSha],
Expand Down

0 comments on commit d03ad31

Please sign in to comment.