Skip to content

Commit

Permalink
Merge pull request #255 from veewee/bugfix-diff-console-input
Browse files Browse the repository at this point in the history
Fix No run task with commit with phpstorm
  • Loading branch information
veewee authored Jan 10, 2017
2 parents e6f4b88 + 96c9121 commit d5103e0
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 2 deletions.
21 changes: 20 additions & 1 deletion spec/GrumPHP/IO/ConsoleIOSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,28 @@ function it_reads_command_input()
$this->readCommandInput($handle)->shouldBe('input');
}

function it_reads_actual_diffs_from_input()
{
$diff = <<<EOD
diff --git a/src/test.php b/src/test.php
index 372bf10b74013301cfb4bf0e8007d208bb813363..d95f50da4a02d3d203bda1f3cb94e29d4f0ef481 100644
--- a/src/test.php
+++ b/src/test.php
@@ -2,3 +2,4 @@
'something';
+'ok';
EOD;

$handle = $this->mockHandle($diff);
$this->readCommandInput($handle)->shouldBe($diff);
}

function it_knows_empty_command_input()
{
$handle = $this->mockHandle("\r\n\t\f ");
$handle = $this->mockHandle(" \r\n\t\f ");
$this->readCommandInput($handle)->shouldBe('');
}

Expand Down
2 changes: 1 addition & 1 deletion src/GrumPHP/IO/ConsoleIO.php
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ public function readCommandInput($handle)
}

// When the input only consist of white space characters, we assume that there is no input.
$this->stdin = !preg_match('/^([\s]*)$/m', $input) ? $input : '';
$this->stdin = !preg_match_all('/^([\s]*)$/', $input) ? $input : '';

return $this->stdin;
}
Expand Down

0 comments on commit d5103e0

Please sign in to comment.