From bcd080164c2a102886e3e2f91448a38da7dc3689 Mon Sep 17 00:00:00 2001 From: Jacob Dreesen Date: Mon, 11 Mar 2024 17:31:33 +0100 Subject: [PATCH] Test kernel shutdown --- tests/Functional/KernelShutdownTest.php | 45 +++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 tests/Functional/KernelShutdownTest.php diff --git a/tests/Functional/KernelShutdownTest.php b/tests/Functional/KernelShutdownTest.php new file mode 100644 index 0000000..85e5500 --- /dev/null +++ b/tests/Functional/KernelShutdownTest.php @@ -0,0 +1,45 @@ +getCacheDir(); + $filesystem = new Filesystem(); + + self::assertTrue($filesystem->exists($cacheDirectory)); + + self::ensureKernelShutdown(); + + self::assertTrue($filesystem->exists($cacheDirectory)); + } + + /** + * @test + */ + public function it_does_cleanup_the_cache_directory_of_the_dynamic_kernel(): void + { + $kernel = self::bootKernel(['config' => function (TestKernel $kernel) { + $kernel->addTestExtensionConfig('framework', ['secret' => 'foo']); + }]); + + $cacheDirectory = $kernel->getCacheDir(); + $filesystem = new Filesystem(); + + self::assertTrue($filesystem->exists($cacheDirectory)); + + self::ensureKernelShutdown(); + + self::assertFalse($filesystem->exists($cacheDirectory)); + } +}