Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[FrameworkBundle] Always use buildDir as ConfigBuilderGenerator outputDir #51588

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public function __construct(KernelInterface $kernel, LoggerInterface $logger = n
*/
public function warmUp(string $cacheDir)
{
$generator = new ConfigBuilderGenerator($cacheDir);
$generator = new ConfigBuilderGenerator($this->kernel->getBuildDir());

foreach ($this->kernel->getBundles() as $bundle) {
$extension = $bundle->getContainerExtension();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
<?php

/*
* This file is part of the Symfony package.
*
* (c) Fabien Potencier <fabien@symfony.com>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/

namespace Symfony\Bundle\FrameworkBundle\Tests\CacheWarmer;

use Symfony\Bundle\FrameworkBundle\CacheWarmer\ConfigBuilderCacheWarmer;
use Symfony\Bundle\FrameworkBundle\FrameworkBundle;
use Symfony\Bundle\FrameworkBundle\Tests\TestCase;
use Symfony\Component\Config\Loader\LoaderInterface;
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\HttpKernel\Kernel;

class ConfigBuilderCacheWarmerTest extends TestCase
{
private $varDir;

protected function setUp(): void
{
$this->varDir = sys_get_temp_dir().'/'.uniqid();
$fs = new Filesystem();
$fs->mkdir($this->varDir);
}

protected function tearDown(): void
{
$fs = new Filesystem();
$fs->remove($this->varDir);
unset($this->varDir);
}

public function testBuildDirIsUsedAsConfigBuilderOutputDir()
{
$kernel = new class($this->varDir) extends Kernel {
private $varDir;

public function __construct(string $varDir)
{
parent::__construct('test', false);

$this->varDir = $varDir;
}

public function registerBundles(): iterable
{
yield new FrameworkBundle();
}

public function getBuildDir(): string
{
return $this->varDir.'/build';
}

public function getCacheDir(): string
{
return $this->varDir.'/cache';
}

public function registerContainerConfiguration(LoaderInterface $loader)
{
}
};
$kernel->boot();

$warmer = new ConfigBuilderCacheWarmer($kernel);
$warmer->warmUp($kernel->getCacheDir());

self::assertDirectoryExists($kernel->getBuildDir().'/Symfony');
self::assertDirectoryDoesNotExist($kernel->getCacheDir().'/Symfony');
}
}
Morty Proxy This is a proxified and sanitized view of the page, visit original site.