Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,13 @@

namespace Rector\Tests\Application\ApplicationFileProcessor;

use Illuminate\Container\Container;
use Rector\Application\ApplicationFileProcessor;
use Rector\Caching\Cache;
use Rector\Caching\CacheFactory;
use Rector\Caching\Detector\ChangedFilesDetector;
use Rector\Configuration\Option;
use Rector\Configuration\Parameter\SimpleParameterProvider;
use Rector\DeadCode\Rector\ClassMethod\RemoveEmptyClassMethodRector;
use Rector\Testing\PHPUnit\AbstractLazyTestCase;
use Rector\ValueObject\Configuration;
Expand All @@ -20,6 +25,19 @@ protected function setUp(): void
{
parent::setUp();

// isolate the cache directory to this test - the default directory is shared across all
// parallel test chunks, and FileCacheStorage::clear() deletes the whole directory, so a
// sibling chunk can wipe this test's cache between save and load and flip the assertions
$rectorConfig = self::getContainer();
SimpleParameterProvider::setParameter(
Option::CACHE_DIR,
sys_get_temp_dir() . '/rector_test_application_file_processor'
);
$rectorConfig->singleton(
Cache::class,
static fn (Container $container): Cache => $container->make(CacheFactory::class)->create()
);

$this->applicationFileProcessor = $this->make(ApplicationFileProcessor::class);
$this->changedFilesDetector = $this->make(ChangedFilesDetector::class);
}
Expand Down
Loading