Skip to content

Commit 7287e72

Browse files
authored
Merge pull request #104 from clue-labs/exec-user
Fix `execCreate()` to send numeric `$user` as string
2 parents c319415 + f123185 commit 7287e72

2 files changed

Lines changed: 10 additions & 1 deletion

File tree

‎src/Client.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1280,7 +1280,7 @@ public function execCreate($container, $cmd, $tty = false, $stdin = false, $stdo
12801280
'AttachStdin' => !!$stdin,
12811281
'AttachStdout' => !!$stdout,
12821282
'AttachStderr' => !!$stderr,
1283-
'User' => $user,
1283+
'User' => (string) $user,
12841284
'Privileged' => !!$privileged,
12851285
)
12861286
)->then(array($this->parser, 'expectJson'));

‎tests/ClientTest.php‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -663,6 +663,15 @@ public function testExecCreateStringCommand()
663663
$this->expectPromiseResolveWith($json, $this->client->execCreate(123, 'env'));
664664
}
665665

666+
public function testExecCreateWithNumericUser()
667+
{
668+
$json = array();
669+
$this->browser->expects($this->once())->method('post')->with('containers/123/exec', $this->anything(), '{"Cmd":["env"],"Tty":false,"AttachStdin":false,"AttachStdout":true,"AttachStderr":true,"User":"1000","Privileged":false}')->willReturn(\React\Promise\resolve($this->createResponseJson($json)));
670+
$this->parser->expects($this->once())->method('expectJson')->willReturn($json);
671+
672+
$this->expectPromiseResolveWith($json, $this->client->execCreate(123, array('env'), false, false, true, true, 1000));
673+
}
674+
666675
public function testExecDetached()
667676
{
668677
$body = '';

0 commit comments

Comments
 (0)