Merge branch '4.1'

* 4.1:
  [Form] fix truncating form views in data collector
  [TwigBridge][Form] fix tests by moving AbstractBootstrap* cases to the bridge
This commit is contained in:
Nicolas Grekas 2018-07-23 17:02:41 +02:00
commit 0eea077522
10 changed files with 7 additions and 13 deletions

View File

@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\Tests;
namespace Symfony\Bridge\Twig\Tests\Extension;
abstract class AbstractBootstrap3HorizontalLayoutTest extends AbstractBootstrap3LayoutTest
{

View File

@ -9,9 +9,10 @@
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\Tests;
namespace Symfony\Bridge\Twig\Tests\Extension;
use Symfony\Component\Form\FormError;
use Symfony\Component\Form\Tests\AbstractLayoutTest;
abstract class AbstractBootstrap3LayoutTest extends AbstractLayoutTest
{

View File

@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\Tests;
namespace Symfony\Bridge\Twig\Tests\Extension;
use Symfony\Component\Form\FormError;

View File

@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/
namespace Symfony\Component\Form\Tests;
namespace Symfony\Bridge\Twig\Tests\Extension;
use Symfony\Component\Form\Extension\Core\Type\ButtonType;
use Symfony\Component\Form\Extension\Core\Type\CheckboxType;

View File

@ -18,7 +18,6 @@ use Symfony\Bridge\Twig\Tests\Extension\Fixtures\StubTranslator;
use Symfony\Bridge\Twig\Tests\Extension\Fixtures\StubFilesystemLoader;
use Symfony\Component\Form\FormRenderer;
use Symfony\Component\Form\FormView;
use Symfony\Component\Form\Tests\AbstractBootstrap3HorizontalLayoutTest;
use Twig\Environment;
class FormExtensionBootstrap3HorizontalLayoutTest extends AbstractBootstrap3HorizontalLayoutTest

View File

@ -18,7 +18,6 @@ use Symfony\Bridge\Twig\Tests\Extension\Fixtures\StubTranslator;
use Symfony\Bridge\Twig\Tests\Extension\Fixtures\StubFilesystemLoader;
use Symfony\Component\Form\FormRenderer;
use Symfony\Component\Form\FormView;
use Symfony\Component\Form\Tests\AbstractBootstrap3LayoutTest;
use Twig\Environment;
class FormExtensionBootstrap3LayoutTest extends AbstractBootstrap3LayoutTest

View File

@ -18,7 +18,6 @@ use Symfony\Bridge\Twig\Tests\Extension\Fixtures\StubTranslator;
use Symfony\Bridge\Twig\Tests\Extension\Fixtures\StubFilesystemLoader;
use Symfony\Component\Form\FormRenderer;
use Symfony\Component\Form\FormView;
use Symfony\Component\Form\Tests\AbstractBootstrap4HorizontalLayoutTest;
use Twig\Environment;
/**

View File

@ -18,7 +18,6 @@ use Symfony\Bridge\Twig\Tests\Extension\Fixtures\StubTranslator;
use Symfony\Bridge\Twig\Tests\Extension\Fixtures\StubFilesystemLoader;
use Symfony\Component\Form\FormRenderer;
use Symfony\Component\Form\FormView;
use Symfony\Component\Form\Tests\AbstractBootstrap4LayoutTest;
use Twig\Environment;
/**

View File

@ -19,6 +19,7 @@ use Symfony\Component\HttpKernel\DataCollector\DataCollector;
use Symfony\Component\Validator\ConstraintViolationInterface;
use Symfony\Component\VarDumper\Caster\Caster;
use Symfony\Component\VarDumper\Caster\ClassStub;
use Symfony\Component\VarDumper\Caster\StubCaster;
use Symfony\Component\VarDumper\Cloner\Stub;
/**
@ -261,6 +262,7 @@ class FormDataCollector extends DataCollector implements FormDataCollectorInterf
Caster::PREFIX_VIRTUAL.'type_class' => new ClassStub(get_class($f->getConfig()->getType()->getInnerType())),
);
},
FormView::class => array(StubCaster::class, 'cutInternals'),
ConstraintViolationInterface::class => function (ConstraintViolationInterface $v, array $a) {
return array(
Caster::PREFIX_VIRTUAL.'root' => $v->getRoot(),

View File

@ -14,7 +14,6 @@ namespace Symfony\Component\Form\Extension\DataCollector;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\Form\FormView;
use Symfony\Component\Validator\ConstraintViolationInterface;
use Symfony\Component\VarDumper\Caster\CutStub;
/**
* Default implementation of {@link FormDataExtractorInterface}.
@ -145,10 +144,6 @@ class FormDataExtractor implements FormDataExtractorInterface
);
foreach ($view->vars as $varName => $value) {
// Removing redundant variable from view variables
if ('form' === $varName) {
$value = new CutStub($value);
}
$data['view_vars'][$varName] = $value;
}