Skip to content

Commit 6d92fd2

Browse files
committed
Merge branch '2.7' into 2.8
* 2.7: (95 commits) [DependencyInjection] provide better error message when using deprecated configuration options [console][TableCell] get cell width without decoration. Improve the config validation in TwigBundle [VarDumper] Changed tooltip to expand-all keybinding in OS X [Bridge\PhpUnit] Fix composer installed phpunit detection [VarDumper] Fix generic casters calling order [2.7][SecurityBundle] Remove SecurityContext from Compile [WebProfilerBundle][logger] added missing deprecation message. Fix profiler CSS [Security][Acl] enforce string identifiers [FrameworkBundle] make `templating.helper.router` service available again for BC reasons [BrowserKit] Fix bug when uri starts with http. bumped Symfony version to 2.7.1 updated VERSION for 2.7.0 updated CHANGELOG for 2.7.0 bumped Symfony version to 2.6.10 updated VERSION for 2.6.9 updated CHANGELOG for 2.6.9 fixed tests bumped Symfony version to 2.3.31 ... Conflicts: src/Symfony/Bundle/FrameworkBundle/Command/TranslationDebugCommand.php src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/logger.html.twig src/Symfony/Component/HttpKernel/Kernel.php src/Symfony/Component/Translation/Loader/JsonFileLoader.php
2 parents 1770bdc + 5360f60 commit 6d92fd2

File tree

8 files changed

+31
-13
lines changed

8 files changed

+31
-13
lines changed

ChoiceList/Factory/DefaultChoiceListFactory.php

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
use Symfony\Component\Form\ChoiceList\View\ChoiceListView;
2121
use Symfony\Component\Form\ChoiceList\View\ChoiceView;
2222
use Symfony\Component\Form\Extension\Core\ChoiceList\ChoiceListInterface as LegacyChoiceListInterface;
23+
use Symfony\Component\Form\Extension\Core\View\ChoiceView as LegacyChoiceView;
2324

