Skip to content

Commit 0ddc8ce

Browse files
Merge branch '3.4' into 4.0
* 3.4: [YAML] Issue #26065: leading spaces in YAML multi-line string literals [Bridge\PhpUnit] Exit as late as possible [Bridge\PhpUnit] Cleanup BC layer [PhpBridge] add PHPUnit 7 support to SymfonyTestsListener [Lock] Log already-locked errors as "notice" instead of "warning" add context to serialize and deserialize Update Repository Symlink Helper Document explicitly that dotfiles and vcs files are ignored by default [HttpKernel] don't try to wire Request argument with controller.service_arguments Make kernel build time optionally deterministic Use 0 for unlimited expiry [Routing] fix typo Bump default PHPUnit version from 6.3 to 6.5 do not mock the container builder in tests [Cache][WebProfiler] fix collecting cache stats with sub-requests + allow clearing calls
2 parents 483ab40 + 8b0d8e9 commit 0ddc8ce

File tree

2 files changed

+18
-41
lines changed

2 files changed

+18
-41
lines changed

Dumper/PhpDumper.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ public function dump(array $options = array())
120120
'debug' => true,
121121
'hot_path_tag' => 'container.hot_path',
122122
'inline_class_loader_parameter' => 'container.dumper.inline_class_loader',
123+
'build_time' => time(),
123124
), $options);
124125

125126
$this->namespace = $options['namespace'];
@@ -223,7 +224,7 @@ public function dump(array $options = array())
223224
array_pop($code);
224225
$code["Container{$hash}/{$options['class']}.php"] = substr_replace($files[$options['class'].'.php'], "<?php\n\nnamespace Container{$hash};\n", 0, 6);
225226
$namespaceLine = $this->namespace ? "\nnamespace {$this->namespace};\n" : '';
226-
$time = time();
227+
$time = $options['build_time'];
227228
$id = hash('crc32', $hash.$time);
228229

229230
$code[$options['class'].'.php'] = <<<EOF

Tests/Extension/ExtensionTest.php

Lines changed: 16 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
namespace Symfony\Component\DependencyInjection\Tests\Extension;
1313

1414
use PHPUnit\Framework\TestCase;
15+
use Symfony\Component\DependencyInjection\ContainerBuilder;
16+
use Symfony\Component\DependencyInjection\Extension\Extension;
1517

1618
class ExtensionTest extends TestCase
1719
{
@@ -20,36 +22,8 @@ class ExtensionTest extends TestCase
2022
*/
2123
public function testIsConfigEnabledReturnsTheResolvedValue($enabled)
2224
{
23-
$pb = $this->getMockBuilder('Symfony\Component\DependencyInjection\ParameterBag\ParameterBag')
24-
->setMethods(array('resolveValue'))
25-
->getMock()
26-
;
27-
28-
$container = $this->getMockBuilder('Symfony\Component\DependencyInjection\ContainerBuilder')
29-
->setMethods(array('getParameterBag'))
30-
->getMock()
31-
;
32-
33-
$pb->expects($this->once())
34-
->method('resolveValue')
35-
->with($this->equalTo($enabled))
36-
->will($this->returnValue($enabled))
37-
;
38-
39-
$container->expects($this->once())
40-
->method('getParameterBag')
41-
->will($this->returnValue($pb))
42-
;
43-
44-
$extension = $this->getMockBuilder('Symfony\Component\DependencyInjection\Extension\Extension')
45-
->setMethods(array())
46-
->getMockForAbstractClass()
47-
;
48-
49-
$r = new \ReflectionMethod('Symfony\Component\DependencyInjection\Extension\Extension', 'isConfigEnabled');
50-
$r->setAccessible(true);
51-
52-
$r->invoke($extension, $container, array('enabled' => $enabled));
25+
$extension = new EnableableExtension();
26+
$this->assertSame($enabled, $extension->isConfigEnabled(new ContainerBuilder(), array('enabled' => $enabled)));
5327
}
5428

5529
public function getResolvedEnabledFixtures()
@@ -66,18 +40,20 @@ public function getResolvedEnabledFixtures()
6640
*/
6741
public function testIsConfigEnabledOnNonEnableableConfig()
6842
{
69-
$container = $this->getMockBuilder('Symfony\Component\DependencyInjection\ContainerBuilder')
70-
->getMock()
71-
;
43+
$extension = new EnableableExtension();
7244

73-
$extension = $this->getMockBuilder('Symfony\Component\DependencyInjection\Extension\Extension')
74-
->setMethods(array())
75-
->getMockForAbstractClass()
76-
;
45+
$extension->isConfigEnabled(new ContainerBuilder(), array());
46+
}
47+
}
7748

78-
$r = new \ReflectionMethod('Symfony\Component\DependencyInjection\Extension\Extension', 'isConfigEnabled');
79-
$r->setAccessible(true);
49+
class EnableableExtension extends Extension
50+
{
51+
public function load(array $configs, ContainerBuilder $container)
52+
{
53+
}
8054

81-
$r->invoke($extension, $container, array());
55+
public function isConfigEnabled(ContainerBuilder $container, array $config)
56+
{
57+
return parent::isConfigEnabled($container, $config);
8258
}
8359
}

0 commit comments

Comments
 (0)