Skip to content

Commit 121c3b2

Browse files
committed
Merge branch '7.4' into 8.0
* 7.4: fix merge do not use PHPUnit mock objects without configured expectations [String] Fix UnicodeString::startsWith()/endsWith() on strings that start/end with a zero fix low deps test with Console component < 6.4 [FrameworkBundle] Check for console package before register `CommandDataCollector` do not use PHPUnit mock objects without configured expectations [FrameworkBundle] Ensure a fresh container is used after cache warmup in KernelTestCase do not use PHPUnit mock objects without configured expectations add back missing enabled key in normalization step do not use PHPUnit mock objects without configured expectations [Finder] Fix `Finder::append()` breaking generic typing contract
2 parents 570c754 + 71fffd9 commit 121c3b2

File tree

5 files changed

+39
-4
lines changed

5 files changed

+39
-4
lines changed

DependencyInjection/Configuration.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,7 @@ private function addWorkflowSection(ArrayNodeDefinition $rootNode): void
377377
->beforeNormalization()
378378
->ifArray()
379379
->then(static function ($v) {
380-
if (false !== ($v['enabled'] ?? true)) {
380+
if (true === $v['enabled']) {
381381
$workflows = $v;
382382
unset($workflows['enabled']);
383383

DependencyInjection/FrameworkExtension.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -995,6 +995,10 @@ private function registerProfilerConfiguration(array $config, ContainerBuilder $
995995
if (!$container->getParameter('kernel.debug') || !$this->hasConsole() || !$container->has('debug.stopwatch')) {
996996
$container->removeDefinition('console_profiler_listener');
997997
}
998+
999+
if (!$this->hasConsole()) {
1000+
$container->removeDefinition('.data_collector.command');
1001+
}
9981002
}
9991003

10001004
private function registerWorkflowConfiguration(array $config, ContainerBuilder $container, PhpFileLoader $loader): void

Test/KernelTestCase.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,18 @@ protected static function bootKernel(array $options = []): KernelInterface
7676
static::$kernel = $kernel;
7777
static::$booted = true;
7878

79+
// If the cache warmer is registered, it means that the cache has been
80+
// warmed up, so the current container is not fresh anymore. Let's
81+
// reboot a fresh one.
82+
if (self::getContainer()->initialized('cache_warmer')) {
83+
static::ensureKernelShutdown();
84+
85+
$kernel = static::createKernel($options);
86+
$kernel->boot();
87+
static::$kernel = $kernel;
88+
static::$booted = true;
89+
}
90+
7991
return static::$kernel;
8092
}
8193

Tests/DependencyInjection/FrameworkExtensionTestCase.php

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -286,6 +286,7 @@ public function testEnabledProfiler()
286286

287287
$this->assertTrue($container->hasDefinition('profiler'), '->registerProfilerConfiguration() loads profiling.xml');
288288
$this->assertTrue($container->hasDefinition('data_collector.config'), '->registerProfilerConfiguration() loads collectors.xml');
289+
$this->assertTrue($container->hasDefinition('.data_collector.command'));
289290
}
290291

291292
public function testDisabledProfiler()
@@ -296,6 +297,26 @@ public function testDisabledProfiler()
296297
$this->assertFalse($container->hasDefinition('data_collector.config'), '->registerProfilerConfiguration() does not load collectors.xml');
297298
}
298299

300+
public function testProfilerWithoutConsole()
301+
{
302+
$extension = new class extends FrameworkExtension {
303+
protected function hasConsole(): bool
304+
{
305+
return false;
306+
}
307+
308+
public function getAlias(): string
309+
{
310+
return 'framework';
311+
}
312+
};
313+
314+
$container = $this->createContainerFromFile('profiler', [], true, false, $extension);
315+
$container->compile();
316+
317+
$this->assertFalse($container->hasDefinition('.data_collector.command'));
318+
}
319+
299320
public function testProfilerCollectSerializerDataEnabled()
300321
{
301322
$container = $this->createContainerFromFile('profiler');

Tests/Functional/TestServiceContainerTest.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,9 @@ class TestServiceContainerTest extends AbstractWebTestCase
2424
{
2525
public function testLogicExceptionIfTestConfigIsDisabled()
2626
{
27-
static::bootKernel(['test_case' => 'TestServiceContainer', 'root_config' => 'test_disabled.yml', 'environment' => 'test_disabled']);
28-
2927
$this->expectException(\LogicException::class);
3028

31-
static::getContainer();
29+
static::bootKernel(['test_case' => 'TestServiceContainer', 'root_config' => 'test_disabled.yml', 'environment' => 'test_disabled']);
3230
}
3331

3432
public function testThatPrivateServicesAreAvailableIfTestConfigIsEnabled()

0 commit comments

Comments
 (0)