Merge branch '2.8'
* 2.8: Fix merge [ci] Fix tests requirements [ci] SymfonyTestsListener is now auto-registered adds validation messages missing italian translations [Console] fixed progress bar format on edge cases fix bug with set max count, by start method in progress bar Rename CollectionType options for entries Conflicts: appveyor.yml src/Symfony/Component/ClassLoader/Tests/LegacyApcUniversalClassLoaderTest.php src/Symfony/Component/Console/Helper/ProgressBar.php src/Symfony/Component/Form/Tests/Extension/Core/Type/CollectionTypeTest.php src/Symfony/Component/HttpKernel/Tests/Profiler/MongoDbProfilerStorageTest.php src/Symfony/Component/HttpKernel/Tests/Profiler/SqliteProfilerStorageTest.php src/Symfony/Component/Validator/Tests/Mapping/Cache/LegacyApcCacheTest.php
This commit is contained in:
commit
5b678192af
|
@ -31,7 +31,7 @@ before_install:
|
|||
- if [[ "$TRAVIS_PHP_VERSION" != "hhvm" ]]; then echo "memory_limit = -1" >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini; fi;
|
||||
- if [[ "$TRAVIS_PHP_VERSION" = 5.* ]]; then phpenv config-rm xdebug.ini; fi;
|
||||
- if [[ "$TRAVIS_PHP_VERSION" = 5.* ]]; then echo "extension = mongo.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini; fi;
|
||||
- if [[ "$TRAVIS_PHP_VERSION" =~ 5.[34] ]]; then echo "extension = apc.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini; fi;
|
||||
- if [[ "$TRAVIS_PHP_VERSION" =~ 5.[34] ]]; then echo -e "extension = apc.so\napc.enable_cli = 1" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini; fi;
|
||||
- if [[ "$TRAVIS_PHP_VERSION" = 5.* ]]; then (pecl install -f memcached-2.1.0 && echo "extension = memcache.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini) || echo "Let's continue without memcache extension"; fi;
|
||||
- if [[ "$TRAVIS_PHP_VERSION" = 5.* ]] && [ "$deps" = "no" ]; then (cd src/Symfony/Component/Debug/Resources/ext && phpize && ./configure && make && echo "extension = $(pwd)/modules/symfony_debug.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini); fi;
|
||||
- if [[ "$TRAVIS_PHP_VERSION" != "hhvm" ]]; then echo "extension = ldap.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini; fi;
|
||||
|
|
|
@ -28,7 +28,6 @@ install:
|
|||
- IF %PHP%==1 echo extension_dir=ext >> php.ini-min
|
||||
- IF %PHP%==1 echo extension=php_openssl.dll >> php.ini-min
|
||||
- IF %PHP%==1 copy /Y php.ini-min php.ini-max
|
||||
- IF %PHP%==1 echo extension=php_apc.dll >> php.ini-max
|
||||
- IF %PHP%==1 echo extension=php_intl.dll >> php.ini-max
|
||||
- IF %PHP%==1 echo extension=php_mbstring.dll >> php.ini-max
|
||||
- IF %PHP%==1 echo extension=php_fileinfo.dll >> php.ini-max
|
||||
|
|
|
@ -21,10 +21,10 @@ class ApcClassLoaderTest extends \PHPUnit_Framework_TestCase
|
|||
{
|
||||
protected function setUp()
|
||||
{
|
||||
if (!(ini_get('apc.enabled') && ini_get('apc.enable_cli'))) {
|
||||
$this->markTestSkipped('The apc extension is available, but not enabled.');
|
||||
} else {
|
||||
if (ini_get('apc.enabled') && ini_get('apc.enable_cli')) {
|
||||
apc_clear_cache('user');
|
||||
} else {
|
||||
$this->markTestSkipped('APC is not enabled.');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -28,7 +28,8 @@ class ProgressBar
|
|||
private $barChar;
|
||||
private $emptyBarChar = '-';
|
||||
private $progressChar = '>';
|
||||
private $format = null;
|
||||
private $format;
|
||||
private $internalFormat;
|
||||
private $redrawFreq = 1;
|
||||
|
||||
/**
|
||||
|
@ -73,8 +74,6 @@ class ProgressBar
|
|||
}
|
||||
}
|
||||
|
||||
$this->setFormat($this->determineBestFormat());
|
||||
|
||||
$this->startTime = time();
|
||||
}
|
||||
|
||||
|
@ -295,16 +294,8 @@ class ProgressBar
|
|||
*/
|
||||
public function setFormat($format)
|
||||
{
|
||||
// try to use the _nomax variant if available
|
||||
if (!$this->max && null !== self::getFormatDefinition($format.'_nomax')) {
|
||||
$this->format = self::getFormatDefinition($format.'_nomax');
|
||||
} elseif (null !== self::getFormatDefinition($format)) {
|
||||
$this->format = self::getFormatDefinition($format);
|
||||
} else {
|
||||
$this->format = $format;
|
||||
}
|
||||
|
||||
$this->formatLineCount = substr_count($this->format, "\n");
|
||||
$this->format = null;
|
||||
$this->internalFormat = $format;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -410,6 +401,10 @@ class ProgressBar
|
|||
return;
|
||||
}
|
||||
|
||||
if (null === $this->format) {
|
||||
$this->setRealFormat($this->internalFormat ?: $this->determineBestFormat());
|
||||
}
|
||||
|
||||
$this->overwrite(preg_replace_callback("{%([a-z\-_]+)(?:\:([^%]+))?%}i", function ($matches) {
|
||||
if ($formatter = $this::getPlaceholderFormatterDefinition($matches[1])) {
|
||||
$text = call_user_func($formatter, $this, $this->output);
|
||||
|
@ -440,9 +435,32 @@ class ProgressBar
|
|||
return;
|
||||
}
|
||||
|
||||
if (null === $this->format) {
|
||||
$this->setRealFormat($this->internalFormat ?: $this->determineBestFormat());
|
||||
}
|
||||
|
||||
$this->overwrite(str_repeat("\n", $this->formatLineCount));
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the progress bar format.
|
||||
*
|
||||
* @param string $format The format
|
||||
*/
|
||||
private function setRealFormat($format)
|
||||
{
|
||||
// try to use the _nomax variant if available
|
||||
if (!$this->max && null !== self::getFormatDefinition($format.'_nomax')) {
|
||||
$this->format = self::getFormatDefinition($format.'_nomax');
|
||||
} elseif (null !== self::getFormatDefinition($format)) {
|
||||
$this->format = self::getFormatDefinition($format);
|
||||
} else {
|
||||
$this->format = $format;
|
||||
}
|
||||
|
||||
$this->formatLineCount = substr_count($this->format, "\n");
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the progress bar maximal steps.
|
||||
*
|
||||
|
|
|
@ -106,6 +106,53 @@ class ProgressBarTest extends \PHPUnit_Framework_TestCase
|
|||
);
|
||||
}
|
||||
|
||||
public function testFormat()
|
||||
{
|
||||
$expected =
|
||||
$this->generateOutput(' 0/10 [>---------------------------] 0%').
|
||||
$this->generateOutput(' 10/10 [============================] 100%').
|
||||
$this->generateOutput(' 10/10 [============================] 100%')
|
||||
;
|
||||
|
||||
// max in construct, no format
|
||||
$bar = new ProgressBar($output = $this->getOutputStream(), 10);
|
||||
$bar->start();
|
||||
$bar->advance(10);
|
||||
$bar->finish();
|
||||
|
||||
rewind($output->getStream());
|
||||
$this->assertEquals($expected, stream_get_contents($output->getStream()));
|
||||
|
||||
// max in start, no format
|
||||
$bar = new ProgressBar($output = $this->getOutputStream());
|
||||
$bar->start(10);
|
||||
$bar->advance(10);
|
||||
$bar->finish();
|
||||
|
||||
rewind($output->getStream());
|
||||
$this->assertEquals($expected, stream_get_contents($output->getStream()));
|
||||
|
||||
// max in construct, explicit format before
|
||||
$bar = new ProgressBar($output = $this->getOutputStream(), 10);
|
||||
$bar->setFormat('normal');
|
||||
$bar->start();
|
||||
$bar->advance(10);
|
||||
$bar->finish();
|
||||
|
||||
rewind($output->getStream());
|
||||
$this->assertEquals($expected, stream_get_contents($output->getStream()));
|
||||
|
||||
// max in start, explicit format before
|
||||
$bar = new ProgressBar($output = $this->getOutputStream());
|
||||
$bar->setFormat('normal');
|
||||
$bar->start(10);
|
||||
$bar->advance(10);
|
||||
$bar->finish();
|
||||
|
||||
rewind($output->getStream());
|
||||
$this->assertEquals($expected, stream_get_contents($output->getStream()));
|
||||
}
|
||||
|
||||
public function testCustomizations()
|
||||
{
|
||||
$bar = new ProgressBar($output = $this->getOutputStream(), 10);
|
||||
|
|
|
@ -27,17 +27,17 @@ class CollectionType extends AbstractType
|
|||
public function buildForm(FormBuilderInterface $builder, array $options)
|
||||
{
|
||||
if ($options['allow_add'] && $options['prototype']) {
|
||||
$prototype = $builder->create($options['prototype_name'], $options['type'], array_replace(array(
|
||||
$prototype = $builder->create($options['prototype_name'], $options['entry_type'], array_replace(array(
|
||||
'label' => $options['prototype_name'].'label__',
|
||||
), $options['options'], array(
|
||||
), $options['entry_options'], array(
|
||||
'data' => $options['prototype_data'],
|
||||
)));
|
||||
$builder->setAttribute('prototype', $prototype->getForm());
|
||||
}
|
||||
|
||||
$resizeListener = new ResizeFormListener(
|
||||
$options['type'],
|
||||
$options['options'],
|
||||
$options['entry_type'],
|
||||
$options['entry_options'],
|
||||
$options['allow_add'],
|
||||
$options['allow_delete'],
|
||||
$options['delete_empty']
|
||||
|
@ -76,11 +76,37 @@ class CollectionType extends AbstractType
|
|||
*/
|
||||
public function configureOptions(OptionsResolver $resolver)
|
||||
{
|
||||
$optionsNormalizer = function (Options $options, $value) {
|
||||
$entryOptionsNormalizer = function (Options $options, $value) {
|
||||
$value['block_name'] = 'entry';
|
||||
|
||||
return $value;
|
||||
};
|
||||
$optionsNormalizer = function (Options $options, $value) use ($entryOptionsNormalizer) {
|
||||
if (null !== $value) {
|
||||
@trigger_error('The form option "options" is deprecated since version 2.8 and will be removed in 3.0. Use "entry_options" instead.', E_USER_DEPRECATED);
|
||||
}
|
||||
|
||||
return $entryOptionsNormalizer($options, $value);
|
||||
};
|
||||
$typeNormalizer = function (Options $options, $value) {
|
||||
if (null !== $value) {
|
||||
@trigger_error('The form option "type" is deprecated since version 2.8 and will be removed in 3.0. Use "entry_type" instead.', E_USER_DEPRECATED);
|
||||
}
|
||||
};
|
||||
$entryType = function (Options $options) {
|
||||
if (null !== $options['type']) {
|
||||
return $options['type'];
|
||||
}
|
||||
|
||||
return __NAMESPACE__.'\TextType';
|
||||
};
|
||||
$entryOptions = function (Options $options) {
|
||||
if (1 === count($options['options']) && isset($options['block_name'])) {
|
||||
return array();
|
||||
}
|
||||
|
||||
return $options['options'];
|
||||
};
|
||||
|
||||
$resolver->setDefaults(array(
|
||||
'allow_add' => false,
|
||||
|
@ -88,12 +114,17 @@ class CollectionType extends AbstractType
|
|||
'prototype' => true,
|
||||
'prototype_data' => null,
|
||||
'prototype_name' => '__name__',
|
||||
'type' => __NAMESPACE__.'\TextType',
|
||||
'options' => array(),
|
||||
// deprecated as of Symfony 2.8, to be removed in Symfony 3.0. Use entry_type instead
|
||||
'type' => null,
|
||||
// deprecated as of Symfony 2.8, to be removed in Symfony 3.0. Use entry_options instead
|
||||
'options' => null,
|
||||
'entry_type' => $entryType,
|
||||
'entry_options' => $entryOptions,
|
||||
'delete_empty' => false,
|
||||
));
|
||||
|
||||
$resolver->setNormalizer('options', $optionsNormalizer);
|
||||
$resolver->setNormalizer('entry_options', $entryOptionsNormalizer);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -284,7 +284,7 @@ abstract class AbstractDivLayoutTest extends AbstractLayoutTest
|
|||
public function testCollection()
|
||||
{
|
||||
$form = $this->factory->createNamed('names', 'Symfony\Component\Form\Extension\Core\Type\CollectionType', array('a', 'b'), array(
|
||||
'type' => 'Symfony\Component\Form\Extension\Core\Type\TextType',
|
||||
'entry_type' => 'Symfony\Component\Form\Extension\Core\Type\TextType',
|
||||
));
|
||||
|
||||
$this->assertWidgetMatchesXpath($form->createView(), array(),
|
||||
|
@ -306,7 +306,7 @@ abstract class AbstractDivLayoutTest extends AbstractLayoutTest
|
|||
array('title' => 'b'),
|
||||
);
|
||||
$form = $this->factory->createNamed('names', 'Symfony\Component\Form\Extension\Core\Type\CollectionType', $data, array(
|
||||
'type' => 'Symfony\Component\Form\Tests\Fixtures\AlternatingRowType',
|
||||
'entry_type' => 'Symfony\Component\Form\Tests\Fixtures\AlternatingRowType',
|
||||
));
|
||||
|
||||
$this->assertWidgetMatchesXpath($form->createView(), array(),
|
||||
|
@ -324,7 +324,7 @@ abstract class AbstractDivLayoutTest extends AbstractLayoutTest
|
|||
public function testEmptyCollection()
|
||||
{
|
||||
$form = $this->factory->createNamed('names', 'Symfony\Component\Form\Extension\Core\Type\CollectionType', array(), array(
|
||||
'type' => 'Symfony\Component\Form\Extension\Core\Type\TextType',
|
||||
'entry_type' => 'Symfony\Component\Form\Extension\Core\Type\TextType',
|
||||
));
|
||||
|
||||
$this->assertWidgetMatchesXpath($form->createView(), array(),
|
||||
|
@ -341,7 +341,7 @@ abstract class AbstractDivLayoutTest extends AbstractLayoutTest
|
|||
'collection',
|
||||
'Symfony\Component\Form\Extension\Core\Type\CollectionType',
|
||||
array('a', 'b'),
|
||||
array('type' => 'Symfony\Component\Form\Extension\Core\Type\TextType')
|
||||
array('entry_type' => 'Symfony\Component\Form\Extension\Core\Type\TextType')
|
||||
);
|
||||
|
||||
$form = $this->factory->createNamedBuilder('form', 'Symfony\Component\Form\Extension\Core\Type\FormType')
|
||||
|
|
|
@ -28,8 +28,8 @@ class CollectionTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
|
|||
public function testSetDataAdjustsSize()
|
||||
{
|
||||
$form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\CollectionType', null, array(
|
||||
'type' => 'Symfony\Component\Form\Extension\Core\Type\TextType',
|
||||
'options' => array(
|
||||
'entry_type' => 'Symfony\Component\Form\Extension\Core\Type\TextType',
|
||||
'entry_options' => array(
|
||||
'attr' => array('maxlength' => 20),
|
||||
),
|
||||
));
|
||||
|
@ -57,7 +57,7 @@ class CollectionTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
|
|||
public function testThrowsExceptionIfObjectIsNotTraversable()
|
||||
{
|
||||
$form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\CollectionType', null, array(
|
||||
'type' => 'Symfony\Component\Form\Extension\Core\Type\TextType',
|
||||
'entry_type' => 'Symfony\Component\Form\Extension\Core\Type\TextType',
|
||||
));
|
||||
$this->setExpectedException('Symfony\Component\Form\Exception\UnexpectedTypeException');
|
||||
$form->setData(new \stdClass());
|
||||
|
@ -66,7 +66,7 @@ class CollectionTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
|
|||
public function testNotResizedIfSubmittedWithMissingData()
|
||||
{
|
||||
$form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\CollectionType', null, array(
|
||||
'type' => 'Symfony\Component\Form\Extension\Core\Type\TextType',
|
||||
'entry_type' => 'Symfony\Component\Form\Extension\Core\Type\TextType',
|
||||
));
|
||||
$form->setData(array('foo@foo.com', 'bar@bar.com'));
|
||||
$form->submit(array('foo@bar.com'));
|
||||
|
@ -80,7 +80,7 @@ class CollectionTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
|
|||
public function testResizedDownIfSubmittedWithMissingDataAndAllowDelete()
|
||||
{
|
||||
$form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\CollectionType', null, array(
|
||||
'type' => 'Symfony\Component\Form\Extension\Core\Type\TextType',
|
||||
'entry_type' => 'Symfony\Component\Form\Extension\Core\Type\TextType',
|
||||
'allow_delete' => true,
|
||||
));
|
||||
$form->setData(array('foo@foo.com', 'bar@bar.com'));
|
||||
|
@ -95,7 +95,7 @@ class CollectionTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
|
|||
public function testResizedDownIfSubmittedWithEmptyDataAndDeleteEmpty()
|
||||
{
|
||||
$form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\CollectionType', null, array(
|
||||
'type' => 'Symfony\Component\Form\Extension\Core\Type\TextType',
|
||||
'entry_type' => 'Symfony\Component\Form\Extension\Core\Type\TextType',
|
||||
'allow_delete' => true,
|
||||
'delete_empty' => true,
|
||||
));
|
||||
|
@ -112,7 +112,7 @@ class CollectionTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
|
|||
public function testDontAddEmptyDataIfDeleteEmpty()
|
||||
{
|
||||
$form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\CollectionType', null, array(
|
||||
'type' => 'Symfony\Component\Form\Extension\Core\Type\TextType',
|
||||
'entry_type' => 'Symfony\Component\Form\Extension\Core\Type\TextType',
|
||||
'allow_add' => true,
|
||||
'delete_empty' => true,
|
||||
));
|
||||
|
@ -129,7 +129,7 @@ class CollectionTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
|
|||
public function testNoDeleteEmptyIfDeleteNotAllowed()
|
||||
{
|
||||
$form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\CollectionType', null, array(
|
||||
'type' => 'Symfony\Component\Form\Extension\Core\Type\TextType',
|
||||
'entry_type' => 'Symfony\Component\Form\Extension\Core\Type\TextType',
|
||||
'allow_delete' => false,
|
||||
'delete_empty' => true,
|
||||
));
|
||||
|
@ -144,10 +144,10 @@ class CollectionTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
|
|||
public function testResizedDownIfSubmittedWithCompoundEmptyDataAndDeleteEmpty()
|
||||
{
|
||||
$form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\CollectionType', null, array(
|
||||
'type' => 'Symfony\Component\Form\Tests\Fixtures\AuthorType',
|
||||
'entry_type' => 'Symfony\Component\Form\Tests\Fixtures\AuthorType',
|
||||
// If the field is not required, no new Author will be created if the
|
||||
// form is completely empty
|
||||
'options' => array('required' => false),
|
||||
'entry_options' => array('required' => false),
|
||||
'allow_add' => true,
|
||||
'delete_empty' => true,
|
||||
));
|
||||
|
@ -167,7 +167,7 @@ class CollectionTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
|
|||
public function testNotResizedIfSubmittedWithExtraData()
|
||||
{
|
||||
$form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\CollectionType', null, array(
|
||||
'type' => 'Symfony\Component\Form\Extension\Core\Type\TextType',
|
||||
'entry_type' => 'Symfony\Component\Form\Extension\Core\Type\TextType',
|
||||
));
|
||||
$form->setData(array('foo@bar.com'));
|
||||
$form->submit(array('foo@foo.com', 'bar@bar.com'));
|
||||
|
@ -180,7 +180,7 @@ class CollectionTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
|
|||
public function testResizedUpIfSubmittedWithExtraDataAndAllowAdd()
|
||||
{
|
||||
$form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\CollectionType', null, array(
|
||||
'type' => 'Symfony\Component\Form\Extension\Core\Type\TextType',
|
||||
'entry_type' => 'Symfony\Component\Form\Extension\Core\Type\TextType',
|
||||
'allow_add' => true,
|
||||
));
|
||||
$form->setData(array('foo@bar.com'));
|
||||
|
@ -196,7 +196,7 @@ class CollectionTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
|
|||
public function testAllowAddButNoPrototype()
|
||||
{
|
||||
$form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\CollectionType', null, array(
|
||||
'type' => 'Symfony\Component\Form\Extension\Core\Type\FormType',
|
||||
'entry_type' => 'Symfony\Component\Form\Extension\Core\Type\FormType',
|
||||
'allow_add' => true,
|
||||
'prototype' => false,
|
||||
));
|
||||
|
@ -208,7 +208,7 @@ class CollectionTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
|
|||
{
|
||||
$form = $this->factory
|
||||
->create('Symfony\Component\Form\Extension\Core\Type\CollectionType', null, array(
|
||||
'type' => 'Symfony\Component\Form\Extension\Core\Type\FileType',
|
||||
'entry_type' => 'Symfony\Component\Form\Extension\Core\Type\FileType',
|
||||
'allow_add' => true,
|
||||
'prototype' => true,
|
||||
))
|
||||
|
@ -220,7 +220,7 @@ class CollectionTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
|
|||
public function testGetDataDoesNotContainsPrototypeNameBeforeDataAreSet()
|
||||
{
|
||||
$form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\CollectionType', array(), array(
|
||||
'type' => 'Symfony\Component\Form\Extension\Core\Type\FileType',
|
||||
'entry_type' => 'Symfony\Component\Form\Extension\Core\Type\FileType',
|
||||
'prototype' => true,
|
||||
'allow_add' => true,
|
||||
));
|
||||
|
@ -232,7 +232,7 @@ class CollectionTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
|
|||
public function testGetDataDoesNotContainsPrototypeNameAfterDataAreSet()
|
||||
{
|
||||
$form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\CollectionType', array(), array(
|
||||
'type' => 'Symfony\Component\Form\Extension\Core\Type\FileType',
|
||||
'entry_type' => 'Symfony\Component\Form\Extension\Core\Type\FileType',
|
||||
'allow_add' => true,
|
||||
'prototype' => true,
|
||||
));
|
||||
|
@ -245,7 +245,7 @@ class CollectionTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
|
|||
public function testPrototypeNameOption()
|
||||
{
|
||||
$form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\CollectionType', null, array(
|
||||
'type' => 'Symfony\Component\Form\Extension\Core\Type\FormType',
|
||||
'entry_type' => 'Symfony\Component\Form\Extension\Core\Type\FormType',
|
||||
'prototype' => true,
|
||||
'allow_add' => true,
|
||||
));
|
||||
|
@ -253,7 +253,7 @@ class CollectionTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
|
|||
$this->assertSame('__name__', $form->getConfig()->getAttribute('prototype')->getName(), '__name__ is the default');
|
||||
|
||||
$form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\CollectionType', null, array(
|
||||
'type' => 'Symfony\Component\Form\Extension\Core\Type\FormType',
|
||||
'entry_type' => 'Symfony\Component\Form\Extension\Core\Type\FormType',
|
||||
'prototype' => true,
|
||||
'allow_add' => true,
|
||||
'prototype_name' => '__test__',
|
||||
|
@ -262,10 +262,26 @@ class CollectionTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
|
|||
$this->assertSame('__test__', $form->getConfig()->getAttribute('prototype')->getName());
|
||||
}
|
||||
|
||||
/**
|
||||
* @group legacy
|
||||
*/
|
||||
public function testLegacyEntryOptions()
|
||||
{
|
||||
$form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\CollectionType', array(), array(
|
||||
'type' => 'Symfony\Component\Form\Extension\Core\Type\NumberType',
|
||||
'options' => array('attr' => array('maxlength' => '10')),
|
||||
));
|
||||
|
||||
$resolvedOptions = $form->getConfig()->getOptions();
|
||||
|
||||
$this->assertEquals('Symfony\Component\Form\Extension\Core\Type\NumberType', $resolvedOptions['entry_type']);
|
||||
$this->assertEquals(array('attr' => array('maxlength' => '10'), 'block_name' => 'entry'), $resolvedOptions['entry_options']);
|
||||
}
|
||||
|
||||
public function testPrototypeDefaultLabel()
|
||||
{
|
||||
$form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\CollectionType', array(), array(
|
||||
'type' => 'Symfony\Component\Form\Extension\Core\Type\FileType',
|
||||
'entry_type' => 'Symfony\Component\Form\Extension\Core\Type\FileType',
|
||||
'allow_add' => true,
|
||||
'prototype' => true,
|
||||
'prototype_name' => '__test__',
|
||||
|
@ -281,7 +297,7 @@ class CollectionTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
|
|||
'allow_add' => true,
|
||||
'prototype' => true,
|
||||
'prototype_data' => 'foo',
|
||||
'options' => array(
|
||||
'entry_options' => array(
|
||||
'data' => 'bar',
|
||||
),
|
||||
));
|
||||
|
|
|
@ -347,8 +347,8 @@ class FormTypeCsrfExtensionTest extends TypeTestCase
|
|||
{
|
||||
$prototypeView = $this->factory
|
||||
->create('Symfony\Component\Form\Extension\Core\Type\CollectionType', null, array(
|
||||
'type' => __CLASS__.'_ChildType',
|
||||
'options' => array(
|
||||
'entry_type' => __CLASS__.'_ChildType',
|
||||
'entry_options' => array(
|
||||
'csrf_field_name' => 'csrf',
|
||||
),
|
||||
'prototype' => true,
|
||||
|
|
|
@ -302,6 +302,18 @@
|
|||
<source>An empty file is not allowed.</source>
|
||||
<target>Un file vuoto non è consentito.</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="79">
|
||||
<source>The host could not be resolved.</source>
|
||||
<target>L'host non può essere risolto.</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="80">
|
||||
<source>This value does not match the expected {{ charset }} charset.</source>
|
||||
<target>Questo valore non corrisponde al charset {{ charset }}.</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="81">
|
||||
<source>This is not a valid Business Identifier Code (BIC).</source>
|
||||
<target>Questo valore non è un codice BIC valido.</target>
|
||||
</trans-unit>
|
||||
</body>
|
||||
</file>
|
||||
</xliff>
|
||||
|
|
Reference in New Issue