Skip to content

Commit 24e8225

Browse files
committed
Ignore directory removal failures on CI windows
1 parent de673b2 commit 24e8225

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

components/HttpClient/Tests/CacheMiddlewareIntegrationTest.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,15 @@ protected function tearDown(): void {
2727
}
2828

2929
private function removeDirectory( string $dir ): void {
30-
LocalFilesystem::create($dir)->rmdir('/', ['recursive' => true]);
30+
try {
31+
LocalFilesystem::create($dir)->rmdir('/', ['recursive' => true]);
32+
} catch ( \Exception $e ) {
33+
// Ignore errors on windows – CI sometimes fails to remove the topmost directory
34+
if(PHP_OS_FAMILY === 'Windows') {
35+
return;
36+
}
37+
throw $e;
38+
}
3139
}
3240

3341
private function makeRequest( string $url, string $method = 'GET', array $headers = [] ): array {

components/HttpClient/Tests/CacheMiddlewareTest.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,15 @@ protected function setUp(): void {
3232
}
3333

3434
protected function tearDown(): void {
35-
LocalFilesystem::create($this->cache_dir)->rmdir('/', ['recursive' => true]);
35+
try {
36+
LocalFilesystem::create($this->cache_dir)->rmdir('/', ['recursive' => true]);
37+
} catch ( \Exception $e ) {
38+
// Ignore errors on windows – CI sometimes fails to remove the topmost directory
39+
if(PHP_OS_FAMILY === 'Windows') {
40+
return;
41+
}
42+
throw $e;
43+
}
3644
}
3745

3846
public function test_cache_miss_forwards_to_next_middleware(): void {

0 commit comments

Comments
 (0)