new class($root) extends Kernel { public function __construct(private string $root) { parent::__construct('prod', false); } public function getProjectDir(): string { return $this->root; } }; try { file_put_contents($root.'/VERSION', "1.10.1\n"); $running = $kernel(); $old = $running->getCacheDir(); self::assertSame($old, $kernel()->getCacheDir()); file_put_contents($root.'/VERSION', "1.10.2\n"); self::assertSame($old, $running->getCacheDir(), 'The active request retains its cache even after VERSION changes.'); self::assertNotSame($old, $kernel()->getCacheDir(), 'A new kernel must not reuse the previous compiled container or Twig templates.'); } finally { unlink($root.'/VERSION'); rmdir($root); } } }