From 31ebff2b6bb732f383c249e269c52cdd8de6841b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michae=CC=88l=20Jacobs?= Date: Mon, 1 Jan 2018 23:21:05 +0100 Subject: [PATCH] Add missing test for ProcessArgumentsCollection --- .../ProcessArgumentsCollectionSpec.php | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/spec/Collection/ProcessArgumentsCollectionSpec.php b/spec/Collection/ProcessArgumentsCollectionSpec.php index 36033dea4..09cf794a9 100644 --- a/spec/Collection/ProcessArgumentsCollectionSpec.php +++ b/spec/Collection/ProcessArgumentsCollectionSpec.php @@ -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; @@ -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); + } }