Skip to content

Commit

Permalink
feature #24067 [HttpKernel] Dont register env parameter resource (ro0NL)
Browse files Browse the repository at this point in the history
This PR was merged into the 4.0-dev branch.

Discussion
----------

[HttpKernel] Dont register env parameter resource

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | #... <!-- #-prefixed issue number(s), if any -->
| License       | MIT
| Doc PR        | symfony/symfony-docs#... <!--highly recommended for new features-->

Think this was forgotten in #22886

Not sure about `EnvParametersResource` in the http-kernel component. Core doesnt use it anymore, so we could deprecate it (and while doing so move it to config component to keep the feature if wanted). Kept as is for now.

Commits
-------

36d2a45 [HttpKernel] Dont register env parameter resource
  • Loading branch information
nicolas-grekas committed Sep 5, 2017
2 parents 1cad469 + 36d2a45 commit 05beadd
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 246 deletions.
97 changes: 0 additions & 97 deletions src/Symfony/Component/HttpKernel/Config/EnvParametersResource.php

This file was deleted.

2 changes: 0 additions & 2 deletions src/Symfony/Component/HttpKernel/Kernel.php
Expand Up @@ -26,7 +26,6 @@
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Bundle\BundleInterface;
use Symfony\Component\HttpKernel\Config\EnvParametersResource;
use Symfony\Component\HttpKernel\Config\FileLocator;
use Symfony\Component\HttpKernel\DependencyInjection\MergeExtensionConfigurationPass;
use Symfony\Component\HttpKernel\DependencyInjection\AddAnnotatedClassesToCachePass;
Expand Down Expand Up @@ -625,7 +624,6 @@ protected function buildContainer()
}

$container->addCompilerPass(new AddAnnotatedClassesToCachePass($this));
$container->addResource(new EnvParametersResource('SYMFONY__'));

return $container;
}
Expand Down

This file was deleted.

37 changes: 0 additions & 37 deletions src/Symfony/Component/HttpKernel/Tests/KernelTest.php
Expand Up @@ -16,7 +16,6 @@
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\HttpKernel\Bundle\BundleInterface;
use Symfony\Component\HttpKernel\Config\EnvParametersResource;
use Symfony\Component\HttpKernel\Kernel;
use Symfony\Component\HttpKernel\HttpKernelInterface;
use Symfony\Component\HttpFoundation\Request;
Expand Down Expand Up @@ -104,42 +103,6 @@ public function testClassCacheIsNotLoadedByDefault()
$kernel->boot();
}

public function testEnvParametersResourceIsAdded()
{
$container = new ContainerBuilder();
$kernel = $this->getMockBuilder('Symfony\Component\HttpKernel\Tests\Fixtures\KernelForTest')
->disableOriginalConstructor()
->setMethods(array('getContainerBuilder', 'prepareContainer', 'getCacheDir', 'getLogDir'))
->getMock();
$kernel->expects($this->any())
->method('getContainerBuilder')
->will($this->returnValue($container));
$kernel->expects($this->any())
->method('prepareContainer')
->will($this->returnValue(null));
$kernel->expects($this->any())
->method('getCacheDir')
->will($this->returnValue(sys_get_temp_dir()));
$kernel->expects($this->any())
->method('getLogDir')
->will($this->returnValue(sys_get_temp_dir()));

$reflection = new \ReflectionClass(get_class($kernel));
$method = $reflection->getMethod('buildContainer');
$method->setAccessible(true);
$method->invoke($kernel);

$found = false;
foreach ($container->getResources() as $resource) {
if ($resource instanceof EnvParametersResource) {
$found = true;
break;
}
}

$this->assertTrue($found);
}

public function testBootKernelSeveralTimesOnlyInitializesBundlesOnce()
{
$kernel = $this->getKernel(array('initializeBundles', 'initializeContainer'));
Expand Down

0 comments on commit 05beadd

Please sign in to comment.