Skip to content

Commit cd87d1f

Browse files
authored
Merge pull request Roave#73 from ciaranmcnulty/fix-from-option-parsing
Check that from is actually provided
2 parents 81b816e + d03ad31 commit cd87d1f

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/Command/AssertBackwardsCompatible.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ public function execute(InputInterface $input, OutputInterface $output) : int
148148
// @todo fix flaky assumption about the path of the source repo...
149149
$sourceRepo = CheckedOutRepository::fromPath(getcwd());
150150

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

test/unit/Command/AssertBackwardsCompatibleTest.php

+4
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,7 @@ public function testExecuteWhenRevisionsAreProvidedAsOptions() : void
110110
$toSha = sha1('toRevision', false);
111111

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

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

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

351354
$this->input->expects(self::any())->method('hasOption')->willReturn(true);
355+
$this->input->expects(self::any())->method('hasParameterOption')->willReturn(true);
352356
$this->input->expects(self::any())->method('getOption')->willReturnMap([
353357
['from', $fromSha],
354358
['to', $toSha],

0 commit comments

Comments
 (0)