forked from phpro/grumphp
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
580: Adds support for --tasks option in run command.
- Loading branch information
Pascal Landau
authored and
Lander Vanderstraeten
committed
Apr 19, 2019
1 parent
b3a41a2
commit 6afe0a2
Showing
9 changed files
with
202 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
<?php | ||
|
||
namespace GrumPHPTest\Console\Command; | ||
|
||
use GrumPHP\Configuration\GrumPHP; | ||
use GrumPHP\Console\Command\RunCommand; | ||
use GrumPHP\Locator\RegisteredFiles; | ||
use PHPUnit\Framework\TestCase; | ||
|
||
class RunCommandTest extends TestCase | ||
{ | ||
/** | ||
* @test | ||
* @param null $valueString | ||
* @param null $expected | ||
* @dataProvider parses_comma_separated_options_dataProvider | ||
* @throws \ReflectionException | ||
*/ | ||
function parses_comma_separated_options($valueString = null, $expected = null) | ||
{ | ||
/** | ||
* @var GrumPHP $grumPhp | ||
*/ | ||
$grumPhp = $this->createMock(GrumPHP::class); | ||
/** | ||
* @var RegisteredFiles $registeredFiles | ||
*/ | ||
$registeredFiles = $this->createMock(RegisteredFiles::class); | ||
|
||
$command = new RunCommand($grumPhp, $registeredFiles); | ||
$method = new \ReflectionMethod($command, "parseCommaSeparatedOption"); | ||
$method->setAccessible(true); | ||
|
||
$actual = $method->invoke($command, $valueString); | ||
|
||
$this->assertEquals($expected, $actual); | ||
} | ||
|
||
|
||
public function parses_comma_separated_options_dataProvider() | ||
{ | ||
return [ | ||
"default" => [ | ||
"valueString" => "foo,bar", | ||
"expected" => [ | ||
"foo" => "foo", | ||
"bar" => "bar" | ||
], | ||
], | ||
"trims values" => [ | ||
"valueString" => "foo , bar", | ||
"expected" => [ | ||
"foo" => "foo", | ||
"bar" => "bar" | ||
], | ||
], | ||
"deduplicates values" => [ | ||
"valueString" => "foo,bar,bar", | ||
"expected" => [ | ||
"foo" => "foo", | ||
"bar" => "bar" | ||
], | ||
], | ||
"null" => [ | ||
"valueString" => null, | ||
"expected" => [], | ||
], | ||
"empty" => [ | ||
"valueString" => "", | ||
"expected" => [], | ||
], | ||
"empty after trim" => [ | ||
"valueString" => " ", | ||
"expected" => [], | ||
], | ||
]; | ||
} | ||
} |