Merge branch '2.7' into 2.8

* 2.7:
  Fix computation of PR diffs for component matrix lines
  [BUG] Delete class 'control-group' in bootstrap 3
  [2.8] [Form] Modified iterator_to_array's 2nd parameter to false in ViolationMapper
This commit is contained in:
Fabien Potencier 2016-05-13 13:03:14 -05:00
commit bcdf568a19
4 changed files with 30 additions and 18 deletions

View File

@ -1,20 +1,19 @@
<?php <?php
if (4 > $_SERVER['argc']) { if (4 > $_SERVER['argc']) {
echo "Usage: commit-range branch dir1 dir2 ... dirN\n"; echo "Usage: branch dir1 dir2 ... dirN\n";
exit(1); exit(1);
} }
$dirs = $_SERVER['argv']; $dirs = $_SERVER['argv'];
array_shift($dirs); array_shift($dirs);
$range = array_shift($dirs);
$branch = array_shift($dirs); $branch = array_shift($dirs);
$packages = array(); $packages = array();
$flags = PHP_VERSION_ID >= 50400 ? JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE : 0; $flags = PHP_VERSION_ID >= 50400 ? JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE : 0;
foreach ($dirs as $dir) { foreach ($dirs as $dir) {
if (!`git diff --name-only $range -- $dir`) { if (!`git diff --name-only $branch...HEAD -- $dir`) {
continue; continue;
} }
echo "$dir\n"; echo "$dir\n";

View File

@ -59,7 +59,7 @@ before_install:
install: install:
- if [[ ! $skip ]]; then COMPONENTS=$(find src/Symfony -mindepth 3 -type f -name phpunit.xml.dist -printf '%h\n'); fi - if [[ ! $skip ]]; then COMPONENTS=$(find src/Symfony -mindepth 3 -type f -name phpunit.xml.dist -printf '%h\n'); fi
# Create local composer packages for each patched components and reference them in composer.json files when cross-testing components # Create local composer packages for each patched components and reference them in composer.json files when cross-testing components
- if [[ ! $skip && $deps ]]; then php .travis.php $TRAVIS_COMMIT_RANGE $TRAVIS_BRANCH $COMPONENTS; fi - if [[ ! $skip && $deps ]]; then php .travis.php $TRAVIS_BRANCH $COMPONENTS; fi
# For the master branch when deps=high, the version before master is checked out and tested with the locally patched components # For the master branch when deps=high, the version before master is checked out and tested with the locally patched components
- if [[ $deps = high && $TRAVIS_BRANCH = master ]]; then SYMFONY_VERSION=$(git ls-remote --heads | grep -o '/[1-9].*' | tail -n 1 | sed s/.//); else SYMFONY_VERSION=$(cat composer.json | grep '^ *"dev-master". *"[1-9]' | grep -o '[0-9.]*'); fi - if [[ $deps = high && $TRAVIS_BRANCH = master ]]; then SYMFONY_VERSION=$(git ls-remote --heads | grep -o '/[1-9].*' | tail -n 1 | sed s/.//); else SYMFONY_VERSION=$(cat composer.json | grep '^ *"dev-master". *"[1-9]' | grep -o '[0-9.]*'); fi
- if [[ $deps = high && $TRAVIS_BRANCH = master ]]; then git fetch origin $SYMFONY_VERSION; git checkout -m FETCH_HEAD; COMPONENTS=$(find src/Symfony -mindepth 3 -type f -name phpunit.xml.dist -printf '%h\n'); ./phpunit install; fi - if [[ $deps = high && $TRAVIS_BRANCH = master ]]; then git fetch origin $SYMFONY_VERSION; git checkout -m FETCH_HEAD; COMPONENTS=$(find src/Symfony -mindepth 3 -type f -name phpunit.xml.dist -printf '%h\n'); ./phpunit install; fi

View File

@ -94,14 +94,12 @@
{% block choice_widget_expanded -%} {% block choice_widget_expanded -%}
{% if '-inline' in label_attr.class|default('') -%} {% if '-inline' in label_attr.class|default('') -%}
<div class="control-group"> {%- for child in form %}
{%- for child in form %} {{- form_widget(child, {
{{- form_widget(child, { parent_label_class: label_attr.class|default(''),
parent_label_class: label_attr.class|default(''), translation_domain: choice_translation_domain,
translation_domain: choice_translation_domain, }) -}}
}) -}} {% endfor -%}
{% endfor -%}
</div>
{%- else -%} {%- else -%}
<div {{ block('widget_container_attributes') }}> <div {{ block('widget_container_attributes') }}>
{%- for child in form %} {%- for child in form %}

View File

@ -1542,24 +1542,39 @@ class ViolationMapperTest extends \PHPUnit_Framework_TestCase
public function testBacktrackIfSeveralSubFormsWithSamePropertyPath() public function testBacktrackIfSeveralSubFormsWithSamePropertyPath()
{ {
$violation = $this->getConstraintViolation('data.address[street]');
$parent = $this->getForm('parent'); $parent = $this->getForm('parent');
$child1 = $this->getForm('subform1', 'address'); $child1 = $this->getForm('subform1', 'address');
$child2 = $this->getForm('subform2', 'address'); $child2 = $this->getForm('subform2', 'address');
$grandChild = $this->getForm('street'); $child3 = $this->getForm('subform3', null, null, array(), true);
$child4 = $this->getForm('subform4', null, null, array(), true);
$grandChild1 = $this->getForm('street');
$grandChild2 = $this->getForm('street', '[sub_address1_street]');
$grandChild3 = $this->getForm('street', '[sub_address2_street]');
$parent->add($child1); $parent->add($child1);
$parent->add($child2); $parent->add($child2);
$child2->add($grandChild); $parent->add($child3);
$parent->add($child4);
$child2->add($grandChild1);
$child3->add($grandChild2);
$child4->add($grandChild3);
$parent->submit(array()); $parent->submit(array());
$this->mapper->mapViolation($violation, $parent); $violation1 = $this->getConstraintViolation('data.address[street]');
$violation2 = $this->getConstraintViolation('data[sub_address1_street]');
$violation3 = $this->getConstraintViolation('data[sub_address2_street]');
$this->mapper->mapViolation($violation1, $parent);
$this->mapper->mapViolation($violation2, $parent);
$this->mapper->mapViolation($violation3, $parent);
// The error occurred on the child of the second form with the same path
$this->assertCount(0, $parent->getErrors(), $parent->getName().' should not have an error, but has one'); $this->assertCount(0, $parent->getErrors(), $parent->getName().' should not have an error, but has one');
$this->assertCount(0, $child1->getErrors(), $child1->getName().' should not have an error, but has one'); $this->assertCount(0, $child1->getErrors(), $child1->getName().' should not have an error, but has one');
$this->assertCount(0, $child2->getErrors(), $child2->getName().' should not have an error, but has one'); $this->assertCount(0, $child2->getErrors(), $child2->getName().' should not have an error, but has one');
$this->assertEquals(array($this->getFormError($violation, $grandChild)), iterator_to_array($grandChild->getErrors()), $grandChild->getName().' should have an error, but has none'); $this->assertCount(0, $child3->getErrors(), $child3->getName().' should not have an error, but has one');
$this->assertCount(0, $child4->getErrors(), $child4->getName().' should not have an error, but has one');
$this->assertEquals(array($this->getFormError($violation1, $grandChild1)), iterator_to_array($grandChild1->getErrors()), $grandChild1->getName().' should have an error, but has none');
$this->assertEquals(array($this->getFormError($violation2, $grandChild2)), iterator_to_array($grandChild2->getErrors()), $grandChild2->getName().' should have an error, but has none');
$this->assertEquals(array($this->getFormError($violation3, $grandChild3)), iterator_to_array($grandChild3->getErrors()), $grandChild3->getName().' should have an error, but has none');
} }
} }