From aafed69b36619ba14b01d8e7404aebec7ffd6580 Mon Sep 17 00:00:00 2001 From: Tom Stovall <119924+stovak@users.noreply.github.com> Date: Wed, 14 Feb 2024 12:43:48 -0800 Subject: [PATCH] respect TERMINUS_* vars in testing environment --- tests/Functional/TerminusTestBase.php | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/tests/Functional/TerminusTestBase.php b/tests/Functional/TerminusTestBase.php index da8ae98c9..28d5ecb29 100644 --- a/tests/Functional/TerminusTestBase.php +++ b/tests/Functional/TerminusTestBase.php @@ -38,8 +38,21 @@ protected static function callTerminus( string $command, ?string $pipeInput = null ): array { - $terminusHost = isset($_ENV['TERMINUS_HOST']) ? "TERMINUS_HOST=" . $_ENV['TERMINUS_HOST'] : ""; - $procCommand = sprintf('%s %s %s', $terminusHost, TERMINUS_BIN_FILE, $command); + $preamble = ''; + foreach ( + [ + 'TERMINUS_HOST', + 'TERMINUS_PORT', + 'TERMINUS_VERIFY_HOST_CERT', + 'TERMINUS_CACHE_DIR', + 'PANTHEON_CERT' + ] as $envVar + ) { + if (false !== getenv($envVar)) { + $preamble .= sprintf('%s=%s ', $envVar, getenv($envVar)); + } + } + $procCommand = sprintf('%s %s %s', $preamble, TERMINUS_BIN_FILE, $command); if (null !== $pipeInput) { $procCommand = sprintf('%s | %s', $pipeInput, $procCommand); } @@ -212,7 +225,7 @@ protected function assertTerminusCommandSucceedsInAttempts( int $attempts = 3 ): void { $this->assertTerminusCommandResultEqualsInAttempts( - fn () => static::callTerminus(sprintf('%s --yes', $command))[1], + fn() => static::callTerminus(sprintf('%s --yes', $command))[1], 0, $attempts );