Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 064aedf

Browse filesBrowse files
committed
Merge branch '2.3' into 2.7
* 2.3: [DependencyInjection] Resolve aliases before removing abstract services + add tests Fix Dom Crawler select option with empty value Remove unnecessary option assignment remove unused variable [PropertyAccess] Fix regression
2 parents 283875b + 416f7d7 commit 064aedf
Copy full SHA for 064aedf

File tree

Expand file treeCollapse file tree

10 files changed

+64
-9
lines changed
Filter options
Expand file treeCollapse file tree

10 files changed

+64
-9
lines changed

‎src/Symfony/Component/DependencyInjection/Compiler/PassConfig.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/DependencyInjection/Compiler/PassConfig.php
+2-3Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,8 @@ public function __construct()
5757

5858
$this->removingPasses = array(
5959
new RemovePrivateAliasesPass(),
60-
new RemoveAbstractDefinitionsPass(),
6160
new ReplaceAliasByActualDefinitionPass(),
61+
new RemoveAbstractDefinitionsPass(),
6262
new RepeatedPass(array(
6363
new AnalyzeServiceReferencesPass(),
6464
new InlineServiceDefinitionsPass(),
@@ -101,8 +101,7 @@ public function addPass(CompilerPassInterface $pass, $type = self::TYPE_BEFORE_O
101101
throw new InvalidArgumentException(sprintf('Invalid type "%s".', $type));
102102
}
103103

104-
$passes = &$this->$property;
105-
$passes[] = $pass;
104+
$this->{$property}[] = $pass;
106105
}
107106

108107
/**

‎src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/DependencyInjection/Tests/ContainerBuilderTest.php
+15Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -739,6 +739,21 @@ public function testExtensionConfig()
739739
$this->assertEquals(array($second, $first), $configs);
740740
}
741741

742+
public function testAbstractAlias()
743+
{
744+
$container = new ContainerBuilder();
745+
746+
$abstract = new Definition('AbstractClass');
747+
$abstract->setAbstract(true);
748+
749+
$container->setDefinition('abstract_service', $abstract);
750+
$container->setAlias('abstract_alias', 'abstract_service');
751+
752+
$container->compile();
753+
754+
$this->assertSame('abstract_service', (string) $container->getAlias('abstract_alias'));
755+
}
756+
742757
public function testLazyLoadedService()
743758
{
744759
$loader = new ClosureLoader($container = new ContainerBuilder());

‎src/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services5.xml

Copy file name to clipboardExpand all lines: src/Symfony/Component/DependencyInjection/Tests/Fixtures/xml/services5.xml
+5-1Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,12 @@
1414
</service>
1515
</argument>
1616
<property name="p" type="service">
17-
<service class="BazClass" />
17+
<service class="BuzClass" />
1818
</property>
1919
</service>
20+
<service id="bar" parent="foo" />
21+
<service class="BizClass">
22+
<tag name="biz_tag" />
23+
</service>
2024
</services>
2125
</container>

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

Copy file name to clipboardExpand all lines: src/Symfony/Component/DependencyInjection/Tests/Loader/XmlFileLoaderTest.php
+21-2Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ public function testLoadAnonymousServices()
163163
$loader = new XmlFileLoader($container, new FileLocator(self::$fixturesPath.'/xml'));
164164
$loader->load('services5.xml');
165165
$services = $container->getDefinitions();
166-
$this->assertCount(4, $services, '->load() attributes unique ids to anonymous services');
166+
$this->assertCount(6, $services, '->load() attributes unique ids to anonymous services');
167167

168168
// anonymous service as an argument
169169
$args = $services['foo']->getArguments();
@@ -172,6 +172,7 @@ public function testLoadAnonymousServices()
172172
$this->assertTrue(isset($services[(string) $args[0]]), '->load() makes a reference to the created ones');
173173
$inner = $services[(string) $args[0]];
174174
$this->assertEquals('BarClass', $inner->getClass(), '->load() uses the same configuration as for the anonymous ones');
175+
$this->assertFalse($inner->isPublic());
175176

176177
// inner anonymous services
177178
$args = $inner->getArguments();
@@ -188,7 +189,25 @@ public function testLoadAnonymousServices()
188189
$this->assertInstanceOf('Symfony\\Component\\DependencyInjection\\Reference', $property, '->load() converts anonymous services to references to "normal" services');
189190
$this->assertTrue(isset($services[(string) $property]), '->load() makes a reference to the created ones');
190191
$inner = $services[(string) $property];
191-
$this->assertEquals('BazClass', $inner->getClass(), '->load() uses the same configuration as for the anonymous ones');
192+
$this->assertEquals('BuzClass', $inner->getClass(), '->load() uses the same configuration as for the anonymous ones');
193+
$this->assertFalse($inner->isPublic());
194+
195+
// "wild" service
196+
$service = $container->findTaggedServiceIds('biz_tag');
197+
$this->assertCount(1, $service);
198+
199+
foreach ($service as $id => $tag) {
200+
$service = $container->getDefinition($id);
201+
}
202+
$this->assertEquals('BizClass', $service->getClass(), '->load() uses the same configuration as for the anonymous ones');
203+
$this->assertFalse($service->isPublic());
204+
205+
// anonymous services are shared when using decoration definitions
206+
$container->compile();
207+
$services = $container->getDefinitions();
208+
$fooArgs = $services['foo']->getArguments();
209+
$barArgs = $services['bar']->getArguments();
210+
$this->assertSame($fooArgs[0], $barArgs[0]);
192211
}
193212

194213
/**

‎src/Symfony/Component/DomCrawler/Field/ChoiceFormField.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/DomCrawler/Field/ChoiceFormField.php
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,8 @@ private function buildOptionValue(\DOMElement $node)
263263
{
264264
$option = array();
265265

266-
$defaultValue = (isset($node->nodeValue) && !empty($node->nodeValue)) ? $node->nodeValue : 'on';
266+
$defaultDefaultValue = 'select' === $this->node->nodeName ? '' : 'on';
267+
$defaultValue = (isset($node->nodeValue) && !empty($node->nodeValue)) ? $node->nodeValue : $defaultDefaultValue;
267268
$option['value'] = $node->hasAttribute('value') ? $node->getAttribute('value') : $defaultValue;
268269
$option['disabled'] = $node->hasAttribute('disabled');
269270

‎src/Symfony/Component/DomCrawler/Tests/Field/ChoiceFormFieldTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/DomCrawler/Tests/Field/ChoiceFormFieldTest.php
+8Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -351,6 +351,14 @@ public function testDisableValidation()
351351
$this->assertEquals(array('foobar'), $field->getValue(), '->disableValidation() allows to set a value which is not in the selected options.');
352352
}
353353

354+
public function testSelectWithEmptyValue()
355+
{
356+
$node = $this->createSelectNodeWithEmptyOption(array('' => true, 'Female' => false, 'Male' => false));
357+
$field = new ChoiceFormField($node);
358+
359+
$this->assertSame('', $field->getValue());
360+
}
361+
354362
protected function createSelectNode($options, $attributes = array(), $selectedAttrText = 'selected')
355363
{
356364
$document = new \DOMDocument();

‎src/Symfony/Component/Form/Extension/Core/Type/CollectionType.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Form/Extension/Core/Type/CollectionType.php
-1Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ public function buildForm(FormBuilderInterface $builder, array $options)
2828
{
2929
if ($options['allow_add'] && $options['prototype']) {
3030
$prototype = $builder->create($options['prototype_name'], $options['type'], array_replace(array(
31-
'required' => $options['required'],
3231
'label' => $options['prototype_name'].'label__',
3332
), $options['options']));
3433
$builder->setAttribute('prototype', $prototype->getForm());

‎src/Symfony/Component/PropertyAccess/PropertyAccessor.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/PropertyAccess/PropertyAccessor.php
+1Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,7 @@ public function setValue(&$objectOrArray, $propertyPath, $value)
191191
if ($propertyPath->isIndex($i)) {
192192
if ($overwrite = !isset($zval[self::REF])) {
193193
$ref = &$zval[self::REF];
194+
$ref = $zval[self::VALUE];
194195
}
195196
$this->writeIndex($zval, $property, $value);
196197
if ($overwrite) {

‎src/Symfony/Component/PropertyAccess/Tests/PropertyAccessorTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/PropertyAccess/Tests/PropertyAccessorTest.php
+10Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -529,4 +529,14 @@ public function testSetTypeHint()
529529
$this->propertyAccessor->setValue($object, 'date', $date);
530530
$this->assertSame($date, $object->getDate());
531531
}
532+
533+
public function testArrayNotBeeingOverwritten()
534+
{
535+
$value = array('value1' => 'foo', 'value2' => 'bar');
536+
$object = new TestClass($value);
537+
538+
$this->propertyAccessor->setValue($object, 'publicAccessor[value2]', 'baz');
539+
$this->assertSame('baz', $this->propertyAccessor->getValue($object, 'publicAccessor[value2]'));
540+
$this->assertSame(array('value1' => 'foo', 'value2' => 'baz'), $object->getPublicAccessor());
541+
}
532542
}

‎src/Symfony/Component/Security/Http/Tests/Firewall/SwitchUserListenerTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Security/Http/Tests/Firewall/SwitchUserListenerTest.php
-1Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,6 @@ public function testExitUserDispatchesEventWithRefreshedUser()
161161
public function testExitUserDoesNotDispatchEventWithStringUser()
162162
{
163163
$originalUser = 'anon.';
164-
$refreshedUser = $this->getMock('Symfony\Component\Security\Core\User\UserInterface');
165164
$this
166165
->userProvider
167166
->expects($this->never())

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.