8000 Merge branch '2.5' · symfony/symfony@db3e451 · GitHub
[go: up one dir, main page]

Skip to content

Commit db3e451

Browse files
committed
Merge branch '2.5'
* 2.5: Make Doctrine's dependency injection test less fragile. [Finder] [Iterator] Make the tests less fragile [Form][DateTime] Propagate invalid_message & invalid_message parameters to date & time sub widgets Fix expression language in the container when using the "container" variable Conflicts: src/Symfony/Component/Form/Extension/Core/Type/DateTimeType.php
2 parents b557288 + aa5179b commit db3e451

File tree

17 files changed

+120
-47
lines changed

17 files changed

+120
-47
lines changed

src/Symfony/Bridge/Doctrine/Tests/DependencyInjection/CompilerPass/RegisterEventListenersAndSubscribersPassTest.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,11 @@ public function testProcessEventSubscribersWithPriorities()
132132
;
133133

134134
$this->process 9E88 ($container);
135-
$this->assertEquals(array('c', 'd', 'e', 'b', 'a'), $this->getServiceOrder($container, 'addEventSubscriber'));
135+
$serviceOrder = $this->getServiceOrder($container, 'addEventSubscriber');
136+
$unordered = array_splice($serviceOrder, 0, 3);
137+
sort($unordered);
138+
$this->assertEquals(array('c', 'd', 'e'), $unordered);
139+
$this->assertEquals(array('b', 'a'), $serviceOrder);
136140
}
137141

138142
public function testProcessNoTaggedServices()

src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1263,7 +1263,7 @@ private function dumpValue($value, $interpolate = true)
12631263

12641264
return $this->getServiceCall((string) $value, $value);
12651265
} elseif ($value instanceof Expression) {
1266-
return $this->getExpressionLanguage()->compile((string) $value, array('container'));
1266+
return $this->getExpressionLanguage()->compile((string) $value, array('this' => 'container'));
12671267
} elseif ($value instanceof Parameter) {
12681268
return $this->dumpParameter($value);
12691269
} elseif (true === $interpolate && is_string($value)) {

src/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container9.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
addMethodCall('setBar', array(new Reference('foo2', ContainerInterface::NULL_ON_INVALID_REFERENCE)))->
5353
addMethodCall('setBar', array(new Reference('foo3', ContainerInterface::IGNORE_ON_INVALID_REFERENCE)))->
5454
addMethodCall('setBar', array(new Reference('foobaz', ContainerInterface::IGNORE_ON_INVALID_REFERENCE)))->
55-
addMethodCall('setBar', array(new Expression('service("foo").foo() ~ parameter("foo")')))
55+
addMethodCall('setBar', array(new Expression('service("foo").foo() ~ (container.hasparameter("foo") ? parameter("foo") : "default")')))
5656
;
5757
$container->
5858
register('factory_service', 'Bar')->

src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ protected function getMethodCall1Service()
268268
if ($this->has('foobaz')) {
269269
$instance->setBar($this->get('foobaz', ContainerInterface::NULL_ON_INVALID_REFERENCE));
270270
}
271-
$instance->setBar(($this->get("foo")->foo() . $this->getParameter("foo")));
271+
$instance->setBar(($this->get("foo")->foo() . (($this->hasparameter("foo")) ? ($this->getParameter("foo")) : ("default"))));
272272

273273
return $instance;
274274
}

src/Symfony/Component/DependencyInjection/Tests/Fixtures/php/services9_compiled.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ protected function getMethodCall1Service()
267267

268268
$instance->setBar($this->get('foo'));
269269
$instance->setBar(NULL);
270-
$instance->setBar(($this->get("foo")->foo() . $this->getParameter("foo")));
270+
$instance->setBar(($this->get("foo")->foo() . (($this->hasparameter("foo")) ? ($this->getParameter("foo")) : ("default"))));
271271

272272
return $instance;
273273
}

src/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services6.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
<service id="method_call1" class="FooClass">
3434
<call method="setBar" />
3535
<call method="setBar">
36-
<argument type="expression">service("foo").foo() ~ parameter("foo")</argument>
36+
<argument type="expression">service("foo").foo() ~ (container.hasparameter("foo") ? parameter("foo") : "default")</argument>
3737
</call>
3838
</service>
3939
<service id="method_call2" class="FooClass">

src/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services9.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@
5454
<argument type="service" id="foobaz" on-invalid="ignore"/>
5555
</call>
5656
<call method="setBar">
57-
<argument type="expression">service("foo").foo() ~ parameter("foo")</argument>
57+
<argument type="expression">service("foo").foo() ~ (container.hasparameter("foo") ? parameter("foo") : "default")</argument>
5858
</call>
5959
</service>
6060
<service id="factory_service" class="Bar" factory-method="getInstance" factory-service="foo.baz"/>

src/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services6.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ services:
1515
calls:
1616
- [ setBar, [] ]
1717
- [ setBar ]
18-
- [ setBar, ['@=service("foo").foo() ~ parameter("foo")'] ]
18+
- [ setBar, ['@=service("foo").foo() ~ (container.hasparameter("foo") ? parameter("foo") : "default")'] ]
1919
method_call2:
2020
class: FooClass
2121
calls:

src/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services9.yml

Expand all lines: src/Symfony/Component/DependencyInjection/Tests/Fixtures/yaml/services9.yml
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ services:
3838
- [setBar, ['@?foo2']]
3939
- [setBar, ['@?foo3']]
4040
- [setBar, ['@?foobaz']]
41-
- [setBar, ['@=service("foo").foo() ~ parameter("foo")']]
41+
- [setBar, ['@=service("foo").foo() ~ (container.hasparameter("foo") ? parameter("foo") : "default")']]
4242

4343
factory_service:
4444
class: Bar

src/Symfony/Component/DependencyInjection/Tests/Loader/XmlFileLoaderTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ public function testLoadServices()
211211
$this->assertEquals('sc_configure', $services['configurator1']->getConfigurator(), '->load() parses the configurator tag');
212212
$this->assertEquals(array(new Reference('baz', ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE, false), 'configure'), $services['configurator2']->getConfigurator(), '->load() parses the configurator tag');
213213
$this->assertEquals(array('BazClass', 'configureStatic'), $services['configurator3']->getConfigurator(), '->load() parses the configurator tag');
214-
$this->assertEquals(array(array('setBar', array()), array('setBar', array(new Expression('service("foo").foo() ~ parameter("foo")')))), $services['method_call1']->getMethodCalls(), '->load() parses the method_call tag');
214+
$this->assertEquals(array(array('setBar', array()), array('setBar', array(new Expression('service("foo").foo() ~ (container.hasparameter("foo") ? parameter("foo") : "default")')))), $services['method_call1']->getMethodCalls(), '->load() parses the method_call tag');
215215
$this->assertEquals(array(array('setBar', array('foo', new Reference('foo'), array(true, false)))), $services['method_call2']->getMethodCalls(), '->load() parses the method_call tag');
216216
$this->assertNull($services['factory_service']->getClass());
217217
$this->assertEquals('getInstance', $services['factory_service']->getFactoryMethod());

0 commit comments

Comments
 (0)
0