Skip to content

Commit 9a5dde6

Browse files
authored
[Testing] Isolate ApplicationFileProcessorTest cache dir to fix parallel flake (#8360)
1 parent a9c7644 commit 9a5dde6

2 files changed

Lines changed: 16 additions & 0 deletions

File tree

‎tests/Application/ApplicationFileProcessor/ApplicationFileProcessorTest.php‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ protected function setUp(): void
2020
{
2121
parent::setUp();
2222

23+
// reset the container to boot an isolated cache dir, so parallel test processes cannot
24+
// wipe the shared default cache mid-run and flip the caching assertions below
25+
self::$rectorConfig = null;
26+
$this->bootFromConfigFiles([__DIR__ . '/config.php']);
27+
2328
$this->applicationFileProcessor = $this->make(ApplicationFileProcessor::class);
2429
$this->changedFilesDetector = $this->make(ChangedFilesDetector::class);
2530
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
use Rector\Config\RectorConfig;
6+
7+
return static function (RectorConfig $rectorConfig): void {
8+
// isolated cache dir, so parallel test processes cannot wipe the shared default cache
9+
// mid-run and flip the caching assertions of this test
10+
$rectorConfig->cacheDirectory(sys_get_temp_dir() . '/_rector_application_file_processor_test');
11+
};

0 commit comments

Comments
 (0)