Skip to content

Commit edc0bc1

Browse files
Merge branch '6.0' into 6.1
* 6.0: Fix merge [Mime] Throw exception when body in Email attach method is not ok [VarDumper][VarExporter] Deal with DatePeriod->include_end_date on PHP 8.2 [Cache] Throw when "redis_sentinel" is used with a non-Predis "class" option fix merge Bootstrap 4 fieldset for row errors [Form] Fix same choice loader with different choice values [Filesystem] Safeguard (sym)link calls Fix dumping extension config without bundle [HttpClient] Honor "max_duration" when replacing requests with async decorators [HttpClient] Add missing HttpOptions::setMaxDuration() [HttpKernel] Fix missing null type in `ErrorListener::__construct()` [HttpFoundation] [Session] Overwrite invalid session id
2 parents fb245a4 + 2d277d3 commit edc0bc1

File tree

3 files changed

+30
-3
lines changed

3 files changed

+30
-3
lines changed

Tests/Form/ChoiceList/DoctrineChoiceLoaderTest.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,8 +153,7 @@ public function testLoadChoiceListUsesObjectLoaderIfAvailable()
153153
$this->assertEquals($choiceList, $loaded = $loader->loadChoiceList());
154154

155155
// no further loads on subsequent calls
156-
157-
$this->assertSame($loaded, $loader->loadChoiceList());
156+
$this->assertEquals($loaded, $loader->loadChoiceList());
158157
}
159158

160159
public function testLoadValuesForChoices()

Tests/Form/Type/EntityTypeTest.php

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1776,4 +1776,32 @@ public function testSubmitNullMultipleUsesDefaultEmptyData()
17761776
$this->assertEquals($collection, $form->getNormData());
17771777
$this->assertEquals($collection, $form->getData());
17781778
}
1779+
1780+
public function testWithSameLoaderAndDifferentChoiceValueCallbacks()
1781+
{
1782+
$entity1 = new SingleIntIdEntity(1, 'Foo');
1783+
$entity2 = new SingleIntIdEntity(2, 'Bar');
1784+
$this->persist([$entity1, $entity2]);
1785+
1786+
$view = $this->factory->create(FormTypeTest::TESTED_TYPE)
1787+
->add('entity_one', self::TESTED_TYPE, [
1788+
'em' => 'default',
1789+
'class' => self::SINGLE_IDENT_CLASS,
1790+
])
1791+
->add('entity_two', self::TESTED_TYPE, [
1792+
'em' => 'default',
1793+
'class' => self::SINGLE_IDENT_CLASS,
1794+
'choice_value' => function ($choice) {
1795+
return $choice ? $choice->name : '';
1796+
},
1797+
])
1798+
->createView()
1799+
;
1800+
1801+
$this->assertSame('1', $view['entity_one']->vars['choices'][1]->value);
1802+
$this->assertSame('2', $view['entity_one']->vars['choices'][2]->value);
1803+
1804+
$this->assertSame('Foo', $view['entity_two']->vars['choices']['Foo']->value);
1805+
$this->assertSame('Bar', $view['entity_two']->vars['choices']['Bar']->value);
1806+
}
17791807
}

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@
2929
"symfony/cache": "^5.4|^6.0",
3030
"symfony/config": "^5.4|^6.0",
3131
"symfony/dependency-injection": "^5.4|^6.0",
32-
"symfony/form": "^5.4|^6.0",
32+
"symfony/form": "^5.4.9|^6.0.9",
3333
"symfony/http-kernel": "^5.4|^6.0",
3434
"symfony/messenger": "^5.4|^6.0",
3535
"symfony/doctrine-messenger": "^5.4|^6.0",

0 commit comments

Comments
 (0)