Skip to content

Commit

Permalink
Add missing test for ProcessArgumentsCollection
Browse files Browse the repository at this point in the history
  • Loading branch information
UrGuardian4ngel committed Jan 2, 2018
1 parent 6a4599f commit 31ebff2
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions spec/Collection/ProcessArgumentsCollectionSpec.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use GrumPHP\Collection\FilesCollection;
use GrumPHP\Collection\ProcessArgumentsCollection;
use GrumPHP\Exception\InvalidArgumentException;
use GrumPHP\Process\ProcessUtils;
use PhpSpec\ObjectBehavior;
use SplFileInfo;

Expand Down Expand Up @@ -122,4 +123,21 @@ function it_should_be_able_to_add_an_argument_with_comma_separated_files()

$this->getValues()->shouldBe(['--argument=file1.txt,file2.txt']);
}

function it_should_be_able_to_generate_a_cli_command()
{
$result = $this->forExecutable('exec');
$result->addArgumentArray('--item=%s', [
'file1.txt',
'file2.txt',
]);

$expected = sprintf('%s %s %s',
ProcessUtils::escapeArgument('exec'),
ProcessUtils::escapeArgument('--item=file1.txt'),
ProcessUtils::escapeArgument('--item=file2.txt')
);

$result->generateCliCommand()->shouldBe($expected);
}
}

0 comments on commit 31ebff2

Please sign in to comment.