From b328871a081217275d8fd177711cc23b0114fe11 Mon Sep 17 00:00:00 2001 From: "ondrej@mirtes.cz" Date: Sun, 15 Nov 2026 08:42:19 +0000 Subject: [PATCH] Let the root PSR-4 e2e test start its unchanged-cache run a second after the files were written A run does not record the stat signature of a file modified in the second it started, so when write_class_consumer's run started in the second its files were written, the next run records the signatures and rewrites the result cache, and 'Result cache was not rewritten because it is unchanged.' was missing intermittently. Amp-Thread-ID: https://ampcode.com/threads/T-01a1976c-1bde-72f8-b96c-072279109d59 --- .../result-cache-autoload-entries_test.sh | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/e2e/result-cache-autoload-entries/result-cache-autoload-entries_test.sh b/e2e/result-cache-autoload-entries/result-cache-autoload-entries_test.sh index 5ab250326d5..f1caef9a25e 100644 --- a/e2e/result-cache-autoload-entries/result-cache-autoload-entries_test.sh +++ b/e2e/result-cache-autoload-entries/result-cache-autoload-entries_test.sh @@ -119,6 +119,11 @@ function test_class_appears_in_a_path_package() { function test_class_appears_under_a_psr4_namespace_mapped_to_the_project_root() { write_class_consumer 'AutoloadEntries\Root\Thing' + # A run cannot vouch for the stat of a file written in the second it started, so when the run in + # write_class_consumer started in the second its files were written, the next run records their + # stat signatures and rewrites the cache. Have a run that starts a second later record them. + sleep 1 + analyse # the tmpDir is under the project root too, but PHPStan's own files there are not scanned files OUTPUT=$(../../bin/phpstan analyse -vv 2>&1) || true assert_contains 'Result cache was not rewritten because it is unchanged.' "$OUTPUT"