jdecool/scaleway-runtimepublic Fork
⑂ 51f7215
Commits
⬇ Clone ▾
git clone https://git.rickub.com/jdecool/scaleway-runtime.git
git clone ssh://git@rickub.com/jdecool/scaleway-runtime.git

Host key fingerprint (ed25519): SHA256:iycHnxEyq0Q7uyVpB7JlznP0G7JrTPXLYRcAU5CSLhc — verify it before your first connect.

Download ZIP

test: keep the developer's Composer variables out of the packaging testsUnverified

A COMPOSER or COMPOSER_VENDOR_DIR set in the shell running PHPUnit pointed the offline install at another manifest or vendor dir, failing the tests.
Jérémy DECOOL committed 2026-11-14T02:33:40+01:00 Browse files
51f7215 parent: 158d086
modified tests/PackagerTest.php +10 -1
@@ -174,7 +174,7 @@ final class PackagerTest extends TestCase
174174 'COMPOSER_DISABLE_NETWORK' => '1',
175175 'COMPOSER_NO_AUDIT' => '1',
176176 ];
177- $process = proc_open([\PHP_BINARY, '-d', 'sys_temp_dir='.$this->dir.'/tmp', '-r', $code], [0 => ['file', '/dev/null', 'r'], 1 => ['file', '/dev/null', 'w'], 2 => ['pipe', 'w']], $pipes, null, $env + getenv());
177+ $process = proc_open([\PHP_BINARY, '-d', 'sys_temp_dir='.$this->dir.'/tmp', '-r', $code], [0 => ['file', '/dev/null', 'r'], 1 => ['file', '/dev/null', 'w'], 2 => ['pipe', 'w']], $pipes, null, $env + $this->inheritedEnv());
178178 \assert(false !== $process);
179179 $log = (string) stream_get_contents($pipes[2]);
180180 fclose($pipes[2]);
@@ -182,6 +182,15 @@ final class PackagerTest extends TestCase
182182 return [proc_close($process), $log];
183183 }
184184
185+ /**
186+ * @return array<string, string>
187+ */
188+ private function inheritedEnv(): array
189+ {
190+ // Hermetic: a COMPOSER, COMPOSER_VENDOR_DIR... of the developer's shell would point the install elsewhere.
191+ return array_filter(getenv(), static fn (string $name): bool => !str_starts_with($name, 'COMPOSER'), \ARRAY_FILTER_USE_KEY);
192+ }
193+
185194 /**
186195 * @return array<mixed>
187196 */
@@ -174,7 +174,7 @@ final class PackagerTest extends TestCase
174 'COMPOSER_DISABLE_NETWORK' => '1',174 'COMPOSER_DISABLE_NETWORK' => '1',
175 'COMPOSER_NO_AUDIT' => '1',175 'COMPOSER_NO_AUDIT' => '1',
176 ];176 ];
177- $process = proc_open([\PHP_BINARY, '-d', 'sys_temp_dir='.$this->dir.'/tmp', '-r', $code], [0 => ['file', '/dev/null', 'r'], 1 => ['file', '/dev/null', 'w'], 2 => ['pipe', 'w']], $pipes, null, $env + getenv());177+ $process = proc_open([\PHP_BINARY, '-d', 'sys_temp_dir='.$this->dir.'/tmp', '-r', $code], [0 => ['file', '/dev/null', 'r'], 1 => ['file', '/dev/null', 'w'], 2 => ['pipe', 'w']], $pipes, null, $env + $this->inheritedEnv());
178 \assert(false !== $process);178 \assert(false !== $process);
179 $log = (string) stream_get_contents($pipes[2]);179 $log = (string) stream_get_contents($pipes[2]);
180 fclose($pipes[2]);180 fclose($pipes[2]);
@@ -182,6 +182,15 @@ final class PackagerTest extends TestCase
182 return [proc_close($process), $log];182 return [proc_close($process), $log];
183 }183 }
184 184
185+ /**
186+ * @return array<string, string>
187+ */
188+ private function inheritedEnv(): array
189+ {
190+ // Hermetic: a COMPOSER, COMPOSER_VENDOR_DIR... of the developer's shell would point the install elsewhere.
191+ return array_filter(getenv(), static fn (string $name): bool => !str_starts_with($name, 'COMPOSER'), \ARRAY_FILTER_USE_KEY);
192+ }
193+
185 /**194 /**
186 * @return array<mixed>195 * @return array<mixed>
187 */196 */