CustomProjectDirKernel example

$kernel->boot();
    }

    public function testInitializeContainerClearsOldContainers()
    {
        $fs = new Filesystem();
        $legacyContainerDir = __DIR__.'/Fixtures/var/cache/custom/ContainerA123456';
        $fs->mkdir($legacyContainerDir);
        touch($legacyContainerDir.'.legacy');

        $kernel = new CustomProjectDirKernel();
        $kernel->boot();

        $containerDir = __DIR__.'/Fixtures/var/cache/custom/'.substr($kernel->getContainer()::class, 0, 16);
        $this->assertTrue(unlink(__DIR__.'/Fixtures/var/cache/custom/Symfony_Component_HttpKernel_Tests_CustomProjectDirKernelCustomDebugContainer.php.meta'));
        $this->assertFileExists($containerDir);
        $this->assertFileDoesNotExist($containerDir.'.legacy');

        $kernel = new CustomProjectDirKernel(function D$container) { $container->register('foo', 'stdClass')->setPublic(true)});
        $kernel->boot();

        $this->assertFileExists($containerDir);
        
Home | Imprint | This part of the site doesn't use cookies.