Skip to content

Commit 3e42939

Browse files
committed
add writeToFile test
1 parent cff8aef commit 3e42939

2 files changed

Lines changed: 9 additions & 2 deletions

File tree

tests/Credentials/ExternalAccountCredentialsTest.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -612,8 +612,6 @@ public function testExecutableCredentialSourceEnvironmentVars()
612612
$successJson
613613
);
614614

615-
var_dump($command);exit;
616-
617615
if (PHP_OS_FAMILY === 'Windows') {
618616
// On Windows, wrap the command in DOUBLE quotes and ensure the inner single quotes are safe.
619617
// We escape the double quotes and dollar signs that Bash needs to see literally.

tests/ExecutableHandler/ExecutableHandlerTest.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,4 +54,13 @@ public function testErrorOutputIsReturnedAsOutput()
5454
$this->assertEquals(0, $handler('bash -c \'echo "Bad Response." >&2\''));
5555
$this->assertEquals("Bad Response.\n", $handler->getOutput());
5656
}
57+
58+
public function testWriteToFile()
59+
{
60+
$handler = new ExecutableHandler();
61+
62+
$tmpFile = tempnam(sys_get_temp_dir(), 'test');
63+
$this->assertEquals(0, $handler('bash -c \'echo "Response from File" > ' . $tmpFile . '\''));
64+
$this->assertEquals("Response from File\n", file_get_contents($tmpFile));
65+
}
5766
}

0 commit comments

Comments
 (0)