2425
/**
2526
* Default implementation of {@link ChoiceListFactoryInterface}.
@@ -140,9 +141,16 @@ public function createListFromLoader(ChoiceLoaderInterface $loader, $value = nul
140141
public function createView(ChoiceListInterface $list, $preferredChoices = null, $label = null, $index = null, $groupBy = null, $attr = null)
141142
{
142143
// Backwards compatibility
143-
if ($list instanceof LegacyChoiceListInterface && null === $preferredChoices
144+
if ($list instanceof LegacyChoiceListInterface && empty($preferredChoices)
144145
&& null === $label && null === $index && null === $groupBy && null === $attr) {
145-
return new ChoiceListView($list->getRemainingViews(), $list->getPreferredViews());
146+
$mapToNonLegacyChoiceView = function (LegacyChoiceView $choiceView) {
147+
return new ChoiceView($choiceView->label, $choiceView->value, $choiceView->data);
148+
};
149+
150+
return new ChoiceListView(
151+
array_map($mapToNonLegacyChoiceView, $list->getRemainingViews()),
152+
array_map($mapToNonLegacyChoiceView, $list->getPreferredViews())
153+
);
146154
}
147155

148156
$preferredViews = array();

Extension/Core/DataTransformer/DateTimeToStringTransformer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ public function reverseTransform($value)
215215
}
216216

217217
if ($this->inputTimezone !== $this->outputTimezone) {
218-
$dateTime->setTimeZone(new \DateTimeZone($this->inputTimezone));
218+
$dateTime->setTimezone(new \DateTimeZone($this->inputTimezone));
219219
}
220220
} catch (TransformationFailedException $e) {
221221
throw $e;

FormBuilder.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ public function add($child, $type = null, array $options = array())
6262
throw new BadMethodCallException('FormBuilder methods cannot be accessed anymore once the builder is turned into a FormConfigInterface instance.');
6363
}
6464

65-
if ($child instanceof self) {
65+
if ($child instanceof FormBuilderInterface) {
6666
$this->children[$child->getName()] = $child;
6767

6868
// In case an unresolved child with the same name exists
@@ -72,7 +72,7 @@ public function add($child, $type = null, array $options = array())
7272
}
7373

7474
if (!is_string($child) && !is_int($child)) {
75-
throw new UnexpectedTypeException($child, 'string, integer or Symfony\Component\Form\FormBuilder');
75+
throw new UnexpectedTypeException($child, 'string, integer or Symfony\Component\Form\FormBuilderInterface');
7676
}
7777

7878
if (null !== $type && !is_string($type) && !$type instanceof FormTypeInterface) {

Tests/AbstractBootstrap3LayoutTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -118,12 +118,12 @@ public function testErrors()
118118
[@class="list-unstyled"]
119119
[
120120
./li
121-
[.="[trans]Error 1[/trans]"]
121+
[.=" [trans]Error 1[/trans]"]
122122
[
123123
./span[@class="glyphicon glyphicon-exclamation-sign"]
124124
]
125125
/following-sibling::li
126-
[.="[trans]Error 2[/trans]"]
126+
[.=" [trans]Error 2[/trans]"]
127127
[
128128
./span[@class="glyphicon glyphicon-exclamation-sign"]
129129
]

Tests/AbstractLayoutTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ protected function assertMatchesXpath($html, $expression, $count = 1)
6161
try {
6262
// Wrap in <root> node so we can load HTML with multiple tags at
6363
// the top level
64-
$dom->loadXml('<root>'.$html.'</root>');
64+
$dom->loadXML('<root>'.$html.'</root>');
6565
} catch (\Exception $e) {
6666
$this->fail(sprintf(
6767
"Failed loading HTML:\n\n%s\n\nError: %s",

Tests/ChoiceList/Factory/DefaultChoiceListFactoryTest.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
use Symfony\Component\Form\ChoiceList\View\ChoiceGroupView;
1919
use Symfony\Component\Form\ChoiceList\View\ChoiceListView;
2020
use Symfony\Component\Form\ChoiceList\View\ChoiceView;
21+
use Symfony\Component\Form\Extension\Core\View\ChoiceView as LegacyChoiceView;
2122

2223
class DefaultChoiceListFactoryTest extends \PHPUnit_Framework_TestCase
2324
{
@@ -735,8 +736,9 @@ function ($object, $key, $value) {
735736
*/
736737
public function testCreateViewForLegacyChoiceList()
737738
{
738-
$preferred = array(new ChoiceView('Preferred', 'x', 'x'));
739-
$other = array(new ChoiceView('Other', 'y', 'y'));
739+
// legacy ChoiceList instances provide legacy ChoiceView objects
740+
$preferred = array(new LegacyChoiceView('x', 'x', 'Preferred'));
741+
$other = array(new LegacyChoiceView('y', 'y', 'Other'));
740742

741743
$list = $this->getMock('Symfony\Component\Form\Extension\Core\ChoiceList\ChoiceListInterface');
742744

@@ -749,8 +751,8 @@ public function testCreateViewForLegacyChoiceList()
749751

750752
$view = $this->factory->createView($list);
751753

752-
$this->assertSame($other, $view->choices);
753-
$this->assertSame($preferred, $view->preferredChoices);
754+
$this->assertEquals(array(new ChoiceView('Other', 'y', 'y')), $view->choices);
755+
$this->assertEquals(array(new ChoiceView('Preferred', 'x', 'x')), $view->preferredChoices);
754756
}
755757

756758
private function assertScalarListWithGeneratedValues(ChoiceListInterface $list)

Tests/Extension/Core/DataTransformer/DateTimeToStringTransformerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ public function testReverseTransformWithDifferentTimezones()
140140

141141
$output = new \DateTime('2010-02-03 16:05:06 Asia/Hong_Kong');
142142
$input = $output->format('Y-m-d H:i:s');
143-
$output->setTimeZone(new \DateTimeZone('America/New_York'));
143+
$output->setTimezone(new \DateTimeZone('America/New_York'));
144144

145145
$this->assertDateTimeEquals($output, $reverseTransformer->reverseTransform($input));
146146
}

Tests/FormBuilderTest.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,9 @@
1111

1212
namespace Symfony\Component\Form\Tests;
1313

14+
use Symfony\Component\Form\ButtonBuilder;
1415
use Symfony\Component\Form\FormBuilder;
16+
use Symfony\Component\Form\SubmitButtonBuilder;
1517

1618
class FormBuilderTest extends \PHPUnit_Framework_TestCase
1719
{
@@ -154,6 +156,12 @@ public function testCreateNoTypeNo()
154156
$this->builder->create('foo');
155157
}
156158

159+
public function testAddButton()
160+
{
161+
$this->builder->add(new ButtonBuilder('reset'));
162+
$this->builder->add(new SubmitButtonBuilder('submit'));
163+
}
164+
157165
public function testGetUnknown()
158166
{
159167
$this->setExpectedException('Symfony\Component\Form\Exception\InvalidArgumentException', 'The child with the name "foo" does not exist.');

0 commit comments

Comments
 (0)