Skip to content

Commit

Permalink
Test kernel shutdown
Browse files Browse the repository at this point in the history
  • Loading branch information
jdreesen committed Mar 11, 2024
1 parent 9d6c96c commit bcd0801
Showing 1 changed file with 45 additions and 0 deletions.
45 changes: 45 additions & 0 deletions tests/Functional/KernelShutdownTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<?php
declare(strict_types=1);

namespace Functional;

use Neusta\Pimcore\TestingFramework\Kernel\TestKernel;
use Neusta\Pimcore\TestingFramework\Test\ConfigurableKernelTestCase;
use Symfony\Component\Filesystem\Filesystem;

class KernelShutdownTest extends ConfigurableKernelTestCase
{
/**
* @test
*/
public function it_does_not_cleanup_the_cache_directory_of_the_standard_kernel(): void
{
$cacheDirectory = self::bootKernel()->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));
}
}

0 comments on commit bcd0801

Please sign in to comment.