Upgrade 1-11.38

This commit is contained in:
xesmyd
2026-03-30 14:10:30 +02:00
parent f2a7e6d1fc
commit ac648ef29d
24665 changed files with 69682 additions and 2205004 deletions
@@ -13,6 +13,7 @@ namespace Symfony\Bundle\FrameworkBundle\Tests\Functional\Bundle\TestBundle;
use Symfony\Component\HttpKernel\Bundle\Bundle;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Bundle\FrameworkBundle\Tests\Functional\Bundle\TestBundle\DependencyInjection\AnnotationReaderPass;
use Symfony\Bundle\FrameworkBundle\Tests\Functional\Bundle\TestBundle\DependencyInjection\Config\CustomConfig;
class TestBundle extends Bundle
@@ -25,5 +26,7 @@ class TestBundle extends Bundle
$extension = $container->getExtension('test');
$extension->setCustomConfig(new CustomConfig());
$container->addCompilerPass(new AnnotationReaderPass());
}
}
@@ -39,6 +39,33 @@ class ConfigDebugCommandTest extends WebTestCase
$this->assertContains('custom: foo', $tester->getDisplay());
}
public function testDumpBundleOption()
{
$tester = $this->createCommandTester();
$ret = $tester->execute(array('name' => 'TestBundle', 'path' => 'custom'));
$this->assertSame(0, $ret, 'Returns 0 in case of success');
$this->assertContains('foo', $tester->getDisplay());
}
public function testParametersValuesAreResolved()
{
$tester = $this->createCommandTester();
$ret = $tester->execute(array('name' => 'framework'));
$this->assertSame(0, $ret, 'Returns 0 in case of success');
$this->assertContains("locale: '%env(LOCALE)%'", $tester->getDisplay());
$this->assertContains('secret: test', $tester->getDisplay());
}
public function testDumpUndefinedBundleOption()
{
$tester = $this->createCommandTester();
$tester->execute(array('name' => 'TestBundle', 'path' => 'foo'));
$this->assertContains('Unable to find configuration for "test.foo"', $tester->getDisplay());
}
/**
* @return CommandTester
*/
@@ -30,7 +30,7 @@ class ProfilerTest extends WebTestCase
$client->enableProfiler();
$crawler = $client->request('GET', '/profiler');
$profile = $client->getProfile();
$this->assertTrue(is_object($profile));
$this->assertInternalType('object', $profile);
$client->request('GET', '/profiler');
$this->assertFalse($client->getProfile());
@@ -134,18 +134,4 @@ class SessionTest extends WebTestCase
array('config.yml', false),
);
}
protected function setUp()
{
parent::setUp();
$this->deleteTmpDir('SessionTest');
}
protected function tearDown()
{
parent::tearDown();
$this->deleteTmpDir('SessionTest');
}
}
@@ -13,7 +13,6 @@ namespace Symfony\Bundle\FrameworkBundle\Tests\Functional;
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase as BaseWebTestCase;
use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\HttpKernel\Kernel;
class WebTestCase extends BaseWebTestCase
{
@@ -23,9 +22,19 @@ class WebTestCase extends BaseWebTestCase
self::assertEquals('http://localhost'.$location, $response->headers->get('Location'));
}
protected function deleteTmpDir($testCase)
public static function setUpBeforeClass()
{
if (!file_exists($dir = sys_get_temp_dir().'/'.Kernel::VERSION.'/'.$testCase)) {
static::deleteTmpDir();
}
public static function tearDownAfterClass()
{
static::deleteTmpDir();
}
protected static function deleteTmpDir()
{
if (!file_exists($dir = sys_get_temp_dir().'/'.static::getVarDir())) {
return;
}
@@ -49,10 +58,16 @@ class WebTestCase extends BaseWebTestCase
}
return new $class(
static::getVarDir(),
$options['test_case'],
isset($options['root_config']) ? $options['root_config'] : 'config.yml',
isset($options['environment']) ? $options['environment'] : 'frameworkbundletest'.strtolower($options['test_case']),
isset($options['environment']) ? $options['environment'] : strtolower(static::getVarDir().$options['test_case']),
isset($options['debug']) ? $options['debug'] : true
);
}
protected static function getVarDir()
{
return substr(strrchr(get_called_class(), '\\'), 1);
}
}
@@ -46,14 +46,16 @@ use Symfony\Component\HttpKernel\Kernel;
*/
class AppKernel extends Kernel
{
private $varDir;
private $testCase;
private $rootConfig;
public function __construct($testCase, $rootConfig, $environment, $debug)
public function __construct($varDir, $testCase, $rootConfig, $environment, $debug)
{
if (!is_dir(__DIR__.'/'.$testCase)) {
throw new \InvalidArgumentException(sprintf('The test case "%s" does not exist.', $testCase));
}
$this->varDir = $varDir;
$this->testCase = $testCase;
$fs = new Filesystem();
@@ -81,12 +83,12 @@ class AppKernel extends Kernel
public function getCacheDir()
{
return sys_get_temp_dir().'/'.Kernel::VERSION.'/'.$this->testCase.'/cache/'.$this->environment;
return sys_get_temp_dir().'/'.$this->varDir.'/'.$this->testCase.'/cache/'.$this->environment;
}
public function getLogDir()
{
return sys_get_temp_dir().'/'.Kernel::VERSION.'/'.$this->testCase.'/logs';
return sys_get_temp_dir().'/'.$this->varDir.'/'.$this->testCase.'/logs';
}
public function registerContainerConfiguration(LoaderInterface $loader)
@@ -96,13 +98,13 @@ class AppKernel extends Kernel
public function serialize()
{
return serialize(array($this->testCase, $this->rootConfig, $this->getEnvironment(), $this->isDebug()));
return serialize(array($this->varDir, $this->testCase, $this->rootConfig, $this->getEnvironment(), $this->isDebug()));
}
public function unserialize($str)
{
$a = unserialize($str);
$this->__construct($a[0], $a[1], $a[2], $a[3]);
$this->__construct($a[0], $a[1], $a[2], $a[3], $a[4]);
}
protected function getKernelParameters()
@@ -1,2 +1,10 @@
imports:
- { resource: ../config/default.yml }
framework:
secret: '%secret%'
default_locale: '%env(LOCALE)%'
parameters:
env(LOCALE): en
secret: test