Skip to content

Commit

Permalink
Merge pull request #73 from ciaranmcnulty/fix-from-option-parsing
Browse files Browse the repository at this point in the history
Check that from is actually provided
  • Loading branch information
Ocramius authored May 27, 2018
2 parents 81b816e + d03ad31 commit cd87d1f
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 cd87d1f

Please sign in to comment.