From 6c50013b12aed899f17eebf374b3b1cf77e12e71 Mon Sep 17 00:00:00 2001
From: WouterJ
Date: Sun, 30 Nov 2014 21:23:32 +0100
Subject: [PATCH 0001/3475] Allowed extensions to inline compiler passes
---
.../Compiler/ExtensionCompilerPass.php | 28 +++++++++++
.../Compiler/PassConfig.php | 1 +
.../Compiler/ExtensionCompilerPassTest.php | 46 +++++++++++++++++++
3 files changed, 75 insertions(+)
create mode 100644 src/Symfony/Component/DependencyInjection/Compiler/ExtensionCompilerPass.php
create mode 100644 src/Symfony/Component/DependencyInjection/Tests/Compiler/ExtensionCompilerPassTest.php
diff --git a/src/Symfony/Component/DependencyInjection/Compiler/ExtensionCompilerPass.php b/src/Symfony/Component/DependencyInjection/Compiler/ExtensionCompilerPass.php
new file mode 100644
index 0000000000000..a9b418d497bed
--- /dev/null
+++ b/src/Symfony/Component/DependencyInjection/Compiler/ExtensionCompilerPass.php
@@ -0,0 +1,28 @@
+
+ */
+class ExtensionCompilerPass implements CompilerPassInterface
+{
+ /**
+ * {@inheritdoc}
+ */
+ public function process(ContainerBuilder $container)
+ {
+ foreach ($container->getExtensions() as $extension) {
+ if (!$extension instanceof CompilerPassInterface) {
+ continue;
+ }
+
+ $extension->process($container);
+ }
+ }
+}
diff --git a/src/Symfony/Component/DependencyInjection/Compiler/PassConfig.php b/src/Symfony/Component/DependencyInjection/Compiler/PassConfig.php
index 044529eb6d7c0..d6dee26fda766 100644
--- a/src/Symfony/Component/DependencyInjection/Compiler/PassConfig.php
+++ b/src/Symfony/Component/DependencyInjection/Compiler/PassConfig.php
@@ -45,6 +45,7 @@ public function __construct()
$this->mergePass = new MergeExtensionConfigurationPass();
$this->optimizationPasses = array(
+ new ExtensionCompilerPass(),
new ResolveDefinitionTemplatesPass(),
new DecoratorServicePass(),
new ResolveParameterPlaceHoldersPass(),
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Compiler/ExtensionCompilerPassTest.php b/src/Symfony/Component/DependencyInjection/Tests/Compiler/ExtensionCompilerPassTest.php
new file mode 100644
index 0000000000000..ef690da16329e
--- /dev/null
+++ b/src/Symfony/Component/DependencyInjection/Tests/Compiler/ExtensionCompilerPassTest.php
@@ -0,0 +1,46 @@
+
+ */
+class ExtensionCompilerPassTest extends \PHPUnit_Framework_TestCase
+{
+ private $container;
+ private $pass;
+
+ public function setUp()
+ {
+ $this->container = $this->getMock('Symfony\Component\DependencyInjection\ContainerBuilder');
+ $this->pass = new ExtensionCompilerPass();
+ }
+
+ public function testProcess()
+ {
+ $extension1 = $this->createExtensionMock(true);
+ $extension1->expects($this->once())->method('process');
+ $extension2 = $this->createExtensionMock(false);
+ $extension3 = $this->createExtensionMock(false);
+ $extension4 = $this->createExtensionMock(true);
+ $extension4->expects($this->once())->method('process');
+
+ $this->container->expects($this->any())
+ ->method('getExtensions')
+ ->will($this->returnValue(array($extension1, $extension2, $extension3, $extension4)))
+ ;
+
+ $this->pass->process($this->container);
+ }
+
+ private function createExtensionMock($hasInlineCompile)
+ {
+ return $this->getMock('Symfony\Component\DependencyInjection\\'.(
+ $hasInlineCompile
+ ? 'Compiler\CompilerPassInterface'
+ : 'Extension\ExtensionInterface'
+ ));
+ }
+}
From dbaefb4f5f9e26054b65f5dc336a5fd3763b179e Mon Sep 17 00:00:00 2001
From: Richard van Laak
Date: Mon, 8 Jun 2015 12:48:52 +0200
Subject: [PATCH 0002/3475] Include working directory in ProcessFailedException
... because quite often the Exception is a result of the `www-data` user not having the appropriate rights at that path.
fixed ProcessFailedException tests
Update ProcessFailedExceptionTest.php
fix indention
fixed indention
---
.../Exception/ProcessFailedException.php | 5 +++--
.../Tests/ProcessFailedExceptionTest.php | 20 ++++++++++++++-----
2 files changed, 18 insertions(+), 7 deletions(-)
diff --git a/src/Symfony/Component/Process/Exception/ProcessFailedException.php b/src/Symfony/Component/Process/Exception/ProcessFailedException.php
index 7523a5e9cd4ea..328acfde5e883 100644
--- a/src/Symfony/Component/Process/Exception/ProcessFailedException.php
+++ b/src/Symfony/Component/Process/Exception/ProcessFailedException.php
@@ -28,10 +28,11 @@ public function __construct(Process $process)
throw new InvalidArgumentException('Expected a failed process, but the given process was successful.');
}
- $error = sprintf('The command "%s" failed.'."\nExit Code: %s(%s)",
+ $error = sprintf('The command "%s" failed.'."\n\nExit Code: %s(%s)\n\nWorking directory: %s",
$process->getCommandLine(),
$process->getExitCode(),
- $process->getExitCodeText()
+ $process->getExitCodeText(),
+ $process->getWorkingDirectory()
);
if (!$process->isOutputDisabled()) {
diff --git a/src/Symfony/Component/Process/Tests/ProcessFailedExceptionTest.php b/src/Symfony/Component/Process/Tests/ProcessFailedExceptionTest.php
index b028395f9b4de..0d763a470d19e 100644
--- a/src/Symfony/Component/Process/Tests/ProcessFailedExceptionTest.php
+++ b/src/Symfony/Component/Process/Tests/ProcessFailedExceptionTest.php
@@ -51,10 +51,11 @@ public function testProcessFailedExceptionPopulatesInformationFromProcessOutput(
$exitText = 'General error';
$output = 'Command output';
$errorOutput = 'FATAL: Unexpected error';
+ $workingDirectory = getcwd();
$process = $this->getMock(
'Symfony\Component\Process\Process',
- array('isSuccessful', 'getOutput', 'getErrorOutput', 'getExitCode', 'getExitCodeText', 'isOutputDisabled'),
+ array('isSuccessful', 'getOutput', 'getErrorOutput', 'getExitCode', 'getExitCodeText', 'isOutputDisabled', 'getWorkingDirectory'),
array($cmd)
);
$process->expects($this->once())
@@ -81,27 +82,32 @@ public function testProcessFailedExceptionPopulatesInformationFromProcessOutput(
->method('isOutputDisabled')
->will($this->returnValue(false));
+ $process->expects($this->once())
+ ->method('getWorkingDirectory')
+ ->will($this->returnValue($workingDirectory));
+
$exception = new ProcessFailedException($process);
$this->assertEquals(
- "The command \"$cmd\" failed.\nExit Code: $exitCode($exitText)\n\nOutput:\n================\n{$output}\n\nError Output:\n================\n{$errorOutput}",
+ "The command \"$cmd\" failed.\n\nExit Code: $exitCode($exitText)\n\nWorking directory: {$workingDirectory}\n\nOutput:\n================\n{$output}\n\nError Output:\n================\n{$errorOutput}",
$exception->getMessage()
);
}
/**
* Tests that ProcessFailedException does not extract information from
- * process output if it was previously disabled
+ * process output if it was previously disabled.
*/
public function testDisabledOutputInFailedExceptionDoesNotPopulateOutput()
{
$cmd = 'php';
$exitCode = 1;
$exitText = 'General error';
+ $workingDirectory = getcwd();
$process = $this->getMock(
'Symfony\Component\Process\Process',
- array('isSuccessful', 'isOutputDisabled', 'getExitCode', 'getExitCodeText', 'getOutput', 'getErrorOutput'),
+ array('isSuccessful', 'isOutputDisabled', 'getExitCode', 'getExitCodeText', 'getOutput', 'getErrorOutput', 'getWorkingDirectory'),
array($cmd)
);
$process->expects($this->once())
@@ -126,10 +132,14 @@ public function testDisabledOutputInFailedExceptionDoesNotPopulateOutput()
->method('isOutputDisabled')
->will($this->returnValue(true));
+ $process->expects($this->once())
+ ->method('getWorkingDirectory')
+ ->will($this->returnValue($workingDirectory));
+
$exception = new ProcessFailedException($process);
$this->assertEquals(
- "The command \"$cmd\" failed.\nExit Code: $exitCode($exitText)",
+ "The command \"$cmd\" failed.\n\nExit Code: $exitCode($exitText)\n\nWorking directory: {$workingDirectory}",
$exception->getMessage()
);
}
From 08bf50ab702214f81ec089a90c402e910ea97d88 Mon Sep 17 00:00:00 2001
From: "Alexander M. Turek"
Date: Thu, 12 Feb 2015 16:48:57 +0100
Subject: [PATCH 0003/3475] Allow parameter use_cookies in session
configuration.
---
.../FrameworkBundle/DependencyInjection/Configuration.php | 1 +
.../FrameworkBundle/DependencyInjection/FrameworkExtension.php | 2 +-
.../FrameworkBundle/Resources/config/schema/symfony-1.0.xsd | 1 +
.../Tests/DependencyInjection/Fixtures/php/full.php | 1 +
.../Tests/DependencyInjection/Fixtures/xml/full.xml | 2 +-
.../Tests/DependencyInjection/Fixtures/yml/full.yml | 1 +
.../Tests/DependencyInjection/FrameworkExtensionTest.php | 1 +
7 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php
index 977c0669c409c..bfaef92429a44 100644
--- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php
+++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php
@@ -341,6 +341,7 @@ private function addSessionSection(ArrayNodeDefinition $rootNode)
->scalarNode('cookie_domain')->end()
->booleanNode('cookie_secure')->end()
->booleanNode('cookie_httponly')->end()
+ ->booleanNode('use_cookies')->end()
->scalarNode('gc_divisor')->end()
->scalarNode('gc_probability')->defaultValue(1)->end()
->scalarNode('gc_maxlifetime')->end()
diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php
index e2e8a84163859..680bdf3efd319 100644
--- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php
+++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php
@@ -396,7 +396,7 @@ private function registerSessionConfiguration(array $config, ContainerBuilder $c
// session storage
$container->setAlias('session.storage', $config['storage_id']);
$options = array();
- foreach (array('name', 'cookie_lifetime', 'cookie_path', 'cookie_domain', 'cookie_secure', 'cookie_httponly', 'gc_maxlifetime', 'gc_probability', 'gc_divisor') as $key) {
+ foreach (array('name', 'cookie_lifetime', 'cookie_path', 'cookie_domain', 'cookie_secure', 'cookie_httponly', 'use_cookies', 'gc_maxlifetime', 'gc_probability', 'gc_divisor') as $key) {
if (isset($config[$key])) {
$options[$key] = $config[$key];
}
diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/config/schema/symfony-1.0.xsd b/src/Symfony/Bundle/FrameworkBundle/Resources/config/schema/symfony-1.0.xsd
index e1ca041e6114f..01862799c2836 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Resources/config/schema/symfony-1.0.xsd
+++ b/src/Symfony/Bundle/FrameworkBundle/Resources/config/schema/symfony-1.0.xsd
@@ -107,6 +107,7 @@
+
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/full.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/full.php
index a035b56d70029..8daf80533aa41 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/full.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/full.php
@@ -33,6 +33,7 @@
'cookie_domain' => 'example.com',
'cookie_secure' => true,
'cookie_httponly' => true,
+ 'use_cookies' => true,
'gc_maxlifetime' => 90000,
'gc_divisor' => 108,
'gc_probability' => 1,
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/full.xml b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/full.xml
index bf4537b910e8b..40151b3c9fb5b 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/full.xml
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/full.xml
@@ -14,7 +14,7 @@
-
+
text/csv
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/full.yml b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/full.yml
index 47513b1f665b5..8ace33413300a 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/full.yml
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/full.yml
@@ -25,6 +25,7 @@ framework:
cookie_domain: example.com
cookie_secure: true
cookie_httponly: true
+ use_cookies: true
gc_probability: 1
gc_divisor: 108
gc_maxlifetime: 90000
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php
index 4acefb43cbe41..e668d26c18411 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php
@@ -150,6 +150,7 @@ public function testSession()
$this->assertEquals('example.com', $options['cookie_domain']);
$this->assertTrue($options['cookie_secure']);
$this->assertTrue($options['cookie_httponly']);
+ $this->assertTrue($options['use_cookies']);
$this->assertEquals(108, $options['gc_divisor']);
$this->assertEquals(1, $options['gc_probability']);
$this->assertEquals(90000, $options['gc_maxlifetime']);
From 3d9e5de2b9dfec8d39b57486064b6e881548a86b Mon Sep 17 00:00:00 2001
From: Bernhard Schussek
Date: Tue, 23 Jun 2015 18:42:21 +0200
Subject: [PATCH 0004/3475] [Form] Deprecated FormTypeInterface::getName() and
passing of type instances
---
UPGRADE-2.8.md | 192 ++++++++++++-
.../Doctrine/Form/Type/DoctrineType.php | 8 +-
.../Bridge/Doctrine/Form/Type/EntityType.php | 17 +-
.../Tests/Form/Type/EntityTypeTest.php | 92 ++++---
src/Symfony/Bridge/Doctrine/composer.json | 2 +-
.../Extension/FormExtensionDivLayoutTest.php | 6 +-
.../DependencyInjection/Compiler/FormPass.php | 23 +-
.../FrameworkBundle/Resources/config/form.xml | 2 +
.../Compiler/FormPassTest.php | 223 +++++++++++++++
.../Controller/LoginController.php | 2 +-
...serLoginFormType.php => UserLoginType.php} | 16 +-
.../Functional/app/CsrfFormLogin/config.yml | 4 +-
.../Component/Form/AbstractExtension.php | 10 +-
src/Symfony/Component/Form/AbstractType.php | 29 +-
.../Form/Extension/Core/Type/BaseType.php | 13 +-
.../Form/Extension/Core/Type/BirthdayType.php | 10 +-
.../Form/Extension/Core/Type/ButtonType.php | 8 +
.../Form/Extension/Core/Type/CheckboxType.php | 8 +
.../Form/Extension/Core/Type/ChoiceType.php | 12 +-
.../Extension/Core/Type/CollectionType.php | 10 +-
.../Form/Extension/Core/Type/CountryType.php | 10 +-
.../Form/Extension/Core/Type/CurrencyType.php | 10 +-
.../Form/Extension/Core/Type/DateTimeType.php | 12 +-
.../Form/Extension/Core/Type/DateType.php | 19 +-
.../Form/Extension/Core/Type/EmailType.php | 10 +-
.../Form/Extension/Core/Type/FileType.php | 8 +
.../Form/Extension/Core/Type/FormType.php | 8 +
.../Form/Extension/Core/Type/HiddenType.php | 8 +
.../Form/Extension/Core/Type/IntegerType.php | 8 +
.../Form/Extension/Core/Type/LanguageType.php | 10 +-
.../Form/Extension/Core/Type/LocaleType.php | 10 +-
.../Form/Extension/Core/Type/MoneyType.php | 8 +
.../Form/Extension/Core/Type/NumberType.php | 8 +
.../Form/Extension/Core/Type/PasswordType.php | 10 +-
.../Form/Extension/Core/Type/PercentType.php | 8 +
.../Form/Extension/Core/Type/RadioType.php | 10 +-
.../Form/Extension/Core/Type/RangeType.php | 10 +-
.../Form/Extension/Core/Type/RepeatedType.php | 10 +-
.../Form/Extension/Core/Type/ResetType.php | 10 +-
.../Form/Extension/Core/Type/SearchType.php | 10 +-
.../Form/Extension/Core/Type/SubmitType.php | 10 +-
.../Form/Extension/Core/Type/TextType.php | 8 +
.../Form/Extension/Core/Type/TextareaType.php | 10 +-
.../Form/Extension/Core/Type/TimeType.php | 19 +-
.../Form/Extension/Core/Type/TimezoneType.php | 10 +-
.../Form/Extension/Core/Type/UrlType.php | 10 +-
.../Csrf/Type/FormTypeCsrfExtension.php | 4 +-
.../Proxy/ResolvedTypeDataCollectorProxy.php | 8 +
.../DependencyInjectionExtension.php | 32 ++-
.../Type/FormTypeValidatorExtension.php | 2 +-
.../Type/RepeatedTypeValidatorExtension.php | 2 +-
.../Type/SubmitTypeValidatorExtension.php | 2 +-
src/Symfony/Component/Form/FormBuilder.php | 2 +-
src/Symfony/Component/Form/FormFactory.php | 50 +++-
.../Component/Form/FormFactoryBuilder.php | 4 +-
.../Component/Form/FormFactoryInterface.php | 8 +-
src/Symfony/Component/Form/FormRegistry.php | 51 +++-
.../Component/Form/FormTypeInterface.php | 10 +-
.../Component/Form/PreloadedExtension.php | 15 +-
.../Component/Form/ResolvedFormType.php | 58 +++-
.../Tests/AbstractBootstrap3LayoutTest.php | 174 ++++++------
.../Form/Tests/AbstractDivLayoutTest.php | 138 +++++-----
.../Form/Tests/AbstractExtensionTest.php | 8 +-
.../Form/Tests/AbstractLayoutTest.php | 256 +++++++++---------
.../Form/Tests/AbstractRequestHandlerTest.php | 2 +-
.../Form/Tests/AbstractTableLayoutTest.php | 80 +++---
.../Tests/CompoundFormPerformanceTest.php | 14 +-
.../Component/Form/Tests/CompoundFormTest.php | 2 +-
.../Extension/Core/Type/BaseTypeTest.php | 12 +-
.../Extension/Core/Type/BirthdayTypeTest.php | 11 +-
.../Extension/Core/Type/ButtonTypeTest.php | 11 +-
.../Extension/Core/Type/CheckboxTypeTest.php | 33 ++-
.../Core/Type/ChoiceTypePerformanceTest.php | 2 +-
.../Extension/Core/Type/ChoiceTypeTest.php | 175 ++++++------
.../Core/Type/CollectionTypeTest.php | 85 +++---
.../Extension/Core/Type/CountryTypeTest.php | 11 +-
.../Extension/Core/Type/CurrencyTypeTest.php | 9 +-
.../Extension/Core/Type/DateTimeTypeTest.php | 61 +++--
.../Extension/Core/Type/DateTypeTest.php | 123 +++++----
.../Extension/Core/Type/FileTypeTest.php | 19 +-
.../Extension/Core/Type/FormTypeTest.php | 169 ++++++------
.../Extension/Core/Type/IntegerTypeTest.php | 9 +-
.../Extension/Core/Type/LanguageTypeTest.php | 11 +-
.../Extension/Core/Type/LocaleTypeTest.php | 9 +-
.../Extension/Core/Type/MoneyTypeTest.php | 15 +-
.../Extension/Core/Type/NumberTypeTest.php | 15 +-
.../Extension/Core/Type/PasswordTypeTest.php | 15 +-
.../Extension/Core/Type/RepeatedTypeTest.php | 47 ++--
.../Extension/Core/Type/SubmitTypeTest.php | 21 +-
.../Extension/Core/Type/TimeTypeTest.php | 95 ++++---
.../Extension/Core/Type/TimezoneTypeTest.php | 9 +-
.../Tests/Extension/Core/Type/UrlTypeTest.php | 19 +-
.../Csrf/Type/FormTypeCsrfExtensionTest.php | 51 ++--
.../FormValidatorPerformanceTest.php | 4 +-
.../Type/FormTypeValidatorExtensionTest.php | 6 +-
.../Type/SubmitTypeValidatorExtensionTest.php | 2 +-
.../Tests/Fixtures/AlternatingRowType.php | 9 +-
.../Form/Tests/Fixtures/AuthorType.php | 5 -
.../Form/Tests/Fixtures/FBooType.php | 18 ++
.../Component/Form/Tests/Fixtures/Foo.php | 18 ++
.../Form/Tests/Fixtures/Foo1Bar2Type.php | 18 ++
.../Form/Tests/Fixtures/FooBarHTMLType.php | 18 ++
.../Form/Tests/Fixtures/FooSubType.php | 7 +-
.../Component/Form/Tests/Fixtures/FooType.php | 5 -
.../Tests/Fixtures/FooTypeBarExtension.php | 2 +-
.../Tests/Fixtures/FooTypeBazExtension.php | 2 +-
.../Form/Tests/Fixtures/LegacyFooSubType.php | 27 ++
...=> LegacyFooSubTypeWithParentInstance.php} | 4 +-
.../Form/Tests/Fixtures/LegacyFooType.php | 26 ++
.../Fixtures/LegacyFooTypeBarExtension.php | 35 +++
.../Fixtures/LegacyFooTypeBazExtension.php | 28 ++
.../Form/Tests/Fixtures/TestExtension.php | 2 +-
.../Component/Form/Tests/Fixtures/Type.php | 18 ++
.../Component/Form/Tests/FormBuilderTest.php | 22 +-
.../Form/Tests/FormFactoryBuilderTest.php | 4 +-
.../Component/Form/Tests/FormFactoryTest.php | 200 +++++++++++++-
.../Component/Form/Tests/FormRegistryTest.php | 204 ++++++++++----
.../Form/Tests/ResolvedFormTypeTest.php | 125 ++++++++-
.../Component/Form/Tests/SimpleFormTest.php | 2 +-
.../Component/Form/Util/StringUtil.php | 15 +
120 files changed, 2704 insertions(+), 1032 deletions(-)
create mode 100644 src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/FormPassTest.php
rename src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/CsrfFormLoginBundle/Form/{UserLoginFormType.php => UserLoginType.php} (89%)
create mode 100644 src/Symfony/Component/Form/Tests/Fixtures/FBooType.php
create mode 100644 src/Symfony/Component/Form/Tests/Fixtures/Foo.php
create mode 100644 src/Symfony/Component/Form/Tests/Fixtures/Foo1Bar2Type.php
create mode 100644 src/Symfony/Component/Form/Tests/Fixtures/FooBarHTMLType.php
create mode 100644 src/Symfony/Component/Form/Tests/Fixtures/LegacyFooSubType.php
rename src/Symfony/Component/Form/Tests/Fixtures/{FooSubTypeWithParentInstance.php => LegacyFooSubTypeWithParentInstance.php} (82%)
create mode 100644 src/Symfony/Component/Form/Tests/Fixtures/LegacyFooType.php
create mode 100644 src/Symfony/Component/Form/Tests/Fixtures/LegacyFooTypeBarExtension.php
create mode 100644 src/Symfony/Component/Form/Tests/Fixtures/LegacyFooTypeBazExtension.php
create mode 100644 src/Symfony/Component/Form/Tests/Fixtures/Type.php
diff --git a/UPGRADE-2.8.md b/UPGRADE-2.8.md
index 966f1f4711132..f8471878f55a3 100644
--- a/UPGRADE-2.8.md
+++ b/UPGRADE-2.8.md
@@ -12,7 +12,7 @@ Form
Before:
```php
- $form = $this->createForm('form', $article, array('cascade_validation' => true))
+ $form = $this->createFormBuilder($article, array('cascade_validation' => true))
->add('author', new AuthorType())
->getForm();
```
@@ -22,7 +22,7 @@ Form
```php
use Symfony\Component\Validator\Constraints\Valid;
- $form = $this->createForm('form', $article)
+ $form = $this->createFormBuilder($article)
->add('author', new AuthorType(), array(
'constraints' => new Valid(),
))
@@ -42,6 +42,194 @@ Form
private $author;
}
```
+
+ * Type names were deprecated and will be removed in Symfony 3.0. Instead of
+ referencing types by name, you should reference them by their
+ fully-qualified class name (FQCN) instead. With PHP 5.5 or later, you can
+ use the "class" constant for that:
+
+ Before:
+
+ ```php
+ $form = $this->createFormBuilder()
+ ->add('name', 'text')
+ ->add('age', 'integer')
+ ->getForm();
+ ```
+
+ After:
+
+ ```php
+ use Symfony\Component\Form\Extension\Core\Type\IntegerType;
+ use Symfony\Component\Form\Extension\Core\Type\TextType;
+
+ $form = $this->createFormBuilder()
+ ->add('name', TextType::class)
+ ->add('age', IntegerType::class)
+ ->getForm();
+ ```
+
+ As a further consequence, the method `FormTypeInterface::getName()` was
+ deprecated and will be removed in Symfony 3.0. You should remove this method
+ from your form types.
+
+ If you want to customize the block prefix of a type in Twig, you should now
+ implement `FormTypeInterface::getBlockPrefix()` instead:
+
+ Before:
+
+ ```php
+ class UserProfileType extends AbstractType
+ {
+ public function getName()
+ {
+ return 'profile';
+ }
+ }
+ ```
+
+ After:
+
+ ```php
+ class UserProfileType extends AbstractType
+ {
+ public function getBlockPrefix()
+ {
+ return 'profile';
+ }
+ }
+ ```
+
+ If you don't customize `getBlockPrefix()`, it defaults to the class name
+ without "Type" suffix in underscore notation (here: "user_profile").
+
+ If you want to create types that are compatible with Symfony 2.3 up to 2.8
+ and don't trigger deprecation errors, implement *both* `getName()` and
+ `getBlockPrefix()`:
+
+ ```php
+ class ProfileType extends AbstractType
+ {
+ public function getName()
+ {
+ return $this->getBlockPrefix();
+ }
+
+ public function getBlockPrefix()
+ {
+ return 'profile';
+ }
+ }
+ ```
+
+ If you define your form types in the Dependency Injection configuration, you
+ should further remove the "alias" attribute:
+
+ Before:
+
+ ```xml
+
+
+
+ ```
+
+ After:
+
+ ```xml
+
+
+
+ ```
+
+ Type extension should return the fully-qualified class name of the extended
+ type from `FormTypeExtensionInterface::getExtendedType()` now.
+
+ Before:
+
+ ```php
+ class MyTypeExtension extends AbstractTypeExtension
+ {
+ public function getExtendedType()
+ {
+ return 'form';
+ }
+ }
+ ```
+
+ After:
+
+ ```php
+ use Symfony\Component\Form\Extension\Core\Type\FormType;
+
+ class MyTypeExtension extends AbstractTypeExtension
+ {
+ public function getExtendedType()
+ {
+ return FormType::class;
+ }
+ }
+ ```
+
+ If your extension has to be compatible with Symfony 2.3-2.8, use the
+ following statement:
+
+ ```php
+ use Symfony\Component\Form\AbstractType;
+ use Symfony\Component\Form\Extension\Core\Type\FormType;
+
+ class MyTypeExtension extends AbstractTypeExtension
+ {
+ public function getExtendedType()
+ {
+ method_exists(AbstractType::class, 'getBlockPrefix') ? FormType::class : 'form';
+ }
+ }
+ ```
+
+ * Returning type instances from `FormTypeInterface::getParent()` is deprecated
+ and will not be supported anymore in Symfony 3.0. Return the fully-qualified
+ class name of the parent type class instead.
+
+ Before:
+
+ ```php
+ class MyType
+ {
+ public function getParent()
+ {
+ return new ParentType();
+ }
+ }
+ ```
+
+ After:
+
+ ```php
+ class MyType
+ {
+ public function getParent()
+ {
+ return ParentType::class;
+ }
+ }
+ ```
+
+ * Passing type instances to `Form::add()`, `FormBuilder::add()` and the
+ `FormFactory::create*()` methods is deprecated and will not be supported
+ anymore in Symfony 3.0. Pass the fully-qualified class name of the type
+ instead.
+
+ Before:
+
+ ```php
+ $form = $this->createForm(new MyType());
+ ```
+
+ After:
+
+ ```php
+ $form = $this->createForm(MyType::class);
+ ```
Translator
----------
diff --git a/src/Symfony/Bridge/Doctrine/Form/Type/DoctrineType.php b/src/Symfony/Bridge/Doctrine/Form/Type/DoctrineType.php
index 2c5012dedff2c..084a7a019552e 100644
--- a/src/Symfony/Bridge/Doctrine/Form/Type/DoctrineType.php
+++ b/src/Symfony/Bridge/Doctrine/Form/Type/DoctrineType.php
@@ -94,12 +94,12 @@ public static function createChoiceName($choice, $key, $value)
* Gets important parts from QueryBuilder that will allow to cache its results.
* For instance in ORM two query builders with an equal SQL string and
* equal parameters are considered to be equal.
- *
+ *
* @param object $queryBuilder
- *
+ *
* @return array|false Array with important QueryBuilder parts or false if
* they can't be determined
- *
+ *
* @internal This method is public to be usable as callback. It should not
* be used in user code.
*/
@@ -335,6 +335,6 @@ abstract public function getLoader(ObjectManager $manager, $queryBuilder, $class
public function getParent()
{
- return 'choice';
+ return 'Symfony\Component\Form\Extension\Core\Type\ChoiceType';
}
}
diff --git a/src/Symfony/Bridge/Doctrine/Form/Type/EntityType.php b/src/Symfony/Bridge/Doctrine/Form/Type/EntityType.php
index 486eca94abf77..3a80ab03272f8 100644
--- a/src/Symfony/Bridge/Doctrine/Form/Type/EntityType.php
+++ b/src/Symfony/Bridge/Doctrine/Form/Type/EntityType.php
@@ -56,7 +56,18 @@ public function getLoader(ObjectManager $manager, $queryBuilder, $class)
return new ORMQueryBuilderLoader($queryBuilder, $manager, $class);
}
+ /**
+ * {@inheritdoc}
+ */
public function getName()
+ {
+ return $this->getBlockPrefix();
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getBlockPrefix()
{
return 'entity';
}
@@ -64,11 +75,11 @@ public function getName()
/**
* We consider two query builders with an equal SQL string and
* equal parameters to be equal.
- *
+ *
* @param QueryBuilder $queryBuilder
- *
+ *
* @return array
- *
+ *
* @internal This method is public to be usable as callback. It should not
* be used in user code.
*/
diff --git a/src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypeTest.php b/src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypeTest.php
index e22db0093ca3e..79b94308abd20 100644
--- a/src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypeTest.php
+++ b/src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypeTest.php
@@ -102,12 +102,22 @@ protected function persist(array $entities)
// be managed!
}
+ public function testLegacyName()
+ {
+ $field = $this->factory->createNamed('name', 'entity', null, array(
+ 'em' => 'default',
+ 'class' => self::SINGLE_IDENT_CLASS,
+ ));
+
+ $this->assertSame('entity', $field->getConfig()->getType()->getName());
+ }
+
/**
* @expectedException \Symfony\Component\OptionsResolver\Exception\MissingOptionsException
*/
public function testClassOptionIsRequired()
{
- $this->factory->createNamed('name', 'entity');
+ $this->factory->createNamed('name', 'Symfony\Bridge\Doctrine\Form\Type\EntityType');
}
/**
@@ -115,7 +125,7 @@ public function testClassOptionIsRequired()
*/
public function testInvalidClassOption()
{
- $this->factory->createNamed('name', 'entity', null, array(
+ $this->factory->createNamed('name', 'Symfony\Bridge\Doctrine\Form\Type\EntityType', null, array(
'class' => 'foo',
));
}
@@ -127,7 +137,7 @@ public function testSetDataToUninitializedEntityWithNonRequired()
$this->persist(array($entity1, $entity2));
- $field = $this->factory->createNamed('name', 'entity', null, array(
+ $field = $this->factory->createNamed('name', 'Symfony\Bridge\Doctrine\Form\Type\EntityType', null, array(
'em' => 'default',
'class' => self::SINGLE_IDENT_CLASS,
'required' => false,
@@ -144,7 +154,7 @@ public function testSetDataToUninitializedEntityWithNonRequiredToString()
$this->persist(array($entity1, $entity2));
- $field = $this->factory->createNamed('name', 'entity', null, array(
+ $field = $this->factory->createNamed('name', 'Symfony\Bridge\Doctrine\Form\Type\EntityType', null, array(
'em' => 'default',
'class' => self::SINGLE_IDENT_CLASS,
'required' => false,
@@ -161,7 +171,7 @@ public function testSetDataToUninitializedEntityWithNonRequiredQueryBuilder()
$this->persist(array($entity1, $entity2));
$qb = $this->em->createQueryBuilder()->select('e')->from(self::SINGLE_IDENT_CLASS, 'e');
- $field = $this->factory->createNamed('name', 'entity', null, array(
+ $field = $this->factory->createNamed('name', 'Symfony\Bridge\Doctrine\Form\Type\EntityType', null, array(
'em' => 'default',
'class' => self::SINGLE_IDENT_CLASS,
'required' => false,
@@ -177,7 +187,7 @@ public function testSetDataToUninitializedEntityWithNonRequiredQueryBuilder()
*/
public function testConfigureQueryBuilderWithNonQueryBuilderAndNonClosure()
{
- $field = $this->factory->createNamed('name', 'entity', null, array(
+ $field = $this->factory->createNamed('name', 'Symfony\Bridge\Doctrine\Form\Type\EntityType', null, array(
'em' => 'default',
'class' => self::SINGLE_IDENT_CLASS,
'query_builder' => new \stdClass(),
@@ -189,7 +199,7 @@ public function testConfigureQueryBuilderWithNonQueryBuilderAndNonClosure()
*/
public function testConfigureQueryBuilderWithClosureReturningNonQueryBuilder()
{
- $field = $this->factory->createNamed('name', 'entity', null, array(
+ $field = $this->factory->createNamed('name', 'Symfony\Bridge\Doctrine\Form\Type\EntityType', null, array(
'em' => 'default',
'class' => self::SINGLE_IDENT_CLASS,
'query_builder' => function () {
@@ -202,7 +212,7 @@ public function testConfigureQueryBuilderWithClosureReturningNonQueryBuilder()
public function testSetDataSingleNull()
{
- $field = $this->factory->createNamed('name', 'entity', null, array(
+ $field = $this->factory->createNamed('name', 'Symfony\Bridge\Doctrine\Form\Type\EntityType', null, array(
'multiple' => false,
'em' => 'default',
'class' => self::SINGLE_IDENT_CLASS,
@@ -215,7 +225,7 @@ public function testSetDataSingleNull()
public function testSetDataMultipleExpandedNull()
{
- $field = $this->factory->createNamed('name', 'entity', null, array(
+ $field = $this->factory->createNamed('name', 'Symfony\Bridge\Doctrine\Form\Type\EntityType', null, array(
'multiple' => true,
'expanded' => true,
'em' => 'default',
@@ -229,7 +239,7 @@ public function testSetDataMultipleExpandedNull()
public function testSetDataMultipleNonExpandedNull()
{
- $field = $this->factory->createNamed('name', 'entity', null, array(
+ $field = $this->factory->createNamed('name', 'Symfony\Bridge\Doctrine\Form\Type\EntityType', null, array(
'multiple' => true,
'expanded' => false,
'em' => 'default',
@@ -243,7 +253,7 @@ public function testSetDataMultipleNonExpandedNull()
public function testSubmitSingleExpandedNull()
{
- $field = $this->factory->createNamed('name', 'entity', null, array(
+ $field = $this->factory->createNamed('name', 'Symfony\Bridge\Doctrine\Form\Type\EntityType', null, array(
'multiple' => false,
'expanded' => true,
'em' => 'default',
@@ -257,7 +267,7 @@ public function testSubmitSingleExpandedNull()
public function testSubmitSingleNonExpandedNull()
{
- $field = $this->factory->createNamed('name', 'entity', null, array(
+ $field = $this->factory->createNamed('name', 'Symfony\Bridge\Doctrine\Form\Type\EntityType', null, array(
'multiple' => false,
'expanded' => false,
'em' => 'default',
@@ -271,7 +281,7 @@ public function testSubmitSingleNonExpandedNull()
public function testSubmitMultipleNull()
{
- $field = $this->factory->createNamed('name', 'entity', null, array(
+ $field = $this->factory->createNamed('name', 'Symfony\Bridge\Doctrine\Form\Type\EntityType', null, array(
'multiple' => true,
'em' => 'default',
'class' => self::SINGLE_IDENT_CLASS,
@@ -289,7 +299,7 @@ public function testSubmitSingleNonExpandedSingleIdentifier()
$this->persist(array($entity1, $entity2));
- $field = $this->factory->createNamed('name', 'entity', null, array(
+ $field = $this->factory->createNamed('name', 'Symfony\Bridge\Doctrine\Form\Type\EntityType', null, array(
'multiple' => false,
'expanded' => false,
'em' => 'default',
@@ -311,7 +321,7 @@ public function testSubmitSingleNonExpandedCompositeIdentifier()
$this->persist(array($entity1, $entity2));
- $field = $this->factory->createNamed('name', 'entity', null, array(
+ $field = $this->factory->createNamed('name', 'Symfony\Bridge\Doctrine\Form\Type\EntityType', null, array(
'multiple' => false,
'expanded' => false,
'em' => 'default',
@@ -335,7 +345,7 @@ public function testSubmitMultipleNonExpandedSingleIdentifier()
$this->persist(array($entity1, $entity2, $entity3));
- $field = $this->factory->createNamed('name', 'entity', null, array(
+ $field = $this->factory->createNamed('name', 'Symfony\Bridge\Doctrine\Form\Type\EntityType', null, array(
'multiple' => true,
'expanded' => false,
'em' => 'default',
@@ -360,7 +370,7 @@ public function testSubmitMultipleNonExpandedSingleIdentifierForExistingData()
$this->persist(array($entity1, $entity2, $entity3));
- $field = $this->factory->createNamed('name', 'entity', null, array(
+ $field = $this->factory->createNamed('name', 'Symfony\Bridge\Doctrine\Form\Type\EntityType', null, array(
'multiple' => true,
'expanded' => false,
'em' => 'default',
@@ -391,7 +401,7 @@ public function testSubmitMultipleNonExpandedCompositeIdentifier()
$this->persist(array($entity1, $entity2, $entity3));
- $field = $this->factory->createNamed('name', 'entity', null, array(
+ $field = $this->factory->createNamed('name', 'Symfony\Bridge\Doctrine\Form\Type\EntityType', null, array(
'multiple' => true,
'expanded' => false,
'em' => 'default',
@@ -417,7 +427,7 @@ public function testSubmitMultipleNonExpandedCompositeIdentifierExistingData()
$this->persist(array($entity1, $entity2, $entity3));
- $field = $this->factory->createNamed('name', 'entity', null, array(
+ $field = $this->factory->createNamed('name', 'Symfony\Bridge\Doctrine\Form\Type\EntityType', null, array(
'multiple' => true,
'expanded' => false,
'em' => 'default',
@@ -447,7 +457,7 @@ public function testSubmitSingleExpanded()
$this->persist(array($entity1, $entity2));
- $field = $this->factory->createNamed('name', 'entity', null, array(
+ $field = $this->factory->createNamed('name', 'Symfony\Bridge\Doctrine\Form\Type\EntityType', null, array(
'multiple' => false,
'expanded' => true,
'em' => 'default',
@@ -473,7 +483,7 @@ public function testSubmitMultipleExpanded()
$this->persist(array($entity1, $entity2, $entity3));
- $field = $this->factory->createNamed('name', 'entity', null, array(
+ $field = $this->factory->createNamed('name', 'Symfony\Bridge\Doctrine\Form\Type\EntityType', null, array(
'multiple' => true,
'expanded' => true,
'em' => 'default',
@@ -503,7 +513,7 @@ public function testOverrideChoices()
$this->persist(array($entity1, $entity2, $entity3));
- $field = $this->factory->createNamed('name', 'entity', null, array(
+ $field = $this->factory->createNamed('name', 'Symfony\Bridge\Doctrine\Form\Type\EntityType', null, array(
'em' => 'default',
'class' => self::SINGLE_IDENT_CLASS,
// not all persisted entities should be displayed
@@ -528,7 +538,7 @@ public function testGroupByChoices()
$this->persist(array($item1, $item2, $item3, $item4));
- $field = $this->factory->createNamed('name', 'entity', null, array(
+ $field = $this->factory->createNamed('name', 'Symfony\Bridge\Doctrine\Form\Type\EntityType', null, array(
'em' => 'default',
'class' => self::ITEM_GROUP_CLASS,
'choices' => array($item1, $item2, $item3, $item4),
@@ -559,7 +569,7 @@ public function testPreferredChoices()
$this->persist(array($entity1, $entity2, $entity3));
- $field = $this->factory->createNamed('name', 'entity', null, array(
+ $field = $this->factory->createNamed('name', 'Symfony\Bridge\Doctrine\Form\Type\EntityType', null, array(
'em' => 'default',
'class' => self::SINGLE_IDENT_CLASS,
'preferred_choices' => array($entity3, $entity2),
@@ -578,7 +588,7 @@ public function testOverrideChoicesWithPreferredChoices()
$this->persist(array($entity1, $entity2, $entity3));
- $field = $this->factory->createNamed('name', 'entity', null, array(
+ $field = $this->factory->createNamed('name', 'Symfony\Bridge\Doctrine\Form\Type\EntityType', null, array(
'em' => 'default',
'class' => self::SINGLE_IDENT_CLASS,
'choices' => array($entity2, $entity3),
@@ -598,7 +608,7 @@ public function testDisallowChoicesThatAreNotIncludedChoicesSingleIdentifier()
$this->persist(array($entity1, $entity2, $entity3));
- $field = $this->factory->createNamed('name', 'entity', null, array(
+ $field = $this->factory->createNamed('name', 'Symfony\Bridge\Doctrine\Form\Type\EntityType', null, array(
'em' => 'default',
'class' => self::SINGLE_IDENT_CLASS,
'choices' => array($entity1, $entity2),
@@ -619,7 +629,7 @@ public function testDisallowChoicesThatAreNotIncludedChoicesCompositeIdentifier(
$this->persist(array($entity1, $entity2, $entity3));
- $field = $this->factory->createNamed('name', 'entity', null, array(
+ $field = $this->factory->createNamed('name', 'Symfony\Bridge\Doctrine\Form\Type\EntityType', null, array(
'em' => 'default',
'class' => self::COMPOSITE_IDENT_CLASS,
'choices' => array($entity1, $entity2),
@@ -642,7 +652,7 @@ public function testDisallowChoicesThatAreNotIncludedQueryBuilderSingleIdentifie
$repository = $this->em->getRepository(self::SINGLE_IDENT_CLASS);
- $field = $this->factory->createNamed('name', 'entity', null, array(
+ $field = $this->factory->createNamed('name', 'Symfony\Bridge\Doctrine\Form\Type\EntityType', null, array(
'em' => 'default',
'class' => self::SINGLE_IDENT_CLASS,
'query_builder' => $repository->createQueryBuilder('e')
@@ -664,7 +674,7 @@ public function testDisallowChoicesThatAreNotIncludedQueryBuilderAsClosureSingle
$this->persist(array($entity1, $entity2, $entity3));
- $field = $this->factory->createNamed('name', 'entity', null, array(
+ $field = $this->factory->createNamed('name', 'Symfony\Bridge\Doctrine\Form\Type\EntityType', null, array(
'em' => 'default',
'class' => self::SINGLE_IDENT_CLASS,
'query_builder' => function ($repository) {
@@ -688,7 +698,7 @@ public function testDisallowChoicesThatAreNotIncludedQueryBuilderAsClosureCompos
$this->persist(array($entity1, $entity2, $entity3));
- $field = $this->factory->createNamed('name', 'entity', null, array(
+ $field = $this->factory->createNamed('name', 'Symfony\Bridge\Doctrine\Form\Type\EntityType', null, array(
'em' => 'default',
'class' => self::COMPOSITE_IDENT_CLASS,
'query_builder' => function ($repository) {
@@ -710,7 +720,7 @@ public function testSubmitSingleStringIdentifier()
$this->persist(array($entity1));
- $field = $this->factory->createNamed('name', 'entity', null, array(
+ $field = $this->factory->createNamed('name', 'Symfony\Bridge\Doctrine\Form\Type\EntityType', null, array(
'multiple' => false,
'expanded' => false,
'em' => 'default',
@@ -731,7 +741,7 @@ public function testSubmitCompositeStringIdentifier()
$this->persist(array($entity1));
- $field = $this->factory->createNamed('name', 'entity', null, array(
+ $field = $this->factory->createNamed('name', 'Symfony\Bridge\Doctrine\Form\Type\EntityType', null, array(
'multiple' => false,
'expanded' => false,
'em' => 'default',
@@ -757,7 +767,7 @@ public function testGetManagerForClassIfNoEm()
->with(self::SINGLE_IDENT_CLASS)
->will($this->returnValue($this->em));
- $this->factory->createNamed('name', 'entity', null, array(
+ $this->factory->createNamed('name', 'Symfony\Bridge\Doctrine\Form\Type\EntityType', null, array(
'class' => self::SINGLE_IDENT_CLASS,
'required' => false,
'choice_label' => 'name',
@@ -772,7 +782,7 @@ public function testExplicitEm()
$this->emRegistry->expects($this->never())
->method('getManagerForClass');
- $this->factory->createNamed('name', 'entity', null, array(
+ $this->factory->createNamed('name', 'Symfony\Bridge\Doctrine\Form\Type\EntityType', null, array(
'em' => $this->em,
'class' => self::SINGLE_IDENT_CLASS,
'choice_label' => 'name',
@@ -801,15 +811,15 @@ public function testLoaderCaching()
->addTypeGuesser($entityTypeGuesser)
->getFormFactory();
- $formBuilder = $factory->createNamedBuilder('form', 'form');
+ $formBuilder = $factory->createNamedBuilder('form', 'Symfony\Component\Form\Extension\Core\Type\FormType');
- $formBuilder->add('property1', 'entity', array(
+ $formBuilder->add('property1', 'Symfony\Bridge\Doctrine\Form\Type\EntityType', array(
'em' => 'default',
'class' => self::SINGLE_IDENT_CLASS,
'query_builder' => $repo->createQueryBuilder('e')->where('e.id IN (1, 2)'),
));
- $formBuilder->add('property2', 'entity', array(
+ $formBuilder->add('property2', 'Symfony\Bridge\Doctrine\Form\Type\EntityType', array(
'em' => 'default',
'class' => self::SINGLE_IDENT_CLASS,
'query_builder' => function (EntityRepository $repo) {
@@ -817,7 +827,7 @@ public function testLoaderCaching()
},
));
- $formBuilder->add('property3', 'entity', array(
+ $formBuilder->add('property3', 'Symfony\Bridge\Doctrine\Form\Type\EntityType', array(
'em' => 'default',
'class' => self::SINGLE_IDENT_CLASS,
'query_builder' => function (EntityRepository $repo) {
@@ -848,14 +858,14 @@ public function testCacheChoiceLists()
$this->persist(array($entity1));
- $field1 = $this->factory->createNamed('name', 'entity', null, array(
+ $field1 = $this->factory->createNamed('name', 'Symfony\Bridge\Doctrine\Form\Type\EntityType', null, array(
'em' => 'default',
'class' => self::SINGLE_IDENT_CLASS,
'required' => false,
'choice_label' => 'name',
));
- $field2 = $this->factory->createNamed('name', 'entity', null, array(
+ $field2 = $this->factory->createNamed('name', 'Symfony\Bridge\Doctrine\Form\Type\EntityType', null, array(
'em' => 'default',
'class' => self::SINGLE_IDENT_CLASS,
'required' => false,
@@ -876,7 +886,7 @@ public function testPropertyOption()
$this->persist(array($entity1, $entity2));
- $field = $this->factory->createNamed('name', 'entity', null, array(
+ $field = $this->factory->createNamed('name', 'Symfony\Bridge\Doctrine\Form\Type\EntityType', null, array(
'em' => 'default',
'class' => self::SINGLE_IDENT_CLASS,
'required' => false,
diff --git a/src/Symfony/Bridge/Doctrine/composer.json b/src/Symfony/Bridge/Doctrine/composer.json
index b76704cba7154..39161c9bdef0a 100644
--- a/src/Symfony/Bridge/Doctrine/composer.json
+++ b/src/Symfony/Bridge/Doctrine/composer.json
@@ -23,7 +23,7 @@
"symfony/phpunit-bridge": "~2.7|~3.0.0",
"symfony/stopwatch": "~2.2|~3.0.0",
"symfony/dependency-injection": "~2.2|~3.0.0",
- "symfony/form": "~2.7,>=2.7.1|~3.0.0",
+ "symfony/form": "~2.8|~3.0.0",
"symfony/http-kernel": "~2.2|~3.0.0",
"symfony/property-access": "~2.3|~3.0.0",
"symfony/security": "~2.2|~3.0.0",
diff --git a/src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionDivLayoutTest.php b/src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionDivLayoutTest.php
index 2581144a1cd75..e720836c9558a 100644
--- a/src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionDivLayoutTest.php
+++ b/src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionDivLayoutTest.php
@@ -69,7 +69,7 @@ protected function tearDown()
public function testThemeBlockInheritanceUsingUse()
{
$view = $this->factory
- ->createNamed('name', 'email')
+ ->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\EmailType')
->createView()
;
@@ -84,7 +84,7 @@ public function testThemeBlockInheritanceUsingUse()
public function testThemeBlockInheritanceUsingExtend()
{
$view = $this->factory
- ->createNamed('name', 'email')
+ ->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\EmailType')
->createView()
;
@@ -99,7 +99,7 @@ public function testThemeBlockInheritanceUsingExtend()
public function testThemeBlockInheritanceUsingDynamicExtend()
{
$view = $this->factory
- ->createNamed('name', 'email')
+ ->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\EmailType')
->createView()
;
diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/FormPass.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/FormPass.php
index 8b46b946e550d..2074946cf0432 100644
--- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/FormPass.php
+++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Compiler/FormPass.php
@@ -33,16 +33,29 @@ public function process(ContainerBuilder $container)
// Builds an array with service IDs as keys and tag aliases as values
$types = array();
+ // Remember which names will not be supported in Symfony 3.0 to trigger
+ // deprecation errors
+ $legacyNames = array();
+
foreach ($container->findTaggedServiceIds('form.type') as $serviceId => $tag) {
- $alias = isset($tag[0]['alias'])
- ? $tag[0]['alias']
- : $serviceId;
+ // The following if-else block is deprecated and will be removed
+ // in Symfony 3.0
+ // Deprecation errors are triggered in DependencyInjectionExtension
+ if (isset($tag[0]['alias'])) {
+ $types[$tag[0]['alias']] = $serviceId;
+ $legacyNames[$tag[0]['alias']] = true;
+ } else {
+ $types[$serviceId] = $serviceId;
+ $legacyNames[$serviceId] = true;
+ }
- // Flip, because we want tag aliases (= type identifiers) as keys
- $types[$alias] = $serviceId;
+ // Support type access by FQCN
+ $serviceDefinition = $container->getDefinition($serviceId);
+ $types[$serviceDefinition->getClass()] = $serviceId;
}
$definition->replaceArgument(1, $types);
+ $definition->replaceArgument(4, $legacyNames);
$typeExtensions = array();
diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/config/form.xml b/src/Symfony/Bundle/FrameworkBundle/Resources/config/form.xml
index 10e8f807899fb..5f12f57c1eb79 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Resources/config/form.xml
+++ b/src/Symfony/Bundle/FrameworkBundle/Resources/config/form.xml
@@ -46,6 +46,8 @@
+
+
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/FormPassTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/FormPassTest.php
new file mode 100644
index 0000000000000..8318cf6f6492f
--- /dev/null
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Compiler/FormPassTest.php
@@ -0,0 +1,223 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Bundle\FrameworkBundle\Tests\DependencyInjection\Compiler;
+
+use Symfony\Bundle\FrameworkBundle\DependencyInjection\Compiler\FormPass;
+use Symfony\Component\DependencyInjection\ContainerBuilder;
+use Symfony\Component\DependencyInjection\Definition;
+use Symfony\Component\DependencyInjection\Reference;
+use Symfony\Component\Form\AbstractType;
+
+/**
+ * @author Bernhard Schussek
+ */
+class FormPassTest extends \PHPUnit_Framework_TestCase
+{
+ public function testDoNothingIfFormExtensionNotLoaded()
+ {
+ $container = new ContainerBuilder();
+ $container->addCompilerPass(new FormPass());
+
+ $container->compile();
+
+ $this->assertFalse($container->hasDefinition('form.extension'));
+ }
+
+ public function testAddTaggedTypes()
+ {
+ $container = new ContainerBuilder();
+ $container->addCompilerPass(new FormPass());
+
+ $extDefinition = new Definition('Symfony\Component\Form\Extension\DependencyInjection\DependencyInjectionExtension');
+ $extDefinition->setArguments(array(
+ new Reference('service_container'),
+ array(),
+ array(),
+ array(),
+ array(),
+ ));
+
+ $definition1 = new Definition(__CLASS__.'_Type1');
+ $definition1->addTag('form.type');
+ $definition2 = new Definition(__CLASS__.'_Type2');
+ $definition2->addTag('form.type');
+
+ $container->setDefinition('form.extension', $extDefinition);
+ $container->setDefinition('my.type1', $definition1);
+ $container->setDefinition('my.type2', $definition2);
+
+ $container->compile();
+
+ $extDefinition = $container->getDefinition('form.extension');
+
+ $this->assertEquals(array(
+ // As of Symfony 2.8, the class is used to look up types
+ __CLASS__.'_Type1' => 'my.type1',
+ __CLASS__.'_Type2' => 'my.type2',
+ // Before Symfony 2.8, the service ID was used as default alias
+ 'my.type1' => 'my.type1',
+ 'my.type2' => 'my.type2',
+ ), $extDefinition->getArgument(1));
+ }
+
+ public function testUseCustomAliasIfSet()
+ {
+ $container = new ContainerBuilder();
+ $container->addCompilerPass(new FormPass());
+
+ $extDefinition = new Definition('Symfony\Component\Form\Extension\DependencyInjection\DependencyInjectionExtension');
+ $extDefinition->setArguments(array(
+ new Reference('service_container'),
+ array(),
+ array(),
+ array(),
+ array(),
+ ));
+
+ $definition1 = new Definition(__CLASS__.'_Type1');
+ $definition1->addTag('form.type', array('alias' => 'mytype1'));
+ $definition2 = new Definition(__CLASS__.'_Type2');
+ $definition2->addTag('form.type', array('alias' => 'mytype2'));
+
+ $container->setDefinition('form.extension', $extDefinition);
+ $container->setDefinition('my.type1', $definition1);
+ $container->setDefinition('my.type2', $definition2);
+
+ $container->compile();
+
+ $extDefinition = $container->getDefinition('form.extension');
+
+ $this->assertEquals(array(
+ __CLASS__.'_Type1' => 'my.type1',
+ __CLASS__.'_Type2' => 'my.type2',
+ 'mytype1' => 'my.type1',
+ 'mytype2' => 'my.type2',
+ ), $extDefinition->getArgument(1));
+ }
+
+ public function testPassLegacyNames()
+ {
+ $container = new ContainerBuilder();
+ $container->addCompilerPass(new FormPass());
+
+ $extDefinition = new Definition('Symfony\Component\Form\Extension\DependencyInjection\DependencyInjectionExtension');
+ $extDefinition->setArguments(array(
+ new Reference('service_container'),
+ array(),
+ array(),
+ array(),
+ array(),
+ ));
+
+ $definition1 = new Definition(__CLASS__.'_Type1');
+ $definition1->addTag('form.type');
+ $definition2 = new Definition(__CLASS__.'_Type2');
+ $definition2->addTag('form.type', array('alias' => 'mytype2'));
+
+ $container->setDefinition('form.extension', $extDefinition);
+ $container->setDefinition('my.type1', $definition1);
+ $container->setDefinition('my.type2', $definition2);
+
+ $container->compile();
+
+ $extDefinition = $container->getDefinition('form.extension');
+
+ $this->assertEquals(array(
+ // Service ID if no alias is set
+ 'my.type1' => true,
+ // Alias if set
+ 'mytype2' => true,
+ ), $extDefinition->getArgument(4));
+ }
+
+ public function testAddTaggedTypeExtensions()
+ {
+ $container = new ContainerBuilder();
+ $container->addCompilerPass(new FormPass());
+
+ $extDefinition = new Definition('Symfony\Component\Form\Extension\DependencyInjection\DependencyInjectionExtension');
+ $extDefinition->setArguments(array(
+ new Reference('service_container'),
+ array(),
+ array(),
+ array(),
+ array(),
+ ));
+
+ $definition1 = new Definition('stdClass');
+ $definition1->addTag('form.type_extension', array('alias' => 'type1'));
+ $definition2 = new Definition('stdClass');
+ $definition2->addTag('form.type_extension', array('alias' => 'type1'));
+ $definition3 = new Definition('stdClass');
+ $definition3->addTag('form.type_extension', array('alias' => 'type2'));
+
+ $container->setDefinition('form.extension', $extDefinition);
+ $container->setDefinition('my.type_extension1', $definition1);
+ $container->setDefinition('my.type_extension2', $definition2);
+ $container->setDefinition('my.type_extension3', $definition3);
+
+ $container->compile();
+
+ $extDefinition = $container->getDefinition('form.extension');
+
+ $this->assertSame(array(
+ 'type1' => array(
+ 'my.type_extension1',
+ 'my.type_extension2',
+ ),
+ 'type2' => array(
+ 'my.type_extension3',
+ ),
+ ), $extDefinition->getArgument(2));
+ }
+
+ public function testAddTaggedGuessers()
+ {
+ $container = new ContainerBuilder();
+ $container->addCompilerPass(new FormPass());
+
+ $extDefinition = new Definition('Symfony\Component\Form\Extension\DependencyInjection\DependencyInjectionExtension');
+ $extDefinition->setArguments(array(
+ new Reference('service_container'),
+ array(),
+ array(),
+ array(),
+ array(),
+ ));
+
+ $definition1 = new Definition('stdClass');
+ $definition1->addTag('form.type_guesser');
+ $definition2 = new Definition('stdClass');
+ $definition2->addTag('form.type_guesser');
+
+ $container->setDefinition('form.extension', $extDefinition);
+ $container->setDefinition('my.guesser1', $definition1);
+ $container->setDefinition('my.guesser2', $definition2);
+
+ $container->compile();
+
+ $extDefinition = $container->getDefinition('form.extension');
+
+ $this->assertSame(array(
+ 'my.guesser1',
+ 'my.guesser2',
+ ), $extDefinition->getArgument(3));
+ }
+}
+
+class FormPassTest_Type1 extends AbstractType
+{
+}
+
+class FormPassTest_Type2 extends AbstractType
+{
+}
diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/CsrfFormLoginBundle/Controller/LoginController.php b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/CsrfFormLoginBundle/Controller/LoginController.php
index 1eccbfd795bea..dd7c19e9c7f15 100644
--- a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/CsrfFormLoginBundle/Controller/LoginController.php
+++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/CsrfFormLoginBundle/Controller/LoginController.php
@@ -19,7 +19,7 @@ class LoginController extends ContainerAware
{
public function loginAction()
{
- $form = $this->container->get('form.factory')->create('user_login');
+ $form = $this->container->get('form.factory')->create('Symfony\Bundle\SecurityBundle\Tests\Functional\Bundle\CsrfFormLoginBundle\Form\UserLoginType');
return $this->container->get('templating')->renderResponse('CsrfFormLoginBundle:Login:login.html.twig', array(
'form' => $form->createView(),
diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/CsrfFormLoginBundle/Form/UserLoginFormType.php b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/CsrfFormLoginBundle/Form/UserLoginType.php
similarity index 89%
rename from src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/CsrfFormLoginBundle/Form/UserLoginFormType.php
rename to src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/CsrfFormLoginBundle/Form/UserLoginType.php
index 04d41752c83ea..48b87fbecbfc1 100644
--- a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/CsrfFormLoginBundle/Form/UserLoginFormType.php
+++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/Bundle/CsrfFormLoginBundle/Form/UserLoginType.php
@@ -27,7 +27,7 @@
* @author Henrik Bjornskov
* @author Jeremy Mikola
*/
-class UserLoginFormType extends AbstractType
+class UserLoginType extends AbstractType
{
private $requestStack;
@@ -45,9 +45,9 @@ public function __construct(RequestStack $requestStack)
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder
- ->add('username', 'text')
- ->add('password', 'password')
- ->add('_target_path', 'hidden')
+ ->add('username', 'Symfony\Component\Form\Extension\Core\Type\TextType')
+ ->add('password', 'Symfony\Component\Form\Extension\Core\Type\PasswordType')
+ ->add('_target_path', 'Symfony\Component\Form\Extension\Core\Type\HiddenType')
;
$request = $this->requestStack->getCurrentRequest();
@@ -87,12 +87,4 @@ public function configureOptions(OptionsResolver $resolver)
'intention' => 'authenticate',
));
}
-
- /**
- * {@inheritdoc}
- */
- public function getName()
- {
- return 'user_login';
- }
}
diff --git a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/CsrfFormLogin/config.yml b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/CsrfFormLogin/config.yml
index 2b97bd5a66384..d7ad6049aa616 100644
--- a/src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/CsrfFormLogin/config.yml
+++ b/src/Symfony/Bundle/SecurityBundle/Tests/Functional/app/CsrfFormLogin/config.yml
@@ -3,11 +3,11 @@ imports:
services:
csrf_form_login.form.type:
- class: Symfony\Bundle\SecurityBundle\Tests\Functional\Bundle\CsrfFormLoginBundle\Form\UserLoginFormType
+ class: Symfony\Bundle\SecurityBundle\Tests\Functional\Bundle\CsrfFormLoginBundle\Form\UserLoginType
arguments:
- @request_stack
tags:
- - { name: form.type, alias: user_login }
+ - { name: form.type }
security:
encoders:
diff --git a/src/Symfony/Component/Form/AbstractExtension.php b/src/Symfony/Component/Form/AbstractExtension.php
index a2eef508f315a..2233a83a416bd 100644
--- a/src/Symfony/Component/Form/AbstractExtension.php
+++ b/src/Symfony/Component/Form/AbstractExtension.php
@@ -156,7 +156,15 @@ private function initTypes()
throw new UnexpectedTypeException($type, 'Symfony\Component\Form\FormTypeInterface');
}
- $this->types[$type->getName()] = $type;
+ // Since Symfony 3.0 types are identified by their FQCN
+ $fqcn = get_class($type);
+ $legacyName = $type->getName();
+
+ $this->types[$fqcn] = $type;
+
+ if ($legacyName) {
+ $this->types[$legacyName] = $type;
+ }
}
}
diff --git a/src/Symfony/Component/Form/AbstractType.php b/src/Symfony/Component/Form/AbstractType.php
index 1e74d99e4937e..42666614e8b79 100644
--- a/src/Symfony/Component/Form/AbstractType.php
+++ b/src/Symfony/Component/Form/AbstractType.php
@@ -11,6 +11,7 @@
namespace Symfony\Component\Form;
+use Symfony\Component\Form\Util\StringUtil;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;
@@ -61,11 +62,37 @@ public function configureOptions(OptionsResolver $resolver)
{
}
+ /**
+ * {@inheritdoc}
+ */
+ public function getName()
+ {
+ // As of Symfony 2.8, the name defaults to the fully-qualified class name
+ return get_class($this);
+ }
+
+ /**
+ * Returns the prefix of the template block name for this type.
+ *
+ * The block prefixes defaults to the underscored short class name with
+ * the "Type" suffix removed (e.g. "UserProfileType" => "user_profile").
+ *
+ * @return string The prefix of the template block name
+ */
+ public function getBlockPrefix()
+ {
+ $fqcn = get_class($this);
+ $name = $this->getName();
+
+ // For BC: Use the name as block prefix if one is set
+ return $name !== $fqcn ? $name : StringUtil::fqcnToBlockPrefix($fqcn);
+ }
+
/**
* {@inheritdoc}
*/
public function getParent()
{
- return 'form';
+ return 'Symfony\Component\Form\Extension\Core\Type\FormType';
}
}
diff --git a/src/Symfony/Component/Form/Extension/Core/Type/BaseType.php b/src/Symfony/Component/Form/Extension/Core/Type/BaseType.php
index c0e30f303452a..b36a67f36b0f7 100644
--- a/src/Symfony/Component/Form/Extension/Core/Type/BaseType.php
+++ b/src/Symfony/Component/Form/Extension/Core/Type/BaseType.php
@@ -15,6 +15,7 @@
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\Form\FormInterface;
use Symfony\Component\Form\FormView;
+use Symfony\Component\Form\Util\StringUtil;
use Symfony\Component\OptionsResolver\OptionsResolver;
/**
@@ -77,7 +78,17 @@ public function buildView(FormView $view, FormInterface $form, array $options)
$blockPrefixes = array();
for ($type = $form->getConfig()->getType(); null !== $type; $type = $type->getParent()) {
- array_unshift($blockPrefixes, $type->getName());
+ if (method_exists($type, 'getBlockPrefix')) {
+ array_unshift($blockPrefixes, $type->getBlockPrefix());
+ } else {
+ @trigger_error(get_class($type).': The ResolvedFormTypeInterface::getBlockPrefix() method will be added in version 3.0. You should add it to your implementation.', E_USER_DEPRECATED);
+
+ $fqcn = get_class($type->getInnerType());
+ $name = $type->getName();
+ $hasCustomName = $name !== $fqcn;
+
+ array_unshift($blockPrefixes, $hasCustomName ? $name : StringUtil::fqcnToBlockPrefix($fqcn));
+ }
}
$blockPrefixes[] = $uniqueBlockPrefix;
diff --git a/src/Symfony/Component/Form/Extension/Core/Type/BirthdayType.php b/src/Symfony/Component/Form/Extension/Core/Type/BirthdayType.php
index 057ec54d8c6ca..3548a609fea46 100644
--- a/src/Symfony/Component/Form/Extension/Core/Type/BirthdayType.php
+++ b/src/Symfony/Component/Form/Extension/Core/Type/BirthdayType.php
@@ -31,13 +31,21 @@ public function configureOptions(OptionsResolver $resolver)
*/
public function getParent()
{
- return 'date';
+ return __NAMESPACE__.'\DateType';
}
/**
* {@inheritdoc}
*/
public function getName()
+ {
+ return $this->getBlockPrefix();
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getBlockPrefix()
{
return 'birthday';
}
diff --git a/src/Symfony/Component/Form/Extension/Core/Type/ButtonType.php b/src/Symfony/Component/Form/Extension/Core/Type/ButtonType.php
index 7456adc93dd97..9e58b80245615 100644
--- a/src/Symfony/Component/Form/Extension/Core/Type/ButtonType.php
+++ b/src/Symfony/Component/Form/Extension/Core/Type/ButtonType.php
@@ -32,6 +32,14 @@ public function getParent()
* {@inheritdoc}
*/
public function getName()
+ {
+ return $this->getBlockPrefix();
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getBlockPrefix()
{
return 'button';
}
diff --git a/src/Symfony/Component/Form/Extension/Core/Type/CheckboxType.php b/src/Symfony/Component/Form/Extension/Core/Type/CheckboxType.php
index 53a5e05275735..ddf7a5e5fcdbd 100644
--- a/src/Symfony/Component/Form/Extension/Core/Type/CheckboxType.php
+++ b/src/Symfony/Component/Form/Extension/Core/Type/CheckboxType.php
@@ -66,6 +66,14 @@ public function configureOptions(OptionsResolver $resolver)
* {@inheritdoc}
*/
public function getName()
+ {
+ return $this->getBlockPrefix();
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getBlockPrefix()
{
return 'checkbox';
}
diff --git a/src/Symfony/Component/Form/Extension/Core/Type/ChoiceType.php b/src/Symfony/Component/Form/Extension/Core/Type/ChoiceType.php
index 386f27dbc91a0..66444659d4315 100644
--- a/src/Symfony/Component/Form/Extension/Core/Type/ChoiceType.php
+++ b/src/Symfony/Component/Form/Extension/Core/Type/ChoiceType.php
@@ -361,6 +361,14 @@ public function configureOptions(OptionsResolver $resolver)
* {@inheritdoc}
*/
public function getName()
+ {
+ return $this->getBlockPrefix();
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getBlockPrefix()
{
return 'choice';
}
@@ -424,12 +432,12 @@ private function addSubForm(FormBuilderInterface $builder, $name, ChoiceView $ch
);
if ($options['multiple']) {
- $choiceType = 'checkbox';
+ $choiceType = __NAMESPACE__.'\CheckboxType';
// The user can check 0 or more checkboxes. If required
// is true, he is required to check all of them.
$choiceOpts['required'] = false;
} else {
- $choiceType = 'radio';
+ $choiceType = __NAMESPACE__.'\RadioType';
}
$builder->add($name, $choiceType, $choiceOpts);
diff --git a/src/Symfony/Component/Form/Extension/Core/Type/CollectionType.php b/src/Symfony/Component/Form/Extension/Core/Type/CollectionType.php
index 32001e81bdc6a..508013b312ed3 100644
--- a/src/Symfony/Component/Form/Extension/Core/Type/CollectionType.php
+++ b/src/Symfony/Component/Form/Extension/Core/Type/CollectionType.php
@@ -88,7 +88,7 @@ public function configureOptions(OptionsResolver $resolver)
'prototype' => true,
'prototype_data' => null,
'prototype_name' => '__name__',
- 'type' => 'text',
+ 'type' => __NAMESPACE__.'\TextType',
'options' => array(),
'delete_empty' => false,
));
@@ -100,6 +100,14 @@ public function configureOptions(OptionsResolver $resolver)
* {@inheritdoc}
*/
public function getName()
+ {
+ return $this->getBlockPrefix();
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getBlockPrefix()
{
return 'collection';
}
diff --git a/src/Symfony/Component/Form/Extension/Core/Type/CountryType.php b/src/Symfony/Component/Form/Extension/Core/Type/CountryType.php
index 30ee0a0f9e89c..45da8d509a56a 100644
--- a/src/Symfony/Component/Form/Extension/Core/Type/CountryType.php
+++ b/src/Symfony/Component/Form/Extension/Core/Type/CountryType.php
@@ -33,13 +33,21 @@ public function configureOptions(OptionsResolver $resolver)
*/
public function getParent()
{
- return 'choice';
+ return __NAMESPACE__.'\ChoiceType';
}
/**
* {@inheritdoc}
*/
public function getName()
+ {
+ return $this->getBlockPrefix();
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getBlockPrefix()
{
return 'country';
}
diff --git a/src/Symfony/Component/Form/Extension/Core/Type/CurrencyType.php b/src/Symfony/Component/Form/Extension/Core/Type/CurrencyType.php
index b473d139e6566..7a26316e01a47 100644
--- a/src/Symfony/Component/Form/Extension/Core/Type/CurrencyType.php
+++ b/src/Symfony/Component/Form/Extension/Core/Type/CurrencyType.php
@@ -33,13 +33,21 @@ public function configureOptions(OptionsResolver $resolver)
*/
public function getParent()
{
- return 'choice';
+ return __NAMESPACE__.'\ChoiceType';
}
/**
* {@inheritdoc}
*/
public function getName()
+ {
+ return $this->getBlockPrefix();
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getBlockPrefix()
{
return 'currency';
}
diff --git a/src/Symfony/Component/Form/Extension/Core/Type/DateTimeType.php b/src/Symfony/Component/Form/Extension/Core/Type/DateTimeType.php
index 24fa3e5424615..cddeac9b4dc28 100644
--- a/src/Symfony/Component/Form/Extension/Core/Type/DateTimeType.php
+++ b/src/Symfony/Component/Form/Extension/Core/Type/DateTimeType.php
@@ -161,8 +161,8 @@ public function buildForm(FormBuilderInterface $builder, array $options)
'time' => $timeParts,
)),
)))
- ->add('date', 'date', $dateOptions)
- ->add('time', 'time', $timeOptions)
+ ->add('date', __NAMESPACE__.'\DateType', $dateOptions)
+ ->add('time', __NAMESPACE__.'\TimeType', $timeOptions)
;
}
@@ -284,6 +284,14 @@ public function configureOptions(OptionsResolver $resolver)
* {@inheritdoc}
*/
public function getName()
+ {
+ return $this->getBlockPrefix();
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getBlockPrefix()
{
return 'datetime';
}
diff --git a/src/Symfony/Component/Form/Extension/Core/Type/DateType.php b/src/Symfony/Component/Form/Extension/Core/Type/DateType.php
index 9c567d76e2c01..59500c89155c8 100644
--- a/src/Symfony/Component/Form/Extension/Core/Type/DateType.php
+++ b/src/Symfony/Component/Form/Extension/Core/Type/DateType.php
@@ -37,6 +37,11 @@ class DateType extends AbstractType
\IntlDateFormatter::SHORT,
);
+ private static $widgets = array(
+ 'text' => 'Symfony\Component\Form\Extension\Core\Type\TextType',
+ 'choice' => 'Symfony\Component\Form\Extension\Core\Type\ChoiceType',
+ );
+
/**
* {@inheritdoc}
*/
@@ -101,9 +106,9 @@ public function buildForm(FormBuilderInterface $builder, array $options)
}
$builder
- ->add('year', $options['widget'], $yearOptions)
- ->add('month', $options['widget'], $monthOptions)
- ->add('day', $options['widget'], $dayOptions)
+ ->add('year', self::$widgets[$options['widget']], $yearOptions)
+ ->add('month', self::$widgets[$options['widget']], $monthOptions)
+ ->add('day', self::$widgets[$options['widget']], $dayOptions)
->addViewTransformer(new DateTimeToArrayTransformer(
$options['model_timezone'], $options['view_timezone'], array('year', 'month', 'day')
))
@@ -253,6 +258,14 @@ public function configureOptions(OptionsResolver $resolver)
* {@inheritdoc}
*/
public function getName()
+ {
+ return $this->getBlockPrefix();
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getBlockPrefix()
{
return 'date';
}
diff --git a/src/Symfony/Component/Form/Extension/Core/Type/EmailType.php b/src/Symfony/Component/Form/Extension/Core/Type/EmailType.php
index 26652ef6603b2..019a09e0e1c3e 100644
--- a/src/Symfony/Component/Form/Extension/Core/Type/EmailType.php
+++ b/src/Symfony/Component/Form/Extension/Core/Type/EmailType.php
@@ -20,13 +20,21 @@ class EmailType extends AbstractType
*/
public function getParent()
{
- return 'text';
+ return __NAMESPACE__.'\TextType';
}
/**
* {@inheritdoc}
*/
public function getName()
+ {
+ return $this->getBlockPrefix();
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getBlockPrefix()
{
return 'email';
}
diff --git a/src/Symfony/Component/Form/Extension/Core/Type/FileType.php b/src/Symfony/Component/Form/Extension/Core/Type/FileType.php
index bc24899de5cb0..6c67b8dc4b595 100644
--- a/src/Symfony/Component/Form/Extension/Core/Type/FileType.php
+++ b/src/Symfony/Component/Form/Extension/Core/Type/FileType.php
@@ -61,6 +61,14 @@ public function configureOptions(OptionsResolver $resolver)
* {@inheritdoc}
*/
public function getName()
+ {
+ return $this->getBlockPrefix();
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getBlockPrefix()
{
return 'file';
}
diff --git a/src/Symfony/Component/Form/Extension/Core/Type/FormType.php b/src/Symfony/Component/Form/Extension/Core/Type/FormType.php
index 9d5be03bf6e59..734c56b0eb1d8 100644
--- a/src/Symfony/Component/Form/Extension/Core/Type/FormType.php
+++ b/src/Symfony/Component/Form/Extension/Core/Type/FormType.php
@@ -244,6 +244,14 @@ public function getParent()
* {@inheritdoc}
*/
public function getName()
+ {
+ return $this->getBlockPrefix();
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getBlockPrefix()
{
return 'form';
}
diff --git a/src/Symfony/Component/Form/Extension/Core/Type/HiddenType.php b/src/Symfony/Component/Form/Extension/Core/Type/HiddenType.php
index 37b25435e1842..5287bb7c1db0f 100644
--- a/src/Symfony/Component/Form/Extension/Core/Type/HiddenType.php
+++ b/src/Symfony/Component/Form/Extension/Core/Type/HiddenType.php
@@ -34,6 +34,14 @@ public function configureOptions(OptionsResolver $resolver)
* {@inheritdoc}
*/
public function getName()
+ {
+ return $this->getBlockPrefix();
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getBlockPrefix()
{
return 'hidden';
}
diff --git a/src/Symfony/Component/Form/Extension/Core/Type/IntegerType.php b/src/Symfony/Component/Form/Extension/Core/Type/IntegerType.php
index 512844f43a037..8e790793b96ed 100644
--- a/src/Symfony/Component/Form/Extension/Core/Type/IntegerType.php
+++ b/src/Symfony/Component/Form/Extension/Core/Type/IntegerType.php
@@ -73,6 +73,14 @@ public function configureOptions(OptionsResolver $resolver)
* {@inheritdoc}
*/
public function getName()
+ {
+ return $this->getBlockPrefix();
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getBlockPrefix()
{
return 'integer';
}
diff --git a/src/Symfony/Component/Form/Extension/Core/Type/LanguageType.php b/src/Symfony/Component/Form/Extension/Core/Type/LanguageType.php
index 9d071eb8b03ee..6fc6031af11c2 100644
--- a/src/Symfony/Component/Form/Extension/Core/Type/LanguageType.php
+++ b/src/Symfony/Component/Form/Extension/Core/Type/LanguageType.php
@@ -33,13 +33,21 @@ public function configureOptions(OptionsResolver $resolver)
*/
public function getParent()
{
- return 'choice';
+ return __NAMESPACE__.'\ChoiceType';
}
/**
* {@inheritdoc}
*/
public function getName()
+ {
+ return $this->getBlockPrefix();
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getBlockPrefix()
{
return 'language';
}
diff --git a/src/Symfony/Component/Form/Extension/Core/Type/LocaleType.php b/src/Symfony/Component/Form/Extension/Core/Type/LocaleType.php
index f09f5a62f1e29..a6d42f8c917ee 100644
--- a/src/Symfony/Component/Form/Extension/Core/Type/LocaleType.php
+++ b/src/Symfony/Component/Form/Extension/Core/Type/LocaleType.php
@@ -33,13 +33,21 @@ public function configureOptions(OptionsResolver $resolver)
*/
public function getParent()
{
- return 'choice';
+ return __NAMESPACE__.'\ChoiceType';
}
/**
* {@inheritdoc}
*/
public function getName()
+ {
+ return $this->getBlockPrefix();
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getBlockPrefix()
{
return 'locale';
}
diff --git a/src/Symfony/Component/Form/Extension/Core/Type/MoneyType.php b/src/Symfony/Component/Form/Extension/Core/Type/MoneyType.php
index 267fe9eaf636c..788f9460f5c36 100644
--- a/src/Symfony/Component/Form/Extension/Core/Type/MoneyType.php
+++ b/src/Symfony/Component/Form/Extension/Core/Type/MoneyType.php
@@ -78,6 +78,14 @@ public function configureOptions(OptionsResolver $resolver)
* {@inheritdoc}
*/
public function getName()
+ {
+ return $this->getBlockPrefix();
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getBlockPrefix()
{
return 'money';
}
diff --git a/src/Symfony/Component/Form/Extension/Core/Type/NumberType.php b/src/Symfony/Component/Form/Extension/Core/Type/NumberType.php
index b53961a81a404..7794349ae2adb 100644
--- a/src/Symfony/Component/Form/Extension/Core/Type/NumberType.php
+++ b/src/Symfony/Component/Form/Extension/Core/Type/NumberType.php
@@ -71,6 +71,14 @@ public function configureOptions(OptionsResolver $resolver)
* {@inheritdoc}
*/
public function getName()
+ {
+ return $this->getBlockPrefix();
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getBlockPrefix()
{
return 'number';
}
diff --git a/src/Symfony/Component/Form/Extension/Core/Type/PasswordType.php b/src/Symfony/Component/Form/Extension/Core/Type/PasswordType.php
index 611eb4d4a3004..2aa1808972b5a 100644
--- a/src/Symfony/Component/Form/Extension/Core/Type/PasswordType.php
+++ b/src/Symfony/Component/Form/Extension/Core/Type/PasswordType.php
@@ -44,13 +44,21 @@ public function configureOptions(OptionsResolver $resolver)
*/
public function getParent()
{
- return 'text';
+ return __NAMESPACE__.'\TextType';
}
/**
* {@inheritdoc}
*/
public function getName()
+ {
+ return $this->getBlockPrefix();
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getBlockPrefix()
{
return 'password';
}
diff --git a/src/Symfony/Component/Form/Extension/Core/Type/PercentType.php b/src/Symfony/Component/Form/Extension/Core/Type/PercentType.php
index ff8beff72bc26..1fbad1aaa0d35 100644
--- a/src/Symfony/Component/Form/Extension/Core/Type/PercentType.php
+++ b/src/Symfony/Component/Form/Extension/Core/Type/PercentType.php
@@ -62,6 +62,14 @@ public function configureOptions(OptionsResolver $resolver)
* {@inheritdoc}
*/
public function getName()
+ {
+ return $this->getBlockPrefix();
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getBlockPrefix()
{
return 'percent';
}
diff --git a/src/Symfony/Component/Form/Extension/Core/Type/RadioType.php b/src/Symfony/Component/Form/Extension/Core/Type/RadioType.php
index dfa7c7d53bd5f..43110d99697e0 100644
--- a/src/Symfony/Component/Form/Extension/Core/Type/RadioType.php
+++ b/src/Symfony/Component/Form/Extension/Core/Type/RadioType.php
@@ -20,13 +20,21 @@ class RadioType extends AbstractType
*/
public function getParent()
{
- return 'checkbox';
+ return __NAMESPACE__.'\CheckboxType';
}
/**
* {@inheritdoc}
*/
public function getName()
+ {
+ return $this->getBlockPrefix();
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getBlockPrefix()
{
return 'radio';
}
diff --git a/src/Symfony/Component/Form/Extension/Core/Type/RangeType.php b/src/Symfony/Component/Form/Extension/Core/Type/RangeType.php
index 78909e643f5a7..b70926f354edc 100644
--- a/src/Symfony/Component/Form/Extension/Core/Type/RangeType.php
+++ b/src/Symfony/Component/Form/Extension/Core/Type/RangeType.php
@@ -20,13 +20,21 @@ class RangeType extends AbstractType
*/
public function getParent()
{
- return 'text';
+ return __NAMESPACE__.'\TextType';
}
/**
* {@inheritdoc}
*/
public function getName()
+ {
+ return $this->getBlockPrefix();
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getBlockPrefix()
{
return 'range';
}
diff --git a/src/Symfony/Component/Form/Extension/Core/Type/RepeatedType.php b/src/Symfony/Component/Form/Extension/Core/Type/RepeatedType.php
index 950dc740056b0..f46dba7f7af32 100644
--- a/src/Symfony/Component/Form/Extension/Core/Type/RepeatedType.php
+++ b/src/Symfony/Component/Form/Extension/Core/Type/RepeatedType.php
@@ -47,7 +47,7 @@ public function buildForm(FormBuilderInterface $builder, array $options)
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults(array(
- 'type' => 'text',
+ 'type' => __NAMESPACE__.'\TextType',
'options' => array(),
'first_options' => array(),
'second_options' => array(),
@@ -65,6 +65,14 @@ public function configureOptions(OptionsResolver $resolver)
* {@inheritdoc}
*/
public function getName()
+ {
+ return $this->getBlockPrefix();
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getBlockPrefix()
{
return 'repeated';
}
diff --git a/src/Symfony/Component/Form/Extension/Core/Type/ResetType.php b/src/Symfony/Component/Form/Extension/Core/Type/ResetType.php
index cf55f7c5910a1..6d8421355d52f 100644
--- a/src/Symfony/Component/Form/Extension/Core/Type/ResetType.php
+++ b/src/Symfony/Component/Form/Extension/Core/Type/ResetType.php
@@ -26,13 +26,21 @@ class ResetType extends AbstractType implements ButtonTypeInterface
*/
public function getParent()
{
- return 'button';
+ return __NAMESPACE__.'\ButtonType';
}
/**
* {@inheritdoc}
*/
public function getName()
+ {
+ return $this->getBlockPrefix();
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getBlockPrefix()
{
return 'reset';
}
diff --git a/src/Symfony/Component/Form/Extension/Core/Type/SearchType.php b/src/Symfony/Component/Form/Extension/Core/Type/SearchType.php
index bf82972d56bc2..a5148740ce84f 100644
--- a/src/Symfony/Component/Form/Extension/Core/Type/SearchType.php
+++ b/src/Symfony/Component/Form/Extension/Core/Type/SearchType.php
@@ -20,13 +20,21 @@ class SearchType extends AbstractType
*/
public function getParent()
{
- return 'text';
+ return __NAMESPACE__.'\TextType';
}
/**
* {@inheritdoc}
*/
public function getName()
+ {
+ return $this->getBlockPrefix();
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getBlockPrefix()
{
return 'search';
}
diff --git a/src/Symfony/Component/Form/Extension/Core/Type/SubmitType.php b/src/Symfony/Component/Form/Extension/Core/Type/SubmitType.php
index 6d160b969214b..d102fc9579114 100644
--- a/src/Symfony/Component/Form/Extension/Core/Type/SubmitType.php
+++ b/src/Symfony/Component/Form/Extension/Core/Type/SubmitType.php
@@ -33,13 +33,21 @@ public function buildView(FormView $view, FormInterface $form, array $options)
*/
public function getParent()
{
- return 'button';
+ return __NAMESPACE__.'\ButtonType';
}
/**
* {@inheritdoc}
*/
public function getName()
+ {
+ return $this->getBlockPrefix();
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getBlockPrefix()
{
return 'submit';
}
diff --git a/src/Symfony/Component/Form/Extension/Core/Type/TextType.php b/src/Symfony/Component/Form/Extension/Core/Type/TextType.php
index 4aef1cd6e6218..86df235385435 100644
--- a/src/Symfony/Component/Form/Extension/Core/Type/TextType.php
+++ b/src/Symfony/Component/Form/Extension/Core/Type/TextType.php
@@ -30,6 +30,14 @@ public function configureOptions(OptionsResolver $resolver)
* {@inheritdoc}
*/
public function getName()
+ {
+ return $this->getBlockPrefix();
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getBlockPrefix()
{
return 'text';
}
diff --git a/src/Symfony/Component/Form/Extension/Core/Type/TextareaType.php b/src/Symfony/Component/Form/Extension/Core/Type/TextareaType.php
index 0e749b155433a..9bbd9b5671c39 100644
--- a/src/Symfony/Component/Form/Extension/Core/Type/TextareaType.php
+++ b/src/Symfony/Component/Form/Extension/Core/Type/TextareaType.php
@@ -30,13 +30,21 @@ public function buildView(FormView $view, FormInterface $form, array $options)
*/
public function getParent()
{
- return 'text';
+ return __NAMESPACE__.'\TextType';
}
/**
* {@inheritdoc}
*/
public function getName()
+ {
+ return $this->getBlockPrefix();
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getBlockPrefix()
{
return 'textarea';
}
diff --git a/src/Symfony/Component/Form/Extension/Core/Type/TimeType.php b/src/Symfony/Component/Form/Extension/Core/Type/TimeType.php
index 49f77c5bd1d66..d4803d03e7699 100644
--- a/src/Symfony/Component/Form/Extension/Core/Type/TimeType.php
+++ b/src/Symfony/Component/Form/Extension/Core/Type/TimeType.php
@@ -25,6 +25,11 @@
class TimeType extends AbstractType
{
+ private static $widgets = array(
+ 'text' => 'Symfony\Component\Form\Extension\Core\Type\TextType',
+ 'choice' => 'Symfony\Component\Form\Extension\Core\Type\ChoiceType',
+ );
+
/**
* {@inheritdoc}
*/
@@ -99,14 +104,14 @@ public function buildForm(FormBuilderInterface $builder, array $options)
}
}
- $builder->add('hour', $options['widget'], $hourOptions);
+ $builder->add('hour', self::$widgets[$options['widget']], $hourOptions);
if ($options['with_minutes']) {
- $builder->add('minute', $options['widget'], $minuteOptions);
+ $builder->add('minute', self::$widgets[$options['widget']], $minuteOptions);
}
if ($options['with_seconds']) {
- $builder->add('second', $options['widget'], $secondOptions);
+ $builder->add('second', self::$widgets[$options['widget']], $secondOptions);
}
$builder->addViewTransformer(new DateTimeToArrayTransformer($options['model_timezone'], $options['view_timezone'], $parts, 'text' === $options['widget']));
@@ -238,6 +243,14 @@ public function configureOptions(OptionsResolver $resolver)
* {@inheritdoc}
*/
public function getName()
+ {
+ return $this->getBlockPrefix();
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getBlockPrefix()
{
return 'time';
}
diff --git a/src/Symfony/Component/Form/Extension/Core/Type/TimezoneType.php b/src/Symfony/Component/Form/Extension/Core/Type/TimezoneType.php
index 82c07e2f121ba..3277a1838636c 100644
--- a/src/Symfony/Component/Form/Extension/Core/Type/TimezoneType.php
+++ b/src/Symfony/Component/Form/Extension/Core/Type/TimezoneType.php
@@ -39,13 +39,21 @@ public function configureOptions(OptionsResolver $resolver)
*/
public function getParent()
{
- return 'choice';
+ return __NAMESPACE__.'\ChoiceType';
}
/**
* {@inheritdoc}
*/
public function getName()
+ {
+ return $this->getBlockPrefix();
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getBlockPrefix()
{
return 'timezone';
}
diff --git a/src/Symfony/Component/Form/Extension/Core/Type/UrlType.php b/src/Symfony/Component/Form/Extension/Core/Type/UrlType.php
index 3b087e1865c17..a723a90a27b67 100644
--- a/src/Symfony/Component/Form/Extension/Core/Type/UrlType.php
+++ b/src/Symfony/Component/Form/Extension/Core/Type/UrlType.php
@@ -43,13 +43,21 @@ public function configureOptions(OptionsResolver $resolver)
*/
public function getParent()
{
- return 'text';
+ return __NAMESPACE__.'\TextType';
}
/**
* {@inheritdoc}
*/
public function getName()
+ {
+ return $this->getBlockPrefix();
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getBlockPrefix()
{
return 'url';
}
diff --git a/src/Symfony/Component/Form/Extension/Csrf/Type/FormTypeCsrfExtension.php b/src/Symfony/Component/Form/Extension/Csrf/Type/FormTypeCsrfExtension.php
index 35d8648215855..cf5038ae1f6cd 100644
--- a/src/Symfony/Component/Form/Extension/Csrf/Type/FormTypeCsrfExtension.php
+++ b/src/Symfony/Component/Form/Extension/Csrf/Type/FormTypeCsrfExtension.php
@@ -108,7 +108,7 @@ public function finishView(FormView $view, FormInterface $form, array $options)
$tokenId = $options['csrf_token_id'] ?: ($form->getName() ?: get_class($form->getConfig()->getType()->getInnerType()));
$data = (string) $options['csrf_token_manager']->getToken($tokenId);
- $csrfForm = $factory->createNamed($options['csrf_field_name'], 'hidden', $data, array(
+ $csrfForm = $factory->createNamed($options['csrf_field_name'], 'Symfony\Component\Form\Extension\Core\Type\HiddenType', $data, array(
'mapped' => false,
));
@@ -153,6 +153,6 @@ public function configureOptions(OptionsResolver $resolver)
*/
public function getExtendedType()
{
- return 'form';
+ return 'Symfony\Component\Form\Extension\Core\Type\FormType';
}
}
diff --git a/src/Symfony/Component/Form/Extension/DataCollector/Proxy/ResolvedTypeDataCollectorProxy.php b/src/Symfony/Component/Form/Extension/DataCollector/Proxy/ResolvedTypeDataCollectorProxy.php
index 960048a0c2ee6..24d690cc89f5f 100644
--- a/src/Symfony/Component/Form/Extension/DataCollector/Proxy/ResolvedTypeDataCollectorProxy.php
+++ b/src/Symfony/Component/Form/Extension/DataCollector/Proxy/ResolvedTypeDataCollectorProxy.php
@@ -50,6 +50,14 @@ public function getName()
return $this->proxiedType->getName();
}
+ /**
+ * {@inheritdoc}
+ */
+ public function getBlockPrefix()
+ {
+ return method_exists($this->proxiedType, 'getBlockPrefix') ? $this->proxiedType->getBlockPrefix() : $this->getName();
+ }
+
/**
* {@inheritdoc}
*/
diff --git a/src/Symfony/Component/Form/Extension/DependencyInjection/DependencyInjectionExtension.php b/src/Symfony/Component/Form/Extension/DependencyInjection/DependencyInjectionExtension.php
index 685e8cf2996d5..2c3730c46d8ec 100644
--- a/src/Symfony/Component/Form/Extension/DependencyInjection/DependencyInjectionExtension.php
+++ b/src/Symfony/Component/Form/Extension/DependencyInjection/DependencyInjectionExtension.php
@@ -22,17 +22,19 @@ class DependencyInjectionExtension implements FormExtensionInterface
private $typeServiceIds;
private $typeExtensionServiceIds;
private $guesserServiceIds;
+ private $legacyNames;
private $guesser;
private $guesserLoaded = false;
public function __construct(ContainerInterface $container,
array $typeServiceIds, array $typeExtensionServiceIds,
- array $guesserServiceIds)
+ array $guesserServiceIds, array $legacyNames = array())
{
$this->container = $container;
$this->typeServiceIds = $typeServiceIds;
$this->typeExtensionServiceIds = $typeExtensionServiceIds;
$this->guesserServiceIds = $guesserServiceIds;
+ $this->legacyNames = $legacyNames;
}
public function getType($name)
@@ -41,15 +43,21 @@ public function getType($name)
throw new InvalidArgumentException(sprintf('The field type "%s" is not registered with the service container.', $name));
}
+ if (isset($this->legacyNames[$name])) {
+ @trigger_error('Accessing form types by type name/service ID is deprecated since version 2.8 and will not be supported in 3.0. Use the fully-qualified type class name instead.', E_USER_DEPRECATED);
+ }
+
$type = $this->container->get($this->typeServiceIds[$name]);
- if ($type->getName() !== $name) {
+ // BC: validate result of getName() for legacy names (non-FQCN)
+ if (isset($this->legacyNames[$name]) && $type->getName() !== $name) {
throw new InvalidArgumentException(
sprintf('The type name specified for the service "%s" does not match the actual name. Expected "%s", given "%s"',
$this->typeServiceIds[$name],
$name,
$type->getName()
- ));
+ )
+ );
}
return $type;
@@ -57,11 +65,23 @@ public function getType($name)
public function hasType($name)
{
- return isset($this->typeServiceIds[$name]);
+ if (isset($this->typeServiceIds[$name])) {
+ if (isset($this->legacyNames[$name])) {
+ @trigger_error('Accessing form types by type name/service ID is deprecated since version 2.8 and will not be supported in 3.0. Use the fully-qualified type class name instead.', E_USER_DEPRECATED);
+ }
+
+ return true;
+ }
+
+ return false;
}
public function getTypeExtensions($name)
{
+ if (isset($this->legacyNames[$name])) {
+ @trigger_error('Accessing form types by type name/service ID is deprecated since version 2.8 and will not be supported in 3.0. Use the fully-qualified type class name instead.', E_USER_DEPRECATED);
+ }
+
$extensions = array();
if (isset($this->typeExtensionServiceIds[$name])) {
@@ -75,6 +95,10 @@ public function getTypeExtensions($name)
public function hasTypeExtensions($name)
{
+ if (isset($this->legacyNames[$name])) {
+ @trigger_error('Accessing form types by type name/service ID is deprecated since version 2.8 and will not be supported in 3.0. Use the fully-qualified type class name instead.', E_USER_DEPRECATED);
+ }
+
return isset($this->typeExtensionServiceIds[$name]);
}
diff --git a/src/Symfony/Component/Form/Extension/Validator/Type/FormTypeValidatorExtension.php b/src/Symfony/Component/Form/Extension/Validator/Type/FormTypeValidatorExtension.php
index 97c0d67997ece..066a3d9eec3f7 100644
--- a/src/Symfony/Component/Form/Extension/Validator/Type/FormTypeValidatorExtension.php
+++ b/src/Symfony/Component/Form/Extension/Validator/Type/FormTypeValidatorExtension.php
@@ -94,6 +94,6 @@ public function configureOptions(OptionsResolver $resolver)
*/
public function getExtendedType()
{
- return 'form';
+ return 'Symfony\Component\Form\Extension\Core\Type\FormType';
}
}
diff --git a/src/Symfony/Component/Form/Extension/Validator/Type/RepeatedTypeValidatorExtension.php b/src/Symfony/Component/Form/Extension/Validator/Type/RepeatedTypeValidatorExtension.php
index 3eacceae63224..ff27fbdb474fe 100644
--- a/src/Symfony/Component/Form/Extension/Validator/Type/RepeatedTypeValidatorExtension.php
+++ b/src/Symfony/Component/Form/Extension/Validator/Type/RepeatedTypeValidatorExtension.php
@@ -40,6 +40,6 @@ public function configureOptions(OptionsResolver $resolver)
*/
public function getExtendedType()
{
- return 'repeated';
+ return 'Symfony\Component\Form\Extension\Core\Type\RepeatedType';
}
}
diff --git a/src/Symfony/Component/Form/Extension/Validator/Type/SubmitTypeValidatorExtension.php b/src/Symfony/Component/Form/Extension/Validator/Type/SubmitTypeValidatorExtension.php
index ff1c762ef072d..fa844eb1331ad 100644
--- a/src/Symfony/Component/Form/Extension/Validator/Type/SubmitTypeValidatorExtension.php
+++ b/src/Symfony/Component/Form/Extension/Validator/Type/SubmitTypeValidatorExtension.php
@@ -21,6 +21,6 @@ class SubmitTypeValidatorExtension extends BaseValidatorExtension
*/
public function getExtendedType()
{
- return 'submit';
+ return 'Symfony\Component\Form\Extension\Core\Type\SubmitType';
}
}
diff --git a/src/Symfony/Component/Form/FormBuilder.php b/src/Symfony/Component/Form/FormBuilder.php
index 81c9ad5f6d680..b4dd78c105be3 100644
--- a/src/Symfony/Component/Form/FormBuilder.php
+++ b/src/Symfony/Component/Form/FormBuilder.php
@@ -99,7 +99,7 @@ public function create($name, $type = null, array $options = array())
}
if (null === $type && null === $this->getDataClass()) {
- $type = 'text';
+ $type = 'Symfony\Component\Form\Extension\Core\Type\TextType';
}
if (null !== $type) {
diff --git a/src/Symfony/Component/Form/FormFactory.php b/src/Symfony/Component/Form/FormFactory.php
index cfca4588bd8b1..a88fd0d176502 100644
--- a/src/Symfony/Component/Form/FormFactory.php
+++ b/src/Symfony/Component/Form/FormFactory.php
@@ -12,6 +12,7 @@
namespace Symfony\Component\Form;
use Symfony\Component\Form\Exception\UnexpectedTypeException;
+use Symfony\Component\Form\Util\StringUtil;
class FormFactory implements FormFactoryInterface
{
@@ -34,7 +35,7 @@ public function __construct(FormRegistryInterface $registry, ResolvedFormTypeFac
/**
* {@inheritdoc}
*/
- public function create($type = 'form', $data = null, array $options = array())
+ public function create($type = 'Symfony\Component\Form\Extension\Core\Type\FormType', $data = null, array $options = array())
{
return $this->createBuilder($type, $data, $options)->getForm();
}
@@ -42,7 +43,7 @@ public function create($type = 'form', $data = null, array $options = array())
/**
* {@inheritdoc}
*/
- public function createNamed($name, $type = 'form', $data = null, array $options = array())
+ public function createNamed($name, $type = 'Symfony\Component\Form\Extension\Core\Type\FormType', $data = null, array $options = array())
{
return $this->createNamedBuilder($name, $type, $data, $options)->getForm();
}
@@ -58,11 +59,37 @@ public function createForProperty($class, $property, $data = null, array $option
/**
* {@inheritdoc}
*/
- public function createBuilder($type = 'form', $data = null, array $options = array())
+ public function createBuilder($type = 'Symfony\Component\Form\Extension\Core\Type\FormType', $data = null, array $options = array())
{
- $name = $type instanceof FormTypeInterface || $type instanceof ResolvedFormTypeInterface
- ? $type->getName()
- : $type;
+ $name = null;
+ $typeName = null;
+
+ if ($type instanceof ResolvedFormTypeInterface) {
+ if (method_exists($type, 'getBlockPrefix')) {
+ // As of Symfony 3.0, the block prefix of the type is used as
+ // default name
+ $name = $type->getBlockPrefix();
+ } else {
+ // BC
+ $typeName = $type->getName();
+ }
+ } elseif ($type instanceof FormTypeInterface) {
+ // BC
+ $typeName = $type->getName();
+ } else {
+ // BC
+ $typeName = $type;
+ }
+
+ if (null === $name) {
+ if (false === strpos($typeName, '\\')) {
+ // No FQCN - leave unchanged for BC
+ $name = $typeName;
+ } else {
+ // FQCN
+ $name = StringUtil::fqcnToBlockPrefix($typeName);
+ }
+ }
return $this->createNamedBuilder($name, $type, $data, $options);
}
@@ -70,17 +97,20 @@ public function createBuilder($type = 'form', $data = null, array $options = arr
/**
* {@inheritdoc}
*/
- public function createNamedBuilder($name, $type = 'form', $data = null, array $options = array())
+ public function createNamedBuilder($name, $type = 'Symfony\Component\Form\Extension\Core\Type\FormType', $data = null, array $options = array())
{
if (null !== $data && !array_key_exists('data', $options)) {
$options['data'] = $data;
}
if ($type instanceof FormTypeInterface) {
+ @trigger_error('Passing type instances to FormBuilder::add(), Form::add() or the FormFactory is deprecated since version 2.8 and will not be supported in 3.0. Use the fully-qualified type class name instead.', E_USER_DEPRECATED);
$type = $this->resolveType($type);
} elseif (is_string($type)) {
$type = $this->registry->getType($type);
- } elseif (!$type instanceof ResolvedFormTypeInterface) {
+ } elseif ($type instanceof ResolvedFormTypeInterface) {
+ @trigger_error('Passing type instances to FormBuilder::add(), Form::add() or the FormFactory is deprecated since version 2.8 and will not be supported in 3.0. Use the fully-qualified type class name instead.', E_USER_DEPRECATED);
+ } else {
throw new UnexpectedTypeException($type, 'string, Symfony\Component\Form\ResolvedFormTypeInterface or Symfony\Component\Form\FormTypeInterface');
}
@@ -99,7 +129,7 @@ public function createNamedBuilder($name, $type = 'form', $data = null, array $o
public function createBuilderForProperty($class, $property, $data = null, array $options = array())
{
if (null === $guesser = $this->registry->getTypeGuesser()) {
- return $this->createNamedBuilder($property, 'text', $data, $options);
+ return $this->createNamedBuilder($property, 'Symfony\Component\Form\Extension\Core\Type\TextType', $data, $options);
}
$typeGuess = $guesser->guessType($class, $property);
@@ -107,7 +137,7 @@ public function createBuilderForProperty($class, $property, $data = null, array
$requiredGuess = $guesser->guessRequired($class, $property);
$patternGuess = $guesser->guessPattern($class, $property);
- $type = $typeGuess ? $typeGuess->getType() : 'text';
+ $type = $typeGuess ? $typeGuess->getType() : 'Symfony\Component\Form\Extension\Core\Type\TextType';
$maxLength = $maxLengthGuess ? $maxLengthGuess->getValue() : null;
$pattern = $patternGuess ? $patternGuess->getValue() : null;
diff --git a/src/Symfony/Component/Form/FormFactoryBuilder.php b/src/Symfony/Component/Form/FormFactoryBuilder.php
index a5bf5b38fdbce..64021eac7a573 100644
--- a/src/Symfony/Component/Form/FormFactoryBuilder.php
+++ b/src/Symfony/Component/Form/FormFactoryBuilder.php
@@ -78,7 +78,7 @@ public function addExtensions(array $extensions)
*/
public function addType(FormTypeInterface $type)
{
- $this->types[$type->getName()] = $type;
+ $this->types[] = $type;
return $this;
}
@@ -89,7 +89,7 @@ public function addType(FormTypeInterface $type)
public function addTypes(array $types)
{
foreach ($types as $type) {
- $this->types[$type->getName()] = $type;
+ $this->types[] = $type;
}
return $this;
diff --git a/src/Symfony/Component/Form/FormFactoryInterface.php b/src/Symfony/Component/Form/FormFactoryInterface.php
index 220b470496551..b7e95cb01eb4d 100644
--- a/src/Symfony/Component/Form/FormFactoryInterface.php
+++ b/src/Symfony/Component/Form/FormFactoryInterface.php
@@ -29,7 +29,7 @@ interface FormFactoryInterface
*
* @throws \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException if any given option is not applicable to the given type
*/
- public function create($type = 'form', $data = null, array $options = array());
+ public function create($type = 'Symfony\Component\Form\Extension\Core\Type\FormType', $data = null, array $options = array());
/**
* Returns a form.
@@ -45,7 +45,7 @@ public function create($type = 'form', $data = null, array $options = array());
*
* @throws \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException if any given option is not applicable to the given type
*/
- public function createNamed($name, $type = 'form', $data = null, array $options = array());
+ public function createNamed($name, $type = 'Symfony\Component\Form\Extension\Core\Type\FormType', $data = null, array $options = array());
/**
* Returns a form for a property of a class.
@@ -74,7 +74,7 @@ public function createForProperty($class, $property, $data = null, array $option
*
* @throws \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException if any given option is not applicable to the given type
*/
- public function createBuilder($type = 'form', $data = null, array $options = array());
+ public function createBuilder($type = 'Symfony\Component\Form\Extension\Core\Type\FormType', $data = null, array $options = array());
/**
* Returns a form builder.
@@ -88,7 +88,7 @@ public function createBuilder($type = 'form', $data = null, array $options = arr
*
* @throws \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException if any given option is not applicable to the given type
*/
- public function createNamedBuilder($name, $type = 'form', $data = null, array $options = array());
+ public function createNamedBuilder($name, $type = 'Symfony\Component\Form\Extension\Core\Type\FormType', $data = null, array $options = array());
/**
* Returns a form builder for a property of a class.
diff --git a/src/Symfony/Component/Form/FormRegistry.php b/src/Symfony/Component/Form/FormRegistry.php
index 0dc21df2bcaa0..dbf944e5cb042 100644
--- a/src/Symfony/Component/Form/FormRegistry.php
+++ b/src/Symfony/Component/Form/FormRegistry.php
@@ -34,6 +34,11 @@ class FormRegistry implements FormRegistryInterface
*/
private $types = array();
+ /**
+ * @var string[]
+ */
+ private $legacyNames = array();
+
/**
* @var FormTypeGuesserInterface|false|null
*/
@@ -84,12 +89,21 @@ public function getType($name)
}
if (!$type) {
- throw new InvalidArgumentException(sprintf('Could not load type "%s"', $name));
+ // Support fully-qualified class names
+ if (class_exists($name) && in_array('Symfony\Component\Form\FormTypeInterface', class_implements($name))) {
+ $type = new $name();
+ } else {
+ throw new InvalidArgumentException(sprintf('Could not load type "%s"', $name));
+ }
}
$this->resolveAndAddType($type);
}
+ if (isset($this->legacyNames[$name])) {
+ @trigger_error('Accessing types by their string name is deprecated since version 2.8 and will be removed in 3.0. Use the fully-qualified type class name instead.', E_USER_DEPRECATED);
+ }
+
return $this->types[$name];
}
@@ -103,27 +117,52 @@ public function getType($name)
*/
private function resolveAndAddType(FormTypeInterface $type)
{
+ $typeExtensions = array();
$parentType = $type->getParent();
+ $fqcn = get_class($type);
+ $name = $type->getName();
+ $hasCustomName = $name !== $fqcn;
if ($parentType instanceof FormTypeInterface) {
+ @trigger_error('Returning a FormTypeInterface from FormTypeInterface::getParent() is deprecated since version 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
+
$this->resolveAndAddType($parentType);
$parentType = $parentType->getName();
}
- $typeExtensions = array();
+ if ($hasCustomName) {
+ foreach ($this->extensions as $extension) {
+ $typeExtensions = array_merge(
+ $typeExtensions,
+ $extension->getTypeExtensions($name)
+ );
+ }
+
+ if ($typeExtensions) {
+ @trigger_error('Returning a type name from FormTypeExtensionInterface::getExtendedType() is deprecated since version 2.8 and will be removed in 3.0. Return the fully-qualified type class name instead.', E_USER_DEPRECATED);
+ }
+ }
foreach ($this->extensions as $extension) {
$typeExtensions = array_merge(
$typeExtensions,
- $extension->getTypeExtensions($type->getName())
+ $extension->getTypeExtensions($fqcn)
);
}
- $this->types[$type->getName()] = $this->resolvedTypeFactory->createResolvedType(
+ $resolvedType = $this->resolvedTypeFactory->createResolvedType(
$type,
$typeExtensions,
$parentType ? $this->getType($parentType) : null
);
+
+ $this->types[$fqcn] = $resolvedType;
+
+ if ($hasCustomName) {
+ // Enable access by the explicit type name until Symfony 3.0
+ $this->types[$name] = $resolvedType;
+ $this->legacyNames[$name] = true;
+ }
}
/**
@@ -131,6 +170,10 @@ private function resolveAndAddType(FormTypeInterface $type)
*/
public function hasType($name)
{
+ if (isset($this->legacyNames[$name])) {
+ @trigger_error('Accessing types by their string name is deprecated since version 2.8 and will be removed in 3.0. Use the fully-qualified type class name instead.', E_USER_DEPRECATED);
+ }
+
if (isset($this->types[$name])) {
return true;
}
diff --git a/src/Symfony/Component/Form/FormTypeInterface.php b/src/Symfony/Component/Form/FormTypeInterface.php
index 11c48db26de5f..83d2181b925a8 100644
--- a/src/Symfony/Component/Form/FormTypeInterface.php
+++ b/src/Symfony/Component/Form/FormTypeInterface.php
@@ -86,7 +86,12 @@ public function setDefaultOptions(OptionsResolverInterface $resolver);
* is discouraged because it leads to a performance penalty. The support
* for returning type instances may be dropped from future releases.
*
- * @return string|null|FormTypeInterface The name of the parent type if any, null otherwise.
+ * Returning a {@link FormTypeInterface} instance is deprecated since
+ * Symfony 2.8 and will be unsupported as of Symfony 3.0. Return the
+ * fully-qualified class name of the parent type instead.
+ *
+ * @return string|null|FormTypeInterface The name of the parent type if any,
+ * null otherwise.
*/
public function getParent();
@@ -94,6 +99,9 @@ public function getParent();
* Returns the name of this type.
*
* @return string The name of this type
+ *
+ * @deprecated Deprecated since Symfony 2.8, to be removed in Symfony 3.0.
+ * Use the fully-qualified class name of the type instead.
*/
public function getName();
}
diff --git a/src/Symfony/Component/Form/PreloadedExtension.php b/src/Symfony/Component/Form/PreloadedExtension.php
index f70ca8d4551e8..782811163f718 100644
--- a/src/Symfony/Component/Form/PreloadedExtension.php
+++ b/src/Symfony/Component/Form/PreloadedExtension.php
@@ -38,15 +38,22 @@ class PreloadedExtension implements FormExtensionInterface
/**
* Creates a new preloaded extension.
*
- * @param FormTypeInterface[] $types The types that the extension should support.
- * @param array[FormTypeExtensionInterface[]] typeExtensions The type extensions that the extension should support.
- * @param FormTypeGuesserInterface|null $typeGuesser The guesser that the extension should support.
+ * @param FormTypeInterface[] $types The types that the extension should support.
+ * @param FormTypeExtensionInterface[][] $typeExtensions The type extensions that the extension should support.
+ * @param FormTypeGuesserInterface|null $typeGuesser The guesser that the extension should support.
*/
public function __construct(array $types, array $typeExtensions, FormTypeGuesserInterface $typeGuesser = null)
{
- $this->types = $types;
$this->typeExtensions = $typeExtensions;
$this->typeGuesser = $typeGuesser;
+
+ foreach ($types as $type) {
+ // Up to Symfony 2.8, types were identified by their names
+ $this->types[$type->getName()] = $type;
+
+ // Since Symfony 2.8, types are identified by their FQCN
+ $this->types[get_class($type)] = $type;
+ }
}
/**
diff --git a/src/Symfony/Component/Form/ResolvedFormType.php b/src/Symfony/Component/Form/ResolvedFormType.php
index 765cb7bf6cbdc..b334acff3c655 100644
--- a/src/Symfony/Component/Form/ResolvedFormType.php
+++ b/src/Symfony/Component/Form/ResolvedFormType.php
@@ -14,6 +14,7 @@
use Symfony\Component\Form\Exception\InvalidArgumentException;
use Symfony\Component\Form\Exception\UnexpectedTypeException;
use Symfony\Component\EventDispatcher\EventDispatcher;
+use Symfony\Component\Form\Util\StringUtil;
use Symfony\Component\OptionsResolver\OptionsResolver;
/**
@@ -23,6 +24,16 @@
*/
class ResolvedFormType implements ResolvedFormTypeInterface
{
+ /**
+ * @var string
+ */
+ private $name;
+
+ /**
+ * @var string
+ */
+ private $blockPrefix;
+
/**
* @var FormTypeInterface
*/
@@ -45,11 +56,40 @@ class ResolvedFormType implements ResolvedFormTypeInterface
public function __construct(FormTypeInterface $innerType, array $typeExtensions = array(), ResolvedFormTypeInterface $parent = null)
{
- if (!preg_match('/^[a-z0-9_]*$/i', $innerType->getName())) {
+ $fqcn = get_class($innerType);
+ $name = $innerType->getName();
+ $hasCustomName = $name !== $fqcn;
+
+ if (method_exists($innerType, 'getBlockPrefix')) {
+ $reflector = new \ReflectionMethod($innerType, 'getName');
+ $isOldOverwritten = $reflector->getDeclaringClass()->getName() !== 'Symfony\Component\Form\AbstractType';
+
+ $reflector = new \ReflectionMethod($innerType, 'getBlockPrefix');
+ $isNewOverwritten = $reflector->getDeclaringClass()->getName() !== 'Symfony\Component\Form\AbstractType';
+
+ // Bundles compatible with both 2.3 and 2.8 should implement both methods
+ // Anyone else should only override getBlockPrefix() if they actually
+ // want to have a different block prefix than the default one
+ if ($isOldOverwritten && !$isNewOverwritten) {
+ @trigger_error(get_class($this->innerType).': The FormTypeInterface::getName() method is deprecated since version 2.8 and will be removed in 3.0. Remove it from your classes. Use getBlockPrefix() if you want to customize the template block prefix. This method will be added to the FormTypeInterface with Symfony 3.0.', E_USER_DEPRECATED);
+ }
+
+ $blockPrefix = $innerType->getBlockPrefix();
+ } else {
+ @trigger_error(get_class($this->innerType).': The FormTypeInterface::getBlockPrefix() method will be added in version 3.0. You should extend AbstractType or add it to your implementation.', E_USER_DEPRECATED);
+
+ // Deal with classes that don't extend AbstractType
+ // Calculate block prefix from the FQCN by default
+ $blockPrefix = $hasCustomName ? $name : StringUtil::fqcnToBlockPrefix($fqcn);
+ }
+
+ // As of Symfony 2.8, getName() returns the FQCN by default
+ // Otherwise check that the name matches the old naming restrictions
+ if ($hasCustomName && !preg_match('/^[a-z0-9_]*$/i', $name)) {
throw new InvalidArgumentException(sprintf(
'The "%s" form type name ("%s") is not valid. Names must only contain letters, numbers, and "_".',
get_class($innerType),
- $innerType->getName()
+ $name
));
}
@@ -59,6 +99,8 @@ public function __construct(FormTypeInterface $innerType, array $typeExtensions
}
}
+ $this->name = $name;
+ $this->blockPrefix = $blockPrefix;
$this->innerType = $innerType;
$this->typeExtensions = $typeExtensions;
$this->parent = $parent;
@@ -69,7 +111,17 @@ public function __construct(FormTypeInterface $innerType, array $typeExtensions
*/
public function getName()
{
- return $this->innerType->getName();
+ return $this->name;
+ }
+
+ /**
+ * Returns the prefix of the template block name for this type.
+ *
+ * @return string The prefix of the template block name
+ */
+ public function getBlockPrefix()
+ {
+ return $this->blockPrefix;
}
/**
diff --git a/src/Symfony/Component/Form/Tests/AbstractBootstrap3LayoutTest.php b/src/Symfony/Component/Form/Tests/AbstractBootstrap3LayoutTest.php
index af01a8ea1dfb8..c3c33ec1e90a7 100644
--- a/src/Symfony/Component/Form/Tests/AbstractBootstrap3LayoutTest.php
+++ b/src/Symfony/Component/Form/Tests/AbstractBootstrap3LayoutTest.php
@@ -17,7 +17,7 @@ abstract class AbstractBootstrap3LayoutTest extends AbstractLayoutTest
{
public function testLabelOnForm()
{
- $form = $this->factory->createNamed('name', 'date');
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\DateType');
$view = $form->createView();
$this->renderWidget($view, array('label' => 'foo'));
$html = $this->renderLabel($view);
@@ -32,7 +32,7 @@ public function testLabelOnForm()
public function testLabelDoesNotRenderFieldAttributes()
{
- $form = $this->factory->createNamed('name', 'text');
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\TextType');
$html = $this->renderLabel($form->createView(), null, array(
'attr' => array(
'class' => 'my&class',
@@ -49,7 +49,7 @@ public function testLabelDoesNotRenderFieldAttributes()
public function testLabelWithCustomAttributesPassedDirectly()
{
- $form = $this->factory->createNamed('name', 'text');
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\TextType');
$html = $this->renderLabel($form->createView(), null, array(
'label_attr' => array(
'class' => 'my&class',
@@ -66,7 +66,7 @@ public function testLabelWithCustomAttributesPassedDirectly()
public function testLabelWithCustomTextAndCustomAttributesPassedDirectly()
{
- $form = $this->factory->createNamed('name', 'text');
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\TextType');
$html = $this->renderLabel($form->createView(), 'Custom label', array(
'label_attr' => array(
'class' => 'my&class',
@@ -84,7 +84,7 @@ public function testLabelWithCustomTextAndCustomAttributesPassedDirectly()
public function testLabelWithCustomTextAsOptionAndCustomAttributesPassedDirectly()
{
- $form = $this->factory->createNamed('name', 'text', null, array(
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\TextType', null, array(
'label' => 'Custom label',
));
$html = $this->renderLabel($form->createView(), null, array(
@@ -104,7 +104,7 @@ public function testLabelWithCustomTextAsOptionAndCustomAttributesPassedDirectly
public function testErrors()
{
- $form = $this->factory->createNamed('name', 'text');
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\TextType');
$form->addError(new FormError('[trans]Error 1[/trans]'));
$form->addError(new FormError('[trans]Error 2[/trans]'));
$view = $form->createView();
@@ -137,7 +137,7 @@ public function testErrors()
public function testOverrideWidgetBlock()
{
// see custom_widgets.html.twig
- $form = $this->factory->createNamed('text_id', 'text');
+ $form = $this->factory->createNamed('text_id', 'Symfony\Component\Form\Extension\Core\Type\TextType');
$html = $this->renderWidget($form->createView());
$this->assertMatchesXpath($html,
@@ -155,7 +155,7 @@ public function testOverrideWidgetBlock()
public function testCheckedCheckbox()
{
- $form = $this->factory->createNamed('name', 'checkbox', true);
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\CheckboxType', true);
$this->assertWidgetMatchesXpath($form->createView(), array('id' => 'my&id', 'attr' => array('class' => 'my&class')),
'/div
@@ -173,7 +173,7 @@ public function testCheckedCheckbox()
public function testUncheckedCheckbox()
{
- $form = $this->factory->createNamed('name', 'checkbox', false);
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\CheckboxType', false);
$this->assertWidgetMatchesXpath($form->createView(), array('id' => 'my&id', 'attr' => array('class' => 'my&class')),
'/div
@@ -191,7 +191,7 @@ public function testUncheckedCheckbox()
public function testCheckboxWithValue()
{
- $form = $this->factory->createNamed('name', 'checkbox', false, array(
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\CheckboxType', false, array(
'value' => 'foo&bar',
));
@@ -211,7 +211,7 @@ public function testCheckboxWithValue()
public function testSingleChoice()
{
- $form = $this->factory->createNamed('name', 'choice', '&a', array(
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', '&a', array(
'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'),
'multiple' => false,
'expanded' => false,
@@ -256,7 +256,7 @@ public function testSingleChoiceWithoutTranslation()
public function testSingleChoiceAttributes()
{
- $form = $this->factory->createNamed('name', 'choice', '&a', array(
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', '&a', array(
'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'),
'choice_attr' => array('Choice&B' => array('class' => 'foo&bar')),
'multiple' => false,
@@ -281,7 +281,7 @@ public function testSingleChoiceAttributes()
public function testSingleChoiceWithPreferred()
{
- $form = $this->factory->createNamed('name', 'choice', '&a', array(
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', '&a', array(
'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'),
'preferred_choices' => array('&b'),
'multiple' => false,
@@ -305,7 +305,7 @@ public function testSingleChoiceWithPreferred()
public function testSingleChoiceWithPreferredAndNoSeparator()
{
- $form = $this->factory->createNamed('name', 'choice', '&a', array(
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', '&a', array(
'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'),
'preferred_choices' => array('&b'),
'multiple' => false,
@@ -328,7 +328,7 @@ public function testSingleChoiceWithPreferredAndNoSeparator()
public function testSingleChoiceWithPreferredAndBlankSeparator()
{
- $form = $this->factory->createNamed('name', 'choice', '&a', array(
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', '&a', array(
'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'),
'preferred_choices' => array('&b'),
'multiple' => false,
@@ -352,7 +352,7 @@ public function testSingleChoiceWithPreferredAndBlankSeparator()
public function testChoiceWithOnlyPreferred()
{
- $form = $this->factory->createNamed('name', 'choice', '&a', array(
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', '&a', array(
'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'),
'preferred_choices' => array('&a', '&b'),
'multiple' => false,
@@ -369,7 +369,7 @@ public function testChoiceWithOnlyPreferred()
public function testSingleChoiceNonRequired()
{
- $form = $this->factory->createNamed('name', 'choice', '&a', array(
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', '&a', array(
'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'),
'required' => false,
'multiple' => false,
@@ -393,7 +393,7 @@ public function testSingleChoiceNonRequired()
public function testSingleChoiceNonRequiredNoneSelected()
{
- $form = $this->factory->createNamed('name', 'choice', null, array(
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'),
'required' => false,
'multiple' => false,
@@ -417,7 +417,7 @@ public function testSingleChoiceNonRequiredNoneSelected()
public function testSingleChoiceNonRequiredWithPlaceholder()
{
- $form = $this->factory->createNamed('name', 'choice', '&a', array(
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', '&a', array(
'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'),
'multiple' => false,
'expanded' => false,
@@ -442,7 +442,7 @@ public function testSingleChoiceNonRequiredWithPlaceholder()
public function testSingleChoiceRequiredWithPlaceholder()
{
- $form = $this->factory->createNamed('name', 'choice', '&a', array(
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', '&a', array(
'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'),
'required' => true,
'multiple' => false,
@@ -467,7 +467,7 @@ public function testSingleChoiceRequiredWithPlaceholder()
public function testSingleChoiceRequiredWithPlaceholderViaView()
{
- $form = $this->factory->createNamed('name', 'choice', '&a', array(
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', '&a', array(
'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'),
'required' => true,
'multiple' => false,
@@ -491,7 +491,7 @@ public function testSingleChoiceRequiredWithPlaceholderViaView()
public function testSingleChoiceGrouped()
{
- $form = $this->factory->createNamed('name', 'choice', '&a', array(
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', '&a', array(
'choices' => array(
'Group&1' => array('&a' => 'Choice&A', '&b' => 'Choice&B'),
'Group&2' => array('&c' => 'Choice&C'),
@@ -522,7 +522,7 @@ public function testSingleChoiceGrouped()
public function testMultipleChoice()
{
- $form = $this->factory->createNamed('name', 'choice', array('&a'), array(
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', array('&a'), array(
'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'),
'required' => true,
'multiple' => true,
@@ -546,7 +546,7 @@ public function testMultipleChoice()
public function testMultipleChoiceAttributes()
{
- $form = $this->factory->createNamed('name', 'choice', array('&a'), array(
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', array('&a'), array(
'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'),
'choice_attr' => array('Choice&B' => array('class' => 'foo&bar')),
'required' => true,
@@ -573,7 +573,7 @@ public function testMultipleChoiceAttributes()
public function testMultipleChoiceSkipsPlaceholder()
{
- $form = $this->factory->createNamed('name', 'choice', array('&a'), array(
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', array('&a'), array(
'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'),
'multiple' => true,
'expanded' => false,
@@ -596,7 +596,7 @@ public function testMultipleChoiceSkipsPlaceholder()
public function testMultipleChoiceNonRequired()
{
- $form = $this->factory->createNamed('name', 'choice', array('&a'), array(
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', array('&a'), array(
'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'),
'required' => false,
'multiple' => true,
@@ -619,7 +619,7 @@ public function testMultipleChoiceNonRequired()
public function testSingleChoiceExpanded()
{
- $form = $this->factory->createNamed('name', 'choice', '&a', array(
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', '&a', array(
'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'),
'multiple' => false,
'expanded' => true,
@@ -690,7 +690,7 @@ public function testSingleChoiceExpandedWithoutTranslation()
public function testSingleChoiceExpandedAttributes()
{
- $form = $this->factory->createNamed('name', 'choice', '&a', array(
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', '&a', array(
'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'),
'choice_attr' => array('Choice&B' => array('class' => 'foo&bar')),
'multiple' => false,
@@ -728,7 +728,7 @@ public function testSingleChoiceExpandedAttributes()
public function testSingleChoiceExpandedWithPlaceholder()
{
- $form = $this->factory->createNamed('name', 'choice', '&a', array(
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', '&a', array(
'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'),
'multiple' => false,
'expanded' => true,
@@ -773,7 +773,7 @@ public function testSingleChoiceExpandedWithPlaceholder()
public function testSingleChoiceExpandedWithBooleanValue()
{
- $form = $this->factory->createNamed('name', 'choice', true, array(
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', true, array(
'choices' => array('1' => 'Choice&A', '0' => 'Choice&B'),
'multiple' => false,
'expanded' => true,
@@ -808,7 +808,7 @@ public function testSingleChoiceExpandedWithBooleanValue()
public function testMultipleChoiceExpanded()
{
- $form = $this->factory->createNamed('name', 'choice', array('&a', '&c'), array(
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', array('&a', '&c'), array(
'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B', '&c' => 'Choice&C'),
'multiple' => true,
'expanded' => true,
@@ -899,7 +899,7 @@ public function testMultipleChoiceExpandedWithoutTranslation()
public function testMultipleChoiceExpandedAttributes()
{
- $form = $this->factory->createNamed('name', 'choice', array('&a', '&c'), array(
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', array('&a', '&c'), array(
'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B', '&c' => 'Choice&C'),
'choice_attr' => array('Choice&B' => array('class' => 'foo&bar')),
'multiple' => true,
@@ -947,7 +947,7 @@ public function testMultipleChoiceExpandedAttributes()
public function testCountry()
{
- $form = $this->factory->createNamed('name', 'country', 'AT');
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\CountryType', 'AT');
$this->assertWidgetMatchesXpath($form->createView(), array('attr' => array('class' => 'my&class')),
'/select
@@ -961,7 +961,7 @@ public function testCountry()
public function testCountryWithPlaceholder()
{
- $form = $this->factory->createNamed('name', 'country', 'AT', array(
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\CountryType', 'AT', array(
'placeholder' => 'Select&Country',
'required' => false,
));
@@ -979,7 +979,7 @@ public function testCountryWithPlaceholder()
public function testDateTime()
{
- $form = $this->factory->createNamed('name', 'datetime', '2011-02-03 04:05:06', array(
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\DateTimeType', '2011-02-03 04:05:06', array(
'input' => 'string',
'with_seconds' => false,
));
@@ -1015,7 +1015,7 @@ public function testDateTime()
public function testDateTimeWithPlaceholderGlobal()
{
- $form = $this->factory->createNamed('name', 'datetime', null, array(
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\DateTimeType', null, array(
'input' => 'string',
'placeholder' => 'Change&Me',
'required' => false,
@@ -1055,7 +1055,7 @@ public function testDateTimeWithHourAndMinute()
{
$data = array('year' => '2011', 'month' => '2', 'day' => '3', 'hour' => '4', 'minute' => '5');
- $form = $this->factory->createNamed('name', 'datetime', $data, array(
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\DateTimeType', $data, array(
'input' => 'array',
'required' => false,
));
@@ -1092,7 +1092,7 @@ public function testDateTimeWithHourAndMinute()
public function testDateTimeWithSeconds()
{
- $form = $this->factory->createNamed('name', 'datetime', '2011-02-03 04:05:06', array(
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\DateTimeType', '2011-02-03 04:05:06', array(
'input' => 'string',
'with_seconds' => true,
));
@@ -1133,7 +1133,7 @@ public function testDateTimeWithSeconds()
public function testDateTimeSingleText()
{
- $form = $this->factory->createNamed('name', 'datetime', '2011-02-03 04:05:06', array(
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\DateTimeType', '2011-02-03 04:05:06', array(
'input' => 'string',
'date_widget' => 'single_text',
'time_widget' => 'single_text',
@@ -1162,7 +1162,7 @@ public function testDateTimeSingleText()
public function testDateTimeWithWidgetSingleText()
{
- $form = $this->factory->createNamed('name', 'datetime', '2011-02-03 04:05:06', array(
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\DateTimeType', '2011-02-03 04:05:06', array(
'input' => 'string',
'widget' => 'single_text',
'model_timezone' => 'UTC',
@@ -1181,7 +1181,7 @@ public function testDateTimeWithWidgetSingleText()
public function testDateTimeWithWidgetSingleTextIgnoreDateAndTimeWidgets()
{
- $form = $this->factory->createNamed('name', 'datetime', '2011-02-03 04:05:06', array(
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\DateTimeType', '2011-02-03 04:05:06', array(
'input' => 'string',
'date_widget' => 'choice',
'time_widget' => 'choice',
@@ -1202,7 +1202,7 @@ public function testDateTimeWithWidgetSingleTextIgnoreDateAndTimeWidgets()
public function testDateChoice()
{
- $form = $this->factory->createNamed('name', 'date', '2011-02-03', array(
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\DateType', '2011-02-03', array(
'input' => 'string',
'widget' => 'choice',
));
@@ -1231,7 +1231,7 @@ public function testDateChoice()
public function testDateChoiceWithPlaceholderGlobal()
{
- $form = $this->factory->createNamed('name', 'date', null, array(
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\DateType', null, array(
'input' => 'string',
'widget' => 'choice',
'placeholder' => 'Change&Me',
@@ -1262,7 +1262,7 @@ public function testDateChoiceWithPlaceholderGlobal()
public function testDateChoiceWithPlaceholderOnYear()
{
- $form = $this->factory->createNamed('name', 'date', null, array(
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\DateType', null, array(
'input' => 'string',
'widget' => 'choice',
'required' => false,
@@ -1293,7 +1293,7 @@ public function testDateChoiceWithPlaceholderOnYear()
public function testDateText()
{
- $form = $this->factory->createNamed('name', 'date', '2011-02-03', array(
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\DateType', '2011-02-03', array(
'input' => 'string',
'widget' => 'text',
));
@@ -1325,7 +1325,7 @@ public function testDateText()
public function testDateSingleText()
{
- $form = $this->factory->createNamed('name', 'date', '2011-02-03', array(
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\DateType', '2011-02-03', array(
'input' => 'string',
'widget' => 'single_text',
));
@@ -1342,7 +1342,7 @@ public function testDateSingleText()
public function testBirthDay()
{
- $form = $this->factory->createNamed('name', 'birthday', '2000-02-03', array(
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\BirthdayType', '2000-02-03', array(
'input' => 'string',
));
@@ -1370,7 +1370,7 @@ public function testBirthDay()
public function testBirthDayWithPlaceholder()
{
- $form = $this->factory->createNamed('name', 'birthday', '1950-01-01', array(
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\BirthdayType', '1950-01-01', array(
'input' => 'string',
'placeholder' => '',
'required' => false,
@@ -1403,7 +1403,7 @@ public function testBirthDayWithPlaceholder()
public function testEmail()
{
- $form = $this->factory->createNamed('name', 'email', 'foo&bar');
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\EmailType', 'foo&bar');
$this->assertWidgetMatchesXpath($form->createView(), array('attr' => array('class' => 'my&class')),
'/input
@@ -1418,7 +1418,7 @@ public function testEmail()
public function testEmailWithMaxLength()
{
- $form = $this->factory->createNamed('name', 'email', 'foo&bar', array(
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\EmailType', 'foo&bar', array(
'attr' => array('maxlength' => 123),
));
@@ -1435,7 +1435,7 @@ public function testEmailWithMaxLength()
public function testHidden()
{
- $form = $this->factory->createNamed('name', 'hidden', 'foo&bar');
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\HiddenType', 'foo&bar');
$this->assertWidgetMatchesXpath($form->createView(), array('attr' => array('class' => 'my&class')),
'/input
@@ -1452,7 +1452,7 @@ public function testHidden()
*/
public function testLegacyReadOnly()
{
- $form = $this->factory->createNamed('name', 'text', null, array(
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\TextType', null, array(
'read_only' => true,
));
@@ -1468,7 +1468,7 @@ public function testLegacyReadOnly()
public function testDisabled()
{
- $form = $this->factory->createNamed('name', 'text', null, array(
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\TextType', null, array(
'disabled' => true,
));
@@ -1484,7 +1484,7 @@ public function testDisabled()
public function testInteger()
{
- $form = $this->factory->createNamed('name', 'integer', 123);
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\IntegerType', 123);
$this->assertWidgetMatchesXpath($form->createView(), array('attr' => array('class' => 'my&class')),
'/input
@@ -1498,7 +1498,7 @@ public function testInteger()
public function testLanguage()
{
- $form = $this->factory->createNamed('name', 'language', 'de');
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\LanguageType', 'de');
$this->assertWidgetMatchesXpath($form->createView(), array('attr' => array('class' => 'my&class')),
'/select
@@ -1512,7 +1512,7 @@ public function testLanguage()
public function testLocale()
{
- $form = $this->factory->createNamed('name', 'locale', 'de_AT');
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\LocaleType', 'de_AT');
$this->assertWidgetMatchesXpath($form->createView(), array('attr' => array('class' => 'my&class')),
'/select
@@ -1526,7 +1526,7 @@ public function testLocale()
public function testMoney()
{
- $form = $this->factory->createNamed('name', 'money', 1234.56, array(
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\MoneyType', 1234.56, array(
'currency' => 'EUR',
));
@@ -1550,7 +1550,7 @@ public function testMoney()
public function testNumber()
{
- $form = $this->factory->createNamed('name', 'number', 1234.56);
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\NumberType', 1234.56);
$this->assertWidgetMatchesXpath($form->createView(), array('attr' => array('class' => 'my&class')),
'/input
@@ -1564,7 +1564,7 @@ public function testNumber()
public function testPassword()
{
- $form = $this->factory->createNamed('name', 'password', 'foo&bar');
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\PasswordType', 'foo&bar');
$this->assertWidgetMatchesXpath($form->createView(), array('attr' => array('class' => 'my&class')),
'/input
@@ -1577,7 +1577,7 @@ public function testPassword()
public function testPasswordSubmittedWithNotAlwaysEmpty()
{
- $form = $this->factory->createNamed('name', 'password', null, array(
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\PasswordType', null, array(
'always_empty' => false,
));
$form->submit('foo&bar');
@@ -1594,7 +1594,7 @@ public function testPasswordSubmittedWithNotAlwaysEmpty()
public function testPasswordWithMaxLength()
{
- $form = $this->factory->createNamed('name', 'password', 'foo&bar', array(
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\PasswordType', 'foo&bar', array(
'attr' => array('maxlength' => 123),
));
@@ -1610,7 +1610,7 @@ public function testPasswordWithMaxLength()
public function testPercent()
{
- $form = $this->factory->createNamed('name', 'percent', 0.1);
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\PercentType', 0.1);
$this->assertWidgetMatchesXpath($form->createView(), array('id' => 'my&id', 'attr' => array('class' => 'my&class')),
'/div
@@ -1632,7 +1632,7 @@ public function testPercent()
public function testCheckedRadio()
{
- $form = $this->factory->createNamed('name', 'radio', true);
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\RadioType', true);
$this->assertWidgetMatchesXpath($form->createView(), array('id' => 'my&id', 'attr' => array('class' => 'my&class')),
'/div
@@ -1656,7 +1656,7 @@ public function testCheckedRadio()
public function testUncheckedRadio()
{
- $form = $this->factory->createNamed('name', 'radio', false);
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\RadioType', false);
$this->assertWidgetMatchesXpath($form->createView(), array('id' => 'my&id', 'attr' => array('class' => 'my&class')),
'/div
@@ -1679,7 +1679,7 @@ public function testUncheckedRadio()
public function testRadioWithValue()
{
- $form = $this->factory->createNamed('name', 'radio', false, array(
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\RadioType', false, array(
'value' => 'foo&bar',
));
@@ -1704,7 +1704,7 @@ public function testRadioWithValue()
public function testRange()
{
- $form = $this->factory->createNamed('name', 'range', 42, array('attr' => array('min' => 5)));
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\RangeType', 42, array('attr' => array('min' => 5)));
$this->assertWidgetMatchesXpath($form->createView(), array('attr' => array('class' => 'my&class')),
'/input
@@ -1719,7 +1719,7 @@ public function testRange()
public function testRangeWithMinMaxValues()
{
- $form = $this->factory->createNamed('name', 'range', 42, array('attr' => array('min' => 5, 'max' => 57)));
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\RangeType', 42, array('attr' => array('min' => 5, 'max' => 57)));
$this->assertWidgetMatchesXpath($form->createView(), array('attr' => array('class' => 'my&class')),
'/input
@@ -1735,7 +1735,7 @@ public function testRangeWithMinMaxValues()
public function testTextarea()
{
- $form = $this->factory->createNamed('name', 'textarea', 'foo&bar', array(
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\TextareaType', 'foo&bar', array(
'attr' => array('pattern' => 'foo'),
));
@@ -1751,7 +1751,7 @@ public function testTextarea()
public function testText()
{
- $form = $this->factory->createNamed('name', 'text', 'foo&bar');
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\TextType', 'foo&bar');
$this->assertWidgetMatchesXpath($form->createView(), array('attr' => array('class' => 'my&class')),
'/input
@@ -1766,7 +1766,7 @@ public function testText()
public function testTextWithMaxLength()
{
- $form = $this->factory->createNamed('name', 'text', 'foo&bar', array(
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\TextType', 'foo&bar', array(
'attr' => array('maxlength' => 123),
));
@@ -1783,7 +1783,7 @@ public function testTextWithMaxLength()
public function testSearch()
{
- $form = $this->factory->createNamed('name', 'search', 'foo&bar');
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\SearchType', 'foo&bar');
$this->assertWidgetMatchesXpath($form->createView(), array('attr' => array('class' => 'my&class')),
'/input
@@ -1798,7 +1798,7 @@ public function testSearch()
public function testTime()
{
- $form = $this->factory->createNamed('name', 'time', '04:05:06', array(
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\TimeType', '04:05:06', array(
'input' => 'string',
'with_seconds' => false,
));
@@ -1825,7 +1825,7 @@ public function testTime()
public function testTimeWithSeconds()
{
- $form = $this->factory->createNamed('name', 'time', '04:05:06', array(
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\TimeType', '04:05:06', array(
'input' => 'string',
'with_seconds' => true,
));
@@ -1860,7 +1860,7 @@ public function testTimeWithSeconds()
public function testTimeText()
{
- $form = $this->factory->createNamed('name', 'time', '04:05:06', array(
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\TimeType', '04:05:06', array(
'input' => 'string',
'widget' => 'text',
));
@@ -1893,7 +1893,7 @@ public function testTimeText()
public function testTimeSingleText()
{
- $form = $this->factory->createNamed('name', 'time', '04:05:06', array(
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\TimeType', '04:05:06', array(
'input' => 'string',
'widget' => 'single_text',
));
@@ -1911,7 +1911,7 @@ public function testTimeSingleText()
public function testTimeWithPlaceholderGlobal()
{
- $form = $this->factory->createNamed('name', 'time', null, array(
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\TimeType', null, array(
'input' => 'string',
'placeholder' => 'Change&Me',
'required' => false,
@@ -1938,7 +1938,7 @@ public function testTimeWithPlaceholderGlobal()
public function testTimeWithPlaceholderOnYear()
{
- $form = $this->factory->createNamed('name', 'time', null, array(
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\TimeType', null, array(
'input' => 'string',
'required' => false,
'placeholder' => array('hour' => 'Change&Me'),
@@ -1965,7 +1965,7 @@ public function testTimeWithPlaceholderOnYear()
public function testTimezone()
{
- $form = $this->factory->createNamed('name', 'timezone', 'Europe/Vienna');
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\TimezoneType', 'Europe/Vienna');
$this->assertWidgetMatchesXpath($form->createView(), array('attr' => array('class' => 'my&class')),
'/select
@@ -1984,7 +1984,7 @@ public function testTimezone()
public function testTimezoneWithPlaceholder()
{
- $form = $this->factory->createNamed('name', 'timezone', null, array(
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\TimezoneType', null, array(
'placeholder' => 'Select&Timezone',
'required' => false,
));
@@ -2002,7 +2002,7 @@ public function testTimezoneWithPlaceholder()
public function testUrl()
{
$url = 'http://www.google.com?foo1=bar1&foo2=bar2';
- $form = $this->factory->createNamed('name', 'url', $url);
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\UrlType', $url);
$this->assertWidgetMatchesXpath($form->createView(), array('attr' => array('class' => 'my&class')),
'/input
@@ -2016,7 +2016,7 @@ public function testUrl()
public function testButton()
{
- $form = $this->factory->createNamed('name', 'button');
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ButtonType');
$this->assertWidgetMatchesXpath($form->createView(), array('attr' => array('class' => 'my&class')),
'/button[@type="button"][@name="name"][.="[trans]Name[/trans]"][@class="my&class btn"]'
@@ -2025,7 +2025,7 @@ public function testButton()
public function testSubmit()
{
- $form = $this->factory->createNamed('name', 'submit');
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\SubmitType');
$this->assertWidgetMatchesXpath($form->createView(), array('attr' => array('class' => 'my&class')),
'/button[@type="submit"][@name="name"][@class="my&class btn"]'
@@ -2034,7 +2034,7 @@ public function testSubmit()
public function testReset()
{
- $form = $this->factory->createNamed('name', 'reset');
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ResetType');
$this->assertWidgetMatchesXpath($form->createView(), array('attr' => array('class' => 'my&class')),
'/button[@type="reset"][@name="name"][@class="my&class btn"]'
@@ -2043,7 +2043,7 @@ public function testReset()
public function testWidgetAttributes()
{
- $form = $this->factory->createNamed('text', 'text', 'value', array(
+ $form = $this->factory->createNamed('text', 'Symfony\Component\Form\Extension\Core\Type\TextType', 'value', array(
'required' => true,
'disabled' => true,
'attr' => array('readonly' => true, 'maxlength' => 10, 'pattern' => '\d+', 'class' => 'foobar', 'data-foo' => 'bar'),
@@ -2057,7 +2057,7 @@ public function testWidgetAttributes()
public function testWidgetAttributeNameRepeatedIfTrue()
{
- $form = $this->factory->createNamed('text', 'text', 'value', array(
+ $form = $this->factory->createNamed('text', 'Symfony\Component\Form\Extension\Core\Type\TextType', 'value', array(
'attr' => array('foo' => true),
));
@@ -2069,7 +2069,7 @@ public function testWidgetAttributeNameRepeatedIfTrue()
public function testButtonAttributes()
{
- $form = $this->factory->createNamed('button', 'button', null, array(
+ $form = $this->factory->createNamed('button', 'Symfony\Component\Form\Extension\Core\Type\ButtonType', null, array(
'disabled' => true,
'attr' => array('class' => 'foobar', 'data-foo' => 'bar'),
));
@@ -2082,7 +2082,7 @@ public function testButtonAttributes()
public function testButtonAttributeNameRepeatedIfTrue()
{
- $form = $this->factory->createNamed('button', 'button', null, array(
+ $form = $this->factory->createNamed('button', 'Symfony\Component\Form\Extension\Core\Type\ButtonType', null, array(
'attr' => array('foo' => true),
));
diff --git a/src/Symfony/Component/Form/Tests/AbstractDivLayoutTest.php b/src/Symfony/Component/Form/Tests/AbstractDivLayoutTest.php
index 45b2f311c2942..e13415db86a7d 100644
--- a/src/Symfony/Component/Form/Tests/AbstractDivLayoutTest.php
+++ b/src/Symfony/Component/Form/Tests/AbstractDivLayoutTest.php
@@ -19,7 +19,7 @@ abstract class AbstractDivLayoutTest extends AbstractLayoutTest
{
public function testRow()
{
- $form = $this->factory->createNamed('name', 'text');
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\TextType');
$form->addError(new FormError('[trans]Error![/trans]'));
$view = $form->createView();
$html = $this->renderRow($view);
@@ -39,7 +39,7 @@ public function testRow()
public function testRowOverrideVariables()
{
- $view = $this->factory->createNamed('name', 'text')->createView();
+ $view = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\TextType')->createView();
$html = $this->renderRow($view, array(
'attr' => array('class' => 'my&class'),
'label' => 'foo&bar',
@@ -58,7 +58,7 @@ public function testRowOverrideVariables()
public function testRepeatedRow()
{
- $form = $this->factory->createNamed('name', 'repeated');
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\RepeatedType');
$form->addError(new FormError('[trans]Error![/trans]'));
$view = $form->createView();
$html = $this->renderRow($view);
@@ -85,7 +85,7 @@ public function testRepeatedRow()
public function testButtonRow()
{
- $form = $this->factory->createNamed('name', 'button');
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ButtonType');
$view = $form->createView();
$html = $this->renderRow($view);
@@ -101,11 +101,11 @@ public function testButtonRow()
public function testRest()
{
- $view = $this->factory->createNamedBuilder('name', 'form')
- ->add('field1', 'text')
- ->add('field2', 'repeated')
- ->add('field3', 'text')
- ->add('field4', 'text')
+ $view = $this->factory->createNamedBuilder('name', 'Symfony\Component\Form\Extension\Core\Type\FormType')
+ ->add('field1', 'Symfony\Component\Form\Extension\Core\Type\TextType')
+ ->add('field2', 'Symfony\Component\Form\Extension\Core\Type\RepeatedType')
+ ->add('field3', 'Symfony\Component\Form\Extension\Core\Type\TextType')
+ ->add('field4', 'Symfony\Component\Form\Extension\Core\Type\TextType')
->getForm()
->createView();
@@ -142,15 +142,15 @@ public function testRest()
public function testRestWithChildrenForms()
{
- $child1 = $this->factory->createNamedBuilder('child1', 'form')
- ->add('field1', 'text')
- ->add('field2', 'text');
+ $child1 = $this->factory->createNamedBuilder('child1', 'Symfony\Component\Form\Extension\Core\Type\FormType')
+ ->add('field1', 'Symfony\Component\Form\Extension\Core\Type\TextType')
+ ->add('field2', 'Symfony\Component\Form\Extension\Core\Type\TextType');
- $child2 = $this->factory->createNamedBuilder('child2', 'form')
- ->add('field1', 'text')
- ->add('field2', 'text');
+ $child2 = $this->factory->createNamedBuilder('child2', 'Symfony\Component\Form\Extension\Core\Type\FormType')
+ ->add('field1', 'Symfony\Component\Form\Extension\Core\Type\TextType')
+ ->add('field2', 'Symfony\Component\Form\Extension\Core\Type\TextType');
- $view = $this->factory->createNamedBuilder('parent', 'form')
+ $view = $this->factory->createNamedBuilder('parent', 'Symfony\Component\Form\Extension\Core\Type\FormType')
->add($child1)
->add($child2)
->getForm()
@@ -200,9 +200,9 @@ public function testRestWithChildrenForms()
public function testRestAndRepeatedWithRow()
{
- $view = $this->factory->createNamedBuilder('name', 'form')
- ->add('first', 'text')
- ->add('password', 'repeated')
+ $view = $this->factory->createNamedBuilder('name', 'Symfony\Component\Form\Extension\Core\Type\FormType')
+ ->add('first', 'Symfony\Component\Form\Extension\Core\Type\TextType')
+ ->add('password', 'Symfony\Component\Form\Extension\Core\Type\RepeatedType')
->getForm()
->createView();
@@ -226,9 +226,9 @@ public function testRestAndRepeatedWithRow()
public function testRestAndRepeatedWithRowPerChild()
{
- $view = $this->factory->createNamedBuilder('name', 'form')
- ->add('first', 'text')
- ->add('password', 'repeated')
+ $view = $this->factory->createNamedBuilder('name', 'Symfony\Component\Form\Extension\Core\Type\FormType')
+ ->add('first', 'Symfony\Component\Form\Extension\Core\Type\TextType')
+ ->add('password', 'Symfony\Component\Form\Extension\Core\Type\RepeatedType')
->getForm()
->createView();
@@ -254,9 +254,9 @@ public function testRestAndRepeatedWithRowPerChild()
public function testRestAndRepeatedWithWidgetPerChild()
{
- $view = $this->factory->createNamedBuilder('name', 'form')
- ->add('first', 'text')
- ->add('password', 'repeated')
+ $view = $this->factory->createNamedBuilder('name', 'Symfony\Component\Form\Extension\Core\Type\FormType')
+ ->add('first', 'Symfony\Component\Form\Extension\Core\Type\TextType')
+ ->add('password', 'Symfony\Component\Form\Extension\Core\Type\RepeatedType')
->getForm()
->createView();
@@ -284,8 +284,8 @@ public function testRestAndRepeatedWithWidgetPerChild()
public function testCollection()
{
- $form = $this->factory->createNamed('names', 'collection', array('a', 'b'), array(
- 'type' => 'text',
+ $form = $this->factory->createNamed('names', 'Symfony\Component\Form\Extension\Core\Type\CollectionType', array('a', 'b'), array(
+ 'type' => 'Symfony\Component\Form\Extension\Core\Type\TextType',
));
$this->assertWidgetMatchesXpath($form->createView(), array(),
@@ -306,8 +306,8 @@ public function testCollectionWithAlternatingRowTypes()
array('title' => 'a'),
array('title' => 'b'),
);
- $form = $this->factory->createNamed('names', 'collection', $data, array(
- 'type' => new AlternatingRowType(),
+ $form = $this->factory->createNamed('names', 'Symfony\Component\Form\Extension\Core\Type\CollectionType', $data, array(
+ 'type' => 'Symfony\Component\Form\Tests\Fixtures\AlternatingRowType',
));
$this->assertWidgetMatchesXpath($form->createView(), array(),
@@ -324,8 +324,8 @@ public function testCollectionWithAlternatingRowTypes()
public function testEmptyCollection()
{
- $form = $this->factory->createNamed('names', 'collection', array(), array(
- 'type' => 'text',
+ $form = $this->factory->createNamed('names', 'Symfony\Component\Form\Extension\Core\Type\CollectionType', array(), array(
+ 'type' => 'Symfony\Component\Form\Extension\Core\Type\TextType',
));
$this->assertWidgetMatchesXpath($form->createView(), array(),
@@ -340,12 +340,12 @@ public function testCollectionRow()
{
$collection = $this->factory->createNamedBuilder(
'collection',
- 'collection',
+ 'Symfony\Component\Form\Extension\Core\Type\CollectionType',
array('a', 'b'),
- array('type' => 'text')
+ array('type' => 'Symfony\Component\Form\Extension\Core\Type\TextType')
);
- $form = $this->factory->createNamedBuilder('form', 'form')
+ $form = $this->factory->createNamedBuilder('form', 'Symfony\Component\Form\Extension\Core\Type\FormType')
->add($collection)
->getForm();
@@ -378,11 +378,11 @@ public function testCollectionRow()
public function testForm()
{
- $form = $this->factory->createNamedBuilder('name', 'form')
+ $form = $this->factory->createNamedBuilder('name', 'Symfony\Component\Form\Extension\Core\Type\FormType')
->setMethod('PUT')
->setAction('http://example.com')
- ->add('firstName', 'text')
- ->add('lastName', 'text')
+ ->add('firstName', 'Symfony\Component\Form\Extension\Core\Type\TextType')
+ ->add('lastName', 'Symfony\Component\Form\Extension\Core\Type\TextType')
->getForm();
// include ampersands everywhere to validate escaping
@@ -422,9 +422,9 @@ public function testForm()
public function testFormWidget()
{
- $form = $this->factory->createNamedBuilder('name', 'form')
- ->add('firstName', 'text')
- ->add('lastName', 'text')
+ $form = $this->factory->createNamedBuilder('name', 'Symfony\Component\Form\Extension\Core\Type\FormType')
+ ->add('firstName', 'Symfony\Component\Form\Extension\Core\Type\TextType')
+ ->add('lastName', 'Symfony\Component\Form\Extension\Core\Type\TextType')
->getForm();
$this->assertWidgetMatchesXpath($form->createView(), array(),
@@ -450,10 +450,10 @@ public function testFormWidget()
// https://github.com/symfony/symfony/issues/2308
public function testNestedFormError()
{
- $form = $this->factory->createNamedBuilder('name', 'form')
+ $form = $this->factory->createNamedBuilder('name', 'Symfony\Component\Form\Extension\Core\Type\FormType')
->add($this->factory
- ->createNamedBuilder('child', 'form', null, array('error_bubbling' => false))
- ->add('grandChild', 'form')
+ ->createNamedBuilder('child', 'Symfony\Component\Form\Extension\Core\Type\FormType', null, array('error_bubbling' => false))
+ ->add('grandChild', 'Symfony\Component\Form\Extension\Core\Type\FormType')
)
->getForm();
@@ -476,11 +476,11 @@ public function testCsrf()
->method('getToken')
->will($this->returnValue(new CsrfToken('token_id', 'foo&bar')));
- $form = $this->factory->createNamedBuilder('name', 'form')
+ $form = $this->factory->createNamedBuilder('name', 'Symfony\Component\Form\Extension\Core\Type\FormType')
->add($this->factory
// No CSRF protection on nested forms
- ->createNamedBuilder('child', 'form')
- ->add($this->factory->createNamedBuilder('grandchild', 'text'))
+ ->createNamedBuilder('child', 'Symfony\Component\Form\Extension\Core\Type\FormType')
+ ->add($this->factory->createNamedBuilder('grandchild', 'Symfony\Component\Form\Extension\Core\Type\TextType'))
)
->getForm();
@@ -497,8 +497,8 @@ public function testCsrf()
public function testRepeated()
{
- $form = $this->factory->createNamed('name', 'repeated', 'foobar', array(
- 'type' => 'text',
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\RepeatedType', 'foobar', array(
+ 'type' => 'Symfony\Component\Form\Extension\Core\Type\TextType',
));
$this->assertWidgetMatchesXpath($form->createView(), array(),
@@ -523,7 +523,7 @@ public function testRepeated()
public function testRepeatedWithCustomOptions()
{
- $form = $this->factory->createNamed('name', 'repeated', null, array(
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\RepeatedType', null, array(
// the global required value cannot be overridden
'first_options' => array('label' => 'Test', 'required' => false),
'second_options' => array('label' => 'Test2'),
@@ -551,8 +551,8 @@ public function testRepeatedWithCustomOptions()
public function testSearchInputName()
{
- $form = $this->factory->createNamedBuilder('full', 'form')
- ->add('name', 'search')
+ $form = $this->factory->createNamedBuilder('full', 'Symfony\Component\Form\Extension\Core\Type\FormType')
+ ->add('name', 'Symfony\Component\Form\Extension\Core\Type\SearchType')
->getForm();
$this->assertWidgetMatchesXpath($form->createView(), array(),
@@ -572,7 +572,7 @@ public function testSearchInputName()
public function testLabelHasNoId()
{
- $form = $this->factory->createNamed('name', 'text');
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\TextType');
$html = $this->renderRow($form->createView());
$this->assertMatchesXpath($html,
@@ -587,7 +587,7 @@ public function testLabelHasNoId()
public function testLabelIsNotRenderedWhenSetToFalse()
{
- $form = $this->factory->createNamed('name', 'text', null, array(
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\TextType', null, array(
'label' => false,
));
$html = $this->renderRow($form->createView());
@@ -608,7 +608,7 @@ public function testLabelIsNotRenderedWhenSetToFalse()
public function testThemeBlockInheritance($theme)
{
$view = $this->factory
- ->createNamed('name', 'email')
+ ->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\EmailType')
->createView()
;
@@ -625,11 +625,11 @@ public function testThemeBlockInheritance($theme)
*/
public function testThemeInheritance($parentTheme, $childTheme)
{
- $child = $this->factory->createNamedBuilder('child', 'form')
- ->add('field', 'text');
+ $child = $this->factory->createNamedBuilder('child', 'Symfony\Component\Form\Extension\Core\Type\FormType')
+ ->add('field', 'Symfony\Component\Form\Extension\Core\Type\TextType');
- $view = $this->factory->createNamedBuilder('parent', 'form')
- ->add('field', 'text')
+ $view = $this->factory->createNamedBuilder('parent', 'Symfony\Component\Form\Extension\Core\Type\FormType')
+ ->add('field', 'Symfony\Component\Form\Extension\Core\Type\TextType')
->add($child)
->getForm()
->createView()
@@ -671,7 +671,7 @@ public function testThemeInheritance($parentTheme, $childTheme)
public function testCollectionRowWithCustomBlock()
{
$collection = array('one', 'two', 'three');
- $form = $this->factory->createNamedBuilder('names', 'collection', $collection)
+ $form = $this->factory->createNamedBuilder('names', 'Symfony\Component\Form\Extension\Core\Type\CollectionType', $collection)
->getForm();
$this->assertWidgetMatchesXpath($form->createView(), array(),
@@ -691,7 +691,7 @@ public function testCollectionRowWithCustomBlock()
*/
public function testChoiceRowWithCustomBlock()
{
- $form = $this->factory->createNamedBuilder('name_c', 'choice', 'a', array(
+ $form = $this->factory->createNamedBuilder('name_c', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', 'a', array(
'choices' => array('a' => 'ChoiceA', 'b' => 'ChoiceB'),
'expanded' => true,
))
@@ -709,9 +709,9 @@ public function testChoiceRowWithCustomBlock()
public function testFormEndWithRest()
{
- $view = $this->factory->createNamedBuilder('name', 'form')
- ->add('field1', 'text')
- ->add('field2', 'text')
+ $view = $this->factory->createNamedBuilder('name', 'Symfony\Component\Form\Extension\Core\Type\FormType')
+ ->add('field1', 'Symfony\Component\Form\Extension\Core\Type\TextType')
+ ->add('field2', 'Symfony\Component\Form\Extension\Core\Type\TextType')
->getForm()
->createView();
@@ -739,9 +739,9 @@ public function testFormEndWithRest()
public function testFormEndWithoutRest()
{
- $view = $this->factory->createNamedBuilder('name', 'form')
- ->add('field1', 'text')
- ->add('field2', 'text')
+ $view = $this->factory->createNamedBuilder('name', 'Symfony\Component\Form\Extension\Core\Type\FormType')
+ ->add('field1', 'Symfony\Component\Form\Extension\Core\Type\TextType')
+ ->add('field2', 'Symfony\Component\Form\Extension\Core\Type\TextType')
->getForm()
->createView();
@@ -755,11 +755,11 @@ public function testFormEndWithoutRest()
public function testWidgetContainerAttributes()
{
- $form = $this->factory->createNamed('form', 'form', null, array(
+ $form = $this->factory->createNamed('form', 'Symfony\Component\Form\Extension\Core\Type\FormType', null, array(
'attr' => array('class' => 'foobar', 'data-foo' => 'bar'),
));
- $form->add('text', 'text');
+ $form->add('text', 'Symfony\Component\Form\Extension\Core\Type\TextType');
$html = $this->renderWidget($form->createView());
@@ -769,7 +769,7 @@ public function testWidgetContainerAttributes()
public function testWidgetContainerAttributeNameRepeatedIfTrue()
{
- $form = $this->factory->createNamed('form', 'form', null, array(
+ $form = $this->factory->createNamed('form', 'Symfony\Component\Form\Extension\Core\Type\FormType', null, array(
'attr' => array('foo' => true),
));
diff --git a/src/Symfony/Component/Form/Tests/AbstractExtensionTest.php b/src/Symfony/Component/Form/Tests/AbstractExtensionTest.php
index b1534db3abc88..74a70399fd0ce 100644
--- a/src/Symfony/Component/Form/Tests/AbstractExtensionTest.php
+++ b/src/Symfony/Component/Form/Tests/AbstractExtensionTest.php
@@ -19,14 +19,14 @@ class AbstractExtensionTest extends \PHPUnit_Framework_TestCase
public function testHasType()
{
$loader = new ConcreteExtension();
- $this->assertTrue($loader->hasType('foo'));
- $this->assertFalse($loader->hasType('bar'));
+ $this->assertTrue($loader->hasType('Symfony\Component\Form\Tests\Fixtures\FooType'));
+ $this->assertFalse($loader->hasType('foo'));
}
public function testGetType()
{
$loader = new ConcreteExtension();
- $this->assertInstanceOf('Symfony\Component\Form\Tests\Fixtures\FooType', $loader->getType('foo'));
+ $this->assertInstanceOf('Symfony\Component\Form\Tests\Fixtures\FooType', $loader->getType('Symfony\Component\Form\Tests\Fixtures\FooType'));
}
/**
@@ -35,7 +35,7 @@ public function testGetType()
*/
public function testCustomOptionsResolver()
{
- $extension = new Fixtures\FooTypeBarExtension();
+ $extension = new Fixtures\LegacyFooTypeBarExtension();
$resolver = new Fixtures\CustomOptionsResolver();
$extension->setDefaultOptions($resolver);
}
diff --git a/src/Symfony/Component/Form/Tests/AbstractLayoutTest.php b/src/Symfony/Component/Form/Tests/AbstractLayoutTest.php
index 67e381562a1a5..257811f55273c 100644
--- a/src/Symfony/Component/Form/Tests/AbstractLayoutTest.php
+++ b/src/Symfony/Component/Form/Tests/AbstractLayoutTest.php
@@ -134,8 +134,8 @@ abstract protected function setTheme(FormView $view, array $themes);
*/
public function testEnctype()
{
- $form = $this->factory->createNamedBuilder('name', 'form')
- ->add('file', 'file')
+ $form = $this->factory->createNamedBuilder('name', 'Symfony\Component\Form\Extension\Core\Type\FormType')
+ ->add('file', 'Symfony\Component\Form\Extension\Core\Type\FileType')
->getForm();
$this->assertEquals('enctype="multipart/form-data"', $this->renderEnctype($form->createView()));
@@ -146,8 +146,8 @@ public function testEnctype()
*/
public function testNoEnctype()
{
- $form = $this->factory->createNamedBuilder('name', 'form')
- ->add('text', 'text')
+ $form = $this->factory->createNamedBuilder('name', 'Symfony\Component\Form\Extension\Core\Type\FormType')
+ ->add('text', 'Symfony\Component\Form\Extension\Core\Type\TextType')
->getForm();
$this->assertEquals('', $this->renderEnctype($form->createView()));
@@ -155,7 +155,7 @@ public function testNoEnctype()
public function testLabel()
{
- $form = $this->factory->createNamed('name', 'text');
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\TextType');
$view = $form->createView();
$this->renderWidget($view, array('label' => 'foo'));
$html = $this->renderLabel($view);
@@ -184,7 +184,7 @@ public function testLabelWithoutTranslation()
public function testLabelOnForm()
{
- $form = $this->factory->createNamed('name', 'date');
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\DateType');
$view = $form->createView();
$this->renderWidget($view, array('label' => 'foo'));
$html = $this->renderLabel($view);
@@ -199,7 +199,7 @@ public function testLabelOnForm()
public function testLabelWithCustomTextPassedAsOption()
{
- $form = $this->factory->createNamed('name', 'text', null, array(
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\TextType', null, array(
'label' => 'Custom label',
));
$html = $this->renderLabel($form->createView());
@@ -214,7 +214,7 @@ public function testLabelWithCustomTextPassedAsOption()
public function testLabelWithCustomTextPassedDirectly()
{
- $form = $this->factory->createNamed('name', 'text');
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\TextType');
$html = $this->renderLabel($form->createView(), 'Custom label');
$this->assertMatchesXpath($html,
@@ -227,7 +227,7 @@ public function testLabelWithCustomTextPassedDirectly()
public function testLabelWithCustomTextPassedAsOptionAndDirectly()
{
- $form = $this->factory->createNamed('name', 'text', null, array(
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\TextType', null, array(
'label' => 'Custom label',
));
$html = $this->renderLabel($form->createView(), 'Overridden label');
@@ -242,7 +242,7 @@ public function testLabelWithCustomTextPassedAsOptionAndDirectly()
public function testLabelDoesNotRenderFieldAttributes()
{
- $form = $this->factory->createNamed('name', 'text');
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\TextType');
$html = $this->renderLabel($form->createView(), null, array(
'attr' => array(
'class' => 'my&class',
@@ -259,7 +259,7 @@ public function testLabelDoesNotRenderFieldAttributes()
public function testLabelWithCustomAttributesPassedDirectly()
{
- $form = $this->factory->createNamed('name', 'text');
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\TextType');
$html = $this->renderLabel($form->createView(), null, array(
'label_attr' => array(
'class' => 'my&class',
@@ -276,7 +276,7 @@ public function testLabelWithCustomAttributesPassedDirectly()
public function testLabelWithCustomTextAndCustomAttributesPassedDirectly()
{
- $form = $this->factory->createNamed('name', 'text');
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\TextType');
$html = $this->renderLabel($form->createView(), 'Custom label', array(
'label_attr' => array(
'class' => 'my&class',
@@ -295,7 +295,7 @@ public function testLabelWithCustomTextAndCustomAttributesPassedDirectly()
// https://github.com/symfony/symfony/issues/5029
public function testLabelWithCustomTextAsOptionAndCustomAttributesPassedDirectly()
{
- $form = $this->factory->createNamed('name', 'text', null, array(
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\TextType', null, array(
'label' => 'Custom label',
));
$html = $this->renderLabel($form->createView(), null, array(
@@ -316,7 +316,7 @@ public function testLabelWithCustomTextAsOptionAndCustomAttributesPassedDirectly
public function testLabelFormatName()
{
$form = $this->factory->createNamedBuilder('myform')
- ->add('myfield', 'text')
+ ->add('myfield', 'Symfony\Component\Form\Extension\Core\Type\TextType')
->getForm();
$view = $form->get('myfield')->createView();
$html = $this->renderLabel($view, null, array('label_format' => 'form.%name%'));
@@ -332,7 +332,7 @@ public function testLabelFormatName()
public function testLabelFormatId()
{
$form = $this->factory->createNamedBuilder('myform')
- ->add('myfield', 'text')
+ ->add('myfield', 'Symfony\Component\Form\Extension\Core\Type\TextType')
->getForm();
$view = $form->get('myfield')->createView();
$html = $this->renderLabel($view, null, array('label_format' => 'form.%id%'));
@@ -349,8 +349,8 @@ public function testLabelFormatAsFormOption()
{
$options = array('label_format' => 'form.%name%');
- $form = $this->factory->createNamedBuilder('myform', 'form', null, $options)
- ->add('myfield', 'text')
+ $form = $this->factory->createNamedBuilder('myform', 'Symfony\Component\Form\Extension\Core\Type\FormType', null, $options)
+ ->add('myfield', 'Symfony\Component\Form\Extension\Core\Type\TextType')
->getForm();
$view = $form->get('myfield')->createView();
$html = $this->renderLabel($view);
@@ -367,8 +367,8 @@ public function testLabelFormatOverriddenOption()
{
$options = array('label_format' => 'form.%name%');
- $form = $this->factory->createNamedBuilder('myform', 'form', null, $options)
- ->add('myfield', 'text', array('label_format' => 'field.%name%'))
+ $form = $this->factory->createNamedBuilder('myform', 'Symfony\Component\Form\Extension\Core\Type\FormType', null, $options)
+ ->add('myfield', 'Symfony\Component\Form\Extension\Core\Type\TextType', array('label_format' => 'field.%name%'))
->getForm();
$view = $form->get('myfield')->createView();
$html = $this->renderLabel($view);
@@ -384,7 +384,7 @@ public function testLabelFormatOverriddenOption()
public function testLabelFormatOnButton()
{
$form = $this->factory->createNamedBuilder('myform')
- ->add('mybutton', 'button')
+ ->add('mybutton', 'Symfony\Component\Form\Extension\Core\Type\ButtonType')
->getForm();
$view = $form->get('mybutton')->createView();
$html = $this->renderWidget($view, array('label_format' => 'form.%name%'));
@@ -401,7 +401,7 @@ public function testLabelFormatOnButton()
public function testLabelFormatOnButtonId()
{
$form = $this->factory->createNamedBuilder('myform')
- ->add('mybutton', 'button')
+ ->add('mybutton', 'Symfony\Component\Form\Extension\Core\Type\ButtonType')
->getForm();
$view = $form->get('mybutton')->createView();
$html = $this->renderWidget($view, array('label_format' => 'form.%id%'));
@@ -417,7 +417,7 @@ public function testLabelFormatOnButtonId()
public function testErrors()
{
- $form = $this->factory->createNamed('name', 'text');
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\TextType');
$form->addError(new FormError('[trans]Error 1[/trans]'));
$form->addError(new FormError('[trans]Error 2[/trans]'));
$view = $form->createView();
@@ -437,7 +437,7 @@ public function testErrors()
public function testOverrideWidgetBlock()
{
// see custom_widgets.html.twig
- $form = $this->factory->createNamed('text_id', 'text');
+ $form = $this->factory->createNamed('text_id', 'Symfony\Component\Form\Extension\Core\Type\TextType');
$html = $this->renderWidget($form->createView());
$this->assertMatchesXpath($html,
@@ -454,7 +454,7 @@ public function testOverrideWidgetBlock()
public function testCheckedCheckbox()
{
- $form = $this->factory->createNamed('name', 'checkbox', true);
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\CheckboxType', true);
$this->assertWidgetMatchesXpath($form->createView(), array(),
'/input
@@ -468,7 +468,7 @@ public function testCheckedCheckbox()
public function testUncheckedCheckbox()
{
- $form = $this->factory->createNamed('name', 'checkbox', false);
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\CheckboxType', false);
$this->assertWidgetMatchesXpath($form->createView(), array(),
'/input
@@ -481,7 +481,7 @@ public function testUncheckedCheckbox()
public function testCheckboxWithValue()
{
- $form = $this->factory->createNamed('name', 'checkbox', false, array(
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\CheckboxType', false, array(
'value' => 'foo&bar',
));
@@ -496,7 +496,7 @@ public function testCheckboxWithValue()
public function testSingleChoice()
{
- $form = $this->factory->createNamed('name', 'choice', '&a', array(
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', '&a', array(
'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'),
'multiple' => false,
'expanded' => false,
@@ -551,7 +551,7 @@ public function testSingleChoiceWithoutTranslation()
public function testSingleChoiceAttributes()
{
- $form = $this->factory->createNamed('name', 'choice', '&a', array(
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', '&a', array(
'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'),
'choice_attr' => array('Choice&B' => array('class' => 'foo&bar')),
'multiple' => false,
@@ -575,7 +575,7 @@ public function testSingleChoiceAttributes()
public function testSingleChoiceWithPreferred()
{
- $form = $this->factory->createNamed('name', 'choice', '&a', array(
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', '&a', array(
'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'),
'preferred_choices' => array('&b'),
'multiple' => false,
@@ -598,7 +598,7 @@ public function testSingleChoiceWithPreferred()
public function testSingleChoiceWithPreferredAndNoSeparator()
{
- $form = $this->factory->createNamed('name', 'choice', '&a', array(
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', '&a', array(
'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'),
'preferred_choices' => array('&b'),
'multiple' => false,
@@ -620,7 +620,7 @@ public function testSingleChoiceWithPreferredAndNoSeparator()
public function testSingleChoiceWithPreferredAndBlankSeparator()
{
- $form = $this->factory->createNamed('name', 'choice', '&a', array(
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', '&a', array(
'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'),
'preferred_choices' => array('&b'),
'multiple' => false,
@@ -643,7 +643,7 @@ public function testSingleChoiceWithPreferredAndBlankSeparator()
public function testChoiceWithOnlyPreferred()
{
- $form = $this->factory->createNamed('name', 'choice', '&a', array(
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', '&a', array(
'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'),
'preferred_choices' => array('&a', '&b'),
'multiple' => false,
@@ -659,7 +659,7 @@ public function testChoiceWithOnlyPreferred()
public function testSingleChoiceNonRequired()
{
- $form = $this->factory->createNamed('name', 'choice', '&a', array(
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', '&a', array(
'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'),
'required' => false,
'multiple' => false,
@@ -682,7 +682,7 @@ public function testSingleChoiceNonRequired()
public function testSingleChoiceNonRequiredNoneSelected()
{
- $form = $this->factory->createNamed('name', 'choice', null, array(
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'),
'required' => false,
'multiple' => false,
@@ -705,7 +705,7 @@ public function testSingleChoiceNonRequiredNoneSelected()
public function testSingleChoiceNonRequiredWithPlaceholder()
{
- $form = $this->factory->createNamed('name', 'choice', '&a', array(
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', '&a', array(
'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'),
'multiple' => false,
'expanded' => false,
@@ -729,7 +729,7 @@ public function testSingleChoiceNonRequiredWithPlaceholder()
public function testSingleChoiceRequiredWithPlaceholder()
{
- $form = $this->factory->createNamed('name', 'choice', '&a', array(
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', '&a', array(
'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'),
'required' => true,
'multiple' => false,
@@ -756,7 +756,7 @@ public function testSingleChoiceRequiredWithPlaceholder()
public function testSingleChoiceRequiredWithPlaceholderViaView()
{
- $form = $this->factory->createNamed('name', 'choice', '&a', array(
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', '&a', array(
'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'),
'required' => true,
'multiple' => false,
@@ -782,7 +782,7 @@ public function testSingleChoiceRequiredWithPlaceholderViaView()
public function testSingleChoiceGrouped()
{
- $form = $this->factory->createNamed('name', 'choice', '&a', array(
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', '&a', array(
'choices' => array(
'Group&1' => array('&a' => 'Choice&A', '&b' => 'Choice&B'),
'Group&2' => array('&c' => 'Choice&C'),
@@ -812,7 +812,7 @@ public function testSingleChoiceGrouped()
public function testMultipleChoice()
{
- $form = $this->factory->createNamed('name', 'choice', array('&a'), array(
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', array('&a'), array(
'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'),
'required' => true,
'multiple' => true,
@@ -835,7 +835,7 @@ public function testMultipleChoice()
public function testMultipleChoiceAttributes()
{
- $form = $this->factory->createNamed('name', 'choice', array('&a'), array(
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', array('&a'), array(
'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'),
'choice_attr' => array('Choice&B' => array('class' => 'foo&bar')),
'required' => true,
@@ -861,7 +861,7 @@ public function testMultipleChoiceAttributes()
public function testMultipleChoiceSkipsPlaceholder()
{
- $form = $this->factory->createNamed('name', 'choice', array('&a'), array(
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', array('&a'), array(
'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'),
'multiple' => true,
'expanded' => false,
@@ -883,7 +883,7 @@ public function testMultipleChoiceSkipsPlaceholder()
public function testMultipleChoiceNonRequired()
{
- $form = $this->factory->createNamed('name', 'choice', array('&a'), array(
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', array('&a'), array(
'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'),
'required' => false,
'multiple' => true,
@@ -905,7 +905,7 @@ public function testMultipleChoiceNonRequired()
public function testSingleChoiceExpanded()
{
- $form = $this->factory->createNamed('name', 'choice', '&a', array(
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', '&a', array(
'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'),
'multiple' => false,
'expanded' => true,
@@ -950,7 +950,7 @@ public function testSingleChoiceExpandedWithoutTranslation()
public function testSingleChoiceExpandedAttributes()
{
- $form = $this->factory->createNamed('name', 'choice', '&a', array(
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', '&a', array(
'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'),
'choice_attr' => array('Choice&B' => array('class' => 'foo&bar')),
'multiple' => false,
@@ -975,7 +975,7 @@ public function testSingleChoiceExpandedAttributes()
public function testSingleChoiceExpandedWithPlaceholder()
{
- $form = $this->factory->createNamed('name', 'choice', '&a', array(
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', '&a', array(
'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'),
'multiple' => false,
'expanded' => true,
@@ -1000,7 +1000,7 @@ public function testSingleChoiceExpandedWithPlaceholder()
public function testSingleChoiceExpandedWithBooleanValue()
{
- $form = $this->factory->createNamed('name', 'choice', true, array(
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', true, array(
'choices' => array('1' => 'Choice&A', '0' => 'Choice&B'),
'multiple' => false,
'expanded' => true,
@@ -1022,7 +1022,7 @@ public function testSingleChoiceExpandedWithBooleanValue()
public function testMultipleChoiceExpanded()
{
- $form = $this->factory->createNamed('name', 'choice', array('&a', '&c'), array(
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', array('&a', '&c'), array(
'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B', '&c' => 'Choice&C'),
'multiple' => true,
'expanded' => true,
@@ -1073,7 +1073,7 @@ public function testMultipleChoiceExpandedWithoutTranslation()
public function testMultipleChoiceExpandedAttributes()
{
- $form = $this->factory->createNamed('name', 'choice', array('&a', '&c'), array(
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', array('&a', '&c'), array(
'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B', '&c' => 'Choice&C'),
'choice_attr' => array('Choice&B' => array('class' => 'foo&bar')),
'multiple' => true,
@@ -1101,7 +1101,7 @@ public function testMultipleChoiceExpandedAttributes()
public function testCountry()
{
- $form = $this->factory->createNamed('name', 'country', 'AT');
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\CountryType', 'AT');
$this->assertWidgetMatchesXpath($form->createView(), array(),
'/select
@@ -1114,7 +1114,7 @@ public function testCountry()
public function testCountryWithPlaceholder()
{
- $form = $this->factory->createNamed('name', 'country', 'AT', array(
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\CountryType', 'AT', array(
'placeholder' => 'Select&Country',
'required' => false,
));
@@ -1131,7 +1131,7 @@ public function testCountryWithPlaceholder()
public function testDateTime()
{
- $form = $this->factory->createNamed('name', 'datetime', '2011-02-03 04:05:06', array(
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\DateTimeType', '2011-02-03 04:05:06', array(
'input' => 'string',
'with_seconds' => false,
));
@@ -1170,7 +1170,7 @@ public function testDateTime()
public function testDateTimeWithPlaceholderGlobal()
{
- $form = $this->factory->createNamed('name', 'datetime', null, array(
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\DateTimeType', null, array(
'input' => 'string',
'placeholder' => 'Change&Me',
'required' => false,
@@ -1212,7 +1212,7 @@ public function testDateTimeWithHourAndMinute()
{
$data = array('year' => '2011', 'month' => '2', 'day' => '3', 'hour' => '4', 'minute' => '5');
- $form = $this->factory->createNamed('name', 'datetime', $data, array(
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\DateTimeType', $data, array(
'input' => 'array',
'required' => false,
));
@@ -1251,7 +1251,7 @@ public function testDateTimeWithHourAndMinute()
public function testDateTimeWithSeconds()
{
- $form = $this->factory->createNamed('name', 'datetime', '2011-02-03 04:05:06', array(
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\DateTimeType', '2011-02-03 04:05:06', array(
'input' => 'string',
'with_seconds' => true,
));
@@ -1293,7 +1293,7 @@ public function testDateTimeWithSeconds()
public function testDateTimeSingleText()
{
- $form = $this->factory->createNamed('name', 'datetime', '2011-02-03 04:05:06', array(
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\DateTimeType', '2011-02-03 04:05:06', array(
'input' => 'string',
'date_widget' => 'single_text',
'time_widget' => 'single_text',
@@ -1319,7 +1319,7 @@ public function testDateTimeSingleText()
public function testDateTimeWithWidgetSingleText()
{
- $form = $this->factory->createNamed('name', 'datetime', '2011-02-03 04:05:06', array(
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\DateTimeType', '2011-02-03 04:05:06', array(
'input' => 'string',
'widget' => 'single_text',
'model_timezone' => 'UTC',
@@ -1337,7 +1337,7 @@ public function testDateTimeWithWidgetSingleText()
public function testDateTimeWithWidgetSingleTextIgnoreDateAndTimeWidgets()
{
- $form = $this->factory->createNamed('name', 'datetime', '2011-02-03 04:05:06', array(
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\DateTimeType', '2011-02-03 04:05:06', array(
'input' => 'string',
'date_widget' => 'choice',
'time_widget' => 'choice',
@@ -1357,7 +1357,7 @@ public function testDateTimeWithWidgetSingleTextIgnoreDateAndTimeWidgets()
public function testDateChoice()
{
- $form = $this->factory->createNamed('name', 'date', '2011-02-03', array(
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\DateType', '2011-02-03', array(
'input' => 'string',
'widget' => 'choice',
));
@@ -1382,7 +1382,7 @@ public function testDateChoice()
public function testDateChoiceWithPlaceholderGlobal()
{
- $form = $this->factory->createNamed('name', 'date', null, array(
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\DateType', null, array(
'input' => 'string',
'widget' => 'choice',
'placeholder' => 'Change&Me',
@@ -1409,7 +1409,7 @@ public function testDateChoiceWithPlaceholderGlobal()
public function testDateChoiceWithPlaceholderOnYear()
{
- $form = $this->factory->createNamed('name', 'date', null, array(
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\DateType', null, array(
'input' => 'string',
'widget' => 'choice',
'required' => false,
@@ -1436,7 +1436,7 @@ public function testDateChoiceWithPlaceholderOnYear()
public function testDateText()
{
- $form = $this->factory->createNamed('name', 'date', '2011-02-03', array(
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\DateType', '2011-02-03', array(
'input' => 'string',
'widget' => 'text',
));
@@ -1464,7 +1464,7 @@ public function testDateText()
public function testDateSingleText()
{
- $form = $this->factory->createNamed('name', 'date', '2011-02-03', array(
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\DateType', '2011-02-03', array(
'input' => 'string',
'widget' => 'single_text',
));
@@ -1480,8 +1480,8 @@ public function testDateSingleText()
public function testDateErrorBubbling()
{
- $form = $this->factory->createNamedBuilder('form', 'form')
- ->add('date', 'date')
+ $form = $this->factory->createNamedBuilder('form', 'Symfony\Component\Form\Extension\Core\Type\FormType')
+ ->add('date', 'Symfony\Component\Form\Extension\Core\Type\DateType')
->getForm();
$form->get('date')->addError(new FormError('[trans]Error![/trans]'));
$view = $form->createView();
@@ -1492,7 +1492,7 @@ public function testDateErrorBubbling()
public function testBirthDay()
{
- $form = $this->factory->createNamed('name', 'birthday', '2000-02-03', array(
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\BirthdayType', '2000-02-03', array(
'input' => 'string',
));
@@ -1516,7 +1516,7 @@ public function testBirthDay()
public function testBirthDayWithPlaceholder()
{
- $form = $this->factory->createNamed('name', 'birthday', '1950-01-01', array(
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\BirthdayType', '1950-01-01', array(
'input' => 'string',
'placeholder' => '',
'required' => false,
@@ -1545,7 +1545,7 @@ public function testBirthDayWithPlaceholder()
public function testEmail()
{
- $form = $this->factory->createNamed('name', 'email', 'foo&bar');
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\EmailType', 'foo&bar');
$this->assertWidgetMatchesXpath($form->createView(), array(),
'/input
@@ -1559,7 +1559,7 @@ public function testEmail()
public function testEmailWithMaxLength()
{
- $form = $this->factory->createNamed('name', 'email', 'foo&bar', array(
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\EmailType', 'foo&bar', array(
'attr' => array('maxlength' => 123),
));
@@ -1575,7 +1575,7 @@ public function testEmailWithMaxLength()
public function testFile()
{
- $form = $this->factory->createNamed('name', 'file');
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\FileType');
$this->assertWidgetMatchesXpath($form->createView(), array(),
'/input
@@ -1586,7 +1586,7 @@ public function testFile()
public function testHidden()
{
- $form = $this->factory->createNamed('name', 'hidden', 'foo&bar');
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\HiddenType', 'foo&bar');
$this->assertWidgetMatchesXpath($form->createView(), array(),
'/input
@@ -1602,7 +1602,7 @@ public function testHidden()
*/
public function testLegacyReadOnly()
{
- $form = $this->factory->createNamed('name', 'text', null, array(
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\TextType', null, array(
'read_only' => true,
));
@@ -1617,7 +1617,7 @@ public function testLegacyReadOnly()
public function testDisabled()
{
- $form = $this->factory->createNamed('name', 'text', null, array(
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\TextType', null, array(
'disabled' => true,
));
@@ -1632,7 +1632,7 @@ public function testDisabled()
public function testInteger()
{
- $form = $this->factory->createNamed('name', 'integer', 123);
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\IntegerType', 123);
$this->assertWidgetMatchesXpath($form->createView(), array(),
'/input
@@ -1645,7 +1645,7 @@ public function testInteger()
public function testLanguage()
{
- $form = $this->factory->createNamed('name', 'language', 'de');
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\LanguageType', 'de');
$this->assertWidgetMatchesXpath($form->createView(), array(),
'/select
@@ -1658,7 +1658,7 @@ public function testLanguage()
public function testLocale()
{
- $form = $this->factory->createNamed('name', 'locale', 'de_AT');
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\LocaleType', 'de_AT');
$this->assertWidgetMatchesXpath($form->createView(), array(),
'/select
@@ -1671,7 +1671,7 @@ public function testLocale()
public function testMoney()
{
- $form = $this->factory->createNamed('name', 'money', 1234.56, array(
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\MoneyType', 1234.56, array(
'currency' => 'EUR',
));
@@ -1687,7 +1687,7 @@ public function testMoney()
public function testNumber()
{
- $form = $this->factory->createNamed('name', 'number', 1234.56);
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\NumberType', 1234.56);
$this->assertWidgetMatchesXpath($form->createView(), array(),
'/input
@@ -1700,7 +1700,7 @@ public function testNumber()
public function testPassword()
{
- $form = $this->factory->createNamed('name', 'password', 'foo&bar');
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\PasswordType', 'foo&bar');
$this->assertWidgetMatchesXpath($form->createView(), array(),
'/input
@@ -1712,7 +1712,7 @@ public function testPassword()
public function testPasswordSubmittedWithNotAlwaysEmpty()
{
- $form = $this->factory->createNamed('name', 'password', null, array(
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\PasswordType', null, array(
'always_empty' => false,
));
$form->submit('foo&bar');
@@ -1728,7 +1728,7 @@ public function testPasswordSubmittedWithNotAlwaysEmpty()
public function testPasswordWithMaxLength()
{
- $form = $this->factory->createNamed('name', 'password', 'foo&bar', array(
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\PasswordType', 'foo&bar', array(
'attr' => array('maxlength' => 123),
));
@@ -1743,7 +1743,7 @@ public function testPasswordWithMaxLength()
public function testPercent()
{
- $form = $this->factory->createNamed('name', 'percent', 0.1);
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\PercentType', 0.1);
$this->assertWidgetMatchesXpath($form->createView(), array(),
'/input
@@ -1757,7 +1757,7 @@ public function testPercent()
public function testCheckedRadio()
{
- $form = $this->factory->createNamed('name', 'radio', true);
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\RadioType', true);
$this->assertWidgetMatchesXpath($form->createView(), array(),
'/input
@@ -1771,7 +1771,7 @@ public function testCheckedRadio()
public function testUncheckedRadio()
{
- $form = $this->factory->createNamed('name', 'radio', false);
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\RadioType', false);
$this->assertWidgetMatchesXpath($form->createView(), array(),
'/input
@@ -1784,7 +1784,7 @@ public function testUncheckedRadio()
public function testRadioWithValue()
{
- $form = $this->factory->createNamed('name', 'radio', false, array(
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\RadioType', false, array(
'value' => 'foo&bar',
));
@@ -1799,7 +1799,7 @@ public function testRadioWithValue()
public function testRange()
{
- $form = $this->factory->createNamed('name', 'range', 42, array('attr' => array('min' => 5)));
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\RangeType', 42, array('attr' => array('min' => 5)));
$this->assertWidgetMatchesXpath($form->createView(), array(),
'/input
@@ -1813,7 +1813,7 @@ public function testRange()
public function testRangeWithMinMaxValues()
{
- $form = $this->factory->createNamed('name', 'range', 42, array('attr' => array('min' => 5, 'max' => 57)));
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\RangeType', 42, array('attr' => array('min' => 5, 'max' => 57)));
$this->assertWidgetMatchesXpath($form->createView(), array(),
'/input
@@ -1828,7 +1828,7 @@ public function testRangeWithMinMaxValues()
public function testTextarea()
{
- $form = $this->factory->createNamed('name', 'textarea', 'foo&bar', array(
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\TextareaType', 'foo&bar', array(
'attr' => array('pattern' => 'foo'),
));
@@ -1843,7 +1843,7 @@ public function testTextarea()
public function testText()
{
- $form = $this->factory->createNamed('name', 'text', 'foo&bar');
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\TextType', 'foo&bar');
$this->assertWidgetMatchesXpath($form->createView(), array(),
'/input
@@ -1857,7 +1857,7 @@ public function testText()
public function testTextWithMaxLength()
{
- $form = $this->factory->createNamed('name', 'text', 'foo&bar', array(
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\TextType', 'foo&bar', array(
'attr' => array('maxlength' => 123),
));
@@ -1873,7 +1873,7 @@ public function testTextWithMaxLength()
public function testSearch()
{
- $form = $this->factory->createNamed('name', 'search', 'foo&bar');
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\SearchType', 'foo&bar');
$this->assertWidgetMatchesXpath($form->createView(), array(),
'/input
@@ -1887,7 +1887,7 @@ public function testSearch()
public function testTime()
{
- $form = $this->factory->createNamed('name', 'time', '04:05:06', array(
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\TimeType', '04:05:06', array(
'input' => 'string',
'with_seconds' => false,
));
@@ -1911,7 +1911,7 @@ public function testTime()
public function testTimeWithSeconds()
{
- $form = $this->factory->createNamed('name', 'time', '04:05:06', array(
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\TimeType', '04:05:06', array(
'input' => 'string',
'with_seconds' => true,
));
@@ -1942,7 +1942,7 @@ public function testTimeWithSeconds()
public function testTimeText()
{
- $form = $this->factory->createNamed('name', 'time', '04:05:06', array(
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\TimeType', '04:05:06', array(
'input' => 'string',
'widget' => 'text',
));
@@ -1972,7 +1972,7 @@ public function testTimeText()
public function testTimeSingleText()
{
- $form = $this->factory->createNamed('name', 'time', '04:05:06', array(
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\TimeType', '04:05:06', array(
'input' => 'string',
'widget' => 'single_text',
));
@@ -1989,7 +1989,7 @@ public function testTimeSingleText()
public function testTimeWithPlaceholderGlobal()
{
- $form = $this->factory->createNamed('name', 'time', null, array(
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\TimeType', null, array(
'input' => 'string',
'placeholder' => 'Change&Me',
'required' => false,
@@ -2014,7 +2014,7 @@ public function testTimeWithPlaceholderGlobal()
public function testTimeWithPlaceholderOnYear()
{
- $form = $this->factory->createNamed('name', 'time', null, array(
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\TimeType', null, array(
'input' => 'string',
'required' => false,
'placeholder' => array('hour' => 'Change&Me'),
@@ -2039,8 +2039,8 @@ public function testTimeWithPlaceholderOnYear()
public function testTimeErrorBubbling()
{
- $form = $this->factory->createNamedBuilder('form', 'form')
- ->add('time', 'time')
+ $form = $this->factory->createNamedBuilder('form', 'Symfony\Component\Form\Extension\Core\Type\FormType')
+ ->add('time', 'Symfony\Component\Form\Extension\Core\Type\TimeType')
->getForm();
$form->get('time')->addError(new FormError('[trans]Error![/trans]'));
$view = $form->createView();
@@ -2051,7 +2051,7 @@ public function testTimeErrorBubbling()
public function testTimezone()
{
- $form = $this->factory->createNamed('name', 'timezone', 'Europe/Vienna');
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\TimezoneType', 'Europe/Vienna');
$this->assertWidgetMatchesXpath($form->createView(), array(),
'/select
@@ -2069,7 +2069,7 @@ public function testTimezone()
public function testTimezoneWithPlaceholder()
{
- $form = $this->factory->createNamed('name', 'timezone', null, array(
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\TimezoneType', null, array(
'placeholder' => 'Select&Timezone',
'required' => false,
));
@@ -2086,7 +2086,7 @@ public function testTimezoneWithPlaceholder()
public function testUrl()
{
$url = 'http://www.google.com?foo1=bar1&foo2=bar2';
- $form = $this->factory->createNamed('name', 'url', $url);
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\UrlType', $url);
$this->assertWidgetMatchesXpath($form->createView(), array(),
'/input
@@ -2099,8 +2099,8 @@ public function testUrl()
public function testCollectionPrototype()
{
- $form = $this->factory->createNamedBuilder('name', 'form', array('items' => array('one', 'two', 'three')))
- ->add('items', 'collection', array('allow_add' => true))
+ $form = $this->factory->createNamedBuilder('name', 'Symfony\Component\Form\Extension\Core\Type\FormType', array('items' => array('one', 'two', 'three')))
+ ->add('items', 'Symfony\Component\Form\Extension\Core\Type\CollectionType', array('allow_add' => true))
->getForm()
->createView();
@@ -2115,8 +2115,8 @@ public function testCollectionPrototype()
public function testEmptyRootFormName()
{
- $form = $this->factory->createNamedBuilder('', 'form')
- ->add('child', 'text')
+ $form = $this->factory->createNamedBuilder('', 'Symfony\Component\Form\Extension\Core\Type\FormType')
+ ->add('child', 'Symfony\Component\Form\Extension\Core\Type\TextType')
->getForm();
$this->assertMatchesXpath($this->renderWidget($form->createView()),
@@ -2127,7 +2127,7 @@ public function testEmptyRootFormName()
public function testButton()
{
- $form = $this->factory->createNamed('name', 'button');
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ButtonType');
$this->assertWidgetMatchesXpath($form->createView(), array(),
'/button[@type="button"][@name="name"][.="[trans]Name[/trans]"]'
@@ -2136,14 +2136,14 @@ public function testButton()
public function testButtonLabelIsEmpty()
{
- $form = $this->factory->createNamed('name', 'button');
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ButtonType');
$this->assertSame('', $this->renderLabel($form->createView()));
}
public function testSubmit()
{
- $form = $this->factory->createNamed('name', 'submit');
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\SubmitType');
$this->assertWidgetMatchesXpath($form->createView(), array(),
'/button[@type="submit"][@name="name"]'
@@ -2152,7 +2152,7 @@ public function testSubmit()
public function testReset()
{
- $form = $this->factory->createNamed('name', 'reset');
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ResetType');
$this->assertWidgetMatchesXpath($form->createView(), array(),
'/button[@type="reset"][@name="name"]'
@@ -2161,7 +2161,7 @@ public function testReset()
public function testStartTag()
{
- $form = $this->factory->create('form', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\FormType', null, array(
'method' => 'get',
'action' => 'http://example.com/directory',
));
@@ -2173,7 +2173,7 @@ public function testStartTag()
public function testStartTagForPutRequest()
{
- $form = $this->factory->create('form', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\FormType', null, array(
'method' => 'put',
'action' => 'http://example.com/directory',
));
@@ -2190,7 +2190,7 @@ public function testStartTagForPutRequest()
public function testStartTagWithOverriddenVars()
{
- $form = $this->factory->create('form', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\FormType', null, array(
'method' => 'put',
'action' => 'http://example.com/directory',
));
@@ -2205,11 +2205,11 @@ public function testStartTagWithOverriddenVars()
public function testStartTagForMultipartForm()
{
- $form = $this->factory->createBuilder('form', null, array(
+ $form = $this->factory->createBuilder('Symfony\Component\Form\Extension\Core\Type\FormType', null, array(
'method' => 'get',
'action' => 'http://example.com/directory',
))
- ->add('file', 'file')
+ ->add('file', 'Symfony\Component\Form\Extension\Core\Type\FileType')
->getForm();
$html = $this->renderStart($form->createView());
@@ -2219,7 +2219,7 @@ public function testStartTagForMultipartForm()
public function testStartTagWithExtraAttributes()
{
- $form = $this->factory->create('form', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\FormType', null, array(
'method' => 'get',
'action' => 'http://example.com/directory',
));
@@ -2233,7 +2233,7 @@ public function testStartTagWithExtraAttributes()
public function testWidgetAttributes()
{
- $form = $this->factory->createNamed('text', 'text', 'value', array(
+ $form = $this->factory->createNamed('text', 'Symfony\Component\Form\Extension\Core\Type\TextType', 'value', array(
'required' => true,
'disabled' => true,
'attr' => array('readonly' => true, 'maxlength' => 10, 'pattern' => '\d+', 'class' => 'foobar', 'data-foo' => 'bar'),
@@ -2247,7 +2247,7 @@ public function testWidgetAttributes()
public function testWidgetAttributeNameRepeatedIfTrue()
{
- $form = $this->factory->createNamed('text', 'text', 'value', array(
+ $form = $this->factory->createNamed('text', 'Symfony\Component\Form\Extension\Core\Type\TextType', 'value', array(
'attr' => array('foo' => true),
));
@@ -2259,7 +2259,7 @@ public function testWidgetAttributeNameRepeatedIfTrue()
public function testWidgetAttributeHiddenIfFalse()
{
- $form = $this->factory->createNamed('text', 'text', 'value', array(
+ $form = $this->factory->createNamed('text', 'Symfony\Component\Form\Extension\Core\Type\TextType', 'value', array(
'attr' => array('foo' => false),
));
@@ -2270,7 +2270,7 @@ public function testWidgetAttributeHiddenIfFalse()
public function testButtonAttributes()
{
- $form = $this->factory->createNamed('button', 'button', null, array(
+ $form = $this->factory->createNamed('button', 'Symfony\Component\Form\Extension\Core\Type\ButtonType', null, array(
'disabled' => true,
'attr' => array('class' => 'foobar', 'data-foo' => 'bar'),
));
@@ -2283,7 +2283,7 @@ public function testButtonAttributes()
public function testButtonAttributeNameRepeatedIfTrue()
{
- $form = $this->factory->createNamed('button', 'button', null, array(
+ $form = $this->factory->createNamed('button', 'Symfony\Component\Form\Extension\Core\Type\ButtonType', null, array(
'attr' => array('foo' => true),
));
@@ -2295,7 +2295,7 @@ public function testButtonAttributeNameRepeatedIfTrue()
public function testButtonAttributeHiddenIfFalse()
{
- $form = $this->factory->createNamed('button', 'button', null, array(
+ $form = $this->factory->createNamed('button', 'Symfony\Component\Form\Extension\Core\Type\ButtonType', null, array(
'attr' => array('foo' => false),
));
@@ -2306,7 +2306,7 @@ public function testButtonAttributeHiddenIfFalse()
public function testTextareaWithWhitespaceOnlyContentRetainsValue()
{
- $form = $this->factory->createNamed('textarea', 'textarea', ' ');
+ $form = $this->factory->createNamed('textarea', 'Symfony\Component\Form\Extension\Core\Type\TextareaType', ' ');
$html = $this->renderWidget($form->createView());
@@ -2315,8 +2315,8 @@ public function testTextareaWithWhitespaceOnlyContentRetainsValue()
public function testTextareaWithWhitespaceOnlyContentRetainsValueWhenRenderingForm()
{
- $form = $this->factory->createBuilder('form', array('textarea' => ' '))
- ->add('textarea', 'textarea')
+ $form = $this->factory->createBuilder('Symfony\Component\Form\Extension\Core\Type\FormType', array('textarea' => ' '))
+ ->add('textarea', 'Symfony\Component\Form\Extension\Core\Type\TextareaType')
->getForm();
$html = $this->renderForm($form->createView());
@@ -2326,7 +2326,7 @@ public function testTextareaWithWhitespaceOnlyContentRetainsValueWhenRenderingFo
public function testWidgetContainerAttributeHiddenIfFalse()
{
- $form = $this->factory->createNamed('form', 'form', null, array(
+ $form = $this->factory->createNamed('form', 'Symfony\Component\Form\Extension\Core\Type\FormType', null, array(
'attr' => array('foo' => false),
));
@@ -2338,9 +2338,9 @@ public function testWidgetContainerAttributeHiddenIfFalse()
public function testTranslatedAttributes()
{
- $view = $this->factory->createNamedBuilder('name', 'form')
- ->add('firstName', 'text', array('attr' => array('title' => 'Foo')))
- ->add('lastName', 'text', array('attr' => array('placeholder' => 'Bar')))
+ $view = $this->factory->createNamedBuilder('name', 'Symfony\Component\Form\Extension\Core\Type\FormType')
+ ->add('firstName', 'Symfony\Component\Form\Extension\Core\Type\TextType', array('attr' => array('title' => 'Foo')))
+ ->add('lastName', 'Symfony\Component\Form\Extension\Core\Type\TextType', array('attr' => array('placeholder' => 'Bar')))
->getForm()
->createView();
diff --git a/src/Symfony/Component/Form/Tests/AbstractRequestHandlerTest.php b/src/Symfony/Component/Form/Tests/AbstractRequestHandlerTest.php
index d6e0b4f67194b..022b5148e9e51 100644
--- a/src/Symfony/Component/Form/Tests/AbstractRequestHandlerTest.php
+++ b/src/Symfony/Component/Form/Tests/AbstractRequestHandlerTest.php
@@ -323,7 +323,7 @@ public function testAddFormErrorIfPostMaxSizeExceeded($contentLength, $iniMax, $
->will($this->returnValue($iniMax));
$options = array('post_max_size_message' => 'Max {{ max }}!');
- $form = $this->factory->createNamed('name', 'text', null, $options);
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\TextType', null, $options);
$this->setRequestData('POST', array(), array());
$this->requestHandler->handleRequest($form, $this->request);
diff --git a/src/Symfony/Component/Form/Tests/AbstractTableLayoutTest.php b/src/Symfony/Component/Form/Tests/AbstractTableLayoutTest.php
index f655d17cd65a0..7cb44ade6b192 100644
--- a/src/Symfony/Component/Form/Tests/AbstractTableLayoutTest.php
+++ b/src/Symfony/Component/Form/Tests/AbstractTableLayoutTest.php
@@ -18,7 +18,7 @@ abstract class AbstractTableLayoutTest extends AbstractLayoutTest
{
public function testRow()
{
- $form = $this->factory->createNamed('name', 'text');
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\TextType');
$form->addError(new FormError('[trans]Error![/trans]'));
$view = $form->createView();
$html = $this->renderRow($view);
@@ -42,7 +42,7 @@ public function testRow()
public function testLabelIsNotRenderedWhenSetToFalse()
{
- $form = $this->factory->createNamed('name', 'text', null, array(
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\TextType', null, array(
'label' => false,
));
$html = $this->renderRow($form->createView());
@@ -61,7 +61,7 @@ public function testLabelIsNotRenderedWhenSetToFalse()
public function testRepeatedRow()
{
- $form = $this->factory->createNamed('name', 'repeated');
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\RepeatedType');
$html = $this->renderRow($form->createView());
$this->assertMatchesXpath($html,
@@ -91,7 +91,7 @@ public function testRepeatedRow()
public function testRepeatedRowWithErrors()
{
- $form = $this->factory->createNamed('name', 'repeated');
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\RepeatedType');
$form->addError(new FormError('[trans]Error![/trans]'));
$view = $form->createView();
$html = $this->renderRow($view);
@@ -128,7 +128,7 @@ public function testRepeatedRowWithErrors()
public function testButtonRow()
{
- $form = $this->factory->createNamed('name', 'button');
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ButtonType');
$view = $form->createView();
$html = $this->renderRow($view);
@@ -147,11 +147,11 @@ public function testButtonRow()
public function testRest()
{
- $view = $this->factory->createNamedBuilder('name', 'form')
- ->add('field1', 'text')
- ->add('field2', 'repeated')
- ->add('field3', 'text')
- ->add('field4', 'text')
+ $view = $this->factory->createNamedBuilder('name', 'Symfony\Component\Form\Extension\Core\Type\FormType')
+ ->add('field1', 'Symfony\Component\Form\Extension\Core\Type\TextType')
+ ->add('field2', 'Symfony\Component\Form\Extension\Core\Type\RepeatedType')
+ ->add('field3', 'Symfony\Component\Form\Extension\Core\Type\TextType')
+ ->add('field4', 'Symfony\Component\Form\Extension\Core\Type\TextType')
->getForm()
->createView();
@@ -194,8 +194,8 @@ public function testRest()
public function testCollection()
{
- $form = $this->factory->createNamed('names', 'collection', array('a', 'b'), array(
- 'type' => 'text',
+ $form = $this->factory->createNamed('names', 'Symfony\Component\Form\Extension\Core\Type\CollectionType', array('a', 'b'), array(
+ 'type' => 'Symfony\Component\Form\Extension\Core\Type\TextType',
));
$this->assertWidgetMatchesXpath($form->createView(), array(),
@@ -212,8 +212,8 @@ public function testCollection()
public function testEmptyCollection()
{
- $form = $this->factory->createNamed('names', 'collection', array(), array(
- 'type' => 'text',
+ $form = $this->factory->createNamed('names', 'Symfony\Component\Form\Extension\Core\Type\CollectionType', array(), array(
+ 'type' => 'Symfony\Component\Form\Extension\Core\Type\TextType',
));
$this->assertWidgetMatchesXpath($form->createView(), array(),
@@ -226,11 +226,11 @@ public function testEmptyCollection()
public function testForm()
{
- $view = $this->factory->createNamedBuilder('name', 'form')
+ $view = $this->factory->createNamedBuilder('name', 'Symfony\Component\Form\Extension\Core\Type\FormType')
->setMethod('PUT')
->setAction('http://example.com')
- ->add('firstName', 'text')
- ->add('lastName', 'text')
+ ->add('firstName', 'Symfony\Component\Form\Extension\Core\Type\TextType')
+ ->add('lastName', 'Symfony\Component\Form\Extension\Core\Type\TextType')
->getForm()
->createView();
@@ -278,9 +278,9 @@ public function testForm()
public function testFormWidget()
{
- $view = $this->factory->createNamedBuilder('name', 'form')
- ->add('firstName', 'text')
- ->add('lastName', 'text')
+ $view = $this->factory->createNamedBuilder('name', 'Symfony\Component\Form\Extension\Core\Type\FormType')
+ ->add('firstName', 'Symfony\Component\Form\Extension\Core\Type\TextType')
+ ->add('lastName', 'Symfony\Component\Form\Extension\Core\Type\TextType')
->getForm()
->createView();
@@ -315,10 +315,10 @@ public function testFormWidget()
// https://github.com/symfony/symfony/issues/2308
public function testNestedFormError()
{
- $form = $this->factory->createNamedBuilder('name', 'form')
+ $form = $this->factory->createNamedBuilder('name', 'Symfony\Component\Form\Extension\Core\Type\FormType')
->add($this->factory
- ->createNamedBuilder('child', 'form', null, array('error_bubbling' => false))
- ->add('grandChild', 'form')
+ ->createNamedBuilder('child', 'Symfony\Component\Form\Extension\Core\Type\FormType', null, array('error_bubbling' => false))
+ ->add('grandChild', 'Symfony\Component\Form\Extension\Core\Type\FormType')
)
->getForm();
@@ -341,11 +341,11 @@ public function testCsrf()
->method('getToken')
->will($this->returnValue(new CsrfToken('token_id', 'foo&bar')));
- $form = $this->factory->createNamedBuilder('name', 'form')
+ $form = $this->factory->createNamedBuilder('name', 'Symfony\Component\Form\Extension\Core\Type\FormType')
->add($this->factory
// No CSRF protection on nested forms
- ->createNamedBuilder('child', 'form')
- ->add($this->factory->createNamedBuilder('grandchild', 'text'))
+ ->createNamedBuilder('child', 'Symfony\Component\Form\Extension\Core\Type\FormType')
+ ->add($this->factory->createNamedBuilder('grandchild', 'Symfony\Component\Form\Extension\Core\Type\TextType'))
)
->getForm();
@@ -365,8 +365,8 @@ public function testCsrf()
public function testRepeated()
{
- $form = $this->factory->createNamed('name', 'repeated', 'foobar', array(
- 'type' => 'text',
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\RepeatedType', 'foobar', array(
+ 'type' => 'Symfony\Component\Form\Extension\Core\Type\TextType',
));
$this->assertWidgetMatchesXpath($form->createView(), array(),
@@ -399,8 +399,8 @@ public function testRepeated()
public function testRepeatedWithCustomOptions()
{
- $form = $this->factory->createNamed('name', 'repeated', 'foobar', array(
- 'type' => 'password',
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\RepeatedType', 'foobar', array(
+ 'type' => 'Symfony\Component\Form\Extension\Core\Type\PasswordType',
'first_options' => array('label' => 'Test', 'required' => false),
'second_options' => array('label' => 'Test2'),
));
@@ -440,7 +440,7 @@ public function testRepeatedWithCustomOptions()
public function testCollectionRowWithCustomBlock()
{
$collection = array('one', 'two', 'three');
- $form = $this->factory->createNamedBuilder('names', 'collection', $collection)
+ $form = $this->factory->createNamedBuilder('names', 'Symfony\Component\Form\Extension\Core\Type\CollectionType', $collection)
->getForm();
$this->assertWidgetMatchesXpath($form->createView(), array(),
@@ -456,9 +456,9 @@ public function testCollectionRowWithCustomBlock()
public function testFormEndWithRest()
{
- $view = $this->factory->createNamedBuilder('name', 'form')
- ->add('field1', 'text')
- ->add('field2', 'text')
+ $view = $this->factory->createNamedBuilder('name', 'Symfony\Component\Form\Extension\Core\Type\FormType')
+ ->add('field1', 'Symfony\Component\Form\Extension\Core\Type\TextType')
+ ->add('field2', 'Symfony\Component\Form\Extension\Core\Type\TextType')
->getForm()
->createView();
@@ -494,9 +494,9 @@ public function testFormEndWithRest()
public function testFormEndWithoutRest()
{
- $view = $this->factory->createNamedBuilder('name', 'form')
- ->add('field1', 'text')
- ->add('field2', 'text')
+ $view = $this->factory->createNamedBuilder('name', 'Symfony\Component\Form\Extension\Core\Type\FormType')
+ ->add('field1', 'Symfony\Component\Form\Extension\Core\Type\TextType')
+ ->add('field2', 'Symfony\Component\Form\Extension\Core\Type\TextType')
->getForm()
->createView();
@@ -510,11 +510,11 @@ public function testFormEndWithoutRest()
public function testWidgetContainerAttributes()
{
- $form = $this->factory->createNamed('form', 'form', null, array(
+ $form = $this->factory->createNamed('form', 'Symfony\Component\Form\Extension\Core\Type\FormType', null, array(
'attr' => array('class' => 'foobar', 'data-foo' => 'bar'),
));
- $form->add('text', 'text');
+ $form->add('text', 'Symfony\Component\Form\Extension\Core\Type\TextType');
$html = $this->renderWidget($form->createView());
@@ -524,7 +524,7 @@ public function testWidgetContainerAttributes()
public function testWidgetContainerAttributeNameRepeatedIfTrue()
{
- $form = $this->factory->createNamed('form', 'form', null, array(
+ $form = $this->factory->createNamed('form', 'Symfony\Component\Form\Extension\Core\Type\FormType', null, array(
'attr' => array('foo' => true),
));
diff --git a/src/Symfony/Component/Form/Tests/CompoundFormPerformanceTest.php b/src/Symfony/Component/Form/Tests/CompoundFormPerformanceTest.php
index 77873a71f9561..f85568f097cf2 100644
--- a/src/Symfony/Component/Form/Tests/CompoundFormPerformanceTest.php
+++ b/src/Symfony/Component/Form/Tests/CompoundFormPerformanceTest.php
@@ -26,16 +26,16 @@ public function testArrayBasedForm()
$this->setMaxRunningTime(1);
for ($i = 0; $i < 40; ++$i) {
- $form = $this->factory->createBuilder('form')
- ->add('firstName', 'text')
- ->add('lastName', 'text')
- ->add('gender', 'choice', array(
+ $form = $this->factory->createBuilder('Symfony\Component\Form\Extension\Core\Type\FormType')
+ ->add('firstName', 'Symfony\Component\Form\Extension\Core\Type\TextType')
+ ->add('lastName', 'Symfony\Component\Form\Extension\Core\Type\TextType')
+ ->add('gender', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', array(
'choices' => array('male' => 'Male', 'female' => 'Female'),
'required' => false,
))
- ->add('age', 'number')
- ->add('birthDate', 'birthday')
- ->add('city', 'choice', array(
+ ->add('age', 'Symfony\Component\Form\Extension\Core\Type\NumberType')
+ ->add('birthDate', 'Symfony\Component\Form\Extension\Core\Type\BirthdayType')
+ ->add('city', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', array(
// simulate 300 different cities
'choices' => range(1, 300),
))
diff --git a/src/Symfony/Component/Form/Tests/CompoundFormTest.php b/src/Symfony/Component/Form/Tests/CompoundFormTest.php
index fdf83896d55a6..a306647234dd9 100644
--- a/src/Symfony/Component/Form/Tests/CompoundFormTest.php
+++ b/src/Symfony/Component/Form/Tests/CompoundFormTest.php
@@ -110,7 +110,7 @@ public function testSubmitDoesNotAddExtraFieldForNullValues()
$factory = Forms::createFormFactoryBuilder()
->getFormFactory();
- $child = $factory->create('file', null, array('auto_initialize' => false));
+ $child = $factory->createNamed('file', 'Symfony\Component\Form\Extension\Core\Type\FileType', null, array('auto_initialize' => false));
$this->form->add($child);
$this->form->submit(array('file' => null), false);
diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/Type/BaseTypeTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/BaseTypeTest.php
index 0048cf41c5bfd..801ffd8833205 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/BaseTypeTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/BaseTypeTest.php
@@ -45,7 +45,7 @@ public function testStripLeadingUnderscoresAndDigitsFromId()
public function testPassIdAndNameToViewWithParent()
{
- $view = $this->factory->createNamedBuilder('parent', 'form')
+ $view = $this->factory->createNamedBuilder('parent', 'Symfony\Component\Form\Extension\Core\Type\FormType')
->add('child', $this->getTestedType())
->getForm()
->createView();
@@ -57,8 +57,8 @@ public function testPassIdAndNameToViewWithParent()
public function testPassIdAndNameToViewWithGrandParent()
{
- $builder = $this->factory->createNamedBuilder('parent', 'form')
- ->add('child', 'form');
+ $builder = $this->factory->createNamedBuilder('parent', 'Symfony\Component\Form\Extension\Core\Type\FormType')
+ ->add('child', 'Symfony\Component\Form\Extension\Core\Type\FormType');
$builder->get('child')->add('grand_child', $this->getTestedType());
$view = $builder->getForm()->createView();
@@ -80,7 +80,7 @@ public function testPassTranslationDomainToView()
public function testInheritTranslationDomainFromParent()
{
$view = $this->factory
- ->createNamedBuilder('parent', 'form', null, array(
+ ->createNamedBuilder('parent', 'Symfony\Component\Form\Extension\Core\Type\FormType', null, array(
'translation_domain' => 'domain',
))
->add('child', $this->getTestedType())
@@ -93,7 +93,7 @@ public function testInheritTranslationDomainFromParent()
public function testPreferOwnTranslationDomain()
{
$view = $this->factory
- ->createNamedBuilder('parent', 'form', null, array(
+ ->createNamedBuilder('parent', 'Symfony\Component\Form\Extension\Core\Type\FormType', null, array(
'translation_domain' => 'parent_domain',
))
->add('child', $this->getTestedType(), array(
@@ -107,7 +107,7 @@ public function testPreferOwnTranslationDomain()
public function testDefaultTranslationDomain()
{
- $view = $this->factory->createNamedBuilder('parent', 'form')
+ $view = $this->factory->createNamedBuilder('parent', 'Symfony\Component\Form\Extension\Core\Type\FormType')
->add('child', $this->getTestedType())
->getForm()
->createView();
diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/Type/BirthdayTypeTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/BirthdayTypeTest.php
index 755eac9035e07..895c0c9aa433d 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/BirthdayTypeTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/BirthdayTypeTest.php
@@ -16,18 +16,25 @@
*/
class BirthdayTypeTest extends BaseTypeTest
{
+ public function testLegacyName()
+ {
+ $form = $this->factory->create('birthday');
+
+ $this->assertSame('birthday', $form->getConfig()->getType()->getName());
+ }
+
/**
* @expectedException \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException
*/
public function testSetInvalidYearsOption()
{
- $this->factory->create('birthday', null, array(
+ $this->factory->create('Symfony\Component\Form\Extension\Core\Type\BirthdayType', null, array(
'years' => 'bad value',
));
}
protected function getTestedType()
{
- return 'birthday';
+ return 'Symfony\Component\Form\Extension\Core\Type\BirthdayType';
}
}
diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/Type/ButtonTypeTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/ButtonTypeTest.php
index 55835e77feb73..0f58ac6a27190 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/ButtonTypeTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/ButtonTypeTest.php
@@ -16,13 +16,20 @@
*/
class ButtonTypeTest extends BaseTypeTest
{
+ public function testLegacyName()
+ {
+ $form = $this->factory->create('button');
+
+ $this->assertSame('button', $form->getConfig()->getType()->getName());
+ }
+
public function testCreateButtonInstances()
{
- $this->assertInstanceOf('Symfony\Component\Form\Button', $this->factory->create('button'));
+ $this->assertInstanceOf('Symfony\Component\Form\Button', $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ButtonType'));
}
protected function getTestedType()
{
- return 'button';
+ return 'Symfony\Component\Form\Extension\Core\Type\ButtonType';
}
}
diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/Type/CheckboxTypeTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/CheckboxTypeTest.php
index 9437bd7eea655..794ba09adc476 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/CheckboxTypeTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/CheckboxTypeTest.php
@@ -15,10 +15,17 @@
class CheckboxTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
{
- public function testDataIsFalseByDefault()
+ public function testLegacyName()
{
$form = $this->factory->create('checkbox');
+ $this->assertSame('checkbox', $form->getConfig()->getType()->getName());
+ }
+
+ public function testDataIsFalseByDefault()
+ {
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\CheckboxType');
+
$this->assertFalse($form->getData());
$this->assertFalse($form->getNormData());
$this->assertNull($form->getViewData());
@@ -26,7 +33,7 @@ public function testDataIsFalseByDefault()
public function testPassValueToView()
{
- $form = $this->factory->create('checkbox', null, array('value' => 'foobar'));
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\CheckboxType', null, array('value' => 'foobar'));
$view = $form->createView();
$this->assertEquals('foobar', $view->vars['value']);
@@ -34,7 +41,7 @@ public function testPassValueToView()
public function testCheckedIfDataTrue()
{
- $form = $this->factory->create('checkbox');
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\CheckboxType');
$form->setData(true);
$view = $form->createView();
@@ -43,7 +50,7 @@ public function testCheckedIfDataTrue()
public function testCheckedIfDataTrueWithEmptyValue()
{
- $form = $this->factory->create('checkbox', null, array('value' => ''));
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\CheckboxType', null, array('value' => ''));
$form->setData(true);
$view = $form->createView();
@@ -52,7 +59,7 @@ public function testCheckedIfDataTrueWithEmptyValue()
public function testNotCheckedIfDataFalse()
{
- $form = $this->factory->create('checkbox');
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\CheckboxType');
$form->setData(false);
$view = $form->createView();
@@ -61,7 +68,7 @@ public function testNotCheckedIfDataFalse()
public function testSubmitWithValueChecked()
{
- $form = $this->factory->create('checkbox', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\CheckboxType', null, array(
'value' => 'foobar',
));
$form->submit('foobar');
@@ -72,7 +79,7 @@ public function testSubmitWithValueChecked()
public function testSubmitWithRandomValueChecked()
{
- $form = $this->factory->create('checkbox', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\CheckboxType', null, array(
'value' => 'foobar',
));
$form->submit('krixikraxi');
@@ -83,7 +90,7 @@ public function testSubmitWithRandomValueChecked()
public function testSubmitWithValueUnchecked()
{
- $form = $this->factory->create('checkbox', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\CheckboxType', null, array(
'value' => 'foobar',
));
$form->submit(null);
@@ -94,7 +101,7 @@ public function testSubmitWithValueUnchecked()
public function testSubmitWithEmptyValueChecked()
{
- $form = $this->factory->create('checkbox', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\CheckboxType', null, array(
'value' => '',
));
$form->submit('');
@@ -105,7 +112,7 @@ public function testSubmitWithEmptyValueChecked()
public function testSubmitWithEmptyValueUnchecked()
{
- $form = $this->factory->create('checkbox', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\CheckboxType', null, array(
'value' => '',
));
$form->submit(null);
@@ -116,7 +123,7 @@ public function testSubmitWithEmptyValueUnchecked()
public function testSubmitWithEmptyValueAndFalseUnchecked()
{
- $form = $this->factory->create('checkbox', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\CheckboxType', null, array(
'value' => '',
));
$form->submit(false);
@@ -127,7 +134,7 @@ public function testSubmitWithEmptyValueAndFalseUnchecked()
public function testSubmitWithEmptyValueAndTrueChecked()
{
- $form = $this->factory->create('checkbox', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\CheckboxType', null, array(
'value' => '',
));
$form->submit(true);
@@ -151,7 +158,7 @@ function ($value) {
}
);
- $form = $this->factory->createBuilder('checkbox')
+ $form = $this->factory->createBuilder('Symfony\Component\Form\Extension\Core\Type\CheckboxType')
->addModelTransformer($transformer)
->getForm();
diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/Type/ChoiceTypePerformanceTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/ChoiceTypePerformanceTest.php
index 83430d935c674..3e0ea22f9dbfa 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/ChoiceTypePerformanceTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/ChoiceTypePerformanceTest.php
@@ -30,7 +30,7 @@ public function testSameChoiceFieldCreatedMultipleTimes()
$choices = range(1, 300);
for ($i = 0; $i < 100; ++$i) {
- $this->factory->create('choice', mt_rand(1, 400), array(
+ $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', mt_rand(1, 400), array(
'choices' => $choices,
));
}
diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/Type/ChoiceTypeTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/ChoiceTypeTest.php
index 32fa8b1af7543..fdb5639837f76 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/ChoiceTypeTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/ChoiceTypeTest.php
@@ -67,12 +67,19 @@ protected function tearDown()
$this->objectChoices = null;
}
+ public function testLegacyName()
+ {
+ $form = $this->factory->create('choice');
+
+ $this->assertSame('choice', $form->getConfig()->getType()->getName());
+ }
+
/**
* @expectedException \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException
*/
public function testChoicesOptionExpectsArrayOrTraversable()
{
- $this->factory->create('choice', null, array(
+ $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'choices' => new \stdClass(),
));
}
@@ -82,7 +89,7 @@ public function testChoicesOptionExpectsArrayOrTraversable()
*/
public function testChoiceListOptionExpectsChoiceListInterface()
{
- $this->factory->create('choice', null, array(
+ $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'choice_list' => array('foo' => 'foo'),
));
}
@@ -92,19 +99,19 @@ public function testChoiceListOptionExpectsChoiceListInterface()
*/
public function testChoiceLoaderOptionExpectsChoiceLoaderInterface()
{
- $this->factory->create('choice', null, array(
+ $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'choice_loader' => new \stdClass(),
));
}
public function testChoiceListAndChoicesCanBeEmpty()
{
- $this->factory->create('choice');
+ $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType');
}
public function testExpandedChoicesOptionsTurnIntoChildren()
{
- $form = $this->factory->create('choice', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'expanded' => true,
'choices' => $this->choices,
));
@@ -114,7 +121,7 @@ public function testExpandedChoicesOptionsTurnIntoChildren()
public function testPlaceholderPresentOnNonRequiredExpandedSingleChoice()
{
- $form = $this->factory->create('choice', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'multiple' => false,
'expanded' => true,
'required' => false,
@@ -127,7 +134,7 @@ public function testPlaceholderPresentOnNonRequiredExpandedSingleChoice()
public function testPlaceholderNotPresentIfRequired()
{
- $form = $this->factory->create('choice', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'multiple' => false,
'expanded' => true,
'required' => true,
@@ -140,7 +147,7 @@ public function testPlaceholderNotPresentIfRequired()
public function testPlaceholderNotPresentIfMultiple()
{
- $form = $this->factory->create('choice', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'multiple' => true,
'expanded' => true,
'required' => false,
@@ -153,7 +160,7 @@ public function testPlaceholderNotPresentIfMultiple()
public function testPlaceholderNotPresentIfEmptyChoice()
{
- $form = $this->factory->create('choice', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'multiple' => false,
'expanded' => true,
'required' => false,
@@ -169,7 +176,7 @@ public function testPlaceholderNotPresentIfEmptyChoice()
public function testExpandedChoicesOptionsAreFlattened()
{
- $form = $this->factory->create('choice', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'expanded' => true,
'choices' => $this->groupedChoices,
));
@@ -194,7 +201,7 @@ public function testExpandedChoicesOptionsAreFlattenedObjectChoices()
$obj4 = (object) array('id' => 4, 'name' => 'Jon');
$obj5 = (object) array('id' => 5, 'name' => 'Roman');
- $form = $this->factory->create('choice', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'expanded' => true,
'choices' => array(
'Symfony' => array($obj1, $obj2, $obj3),
@@ -214,7 +221,7 @@ public function testExpandedChoicesOptionsAreFlattenedObjectChoices()
public function testExpandedCheckboxesAreNeverRequired()
{
- $form = $this->factory->create('choice', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'multiple' => true,
'expanded' => true,
'required' => true,
@@ -228,7 +235,7 @@ public function testExpandedCheckboxesAreNeverRequired()
public function testExpandedRadiosAreRequiredIfChoiceChildIsRequired()
{
- $form = $this->factory->create('choice', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'multiple' => false,
'expanded' => true,
'required' => true,
@@ -242,7 +249,7 @@ public function testExpandedRadiosAreRequiredIfChoiceChildIsRequired()
public function testExpandedRadiosAreNotRequiredIfChoiceChildIsNotRequired()
{
- $form = $this->factory->create('choice', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'multiple' => false,
'expanded' => true,
'required' => false,
@@ -256,7 +263,7 @@ public function testExpandedRadiosAreNotRequiredIfChoiceChildIsNotRequired()
public function testSubmitSingleNonExpanded()
{
- $form = $this->factory->create('choice', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'multiple' => false,
'expanded' => false,
'choices' => $this->choices,
@@ -271,7 +278,7 @@ public function testSubmitSingleNonExpanded()
public function testSubmitSingleNonExpandedInvalidChoice()
{
- $form = $this->factory->create('choice', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'multiple' => false,
'expanded' => false,
'choices' => $this->choices,
@@ -286,7 +293,7 @@ public function testSubmitSingleNonExpandedInvalidChoice()
public function testSubmitSingleNonExpandedNull()
{
- $form = $this->factory->create('choice', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'multiple' => false,
'expanded' => false,
'choices' => $this->choices,
@@ -304,7 +311,7 @@ public function testSubmitSingleNonExpandedNull()
// choices are available.
public function testSubmitSingleNonExpandedNullNoChoices()
{
- $form = $this->factory->create('choice', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'multiple' => false,
'expanded' => false,
'choices' => array(),
@@ -319,7 +326,7 @@ public function testSubmitSingleNonExpandedNullNoChoices()
public function testSubmitSingleNonExpandedEmpty()
{
- $form = $this->factory->create('choice', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'multiple' => false,
'expanded' => false,
'choices' => $this->choices,
@@ -334,7 +341,7 @@ public function testSubmitSingleNonExpandedEmpty()
public function testSubmitSingleNonExpandedEmptyExplicitEmptyChoice()
{
- $form = $this->factory->create('choice', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'multiple' => false,
'expanded' => false,
'choices' => array(
@@ -357,7 +364,7 @@ public function testSubmitSingleNonExpandedEmptyExplicitEmptyChoice()
// choices are available.
public function testSubmitSingleNonExpandedEmptyNoChoices()
{
- $form = $this->factory->create('choice', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'multiple' => false,
'expanded' => false,
'choices' => array(),
@@ -372,7 +379,7 @@ public function testSubmitSingleNonExpandedEmptyNoChoices()
public function testSubmitSingleNonExpandedFalse()
{
- $form = $this->factory->create('choice', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'multiple' => false,
'expanded' => false,
'choices' => $this->choices,
@@ -390,7 +397,7 @@ public function testSubmitSingleNonExpandedFalse()
// choices are available.
public function testSubmitSingleNonExpandedFalseNoChoices()
{
- $form = $this->factory->create('choice', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'multiple' => false,
'expanded' => false,
'choices' => array(),
@@ -405,7 +412,7 @@ public function testSubmitSingleNonExpandedFalseNoChoices()
public function testSubmitSingleNonExpandedObjectChoices()
{
- $form = $this->factory->create('choice', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'multiple' => false,
'expanded' => false,
'choices' => $this->objectChoices,
@@ -427,7 +434,7 @@ public function testSubmitSingleNonExpandedObjectChoices()
*/
public function testLegacySubmitSingleNonExpandedObjectChoices()
{
- $form = $this->factory->create('choice', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'multiple' => false,
'expanded' => false,
'choice_list' => new ObjectChoiceList(
@@ -451,7 +458,7 @@ public function testLegacySubmitSingleNonExpandedObjectChoices()
public function testSubmitMultipleNonExpanded()
{
- $form = $this->factory->create('choice', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'multiple' => true,
'expanded' => false,
'choices' => $this->choices,
@@ -466,7 +473,7 @@ public function testSubmitMultipleNonExpanded()
public function testSubmitMultipleNonExpandedEmpty()
{
- $form = $this->factory->create('choice', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'multiple' => true,
'expanded' => false,
'choices' => $this->choices,
@@ -484,7 +491,7 @@ public function testSubmitMultipleNonExpandedEmpty()
// choices are available.
public function testSubmitMultipleNonExpandedEmptyNoChoices()
{
- $form = $this->factory->create('choice', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'multiple' => true,
'expanded' => false,
'choices' => array(),
@@ -499,7 +506,7 @@ public function testSubmitMultipleNonExpandedEmptyNoChoices()
public function testSubmitMultipleNonExpandedInvalidScalarChoice()
{
- $form = $this->factory->create('choice', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'multiple' => true,
'expanded' => false,
'choices' => $this->choices,
@@ -514,7 +521,7 @@ public function testSubmitMultipleNonExpandedInvalidScalarChoice()
public function testSubmitMultipleNonExpandedInvalidArrayChoice()
{
- $form = $this->factory->create('choice', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'multiple' => true,
'expanded' => false,
'choices' => $this->choices,
@@ -529,7 +536,7 @@ public function testSubmitMultipleNonExpandedInvalidArrayChoice()
public function testSubmitMultipleNonExpandedObjectChoices()
{
- $form = $this->factory->create('choice', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'multiple' => true,
'expanded' => false,
'choices' => $this->objectChoices,
@@ -550,7 +557,7 @@ public function testSubmitMultipleNonExpandedObjectChoices()
*/
public function testLegacySubmitMultipleNonExpandedObjectChoices()
{
- $form = $this->factory->create('choice', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'multiple' => true,
'expanded' => false,
'choice_list' => new ObjectChoiceList(
@@ -573,7 +580,7 @@ public function testLegacySubmitMultipleNonExpandedObjectChoices()
public function testSubmitSingleExpandedRequired()
{
- $form = $this->factory->create('choice', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'multiple' => false,
'expanded' => true,
'required' => true,
@@ -601,7 +608,7 @@ public function testSubmitSingleExpandedRequired()
public function testSubmitSingleExpandedRequiredInvalidChoice()
{
- $form = $this->factory->create('choice', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'multiple' => false,
'expanded' => true,
'required' => true,
@@ -629,7 +636,7 @@ public function testSubmitSingleExpandedRequiredInvalidChoice()
public function testSubmitSingleExpandedNonRequired()
{
- $form = $this->factory->create('choice', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'multiple' => false,
'expanded' => true,
'required' => false,
@@ -659,7 +666,7 @@ public function testSubmitSingleExpandedNonRequired()
public function testSubmitSingleExpandedNonRequiredInvalidChoice()
{
- $form = $this->factory->create('choice', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'multiple' => false,
'expanded' => true,
'required' => false,
@@ -687,7 +694,7 @@ public function testSubmitSingleExpandedNonRequiredInvalidChoice()
public function testSubmitSingleExpandedRequiredNull()
{
- $form = $this->factory->create('choice', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'multiple' => false,
'expanded' => true,
'required' => true,
@@ -718,7 +725,7 @@ public function testSubmitSingleExpandedRequiredNull()
// choices are available.
public function testSubmitSingleExpandedRequiredNullNoChoices()
{
- $form = $this->factory->create('choice', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'multiple' => false,
'expanded' => true,
'required' => true,
@@ -735,7 +742,7 @@ public function testSubmitSingleExpandedRequiredNullNoChoices()
public function testSubmitSingleExpandedRequiredEmpty()
{
- $form = $this->factory->create('choice', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'multiple' => false,
'expanded' => true,
'required' => true,
@@ -766,7 +773,7 @@ public function testSubmitSingleExpandedRequiredEmpty()
// choices are available.
public function testSubmitSingleExpandedRequiredEmptyNoChoices()
{
- $form = $this->factory->create('choice', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'multiple' => false,
'expanded' => true,
'required' => true,
@@ -783,7 +790,7 @@ public function testSubmitSingleExpandedRequiredEmptyNoChoices()
public function testSubmitSingleExpandedRequiredFalse()
{
- $form = $this->factory->create('choice', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'multiple' => false,
'expanded' => true,
'required' => true,
@@ -814,7 +821,7 @@ public function testSubmitSingleExpandedRequiredFalse()
// choices are available.
public function testSubmitSingleExpandedRequiredFalseNoChoices()
{
- $form = $this->factory->create('choice', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'multiple' => false,
'expanded' => true,
'required' => true,
@@ -831,7 +838,7 @@ public function testSubmitSingleExpandedRequiredFalseNoChoices()
public function testSubmitSingleExpandedNonRequiredNull()
{
- $form = $this->factory->create('choice', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'multiple' => false,
'expanded' => true,
'required' => false,
@@ -864,7 +871,7 @@ public function testSubmitSingleExpandedNonRequiredNull()
// choices are available.
public function testSubmitSingleExpandedNonRequiredNullNoChoices()
{
- $form = $this->factory->create('choice', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'multiple' => false,
'expanded' => true,
'required' => false,
@@ -881,7 +888,7 @@ public function testSubmitSingleExpandedNonRequiredNullNoChoices()
public function testSubmitSingleExpandedNonRequiredEmpty()
{
- $form = $this->factory->create('choice', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'multiple' => false,
'expanded' => true,
'required' => false,
@@ -914,7 +921,7 @@ public function testSubmitSingleExpandedNonRequiredEmpty()
// choices are available.
public function testSubmitSingleExpandedNonRequiredEmptyNoChoices()
{
- $form = $this->factory->create('choice', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'multiple' => false,
'expanded' => true,
'required' => false,
@@ -931,7 +938,7 @@ public function testSubmitSingleExpandedNonRequiredEmptyNoChoices()
public function testSubmitSingleExpandedNonRequiredFalse()
{
- $form = $this->factory->create('choice', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'multiple' => false,
'expanded' => true,
'required' => false,
@@ -964,7 +971,7 @@ public function testSubmitSingleExpandedNonRequiredFalse()
// choices are available.
public function testSubmitSingleExpandedNonRequiredFalseNoChoices()
{
- $form = $this->factory->create('choice', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'multiple' => false,
'expanded' => true,
'required' => false,
@@ -981,7 +988,7 @@ public function testSubmitSingleExpandedNonRequiredFalseNoChoices()
public function testSubmitSingleExpandedWithEmptyChild()
{
- $form = $this->factory->create('choice', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'multiple' => false,
'expanded' => true,
'choices' => array(
@@ -1003,7 +1010,7 @@ public function testSubmitSingleExpandedWithEmptyChild()
public function testSubmitSingleExpandedObjectChoices()
{
- $form = $this->factory->create('choice', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'multiple' => false,
'expanded' => true,
'choices' => $this->objectChoices,
@@ -1034,7 +1041,7 @@ public function testSubmitSingleExpandedObjectChoices()
*/
public function testLegacySubmitSingleExpandedObjectChoices()
{
- $form = $this->factory->create('choice', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'multiple' => false,
'expanded' => true,
'choice_list' => new ObjectChoiceList(
@@ -1067,7 +1074,7 @@ public function testLegacySubmitSingleExpandedObjectChoices()
public function testSubmitSingleExpandedNumericChoices()
{
- $form = $this->factory->create('choice', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'multiple' => false,
'expanded' => true,
'choices' => $this->numericChoices,
@@ -1092,7 +1099,7 @@ public function testSubmitSingleExpandedNumericChoices()
public function testSubmitMultipleExpanded()
{
- $form = $this->factory->create('choice', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'multiple' => true,
'expanded' => true,
'choices' => $this->choices,
@@ -1119,7 +1126,7 @@ public function testSubmitMultipleExpanded()
public function testSubmitMultipleExpandedInvalidScalarChoice()
{
- $form = $this->factory->create('choice', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'multiple' => true,
'expanded' => true,
'choices' => $this->choices,
@@ -1146,7 +1153,7 @@ public function testSubmitMultipleExpandedInvalidScalarChoice()
public function testSubmitMultipleExpandedInvalidArrayChoice()
{
- $form = $this->factory->create('choice', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'multiple' => true,
'expanded' => true,
'choices' => $this->choices,
@@ -1173,7 +1180,7 @@ public function testSubmitMultipleExpandedInvalidArrayChoice()
public function testSubmitMultipleExpandedEmpty()
{
- $form = $this->factory->create('choice', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'multiple' => true,
'expanded' => true,
'choices' => $this->choices,
@@ -1201,7 +1208,7 @@ public function testSubmitMultipleExpandedEmpty()
// choices are available.
public function testSubmitMultipleExpandedEmptyNoChoices()
{
- $form = $this->factory->create('choice', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'multiple' => true,
'expanded' => true,
'choices' => array(),
@@ -1215,7 +1222,7 @@ public function testSubmitMultipleExpandedEmptyNoChoices()
public function testSubmitMultipleExpandedWithEmptyChild()
{
- $form = $this->factory->create('choice', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'multiple' => true,
'expanded' => true,
'choices' => array(
@@ -1240,7 +1247,7 @@ public function testSubmitMultipleExpandedWithEmptyChild()
public function testSubmitMultipleExpandedObjectChoices()
{
- $form = $this->factory->create('choice', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'multiple' => true,
'expanded' => true,
'choices' => $this->objectChoices,
@@ -1271,7 +1278,7 @@ public function testSubmitMultipleExpandedObjectChoices()
*/
public function testLegacySubmitMultipleExpandedObjectChoices()
{
- $form = $this->factory->create('choice', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'multiple' => true,
'expanded' => true,
'choice_list' => new ObjectChoiceList(
@@ -1304,7 +1311,7 @@ public function testLegacySubmitMultipleExpandedObjectChoices()
public function testSubmitMultipleExpandedNumericChoices()
{
- $form = $this->factory->create('choice', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'multiple' => true,
'expanded' => true,
'choices' => $this->numericChoices,
@@ -1333,7 +1340,7 @@ public function testSubmitMultipleExpandedNumericChoices()
*/
public function testSetDataSingleNonExpandedAcceptsBoolean()
{
- $form = $this->factory->create('choice', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'multiple' => false,
'expanded' => false,
'choices' => $this->numericChoices,
@@ -1348,7 +1355,7 @@ public function testSetDataSingleNonExpandedAcceptsBoolean()
public function testSetDataMultipleNonExpandedAcceptsBoolean()
{
- $form = $this->factory->create('choice', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'multiple' => true,
'expanded' => false,
'choices' => $this->numericChoices,
@@ -1363,7 +1370,7 @@ public function testSetDataMultipleNonExpandedAcceptsBoolean()
public function testPassRequiredToView()
{
- $form = $this->factory->create('choice', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'choices' => $this->choices,
));
$view = $form->createView();
@@ -1373,7 +1380,7 @@ public function testPassRequiredToView()
public function testPassNonRequiredToView()
{
- $form = $this->factory->create('choice', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'required' => false,
'choices' => $this->choices,
));
@@ -1384,7 +1391,7 @@ public function testPassNonRequiredToView()
public function testPassMultipleToView()
{
- $form = $this->factory->create('choice', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'multiple' => true,
'choices' => $this->choices,
));
@@ -1395,7 +1402,7 @@ public function testPassMultipleToView()
public function testPassExpandedToView()
{
- $form = $this->factory->create('choice', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'expanded' => true,
'choices' => $this->choices,
));
@@ -1406,7 +1413,7 @@ public function testPassExpandedToView()
public function testPassChoiceTranslationDomainToView()
{
- $form = $this->factory->create('choice', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'choices' => $this->choices,
));
$view = $form->createView();
@@ -1416,7 +1423,7 @@ public function testPassChoiceTranslationDomainToView()
public function testChoiceTranslationDomainWithTrueValueToView()
{
- $form = $this->factory->create('choice', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'choices' => $this->choices,
'choice_translation_domain' => true,
));
@@ -1427,7 +1434,7 @@ public function testChoiceTranslationDomainWithTrueValueToView()
public function testDefaultChoiceTranslationDomainIsSameAsTranslationDomainToView()
{
- $form = $this->factory->create('choice', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'choices' => $this->choices,
'translation_domain' => 'foo',
));
@@ -1439,10 +1446,10 @@ public function testDefaultChoiceTranslationDomainIsSameAsTranslationDomainToVie
public function testInheritChoiceTranslationDomainFromParent()
{
$view = $this->factory
- ->createNamedBuilder('parent', 'form', null, array(
+ ->createNamedBuilder('parent', 'Symfony\Component\Form\Extension\Core\Type\FormType', null, array(
'translation_domain' => 'domain',
))
- ->add('child', 'choice')
+ ->add('child', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType')
->getForm()
->createView();
@@ -1451,7 +1458,7 @@ public function testInheritChoiceTranslationDomainFromParent()
public function testPlaceholderIsNullByDefaultIfRequired()
{
- $form = $this->factory->create('choice', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'multiple' => false,
'required' => true,
'choices' => $this->choices,
@@ -1463,7 +1470,7 @@ public function testPlaceholderIsNullByDefaultIfRequired()
public function testPlaceholderIsEmptyStringByDefaultIfNotRequired()
{
- $form = $this->factory->create('choice', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'multiple' => false,
'required' => false,
'choices' => $this->choices,
@@ -1478,7 +1485,7 @@ public function testPlaceholderIsEmptyStringByDefaultIfNotRequired()
*/
public function testPassPlaceholderToView($multiple, $expanded, $required, $placeholder, $viewValue)
{
- $form = $this->factory->create('choice', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'multiple' => $multiple,
'expanded' => $expanded,
'required' => $required,
@@ -1496,7 +1503,7 @@ public function testPassPlaceholderToView($multiple, $expanded, $required, $plac
*/
public function testPassEmptyValueBC($multiple, $expanded, $required, $placeholder, $viewValue)
{
- $form = $this->factory->create('choice', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'multiple' => $multiple,
'expanded' => $expanded,
'required' => $required,
@@ -1516,7 +1523,7 @@ public function testPassEmptyValueBC($multiple, $expanded, $required, $placehold
*/
public function testDontPassPlaceholderIfContainedInChoices($multiple, $expanded, $required, $placeholder, $viewValue)
{
- $form = $this->factory->create('choice', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'multiple' => $multiple,
'expanded' => $expanded,
'required' => $required,
@@ -1576,7 +1583,7 @@ public function getOptionsWithPlaceholder()
public function testPassChoicesToView()
{
$choices = array('a' => 'A', 'b' => 'B', 'c' => 'C', 'd' => 'D');
- $form = $this->factory->create('choice', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'choices' => $choices,
));
$view = $form->createView();
@@ -1592,7 +1599,7 @@ public function testPassChoicesToView()
public function testPassPreferredChoicesToView()
{
$choices = array('a' => 'A', 'b' => 'B', 'c' => 'C', 'd' => 'D');
- $form = $this->factory->create('choice', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'choices' => $choices,
'preferred_choices' => array('b', 'd'),
));
@@ -1610,7 +1617,7 @@ public function testPassPreferredChoicesToView()
public function testPassHierarchicalChoicesToView()
{
- $form = $this->factory->create('choice', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'choices' => $this->groupedChoices,
'preferred_choices' => array('b', 'd'),
));
@@ -1641,7 +1648,7 @@ public function testPassChoiceDataToView()
$obj2 = (object) array('value' => 'b', 'label' => 'B');
$obj3 = (object) array('value' => 'c', 'label' => 'C');
$obj4 = (object) array('value' => 'd', 'label' => 'D');
- $form = $this->factory->create('choice', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'choices' => array($obj1, $obj2, $obj3, $obj4),
'choices_as_values' => true,
'choice_label' => 'label',
@@ -1659,7 +1666,7 @@ public function testPassChoiceDataToView()
public function testAdjustFullNameForMultipleNonExpanded()
{
- $form = $this->factory->createNamed('name', 'choice', null, array(
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'multiple' => true,
'expanded' => false,
'choices' => $this->choices,
@@ -1672,7 +1679,7 @@ public function testAdjustFullNameForMultipleNonExpanded()
// https://github.com/symfony/symfony/issues/3298
public function testInitializeWithEmptyChoices()
{
- $this->factory->createNamed('name', 'choice', null, array(
+ $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'choices' => array(),
));
}
@@ -1684,7 +1691,7 @@ public function testInitializeWithDefaultObjectChoice()
$obj3 = (object) array('value' => 'c', 'label' => 'C');
$obj4 = (object) array('value' => 'd', 'label' => 'D');
- $form = $this->factory->create('choice', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\ChoiceType', null, array(
'choices' => array($obj1, $obj2, $obj3, $obj4),
'choices_as_values' => true,
'choice_label' => 'label',
diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/Type/CollectionTypeTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/CollectionTypeTest.php
index ef00ea25bd84a..1555765e0522a 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/CollectionTypeTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/CollectionTypeTest.php
@@ -17,19 +17,28 @@
class CollectionTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
{
- public function testContainsNoChildByDefault()
+ public function testLegacyName()
{
- $form = $this->factory->create('collection', null, array(
+ $form = $this->factory->create('collection', array(
'type' => 'text',
));
+ $this->assertSame('collection', $form->getConfig()->getType()->getName());
+ }
+
+ public function testContainsNoChildByDefault()
+ {
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\CollectionType', null, array(
+ 'type' => 'Symfony\Component\Form\Extension\Core\Type\TextType',
+ ));
+
$this->assertCount(0, $form);
}
public function testSetDataAdjustsSize()
{
- $form = $this->factory->create('collection', null, array(
- 'type' => 'text',
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\CollectionType', null, array(
+ 'type' => 'Symfony\Component\Form\Extension\Core\Type\TextType',
'options' => array(
'attr' => array('maxlength' => 20),
),
@@ -57,8 +66,8 @@ public function testSetDataAdjustsSize()
public function testThrowsExceptionIfObjectIsNotTraversable()
{
- $form = $this->factory->create('collection', null, array(
- 'type' => 'text',
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\CollectionType', null, array(
+ 'type' => 'Symfony\Component\Form\Extension\Core\Type\TextType',
));
$this->setExpectedException('Symfony\Component\Form\Exception\UnexpectedTypeException');
$form->setData(new \stdClass());
@@ -66,8 +75,8 @@ public function testThrowsExceptionIfObjectIsNotTraversable()
public function testNotResizedIfSubmittedWithMissingData()
{
- $form = $this->factory->create('collection', null, array(
- 'type' => 'text',
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\CollectionType', null, array(
+ 'type' => 'Symfony\Component\Form\Extension\Core\Type\TextType',
));
$form->setData(array('foo@foo.com', 'bar@bar.com'));
$form->submit(array('foo@bar.com'));
@@ -80,8 +89,8 @@ public function testNotResizedIfSubmittedWithMissingData()
public function testResizedDownIfSubmittedWithMissingDataAndAllowDelete()
{
- $form = $this->factory->create('collection', null, array(
- 'type' => 'text',
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\CollectionType', null, array(
+ 'type' => 'Symfony\Component\Form\Extension\Core\Type\TextType',
'allow_delete' => true,
));
$form->setData(array('foo@foo.com', 'bar@bar.com'));
@@ -95,8 +104,8 @@ public function testResizedDownIfSubmittedWithMissingDataAndAllowDelete()
public function testResizedDownIfSubmittedWithEmptyDataAndDeleteEmpty()
{
- $form = $this->factory->create('collection', null, array(
- 'type' => 'text',
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\CollectionType', null, array(
+ 'type' => 'Symfony\Component\Form\Extension\Core\Type\TextType',
'allow_delete' => true,
'delete_empty' => true,
));
@@ -112,8 +121,8 @@ public function testResizedDownIfSubmittedWithEmptyDataAndDeleteEmpty()
public function testDontAddEmptyDataIfDeleteEmpty()
{
- $form = $this->factory->create('collection', null, array(
- 'type' => 'text',
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\CollectionType', null, array(
+ 'type' => 'Symfony\Component\Form\Extension\Core\Type\TextType',
'allow_add' => true,
'delete_empty' => true,
));
@@ -129,8 +138,8 @@ public function testDontAddEmptyDataIfDeleteEmpty()
public function testNoDeleteEmptyIfDeleteNotAllowed()
{
- $form = $this->factory->create('collection', null, array(
- 'type' => 'text',
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\CollectionType', null, array(
+ 'type' => 'Symfony\Component\Form\Extension\Core\Type\TextType',
'allow_delete' => false,
'delete_empty' => true,
));
@@ -144,8 +153,8 @@ public function testNoDeleteEmptyIfDeleteNotAllowed()
public function testResizedDownIfSubmittedWithCompoundEmptyDataAndDeleteEmpty()
{
- $form = $this->factory->create('collection', null, array(
- 'type' => new AuthorType(),
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\CollectionType', null, array(
+ '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),
@@ -167,8 +176,8 @@ public function testResizedDownIfSubmittedWithCompoundEmptyDataAndDeleteEmpty()
public function testNotResizedIfSubmittedWithExtraData()
{
- $form = $this->factory->create('collection', null, array(
- 'type' => 'text',
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\CollectionType', null, array(
+ 'type' => 'Symfony\Component\Form\Extension\Core\Type\TextType',
));
$form->setData(array('foo@bar.com'));
$form->submit(array('foo@foo.com', 'bar@bar.com'));
@@ -180,8 +189,8 @@ public function testNotResizedIfSubmittedWithExtraData()
public function testResizedUpIfSubmittedWithExtraDataAndAllowAdd()
{
- $form = $this->factory->create('collection', null, array(
- 'type' => 'text',
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\CollectionType', null, array(
+ 'type' => 'Symfony\Component\Form\Extension\Core\Type\TextType',
'allow_add' => true,
));
$form->setData(array('foo@bar.com'));
@@ -196,8 +205,8 @@ public function testResizedUpIfSubmittedWithExtraDataAndAllowAdd()
public function testAllowAddButNoPrototype()
{
- $form = $this->factory->create('collection', null, array(
- 'type' => 'form',
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\CollectionType', null, array(
+ 'type' => 'Symfony\Component\Form\Extension\Core\Type\FormType',
'allow_add' => true,
'prototype' => false,
));
@@ -208,8 +217,8 @@ public function testAllowAddButNoPrototype()
public function testPrototypeMultipartPropagation()
{
$form = $this->factory
- ->create('collection', null, array(
- 'type' => 'file',
+ ->create('Symfony\Component\Form\Extension\Core\Type\CollectionType', null, array(
+ 'type' => 'Symfony\Component\Form\Extension\Core\Type\FileType',
'allow_add' => true,
'prototype' => true,
))
@@ -220,8 +229,8 @@ public function testPrototypeMultipartPropagation()
public function testGetDataDoesNotContainsPrototypeNameBeforeDataAreSet()
{
- $form = $this->factory->create('collection', array(), array(
- 'type' => 'file',
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\CollectionType', array(), array(
+ 'type' => 'Symfony\Component\Form\Extension\Core\Type\FileType',
'prototype' => true,
'allow_add' => true,
));
@@ -232,8 +241,8 @@ public function testGetDataDoesNotContainsPrototypeNameBeforeDataAreSet()
public function testGetDataDoesNotContainsPrototypeNameAfterDataAreSet()
{
- $form = $this->factory->create('collection', array(), array(
- 'type' => 'file',
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\CollectionType', array(), array(
+ 'type' => 'Symfony\Component\Form\Extension\Core\Type\FileType',
'allow_add' => true,
'prototype' => true,
));
@@ -245,16 +254,16 @@ public function testGetDataDoesNotContainsPrototypeNameAfterDataAreSet()
public function testPrototypeNameOption()
{
- $form = $this->factory->create('collection', null, array(
- 'type' => 'form',
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\CollectionType', null, array(
+ 'type' => 'Symfony\Component\Form\Extension\Core\Type\FormType',
'prototype' => true,
'allow_add' => true,
));
$this->assertSame('__name__', $form->getConfig()->getAttribute('prototype')->getName(), '__name__ is the default');
- $form = $this->factory->create('collection', null, array(
- 'type' => 'form',
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\CollectionType', null, array(
+ 'type' => 'Symfony\Component\Form\Extension\Core\Type\FormType',
'prototype' => true,
'allow_add' => true,
'prototype_name' => '__test__',
@@ -265,8 +274,8 @@ public function testPrototypeNameOption()
public function testPrototypeDefaultLabel()
{
- $form = $this->factory->create('collection', array(), array(
- 'type' => 'file',
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\CollectionType', array(), array(
+ 'type' => 'Symfony\Component\Form\Extension\Core\Type\FileType',
'allow_add' => true,
'prototype' => true,
'prototype_name' => '__test__',
@@ -277,8 +286,8 @@ public function testPrototypeDefaultLabel()
public function testPrototypeData()
{
- $form = $this->factory->create('collection', array(), array(
- 'type' => 'text',
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\CollectionType', array(), array(
+ 'type' => 'Symfony\Component\Form\Extension\Core\Type\TextType',
'allow_add' => true,
'prototype' => true,
'prototype_data' => 'foo',
diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/Type/CountryTypeTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/CountryTypeTest.php
index 16af981e624ab..745f09baf47f9 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/CountryTypeTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/CountryTypeTest.php
@@ -24,9 +24,16 @@ protected function setUp()
parent::setUp();
}
- public function testCountriesAreSelectable()
+ public function testLegacyName()
{
$form = $this->factory->create('country');
+
+ $this->assertSame('country', $form->getConfig()->getType()->getName());
+ }
+
+ public function testCountriesAreSelectable()
+ {
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\CountryType');
$view = $form->createView();
$choices = $view->vars['choices'];
@@ -40,7 +47,7 @@ public function testCountriesAreSelectable()
public function testUnknownCountryIsNotIncluded()
{
- $form = $this->factory->create('country', 'country');
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\CountryType', 'Symfony\Component\Form\Extension\Core\Type\CountryType');
$view = $form->createView();
$choices = $view->vars['choices'];
diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/Type/CurrencyTypeTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/CurrencyTypeTest.php
index 2d572d60b45df..8c5fb62d4434d 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/CurrencyTypeTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/CurrencyTypeTest.php
@@ -24,9 +24,16 @@ protected function setUp()
parent::setUp();
}
- public function testCurrenciesAreSelectable()
+ public function testLegacyName()
{
$form = $this->factory->create('currency');
+
+ $this->assertSame('currency', $form->getConfig()->getType()->getName());
+ }
+
+ public function testCurrenciesAreSelectable()
+ {
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\CurrencyType');
$view = $form->createView();
$choices = $view->vars['choices'];
diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/Type/DateTimeTypeTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/DateTimeTypeTest.php
index f31cc04bd0669..51912c67b4eeb 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/DateTimeTypeTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/DateTimeTypeTest.php
@@ -24,9 +24,16 @@ protected function setUp()
parent::setUp();
}
+ public function testLegacyName()
+ {
+ $form = $this->factory->create('datetime');
+
+ $this->assertSame('datetime', $form->getConfig()->getType()->getName());
+ }
+
public function testSubmitDateTime()
{
- $form = $this->factory->create('datetime', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\DateTimeType', null, array(
'model_timezone' => 'UTC',
'view_timezone' => 'UTC',
'date_widget' => 'choice',
@@ -53,7 +60,7 @@ public function testSubmitDateTime()
public function testSubmitString()
{
- $form = $this->factory->create('datetime', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\DateTimeType', null, array(
'model_timezone' => 'UTC',
'view_timezone' => 'UTC',
'input' => 'string',
@@ -78,7 +85,7 @@ public function testSubmitString()
public function testSubmitTimestamp()
{
- $form = $this->factory->create('datetime', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\DateTimeType', null, array(
'model_timezone' => 'UTC',
'view_timezone' => 'UTC',
'input' => 'timestamp',
@@ -105,7 +112,7 @@ public function testSubmitTimestamp()
public function testSubmitWithoutMinutes()
{
- $form = $this->factory->create('datetime', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\DateTimeType', null, array(
'model_timezone' => 'UTC',
'view_timezone' => 'UTC',
'date_widget' => 'choice',
@@ -134,7 +141,7 @@ public function testSubmitWithoutMinutes()
public function testSubmitWithSeconds()
{
- $form = $this->factory->create('datetime', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\DateTimeType', null, array(
'model_timezone' => 'UTC',
'view_timezone' => 'UTC',
'date_widget' => 'choice',
@@ -165,7 +172,7 @@ public function testSubmitWithSeconds()
public function testSubmitDifferentTimezones()
{
- $form = $this->factory->create('datetime', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\DateTimeType', null, array(
'model_timezone' => 'America/New_York',
'view_timezone' => 'Pacific/Tahiti',
'date_widget' => 'choice',
@@ -196,7 +203,7 @@ public function testSubmitDifferentTimezones()
public function testSubmitDifferentTimezonesDateTime()
{
- $form = $this->factory->create('datetime', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\DateTimeType', null, array(
'model_timezone' => 'America/New_York',
'view_timezone' => 'Pacific/Tahiti',
'widget' => 'single_text',
@@ -215,7 +222,7 @@ public function testSubmitDifferentTimezonesDateTime()
public function testSubmitStringSingleText()
{
- $form = $this->factory->create('datetime', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\DateTimeType', null, array(
'model_timezone' => 'UTC',
'view_timezone' => 'UTC',
'input' => 'string',
@@ -230,7 +237,7 @@ public function testSubmitStringSingleText()
public function testSubmitStringSingleTextWithSeconds()
{
- $form = $this->factory->create('datetime', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\DateTimeType', null, array(
'model_timezone' => 'UTC',
'view_timezone' => 'UTC',
'input' => 'string',
@@ -246,7 +253,7 @@ public function testSubmitStringSingleTextWithSeconds()
public function testSubmitDifferentPattern()
{
- $form = $this->factory->create('datetime', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\DateTimeType', null, array(
'date_format' => 'MM*yyyy*dd',
'date_widget' => 'single_text',
'time_widget' => 'single_text',
@@ -268,12 +275,12 @@ public function testInitializeWithDateTime()
{
// Throws an exception if "data_class" option is not explicitly set
// to null in the type
- $this->factory->create('datetime', new \DateTime());
+ $this->factory->create('Symfony\Component\Form\Extension\Core\Type\DateTimeType', new \DateTime());
}
public function testSingleTextWidgetShouldUseTheRightInputType()
{
- $form = $this->factory->create('datetime', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\DateTimeType', null, array(
'widget' => 'single_text',
));
@@ -283,7 +290,7 @@ public function testSingleTextWidgetShouldUseTheRightInputType()
public function testPassDefaultPlaceholderToViewIfNotRequired()
{
- $form = $this->factory->create('datetime', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\DateTimeType', null, array(
'required' => false,
'with_seconds' => true,
));
@@ -299,7 +306,7 @@ public function testPassDefaultPlaceholderToViewIfNotRequired()
public function testPassNoPlaceholderToViewIfRequired()
{
- $form = $this->factory->create('datetime', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\DateTimeType', null, array(
'required' => true,
'with_seconds' => true,
));
@@ -315,7 +322,7 @@ public function testPassNoPlaceholderToViewIfRequired()
public function testPassPlaceholderAsString()
{
- $form = $this->factory->create('datetime', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\DateTimeType', null, array(
'placeholder' => 'Empty',
'with_seconds' => true,
));
@@ -331,7 +338,7 @@ public function testPassPlaceholderAsString()
public function testPassEmptyValueBC()
{
- $form = $this->factory->create('datetime', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\DateTimeType', null, array(
'empty_value' => 'Empty',
'with_seconds' => true,
));
@@ -353,7 +360,7 @@ public function testPassEmptyValueBC()
public function testPassPlaceholderAsArray()
{
- $form = $this->factory->create('datetime', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\DateTimeType', null, array(
'placeholder' => array(
'year' => 'Empty year',
'month' => 'Empty month',
@@ -376,7 +383,7 @@ public function testPassPlaceholderAsArray()
public function testPassPlaceholderAsPartialArrayAddEmptyIfNotRequired()
{
- $form = $this->factory->create('datetime', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\DateTimeType', null, array(
'required' => false,
'placeholder' => array(
'year' => 'Empty year',
@@ -398,7 +405,7 @@ public function testPassPlaceholderAsPartialArrayAddEmptyIfNotRequired()
public function testPassPlaceholderAsPartialArrayAddNullIfRequired()
{
- $form = $this->factory->create('datetime', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\DateTimeType', null, array(
'required' => true,
'placeholder' => array(
'year' => 'Empty year',
@@ -420,7 +427,7 @@ public function testPassPlaceholderAsPartialArrayAddNullIfRequired()
public function testPassHtml5TypeIfSingleTextAndHtml5Format()
{
- $form = $this->factory->create('datetime', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\DateTimeType', null, array(
'widget' => 'single_text',
));
@@ -430,7 +437,7 @@ public function testPassHtml5TypeIfSingleTextAndHtml5Format()
public function testDontPassHtml5TypeIfHtml5NotAllowed()
{
- $form = $this->factory->create('datetime', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\DateTimeType', null, array(
'widget' => 'single_text',
'html5' => false,
));
@@ -441,7 +448,7 @@ public function testDontPassHtml5TypeIfHtml5NotAllowed()
public function testDontPassHtml5TypeIfNotHtml5Format()
{
- $form = $this->factory->create('datetime', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\DateTimeType', null, array(
'widget' => 'single_text',
'format' => 'yyyy-MM-dd HH:mm',
));
@@ -452,7 +459,7 @@ public function testDontPassHtml5TypeIfNotHtml5Format()
public function testDontPassHtml5TypeIfNotSingleText()
{
- $form = $this->factory->create('datetime', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\DateTimeType', null, array(
'widget' => 'text',
));
@@ -463,7 +470,7 @@ public function testDontPassHtml5TypeIfNotSingleText()
public function testDateTypeChoiceErrorsBubbleUp()
{
$error = new FormError('Invalid!');
- $form = $this->factory->create('datetime', null);
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\DateTimeType', null);
$form['date']->addError($error);
@@ -474,7 +481,7 @@ public function testDateTypeChoiceErrorsBubbleUp()
public function testDateTypeSingleTextErrorsBubbleUp()
{
$error = new FormError('Invalid!');
- $form = $this->factory->create('datetime', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\DateTimeType', null, array(
'date_widget' => 'single_text',
));
@@ -487,7 +494,7 @@ public function testDateTypeSingleTextErrorsBubbleUp()
public function testTimeTypeChoiceErrorsBubbleUp()
{
$error = new FormError('Invalid!');
- $form = $this->factory->create('datetime', null);
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\DateTimeType', null);
$form['time']->addError($error);
@@ -498,7 +505,7 @@ public function testTimeTypeChoiceErrorsBubbleUp()
public function testTimeTypeSingleTextErrorsBubbleUp()
{
$error = new FormError('Invalid!');
- $form = $this->factory->create('datetime', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\DateTimeType', null, array(
'time_widget' => 'single_text',
));
diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/Type/DateTypeTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/DateTypeTest.php
index f66441e43cca3..86c2bf3eba682 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/DateTypeTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/DateTypeTest.php
@@ -37,12 +37,19 @@ protected function tearDown()
date_default_timezone_set($this->defaultTimezone);
}
+ public function testLegacyName()
+ {
+ $form = $this->factory->create('date');
+
+ $this->assertSame('date', $form->getConfig()->getType()->getName());
+ }
+
/**
* @expectedException \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException
*/
public function testInvalidWidgetOption()
{
- $this->factory->create('date', null, array(
+ $this->factory->create('Symfony\Component\Form\Extension\Core\Type\DateType', null, array(
'widget' => 'fake_widget',
));
}
@@ -52,14 +59,14 @@ public function testInvalidWidgetOption()
*/
public function testInvalidInputOption()
{
- $this->factory->create('date', null, array(
+ $this->factory->create('Symfony\Component\Form\Extension\Core\Type\DateType', null, array(
'input' => 'fake_input',
));
}
public function testSubmitFromSingleTextDateTimeWithDefaultFormat()
{
- $form = $this->factory->create('date', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\DateType', null, array(
'model_timezone' => 'UTC',
'view_timezone' => 'UTC',
'widget' => 'single_text',
@@ -74,7 +81,7 @@ public function testSubmitFromSingleTextDateTimeWithDefaultFormat()
public function testSubmitFromSingleTextDateTime()
{
- $form = $this->factory->create('date', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\DateType', null, array(
'format' => \IntlDateFormatter::MEDIUM,
'model_timezone' => 'UTC',
'view_timezone' => 'UTC',
@@ -90,7 +97,7 @@ public function testSubmitFromSingleTextDateTime()
public function testSubmitFromSingleTextString()
{
- $form = $this->factory->create('date', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\DateType', null, array(
'format' => \IntlDateFormatter::MEDIUM,
'model_timezone' => 'UTC',
'view_timezone' => 'UTC',
@@ -106,7 +113,7 @@ public function testSubmitFromSingleTextString()
public function testSubmitFromSingleTextTimestamp()
{
- $form = $this->factory->create('date', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\DateType', null, array(
'format' => \IntlDateFormatter::MEDIUM,
'model_timezone' => 'UTC',
'view_timezone' => 'UTC',
@@ -124,7 +131,7 @@ public function testSubmitFromSingleTextTimestamp()
public function testSubmitFromSingleTextRaw()
{
- $form = $this->factory->create('date', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\DateType', null, array(
'format' => \IntlDateFormatter::MEDIUM,
'model_timezone' => 'UTC',
'view_timezone' => 'UTC',
@@ -146,7 +153,7 @@ public function testSubmitFromSingleTextRaw()
public function testSubmitFromText()
{
- $form = $this->factory->create('date', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\DateType', null, array(
'model_timezone' => 'UTC',
'view_timezone' => 'UTC',
'widget' => 'text',
@@ -168,7 +175,7 @@ public function testSubmitFromText()
public function testSubmitFromChoice()
{
- $form = $this->factory->create('date', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\DateType', null, array(
'model_timezone' => 'UTC',
'view_timezone' => 'UTC',
'widget' => 'choice',
@@ -190,7 +197,7 @@ public function testSubmitFromChoice()
public function testSubmitFromChoiceEmpty()
{
- $form = $this->factory->create('date', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\DateType', null, array(
'model_timezone' => 'UTC',
'view_timezone' => 'UTC',
'widget' => 'choice',
@@ -211,7 +218,7 @@ public function testSubmitFromChoiceEmpty()
public function testSubmitFromInputDateTimeDifferentPattern()
{
- $form = $this->factory->create('date', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\DateType', null, array(
'model_timezone' => 'UTC',
'view_timezone' => 'UTC',
'format' => 'MM*yyyy*dd',
@@ -227,7 +234,7 @@ public function testSubmitFromInputDateTimeDifferentPattern()
public function testSubmitFromInputStringDifferentPattern()
{
- $form = $this->factory->create('date', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\DateType', null, array(
'model_timezone' => 'UTC',
'view_timezone' => 'UTC',
'format' => 'MM*yyyy*dd',
@@ -243,7 +250,7 @@ public function testSubmitFromInputStringDifferentPattern()
public function testSubmitFromInputTimestampDifferentPattern()
{
- $form = $this->factory->create('date', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\DateType', null, array(
'model_timezone' => 'UTC',
'view_timezone' => 'UTC',
'format' => 'MM*yyyy*dd',
@@ -261,7 +268,7 @@ public function testSubmitFromInputTimestampDifferentPattern()
public function testSubmitFromInputRawDifferentPattern()
{
- $form = $this->factory->create('date', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\DateType', null, array(
'model_timezone' => 'UTC',
'view_timezone' => 'UTC',
'format' => 'MM*yyyy*dd',
@@ -286,7 +293,7 @@ public function testSubmitFromInputRawDifferentPattern()
*/
public function testDatePatternWithFormatOption($format, $pattern)
{
- $form = $this->factory->create('date', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\DateType', null, array(
'format' => $format,
));
@@ -312,7 +319,7 @@ public function provideDateFormats()
*/
public function testThrowExceptionIfFormatIsNoPattern()
{
- $this->factory->create('date', null, array(
+ $this->factory->create('Symfony\Component\Form\Extension\Core\Type\DateType', null, array(
'format' => '0',
'widget' => 'single_text',
'input' => 'string',
@@ -324,7 +331,7 @@ public function testThrowExceptionIfFormatIsNoPattern()
*/
public function testThrowExceptionIfFormatDoesNotContainYearMonthAndDay()
{
- $this->factory->create('date', null, array(
+ $this->factory->create('Symfony\Component\Form\Extension\Core\Type\DateType', null, array(
'months' => array(6, 7),
'format' => 'yy',
));
@@ -335,7 +342,7 @@ public function testThrowExceptionIfFormatDoesNotContainYearMonthAndDay()
*/
public function testThrowExceptionIfFormatIsNoConstant()
{
- $this->factory->create('date', null, array(
+ $this->factory->create('Symfony\Component\Form\Extension\Core\Type\DateType', null, array(
'format' => 105,
));
}
@@ -345,7 +352,7 @@ public function testThrowExceptionIfFormatIsNoConstant()
*/
public function testThrowExceptionIfFormatIsInvalid()
{
- $this->factory->create('date', null, array(
+ $this->factory->create('Symfony\Component\Form\Extension\Core\Type\DateType', null, array(
'format' => array(),
));
}
@@ -355,7 +362,7 @@ public function testThrowExceptionIfFormatIsInvalid()
*/
public function testThrowExceptionIfYearsIsInvalid()
{
- $this->factory->create('date', null, array(
+ $this->factory->create('Symfony\Component\Form\Extension\Core\Type\DateType', null, array(
'years' => 'bad value',
));
}
@@ -365,7 +372,7 @@ public function testThrowExceptionIfYearsIsInvalid()
*/
public function testThrowExceptionIfMonthsIsInvalid()
{
- $this->factory->create('date', null, array(
+ $this->factory->create('Symfony\Component\Form\Extension\Core\Type\DateType', null, array(
'months' => 'bad value',
));
}
@@ -375,14 +382,14 @@ public function testThrowExceptionIfMonthsIsInvalid()
*/
public function testThrowExceptionIfDaysIsInvalid()
{
- $this->factory->create('date', null, array(
+ $this->factory->create('Symfony\Component\Form\Extension\Core\Type\DateType', null, array(
'days' => 'bad value',
));
}
public function testSetDataWithNegativeTimezoneOffsetStringInput()
{
- $form = $this->factory->create('date', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\DateType', null, array(
'format' => \IntlDateFormatter::MEDIUM,
'model_timezone' => 'UTC',
'view_timezone' => 'America/New_York',
@@ -399,7 +406,7 @@ public function testSetDataWithNegativeTimezoneOffsetStringInput()
public function testSetDataWithNegativeTimezoneOffsetDateTimeInput()
{
- $form = $this->factory->create('date', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\DateType', null, array(
'format' => \IntlDateFormatter::MEDIUM,
'model_timezone' => 'UTC',
'view_timezone' => 'America/New_York',
@@ -419,7 +426,7 @@ public function testSetDataWithNegativeTimezoneOffsetDateTimeInput()
public function testYearsOption()
{
- $form = $this->factory->create('date', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\DateType', null, array(
'years' => array(2010, 2011),
));
@@ -433,7 +440,7 @@ public function testYearsOption()
public function testMonthsOption()
{
- $form = $this->factory->create('date', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\DateType', null, array(
'months' => array(6, 7),
));
@@ -447,7 +454,7 @@ public function testMonthsOption()
public function testMonthsOptionShortFormat()
{
- $form = $this->factory->create('date', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\DateType', null, array(
'months' => array(1, 4),
'format' => 'dd.MMM.yy',
));
@@ -462,7 +469,7 @@ public function testMonthsOptionShortFormat()
public function testMonthsOptionLongFormat()
{
- $form = $this->factory->create('date', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\DateType', null, array(
'months' => array(1, 4),
'format' => 'dd.MMMM.yy',
));
@@ -477,7 +484,7 @@ public function testMonthsOptionLongFormat()
public function testMonthsOptionLongFormatWithDifferentTimezone()
{
- $form = $this->factory->create('date', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\DateType', null, array(
'months' => array(1, 4),
'format' => 'dd.MMMM.yy',
));
@@ -492,7 +499,7 @@ public function testMonthsOptionLongFormatWithDifferentTimezone()
public function testIsDayWithinRangeReturnsTrueIfWithin()
{
- $form = $this->factory->create('date', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\DateType', null, array(
'days' => array(6, 7),
));
@@ -508,7 +515,7 @@ public function testIsPartiallyFilledReturnsFalseIfSingleText()
{
$this->markTestIncomplete('Needs to be reimplemented using validators');
- $form = $this->factory->create('date', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\DateType', null, array(
'model_timezone' => 'UTC',
'view_timezone' => 'UTC',
'widget' => 'single_text',
@@ -523,7 +530,7 @@ public function testIsPartiallyFilledReturnsFalseIfChoiceAndCompletelyEmpty()
{
$this->markTestIncomplete('Needs to be reimplemented using validators');
- $form = $this->factory->create('date', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\DateType', null, array(
'model_timezone' => 'UTC',
'view_timezone' => 'UTC',
'widget' => 'choice',
@@ -542,7 +549,7 @@ public function testIsPartiallyFilledReturnsFalseIfChoiceAndCompletelyFilled()
{
$this->markTestIncomplete('Needs to be reimplemented using validators');
- $form = $this->factory->create('date', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\DateType', null, array(
'model_timezone' => 'UTC',
'view_timezone' => 'UTC',
'widget' => 'choice',
@@ -561,7 +568,7 @@ public function testIsPartiallyFilledReturnsTrueIfChoiceAndDayEmpty()
{
$this->markTestIncomplete('Needs to be reimplemented using validators');
- $form = $this->factory->create('date', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\DateType', null, array(
'model_timezone' => 'UTC',
'view_timezone' => 'UTC',
'widget' => 'choice',
@@ -578,7 +585,7 @@ public function testIsPartiallyFilledReturnsTrueIfChoiceAndDayEmpty()
public function testPassDatePatternToView()
{
- $form = $this->factory->create('date');
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\DateType');
$view = $form->createView();
$this->assertSame('{{ day }}{{ month }}{{ year }}', $view->vars['date_pattern']);
@@ -586,7 +593,7 @@ public function testPassDatePatternToView()
public function testPassDatePatternToViewDifferentFormat()
{
- $form = $this->factory->create('date', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\DateType', null, array(
'format' => \IntlDateFormatter::LONG,
));
@@ -597,7 +604,7 @@ public function testPassDatePatternToViewDifferentFormat()
public function testPassDatePatternToViewDifferentPattern()
{
- $form = $this->factory->create('date', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\DateType', null, array(
'format' => 'MMyyyydd',
));
@@ -608,7 +615,7 @@ public function testPassDatePatternToViewDifferentPattern()
public function testPassDatePatternToViewDifferentPatternWithSeparators()
{
- $form = $this->factory->create('date', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\DateType', null, array(
'format' => 'MM*yyyy*dd',
));
@@ -619,7 +626,7 @@ public function testPassDatePatternToViewDifferentPatternWithSeparators()
public function testDontPassDatePatternIfText()
{
- $form = $this->factory->create('date', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\DateType', null, array(
'widget' => 'single_text',
));
$view = $form->createView();
@@ -631,7 +638,7 @@ public function testDatePatternFormatWithQuotedStrings()
{
\Locale::setDefault('es_ES');
- $form = $this->factory->create('date', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\DateType', null, array(
// EEEE, d 'de' MMMM 'de' y
'format' => \IntlDateFormatter::FULL,
));
@@ -643,7 +650,7 @@ public function testDatePatternFormatWithQuotedStrings()
public function testPassWidgetToView()
{
- $form = $this->factory->create('date', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\DateType', null, array(
'widget' => 'single_text',
));
$view = $form->createView();
@@ -656,12 +663,12 @@ public function testInitializeWithDateTime()
{
// Throws an exception if "data_class" option is not explicitly set
// to null in the type
- $this->factory->create('date', new \DateTime());
+ $this->factory->create('Symfony\Component\Form\Extension\Core\Type\DateType', new \DateTime());
}
public function testSingleTextWidgetShouldUseTheRightInputType()
{
- $form = $this->factory->create('date', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\DateType', null, array(
'widget' => 'single_text',
));
@@ -671,7 +678,7 @@ public function testSingleTextWidgetShouldUseTheRightInputType()
public function testPassDefaultPlaceholderToViewIfNotRequired()
{
- $form = $this->factory->create('date', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\DateType', null, array(
'required' => false,
));
@@ -683,7 +690,7 @@ public function testPassDefaultPlaceholderToViewIfNotRequired()
public function testPassNoPlaceholderToViewIfRequired()
{
- $form = $this->factory->create('date', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\DateType', null, array(
'required' => true,
));
@@ -695,7 +702,7 @@ public function testPassNoPlaceholderToViewIfRequired()
public function testPassPlaceholderAsString()
{
- $form = $this->factory->create('date', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\DateType', null, array(
'placeholder' => 'Empty',
));
@@ -707,7 +714,7 @@ public function testPassPlaceholderAsString()
public function testPassEmptyValueBC()
{
- $form = $this->factory->create('date', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\DateType', null, array(
'empty_value' => 'Empty',
));
@@ -722,7 +729,7 @@ public function testPassEmptyValueBC()
public function testPassPlaceholderAsArray()
{
- $form = $this->factory->create('date', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\DateType', null, array(
'placeholder' => array(
'year' => 'Empty year',
'month' => 'Empty month',
@@ -738,7 +745,7 @@ public function testPassPlaceholderAsArray()
public function testPassPlaceholderAsPartialArrayAddEmptyIfNotRequired()
{
- $form = $this->factory->create('date', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\DateType', null, array(
'required' => false,
'placeholder' => array(
'year' => 'Empty year',
@@ -754,7 +761,7 @@ public function testPassPlaceholderAsPartialArrayAddEmptyIfNotRequired()
public function testPassPlaceholderAsPartialArrayAddNullIfRequired()
{
- $form = $this->factory->create('date', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\DateType', null, array(
'required' => true,
'placeholder' => array(
'year' => 'Empty year',
@@ -770,7 +777,7 @@ public function testPassPlaceholderAsPartialArrayAddNullIfRequired()
public function testPassHtml5TypeIfSingleTextAndHtml5Format()
{
- $form = $this->factory->create('date', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\DateType', null, array(
'widget' => 'single_text',
));
@@ -780,7 +787,7 @@ public function testPassHtml5TypeIfSingleTextAndHtml5Format()
public function testDontPassHtml5TypeIfHtml5NotAllowed()
{
- $form = $this->factory->create('date', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\DateType', null, array(
'widget' => 'single_text',
'html5' => false,
));
@@ -791,7 +798,7 @@ public function testDontPassHtml5TypeIfHtml5NotAllowed()
public function testDontPassHtml5TypeIfNotHtml5Format()
{
- $form = $this->factory->create('date', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\DateType', null, array(
'widget' => 'single_text',
'format' => \IntlDateFormatter::MEDIUM,
));
@@ -802,7 +809,7 @@ public function testDontPassHtml5TypeIfNotHtml5Format()
public function testDontPassHtml5TypeIfNotSingleText()
{
- $form = $this->factory->create('date', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\DateType', null, array(
'widget' => 'text',
));
@@ -824,7 +831,7 @@ public function provideCompoundWidgets()
public function testYearErrorsBubbleUp($widget)
{
$error = new FormError('Invalid!');
- $form = $this->factory->create('date', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\DateType', null, array(
'widget' => $widget,
));
$form['year']->addError($error);
@@ -839,7 +846,7 @@ public function testYearErrorsBubbleUp($widget)
public function testMonthErrorsBubbleUp($widget)
{
$error = new FormError('Invalid!');
- $form = $this->factory->create('date', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\DateType', null, array(
'widget' => $widget,
));
$form['month']->addError($error);
@@ -854,7 +861,7 @@ public function testMonthErrorsBubbleUp($widget)
public function testDayErrorsBubbleUp($widget)
{
$error = new FormError('Invalid!');
- $form = $this->factory->create('date', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\DateType', null, array(
'widget' => $widget,
));
$form['day']->addError($error);
@@ -870,7 +877,7 @@ public function testYearsFor32BitsMachines()
'PHP must be compiled in 32 bit mode to run this test');
}
- $form = $this->factory->create('date', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\DateType', null, array(
'years' => range(1900, 2040),
));
diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/Type/FileTypeTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/FileTypeTest.php
index 55555efecb7bf..61653f3ac1385 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/FileTypeTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/FileTypeTest.php
@@ -13,10 +13,17 @@
class FileTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
{
+ public function testLegacyName()
+ {
+ $form = $this->factory->create('file');
+
+ $this->assertSame('file', $form->getConfig()->getType()->getName());
+ }
+
// https://github.com/symfony/symfony/pull/5028
public function testSetData()
{
- $form = $this->factory->createBuilder('file')->getForm();
+ $form = $this->factory->createBuilder('Symfony\Component\Form\Extension\Core\Type\FileType')->getForm();
$data = $this->createUploadedFileMock('abcdef', 'original.jpg', true);
$form->setData($data);
@@ -26,7 +33,7 @@ public function testSetData()
public function testSubmit()
{
- $form = $this->factory->createBuilder('file')->getForm();
+ $form = $this->factory->createBuilder('Symfony\Component\Form\Extension\Core\Type\FileType')->getForm();
$data = $this->createUploadedFileMock('abcdef', 'original.jpg', true);
$form->submit($data);
@@ -37,7 +44,7 @@ public function testSubmit()
// https://github.com/symfony/symfony/issues/6134
public function testSubmitEmpty()
{
- $form = $this->factory->createBuilder('file')->getForm();
+ $form = $this->factory->createBuilder('Symfony\Component\Form\Extension\Core\Type\FileType')->getForm();
$form->submit(null);
@@ -46,7 +53,7 @@ public function testSubmitEmpty()
public function testSubmitMultiple()
{
- $form = $this->factory->createBuilder('file', null, array(
+ $form = $this->factory->createBuilder('Symfony\Component\Form\Extension\Core\Type\FileType', null, array(
'multiple' => true,
))->getForm();
@@ -65,9 +72,9 @@ public function testSubmitMultiple()
public function testDontPassValueToView()
{
- $form = $this->factory->create('file');
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\FileType');
$form->submit(array(
- 'file' => $this->createUploadedFileMock('abcdef', 'original.jpg', true),
+ 'Symfony\Component\Form\Extension\Core\Type\FileType' => $this->createUploadedFileMock('abcdef', 'original.jpg', true),
));
$view = $form->createView();
diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/Type/FormTypeTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/FormTypeTest.php
index 0ebb554a6ac84..78567ee68fe15 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/FormTypeTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/FormTypeTest.php
@@ -51,25 +51,32 @@ public function setReferenceCopy($reference)
class FormTypeTest extends BaseTypeTest
{
+ public function testLegacyName()
+ {
+ $form = $this->factory->create('form');
+
+ $this->assertSame('form', $form->getConfig()->getType()->getName());
+ }
+
public function testCreateFormInstances()
{
- $this->assertInstanceOf('Symfony\Component\Form\Form', $this->factory->create('form'));
+ $this->assertInstanceOf('Symfony\Component\Form\Form', $this->factory->create('Symfony\Component\Form\Extension\Core\Type\FormType'));
}
public function testPassRequiredAsOption()
{
- $form = $this->factory->create('form', null, array('required' => false));
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\FormType', null, array('required' => false));
$this->assertFalse($form->isRequired());
- $form = $this->factory->create('form', null, array('required' => true));
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\FormType', null, array('required' => true));
$this->assertTrue($form->isRequired());
}
public function testSubmittedDataIsTrimmedBeforeTransforming()
{
- $form = $this->factory->createBuilder('form')
+ $form = $this->factory->createBuilder('Symfony\Component\Form\Extension\Core\Type\FormType')
->addViewTransformer(new FixedDataTransformer(array(
null => '',
'reverse[a]' => 'a',
@@ -85,7 +92,7 @@ public function testSubmittedDataIsTrimmedBeforeTransforming()
public function testSubmittedDataIsNotTrimmedBeforeTransformingIfNoTrimming()
{
- $form = $this->factory->createBuilder('form', null, array('trim' => false))
+ $form = $this->factory->createBuilder('Symfony\Component\Form\Extension\Core\Type\FormType', null, array('trim' => false))
->addViewTransformer(new FixedDataTransformer(array(
null => '',
'reverse[ a ]' => ' a ',
@@ -104,8 +111,8 @@ public function testSubmittedDataIsNotTrimmedBeforeTransformingIfNoTrimming()
*/
public function testLegacyNonReadOnlyFormWithReadOnlyParentIsReadOnly()
{
- $view = $this->factory->createNamedBuilder('parent', 'form', null, array('read_only' => true))
- ->add('child', 'form')
+ $view = $this->factory->createNamedBuilder('parent', 'Symfony\Component\Form\Extension\Core\Type\FormType', null, array('read_only' => true))
+ ->add('child', 'Symfony\Component\Form\Extension\Core\Type\FormType')
->getForm()
->createView();
@@ -114,8 +121,8 @@ public function testLegacyNonReadOnlyFormWithReadOnlyParentIsReadOnly()
public function testNonReadOnlyFormWithReadOnlyParentIsReadOnly()
{
- $view = $this->factory->createNamedBuilder('parent', 'form', null, array('attr' => array('readonly' => true)))
- ->add('child', 'form')
+ $view = $this->factory->createNamedBuilder('parent', 'Symfony\Component\Form\Extension\Core\Type\FormType', null, array('attr' => array('readonly' => true)))
+ ->add('child', 'Symfony\Component\Form\Extension\Core\Type\FormType')
->getForm()
->createView();
@@ -127,8 +134,8 @@ public function testNonReadOnlyFormWithReadOnlyParentIsReadOnly()
*/
public function testLegacyReadOnlyFormWithNonReadOnlyParentIsReadOnly()
{
- $view = $this->factory->createNamedBuilder('parent', 'form')
- ->add('child', 'form', array('read_only' => true))
+ $view = $this->factory->createNamedBuilder('parent', 'Symfony\Component\Form\Extension\Core\Type\FormType')
+ ->add('child', 'Symfony\Component\Form\Extension\Core\Type\FormType', array('read_only' => true))
->getForm()
->createView();
@@ -137,8 +144,8 @@ public function testLegacyReadOnlyFormWithNonReadOnlyParentIsReadOnly()
public function testReadOnlyFormWithNonReadOnlyParentIsReadOnly()
{
- $view = $this->factory->createNamedBuilder('parent', 'form')
- ->add('child', 'form', array('attr' => array('readonly' => true)))
+ $view = $this->factory->createNamedBuilder('parent', 'Symfony\Component\Form\Extension\Core\Type\FormType')
+ ->add('child', 'Symfony\Component\Form\Extension\Core\Type\FormType', array('attr' => array('readonly' => true)))
->getForm()
->createView();
@@ -150,8 +157,8 @@ public function testReadOnlyFormWithNonReadOnlyParentIsReadOnly()
*/
public function testLegacyNonReadOnlyFormWithNonReadOnlyParentIsNotReadOnly()
{
- $view = $this->factory->createNamedBuilder('parent', 'form')
- ->add('child', 'form')
+ $view = $this->factory->createNamedBuilder('parent', 'Symfony\Component\Form\Extension\Core\Type\FormType')
+ ->add('child', 'Symfony\Component\Form\Extension\Core\Type\FormType')
->getForm()
->createView();
@@ -160,8 +167,8 @@ public function testLegacyNonReadOnlyFormWithNonReadOnlyParentIsNotReadOnly()
public function testNonReadOnlyFormWithNonReadOnlyParentIsNotReadOnly()
{
- $view = $this->factory->createNamedBuilder('parent', 'form')
- ->add('child', 'form')
+ $view = $this->factory->createNamedBuilder('parent', 'Symfony\Component\Form\Extension\Core\Type\FormType')
+ ->add('child', 'Symfony\Component\Form\Extension\Core\Type\FormType')
->getForm()
->createView();
@@ -170,7 +177,7 @@ public function testNonReadOnlyFormWithNonReadOnlyParentIsNotReadOnly()
public function testPassMaxLengthToView()
{
- $form = $this->factory->create('form', null, array('attr' => array('maxlength' => 10)));
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\FormType', null, array('attr' => array('maxlength' => 10)));
$view = $form->createView();
$this->assertSame(10, $view->vars['attr']['maxlength']);
@@ -178,7 +185,7 @@ public function testPassMaxLengthToView()
public function testPassMaxLengthBCToView()
{
- $form = $this->factory->create('form', null, array('max_length' => 10));
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\FormType', null, array('max_length' => 10));
$view = $form->createView();
$this->assertSame(10, $view->vars['attr']['maxlength']);
@@ -186,21 +193,21 @@ public function testPassMaxLengthBCToView()
public function testDataClassMayBeNull()
{
- $this->factory->createBuilder('form', null, array(
+ $this->factory->createBuilder('Symfony\Component\Form\Extension\Core\Type\FormType', null, array(
'data_class' => null,
));
}
public function testDataClassMayBeAbstractClass()
{
- $this->factory->createBuilder('form', null, array(
+ $this->factory->createBuilder('Symfony\Component\Form\Extension\Core\Type\FormType', null, array(
'data_class' => 'Symfony\Component\Form\Tests\Fixtures\AbstractAuthor',
));
}
public function testDataClassMayBeInterface()
{
- $this->factory->createBuilder('form', null, array(
+ $this->factory->createBuilder('Symfony\Component\Form\Extension\Core\Type\FormType', null, array(
'data_class' => 'Symfony\Component\Form\Tests\Fixtures\AuthorInterface',
));
}
@@ -210,19 +217,19 @@ public function testDataClassMayBeInterface()
*/
public function testDataClassMustBeValidClassOrInterface()
{
- $this->factory->createBuilder('form', null, array(
+ $this->factory->createBuilder('Symfony\Component\Form\Extension\Core\Type\FormType', null, array(
'data_class' => 'foobar',
));
}
public function testSubmitWithEmptyDataCreatesObjectIfClassAvailable()
{
- $builder = $this->factory->createBuilder('form', null, array(
+ $builder = $this->factory->createBuilder('Symfony\Component\Form\Extension\Core\Type\FormType', null, array(
'data_class' => 'Symfony\Component\Form\Tests\Fixtures\Author',
'required' => false,
));
- $builder->add('firstName', 'text');
- $builder->add('lastName', 'text');
+ $builder->add('firstName', 'Symfony\Component\Form\Extension\Core\Type\TextType');
+ $builder->add('lastName', 'Symfony\Component\Form\Extension\Core\Type\TextType');
$form = $builder->getForm();
$form->setData(null);
@@ -238,13 +245,13 @@ public function testSubmitWithEmptyDataCreatesObjectIfClassAvailable()
public function testSubmitWithEmptyDataCreatesObjectIfInitiallySubmittedWithObject()
{
- $builder = $this->factory->createBuilder('form', null, array(
+ $builder = $this->factory->createBuilder('Symfony\Component\Form\Extension\Core\Type\FormType', null, array(
// data class is inferred from the passed object
'data' => new Author(),
'required' => false,
));
- $builder->add('firstName', 'text');
- $builder->add('lastName', 'text');
+ $builder->add('firstName', 'Symfony\Component\Form\Extension\Core\Type\TextType');
+ $builder->add('lastName', 'Symfony\Component\Form\Extension\Core\Type\TextType');
$form = $builder->getForm();
$form->setData(null);
@@ -260,11 +267,11 @@ public function testSubmitWithEmptyDataCreatesObjectIfInitiallySubmittedWithObje
public function testSubmitWithEmptyDataCreatesArrayIfDataClassIsNull()
{
- $builder = $this->factory->createBuilder('form', null, array(
+ $builder = $this->factory->createBuilder('Symfony\Component\Form\Extension\Core\Type\FormType', null, array(
'data_class' => null,
'required' => false,
));
- $builder->add('firstName', 'text');
+ $builder->add('firstName', 'Symfony\Component\Form\Extension\Core\Type\TextType');
$form = $builder->getForm();
$form->setData(null);
@@ -275,12 +282,12 @@ public function testSubmitWithEmptyDataCreatesArrayIfDataClassIsNull()
public function testSubmitEmptyWithEmptyDataCreatesNoObjectIfNotRequired()
{
- $builder = $this->factory->createBuilder('form', null, array(
+ $builder = $this->factory->createBuilder('Symfony\Component\Form\Extension\Core\Type\FormType', null, array(
'data_class' => 'Symfony\Component\Form\Tests\Fixtures\Author',
'required' => false,
));
- $builder->add('firstName', 'text');
- $builder->add('lastName', 'text');
+ $builder->add('firstName', 'Symfony\Component\Form\Extension\Core\Type\TextType');
+ $builder->add('lastName', 'Symfony\Component\Form\Extension\Core\Type\TextType');
$form = $builder->getForm();
$form->setData(null);
@@ -291,12 +298,12 @@ public function testSubmitEmptyWithEmptyDataCreatesNoObjectIfNotRequired()
public function testSubmitEmptyWithEmptyDataCreatesObjectIfRequired()
{
- $builder = $this->factory->createBuilder('form', null, array(
+ $builder = $this->factory->createBuilder('Symfony\Component\Form\Extension\Core\Type\FormType', null, array(
'data_class' => 'Symfony\Component\Form\Tests\Fixtures\Author',
'required' => true,
));
- $builder->add('firstName', 'text');
- $builder->add('lastName', 'text');
+ $builder->add('firstName', 'Symfony\Component\Form\Extension\Core\Type\TextType');
+ $builder->add('lastName', 'Symfony\Component\Form\Extension\Core\Type\TextType');
$form = $builder->getForm();
$form->setData(null);
@@ -310,8 +317,8 @@ public function testSubmitEmptyWithEmptyDataCreatesObjectIfRequired()
*/
public function testSubmitWithEmptyDataStoresArrayIfNoClassAvailable()
{
- $form = $this->factory->createBuilder('form')
- ->add('firstName', 'text')
+ $form = $this->factory->createBuilder('Symfony\Component\Form\Extension\Core\Type\FormType')
+ ->add('firstName', 'Symfony\Component\Form\Extension\Core\Type\TextType')
->getForm();
$form->setData(null);
@@ -322,7 +329,7 @@ public function testSubmitWithEmptyDataStoresArrayIfNoClassAvailable()
public function testSubmitWithEmptyDataPassesEmptyStringToTransformerIfNotCompound()
{
- $form = $this->factory->createBuilder('form')
+ $form = $this->factory->createBuilder('Symfony\Component\Form\Extension\Core\Type\FormType')
->addViewTransformer(new FixedDataTransformer(array(
// required for the initial, internal setData(null)
null => 'null',
@@ -341,11 +348,11 @@ public function testSubmitWithEmptyDataUsesEmptyDataOption()
{
$author = new Author();
- $builder = $this->factory->createBuilder('form', null, array(
+ $builder = $this->factory->createBuilder('Symfony\Component\Form\Extension\Core\Type\FormType', null, array(
'data_class' => 'Symfony\Component\Form\Tests\Fixtures\Author',
'empty_data' => $author,
));
- $builder->add('firstName', 'text');
+ $builder->add('firstName', 'Symfony\Component\Form\Extension\Core\Type\TextType');
$form = $builder->getForm();
$form->submit(array('firstName' => 'Bernhard'));
@@ -370,7 +377,7 @@ public function provideZeros()
*/
public function testSetDataThroughParamsWithZero($data, $dataAsString)
{
- $form = $this->factory->create('form', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\FormType', null, array(
'data' => $data,
'compound' => false,
));
@@ -387,12 +394,12 @@ public function testSetDataThroughParamsWithZero($data, $dataAsString)
*/
public function testAttributesException()
{
- $this->factory->create('form', null, array('attr' => ''));
+ $this->factory->create('Symfony\Component\Form\Extension\Core\Type\FormType', null, array('attr' => ''));
}
public function testNameCanBeEmptyString()
{
- $form = $this->factory->createNamed('', 'form');
+ $form = $this->factory->createNamed('', 'Symfony\Component\Form\Extension\Core\Type\FormType');
$this->assertEquals('', $form->getName());
}
@@ -401,11 +408,11 @@ public function testSubformDoesntCallSetters()
{
$author = new FormTest_AuthorWithoutRefSetter(new Author());
- $builder = $this->factory->createBuilder('form', $author);
- $builder->add('reference', 'form', array(
+ $builder = $this->factory->createBuilder('Symfony\Component\Form\Extension\Core\Type\FormType', $author);
+ $builder->add('reference', 'Symfony\Component\Form\Extension\Core\Type\FormType', array(
'data_class' => 'Symfony\Component\Form\Tests\Fixtures\Author',
));
- $builder->get('reference')->add('firstName', 'text');
+ $builder->get('reference')->add('firstName', 'Symfony\Component\Form\Extension\Core\Type\TextType');
$form = $builder->getForm();
$form->submit(array(
@@ -424,11 +431,11 @@ public function testSubformCallsSettersIfTheObjectChanged()
$author = new FormTest_AuthorWithoutRefSetter(null);
$newReference = new Author();
- $builder = $this->factory->createBuilder('form', $author);
- $builder->add('referenceCopy', 'form', array(
+ $builder = $this->factory->createBuilder('Symfony\Component\Form\Extension\Core\Type\FormType', $author);
+ $builder->add('referenceCopy', 'Symfony\Component\Form\Extension\Core\Type\FormType', array(
'data_class' => 'Symfony\Component\Form\Tests\Fixtures\Author',
));
- $builder->get('referenceCopy')->add('firstName', 'text');
+ $builder->get('referenceCopy')->add('firstName', 'Symfony\Component\Form\Extension\Core\Type\TextType');
$form = $builder->getForm();
$form['referenceCopy']->setData($newReference); // new author object
@@ -447,12 +454,12 @@ public function testSubformCallsSettersIfByReferenceIsFalse()
{
$author = new FormTest_AuthorWithoutRefSetter(new Author());
- $builder = $this->factory->createBuilder('form', $author);
- $builder->add('referenceCopy', 'form', array(
+ $builder = $this->factory->createBuilder('Symfony\Component\Form\Extension\Core\Type\FormType', $author);
+ $builder->add('referenceCopy', 'Symfony\Component\Form\Extension\Core\Type\FormType', array(
'data_class' => 'Symfony\Component\Form\Tests\Fixtures\Author',
'by_reference' => false,
));
- $builder->get('referenceCopy')->add('firstName', 'text');
+ $builder->get('referenceCopy')->add('firstName', 'Symfony\Component\Form\Extension\Core\Type\TextType');
$form = $builder->getForm();
$form->submit(array(
@@ -470,8 +477,8 @@ public function testSubformCallsSettersIfReferenceIsScalar()
{
$author = new FormTest_AuthorWithoutRefSetter('scalar');
- $builder = $this->factory->createBuilder('form', $author);
- $builder->add('referenceCopy', 'form');
+ $builder = $this->factory->createBuilder('Symfony\Component\Form\Extension\Core\Type\FormType', $author);
+ $builder->add('referenceCopy', 'Symfony\Component\Form\Extension\Core\Type\FormType');
$builder->get('referenceCopy')->addViewTransformer(new CallbackTransformer(
function () {},
function ($value) { // reverseTransform
@@ -495,9 +502,9 @@ public function testSubformAlwaysInsertsIntoArrays()
$ref2 = new Author();
$author = array('referenceCopy' => $ref1);
- $builder = $this->factory->createBuilder('form');
+ $builder = $this->factory->createBuilder('Symfony\Component\Form\Extension\Core\Type\FormType');
$builder->setData($author);
- $builder->add('referenceCopy', 'form');
+ $builder->add('referenceCopy', 'Symfony\Component\Form\Extension\Core\Type\FormType');
$builder->get('referenceCopy')->addViewTransformer(new CallbackTransformer(
function () {},
function ($value) use ($ref2) { // reverseTransform
@@ -518,9 +525,9 @@ function ($value) use ($ref2) { // reverseTransform
public function testPassMultipartTrueIfAnyChildIsMultipartToView()
{
- $view = $this->factory->createBuilder('form')
- ->add('foo', 'text')
- ->add('bar', 'file')
+ $view = $this->factory->createBuilder('Symfony\Component\Form\Extension\Core\Type\FormType')
+ ->add('foo', 'Symfony\Component\Form\Extension\Core\Type\TextType')
+ ->add('bar', 'Symfony\Component\Form\Extension\Core\Type\FileType')
->getForm()
->createView();
@@ -529,8 +536,8 @@ public function testPassMultipartTrueIfAnyChildIsMultipartToView()
public function testViewIsNotRenderedByDefault()
{
- $view = $this->factory->createBuilder('form')
- ->add('foo', 'form')
+ $view = $this->factory->createBuilder('Symfony\Component\Form\Extension\Core\Type\FormType')
+ ->add('foo', 'Symfony\Component\Form\Extension\Core\Type\FormType')
->getForm()
->createView();
@@ -539,7 +546,7 @@ public function testViewIsNotRenderedByDefault()
public function testErrorBubblingIfCompound()
{
- $form = $this->factory->create('form', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\FormType', null, array(
'compound' => true,
));
@@ -548,7 +555,7 @@ public function testErrorBubblingIfCompound()
public function testNoErrorBubblingIfNotCompound()
{
- $form = $this->factory->create('form', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\FormType', null, array(
'compound' => false,
));
@@ -557,7 +564,7 @@ public function testNoErrorBubblingIfNotCompound()
public function testOverrideErrorBubbling()
{
- $form = $this->factory->create('form', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\FormType', null, array(
'compound' => false,
'error_bubbling' => true,
));
@@ -567,7 +574,7 @@ public function testOverrideErrorBubbling()
public function testPropertyPath()
{
- $form = $this->factory->create('form', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\FormType', null, array(
'property_path' => 'foo',
));
@@ -577,7 +584,7 @@ public function testPropertyPath()
public function testPropertyPathNullImpliesDefault()
{
- $form = $this->factory->createNamed('name', 'form', null, array(
+ $form = $this->factory->createNamed('name', 'Symfony\Component\Form\Extension\Core\Type\FormType', null, array(
'property_path' => null,
));
@@ -587,7 +594,7 @@ public function testPropertyPathNullImpliesDefault()
public function testNotMapped()
{
- $form = $this->factory->create('form', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\FormType', null, array(
'property_path' => 'foo',
'mapped' => false,
));
@@ -598,14 +605,14 @@ public function testNotMapped()
public function testViewValidNotSubmitted()
{
- $form = $this->factory->create('form');
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\FormType');
$view = $form->createView();
$this->assertTrue($view->vars['valid']);
}
public function testViewNotValidSubmitted()
{
- $form = $this->factory->create('form');
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\FormType');
$form->submit(array());
$form->addError(new FormError('An error'));
$view = $form->createView();
@@ -614,14 +621,14 @@ public function testViewNotValidSubmitted()
public function testViewSubmittedNotSubmitted()
{
- $form = $this->factory->create('form');
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\FormType');
$view = $form->createView();
$this->assertFalse($view->vars['submitted']);
}
public function testViewSubmittedSubmitted()
{
- $form = $this->factory->create('form');
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\FormType');
$form->submit(array());
$view = $form->createView();
$this->assertTrue($view->vars['submitted']);
@@ -629,7 +636,7 @@ public function testViewSubmittedSubmitted()
public function testDataOptionSupersedesSetDataCalls()
{
- $form = $this->factory->create('form', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\FormType', null, array(
'data' => 'default',
'compound' => false,
));
@@ -641,7 +648,7 @@ public function testDataOptionSupersedesSetDataCalls()
public function testDataOptionSupersedesSetDataCallsIfNull()
{
- $form = $this->factory->create('form', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\FormType', null, array(
'data' => null,
'compound' => false,
));
@@ -653,7 +660,7 @@ public function testDataOptionSupersedesSetDataCallsIfNull()
public function testNormDataIsPassedToView()
{
- $view = $this->factory->createBuilder('form')
+ $view = $this->factory->createBuilder('Symfony\Component\Form\Extension\Core\Type\FormType')
->addViewTransformer(new FixedDataTransformer(array(
'foo' => 'bar',
)))
@@ -668,7 +675,7 @@ public function testNormDataIsPassedToView()
// https://github.com/symfony/symfony/issues/6862
public function testPassZeroLabelToView()
{
- $view = $this->factory->create('form', null, array(
+ $view = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\FormType', null, array(
'label' => '0',
))
->createView();
@@ -681,12 +688,12 @@ public function testPassZeroLabelToView()
*/
public function testCanGetErrorsWhenButtonInForm()
{
- $builder = $this->factory->createBuilder('form', null, array(
+ $builder = $this->factory->createBuilder('Symfony\Component\Form\Extension\Core\Type\FormType', null, array(
'data_class' => 'Symfony\Component\Form\Tests\Fixtures\Author',
'required' => false,
));
- $builder->add('foo', 'text');
- $builder->add('submit', 'submit');
+ $builder->add('foo', 'Symfony\Component\Form\Extension\Core\Type\TextType');
+ $builder->add('submit', 'Symfony\Component\Form\Extension\Core\Type\SubmitType');
$form = $builder->getForm();
//This method should not throw a Fatal Error Exception.
@@ -695,6 +702,6 @@ public function testCanGetErrorsWhenButtonInForm()
protected function getTestedType()
{
- return 'form';
+ return 'Symfony\Component\Form\Extension\Core\Type\FormType';
}
}
diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/Type/IntegerTypeTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/IntegerTypeTest.php
index 85f91ff18126d..a06f8daa43387 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/IntegerTypeTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/IntegerTypeTest.php
@@ -23,10 +23,17 @@ protected function setUp()
parent::setUp();
}
- public function testSubmitCastsToInteger()
+ public function testLegacyName()
{
$form = $this->factory->create('integer');
+ $this->assertSame('integer', $form->getConfig()->getType()->getName());
+ }
+
+ public function testSubmitCastsToInteger()
+ {
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\IntegerType');
+
$form->submit('1.678');
$this->assertSame(1, $form->getData());
diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/Type/LanguageTypeTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/LanguageTypeTest.php
index ea6255d034b6b..eb1a325ec3947 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/LanguageTypeTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/LanguageTypeTest.php
@@ -24,9 +24,16 @@ protected function setUp()
parent::setUp();
}
- public function testCountriesAreSelectable()
+ public function testLegacyName()
{
$form = $this->factory->create('language');
+
+ $this->assertSame('language', $form->getConfig()->getType()->getName());
+ }
+
+ public function testCountriesAreSelectable()
+ {
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\LanguageType');
$view = $form->createView();
$choices = $view->vars['choices'];
@@ -39,7 +46,7 @@ public function testCountriesAreSelectable()
public function testMultipleLanguagesIsNotIncluded()
{
- $form = $this->factory->create('language', 'language');
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\LanguageType', 'Symfony\Component\Form\Extension\Core\Type\LanguageType');
$view = $form->createView();
$choices = $view->vars['choices'];
diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/Type/LocaleTypeTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/LocaleTypeTest.php
index 7f6d922ec9867..8957a1952b1c5 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/LocaleTypeTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/LocaleTypeTest.php
@@ -24,9 +24,16 @@ protected function setUp()
parent::setUp();
}
- public function testLocalesAreSelectable()
+ public function testLegacyName()
{
$form = $this->factory->create('locale');
+
+ $this->assertSame('locale', $form->getConfig()->getType()->getName());
+ }
+
+ public function testLocalesAreSelectable()
+ {
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\LocaleType');
$view = $form->createView();
$choices = $view->vars['choices'];
diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/Type/MoneyTypeTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/MoneyTypeTest.php
index c499908d7713c..0e093de71f69e 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/MoneyTypeTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/MoneyTypeTest.php
@@ -25,11 +25,18 @@ protected function setUp()
parent::setUp();
}
+ public function testLegacyName()
+ {
+ $form = $this->factory->create('money');
+
+ $this->assertSame('money', $form->getConfig()->getType()->getName());
+ }
+
public function testPassMoneyPatternToView()
{
\Locale::setDefault('de_DE');
- $form = $this->factory->create('money');
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\MoneyType');
$view = $form->createView();
$this->assertSame('{{ widget }} €', $view->vars['money_pattern']);
@@ -39,7 +46,7 @@ public function testMoneyPatternWorksForYen()
{
\Locale::setDefault('en_US');
- $form = $this->factory->create('money', null, array('currency' => 'JPY'));
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\MoneyType', null, array('currency' => 'JPY'));
$view = $form->createView();
$this->assertTrue((bool) strstr($view->vars['money_pattern'], '¥'));
}
@@ -49,8 +56,8 @@ public function testPassDifferentPatternsForDifferentCurrencies()
{
\Locale::setDefault('de_DE');
- $form1 = $this->factory->create('money', null, array('currency' => 'GBP'));
- $form2 = $this->factory->create('money', null, array('currency' => 'EUR'));
+ $form1 = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\MoneyType', null, array('currency' => 'GBP'));
+ $form2 = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\MoneyType', null, array('currency' => 'EUR'));
$view1 = $form1->createView();
$view2 = $form2->createView();
diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/Type/NumberTypeTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/NumberTypeTest.php
index f21a7d1ec47d4..dac7af68762a5 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/NumberTypeTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/NumberTypeTest.php
@@ -26,9 +26,16 @@ protected function setUp()
\Locale::setDefault('de_DE');
}
- public function testDefaultFormatting()
+ public function testLegacyName()
{
$form = $this->factory->create('number');
+
+ $this->assertSame('number', $form->getConfig()->getType()->getName());
+ }
+
+ public function testDefaultFormatting()
+ {
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\NumberType');
$form->setData('12345.67890');
$view = $form->createView();
@@ -37,7 +44,7 @@ public function testDefaultFormatting()
public function testDefaultFormattingWithGrouping()
{
- $form = $this->factory->create('number', null, array('grouping' => true));
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\NumberType', null, array('grouping' => true));
$form->setData('12345.67890');
$view = $form->createView();
@@ -46,7 +53,7 @@ public function testDefaultFormattingWithGrouping()
public function testDefaultFormattingWithScale()
{
- $form = $this->factory->create('number', null, array('scale' => 2));
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\NumberType', null, array('scale' => 2));
$form->setData('12345.67890');
$view = $form->createView();
@@ -55,7 +62,7 @@ public function testDefaultFormattingWithScale()
public function testDefaultFormattingWithRounding()
{
- $form = $this->factory->create('number', null, array('scale' => 0, 'rounding_mode' => \NumberFormatter::ROUND_UP));
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\NumberType', null, array('scale' => 0, 'rounding_mode' => \NumberFormatter::ROUND_UP));
$form->setData('12345.54321');
$view = $form->createView();
diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/Type/PasswordTypeTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/PasswordTypeTest.php
index bccb6f7b770ab..388634f54c384 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/PasswordTypeTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/PasswordTypeTest.php
@@ -13,9 +13,16 @@
class PasswordTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
{
- public function testEmptyIfNotSubmitted()
+ public function testLegacyName()
{
$form = $this->factory->create('password');
+
+ $this->assertSame('password', $form->getConfig()->getType()->getName());
+ }
+
+ public function testEmptyIfNotSubmitted()
+ {
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\PasswordType');
$form->setData('pAs5w0rd');
$view = $form->createView();
@@ -24,7 +31,7 @@ public function testEmptyIfNotSubmitted()
public function testEmptyIfSubmitted()
{
- $form = $this->factory->create('password');
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\PasswordType');
$form->submit('pAs5w0rd');
$view = $form->createView();
@@ -33,7 +40,7 @@ public function testEmptyIfSubmitted()
public function testNotEmptyIfSubmittedAndNotAlwaysEmpty()
{
- $form = $this->factory->create('password', null, array('always_empty' => false));
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\PasswordType', null, array('always_empty' => false));
$form->submit('pAs5w0rd');
$view = $form->createView();
@@ -42,7 +49,7 @@ public function testNotEmptyIfSubmittedAndNotAlwaysEmpty()
public function testNotTrimmed()
{
- $form = $this->factory->create('password', null);
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\PasswordType', null);
$form->submit(' pAs5w0rd ');
$data = $form->getData();
diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/Type/RepeatedTypeTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/RepeatedTypeTest.php
index 8e56b8feb9eb3..a2442e657da80 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/RepeatedTypeTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/RepeatedTypeTest.php
@@ -19,12 +19,21 @@ protected function setUp()
{
parent::setUp();
- $this->form = $this->factory->create('repeated', null, array(
- 'type' => 'text',
+ $this->form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\RepeatedType', null, array(
+ 'type' => 'Symfony\Component\Form\Extension\Core\Type\TextType',
));
$this->form->setData(null);
}
+ public function testLegacyName()
+ {
+ $form = $this->factory->create('repeated', array(
+ 'type' => 'text',
+ ));
+
+ $this->assertSame('repeated', $form->getConfig()->getType()->getName());
+ }
+
public function testSetData()
{
$this->form->setData('foobar');
@@ -35,8 +44,8 @@ public function testSetData()
public function testSetOptions()
{
- $form = $this->factory->create('repeated', null, array(
- 'type' => 'text',
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\RepeatedType', null, array(
+ 'type' => 'Symfony\Component\Form\Extension\Core\Type\TextType',
'options' => array('label' => 'Global'),
));
@@ -48,9 +57,9 @@ public function testSetOptions()
public function testSetOptionsPerChild()
{
- $form = $this->factory->create('repeated', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\RepeatedType', null, array(
// the global required value cannot be overridden
- 'type' => 'text',
+ 'type' => 'Symfony\Component\Form\Extension\Core\Type\TextType',
'first_options' => array('label' => 'Test', 'required' => false),
'second_options' => array('label' => 'Test2'),
));
@@ -63,9 +72,9 @@ public function testSetOptionsPerChild()
public function testSetRequired()
{
- $form = $this->factory->create('repeated', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\RepeatedType', null, array(
'required' => false,
- 'type' => 'text',
+ 'type' => 'Symfony\Component\Form\Extension\Core\Type\TextType',
));
$this->assertFalse($form['first']->isRequired());
@@ -77,8 +86,8 @@ public function testSetRequired()
*/
public function testSetInvalidOptions()
{
- $this->factory->create('repeated', null, array(
- 'type' => 'text',
+ $this->factory->create('Symfony\Component\Form\Extension\Core\Type\RepeatedType', null, array(
+ 'type' => 'Symfony\Component\Form\Extension\Core\Type\TextType',
'options' => 'bad value',
));
}
@@ -88,8 +97,8 @@ public function testSetInvalidOptions()
*/
public function testSetInvalidFirstOptions()
{
- $this->factory->create('repeated', null, array(
- 'type' => 'text',
+ $this->factory->create('Symfony\Component\Form\Extension\Core\Type\RepeatedType', null, array(
+ 'type' => 'Symfony\Component\Form\Extension\Core\Type\TextType',
'first_options' => 'bad value',
));
}
@@ -99,15 +108,15 @@ public function testSetInvalidFirstOptions()
*/
public function testSetInvalidSecondOptions()
{
- $this->factory->create('repeated', null, array(
- 'type' => 'text',
+ $this->factory->create('Symfony\Component\Form\Extension\Core\Type\RepeatedType', null, array(
+ 'type' => 'Symfony\Component\Form\Extension\Core\Type\TextType',
'second_options' => 'bad value',
));
}
public function testSetErrorBubblingToTrue()
{
- $form = $this->factory->create('repeated', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\RepeatedType', null, array(
'error_bubbling' => true,
));
@@ -118,7 +127,7 @@ public function testSetErrorBubblingToTrue()
public function testSetErrorBubblingToFalse()
{
- $form = $this->factory->create('repeated', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\RepeatedType', null, array(
'error_bubbling' => false,
));
@@ -129,7 +138,7 @@ public function testSetErrorBubblingToFalse()
public function testSetErrorBubblingIndividually()
{
- $form = $this->factory->create('repeated', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\RepeatedType', null, array(
'error_bubbling' => true,
'options' => array('error_bubbling' => false),
'second_options' => array('error_bubbling' => true),
@@ -142,8 +151,8 @@ public function testSetErrorBubblingIndividually()
public function testSetOptionsPerChildAndOverwrite()
{
- $form = $this->factory->create('repeated', null, array(
- 'type' => 'text',
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\RepeatedType', null, array(
+ 'type' => 'Symfony\Component\Form\Extension\Core\Type\TextType',
'options' => array('label' => 'Label'),
'second_options' => array('label' => 'Second label'),
));
diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/Type/SubmitTypeTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/SubmitTypeTest.php
index 212ffd4007bb1..8996eb506c655 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/SubmitTypeTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/SubmitTypeTest.php
@@ -18,21 +18,28 @@
*/
class SubmitTypeTest extends TestCase
{
+ public function testLegacyName()
+ {
+ $form = $this->factory->create('submit');
+
+ $this->assertSame('submit', $form->getConfig()->getType()->getName());
+ }
+
public function testCreateSubmitButtonInstances()
{
- $this->assertInstanceOf('Symfony\Component\Form\SubmitButton', $this->factory->create('submit'));
+ $this->assertInstanceOf('Symfony\Component\Form\SubmitButton', $this->factory->create('Symfony\Component\Form\Extension\Core\Type\SubmitType'));
}
public function testNotClickedByDefault()
{
- $button = $this->factory->create('submit');
+ $button = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\SubmitType');
$this->assertFalse($button->isClicked());
}
public function testNotClickedIfSubmittedWithNull()
{
- $button = $this->factory->create('submit');
+ $button = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\SubmitType');
$button->submit(null);
$this->assertFalse($button->isClicked());
@@ -40,7 +47,7 @@ public function testNotClickedIfSubmittedWithNull()
public function testClickedIfSubmittedWithEmptyString()
{
- $button = $this->factory->create('submit');
+ $button = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\SubmitType');
$button->submit('');
$this->assertTrue($button->isClicked());
@@ -48,7 +55,7 @@ public function testClickedIfSubmittedWithEmptyString()
public function testClickedIfSubmittedWithUnemptyString()
{
- $button = $this->factory->create('submit');
+ $button = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\SubmitType');
$button->submit('foo');
$this->assertTrue($button->isClicked());
@@ -57,9 +64,9 @@ public function testClickedIfSubmittedWithUnemptyString()
public function testSubmitCanBeAddedToForm()
{
$form = $this->factory
- ->createBuilder('form')
+ ->createBuilder('Symfony\Component\Form\Extension\Core\Type\FormType')
->getForm();
- $this->assertSame($form, $form->add('send', 'submit'));
+ $this->assertSame($form, $form->add('send', 'Symfony\Component\Form\Extension\Core\Type\SubmitType'));
}
}
diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/Type/TimeTypeTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/TimeTypeTest.php
index a1bb3a53f7648..7f28a8a2a6c32 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/TimeTypeTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/TimeTypeTest.php
@@ -25,9 +25,16 @@ protected function setUp()
parent::setUp();
}
+ public function testLegacyName()
+ {
+ $form = $this->factory->create('time');
+
+ $this->assertSame('time', $form->getConfig()->getType()->getName());
+ }
+
public function testSubmitDateTime()
{
- $form = $this->factory->create('time', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\TimeType', null, array(
'model_timezone' => 'UTC',
'view_timezone' => 'UTC',
'input' => 'datetime',
@@ -48,7 +55,7 @@ public function testSubmitDateTime()
public function testSubmitString()
{
- $form = $this->factory->create('time', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\TimeType', null, array(
'model_timezone' => 'UTC',
'view_timezone' => 'UTC',
'input' => 'string',
@@ -67,7 +74,7 @@ public function testSubmitString()
public function testSubmitTimestamp()
{
- $form = $this->factory->create('time', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\TimeType', null, array(
'model_timezone' => 'UTC',
'view_timezone' => 'UTC',
'input' => 'timestamp',
@@ -88,7 +95,7 @@ public function testSubmitTimestamp()
public function testSubmitArray()
{
- $form = $this->factory->create('time', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\TimeType', null, array(
'model_timezone' => 'UTC',
'view_timezone' => 'UTC',
'input' => 'array',
@@ -107,7 +114,7 @@ public function testSubmitArray()
public function testSubmitDatetimeSingleText()
{
- $form = $this->factory->create('time', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\TimeType', null, array(
'model_timezone' => 'UTC',
'view_timezone' => 'UTC',
'input' => 'datetime',
@@ -122,7 +129,7 @@ public function testSubmitDatetimeSingleText()
public function testSubmitDatetimeSingleTextWithoutMinutes()
{
- $form = $this->factory->create('time', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\TimeType', null, array(
'model_timezone' => 'UTC',
'view_timezone' => 'UTC',
'input' => 'datetime',
@@ -138,7 +145,7 @@ public function testSubmitDatetimeSingleTextWithoutMinutes()
public function testSubmitArraySingleText()
{
- $form = $this->factory->create('time', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\TimeType', null, array(
'model_timezone' => 'UTC',
'view_timezone' => 'UTC',
'input' => 'array',
@@ -158,7 +165,7 @@ public function testSubmitArraySingleText()
public function testSubmitArraySingleTextWithoutMinutes()
{
- $form = $this->factory->create('time', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\TimeType', null, array(
'model_timezone' => 'UTC',
'view_timezone' => 'UTC',
'input' => 'array',
@@ -178,7 +185,7 @@ public function testSubmitArraySingleTextWithoutMinutes()
public function testSubmitArraySingleTextWithSeconds()
{
- $form = $this->factory->create('time', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\TimeType', null, array(
'model_timezone' => 'UTC',
'view_timezone' => 'UTC',
'input' => 'array',
@@ -200,7 +207,7 @@ public function testSubmitArraySingleTextWithSeconds()
public function testSubmitStringSingleText()
{
- $form = $this->factory->create('time', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\TimeType', null, array(
'model_timezone' => 'UTC',
'view_timezone' => 'UTC',
'input' => 'string',
@@ -215,7 +222,7 @@ public function testSubmitStringSingleText()
public function testSubmitStringSingleTextWithoutMinutes()
{
- $form = $this->factory->create('time', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\TimeType', null, array(
'model_timezone' => 'UTC',
'view_timezone' => 'UTC',
'input' => 'string',
@@ -231,7 +238,7 @@ public function testSubmitStringSingleTextWithoutMinutes()
public function testSetDataWithoutMinutes()
{
- $form = $this->factory->create('time', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\TimeType', null, array(
'model_timezone' => 'UTC',
'view_timezone' => 'UTC',
'input' => 'datetime',
@@ -245,7 +252,7 @@ public function testSetDataWithoutMinutes()
public function testSetDataWithSeconds()
{
- $form = $this->factory->create('time', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\TimeType', null, array(
'model_timezone' => 'UTC',
'view_timezone' => 'UTC',
'input' => 'datetime',
@@ -259,7 +266,7 @@ public function testSetDataWithSeconds()
public function testSetDataDifferentTimezones()
{
- $form = $this->factory->create('time', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\TimeType', null, array(
'model_timezone' => 'America/New_York',
'view_timezone' => 'Asia/Hong_Kong',
'input' => 'string',
@@ -285,7 +292,7 @@ public function testSetDataDifferentTimezones()
public function testSetDataDifferentTimezonesDateTime()
{
- $form = $this->factory->create('time', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\TimeType', null, array(
'model_timezone' => 'America/New_York',
'view_timezone' => 'Asia/Hong_Kong',
'input' => 'datetime',
@@ -312,7 +319,7 @@ public function testSetDataDifferentTimezonesDateTime()
public function testHoursOption()
{
- $form = $this->factory->create('time', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\TimeType', null, array(
'hours' => array(6, 7),
));
@@ -326,7 +333,7 @@ public function testHoursOption()
public function testIsMinuteWithinRangeReturnsTrueIfWithin()
{
- $form = $this->factory->create('time', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\TimeType', null, array(
'minutes' => array(6, 7),
));
@@ -340,7 +347,7 @@ public function testIsMinuteWithinRangeReturnsTrueIfWithin()
public function testIsSecondWithinRangeReturnsTrueIfWithin()
{
- $form = $this->factory->create('time', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\TimeType', null, array(
'seconds' => array(6, 7),
'with_seconds' => true,
));
@@ -357,7 +364,7 @@ public function testIsPartiallyFilledReturnsFalseIfCompletelyEmpty()
{
$this->markTestIncomplete('Needs to be reimplemented using validators');
- $form = $this->factory->create('time', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\TimeType', null, array(
'widget' => 'choice',
));
@@ -373,7 +380,7 @@ public function testIsPartiallyFilledReturnsFalseIfCompletelyEmptyWithSeconds()
{
$this->markTestIncomplete('Needs to be reimplemented using validators');
- $form = $this->factory->create('time', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\TimeType', null, array(
'widget' => 'choice',
'with_seconds' => true,
));
@@ -391,7 +398,7 @@ public function testIsPartiallyFilledReturnsFalseIfCompletelyFilled()
{
$this->markTestIncomplete('Needs to be reimplemented using validators');
- $form = $this->factory->create('time', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\TimeType', null, array(
'widget' => 'choice',
));
@@ -407,7 +414,7 @@ public function testIsPartiallyFilledReturnsFalseIfCompletelyFilledWithSeconds()
{
$this->markTestIncomplete('Needs to be reimplemented using validators');
- $form = $this->factory->create('time', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\TimeType', null, array(
'widget' => 'choice',
'with_seconds' => true,
));
@@ -425,7 +432,7 @@ public function testIsPartiallyFilledReturnsTrueIfChoiceAndHourEmpty()
{
$this->markTestIncomplete('Needs to be reimplemented using validators');
- $form = $this->factory->create('time', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\TimeType', null, array(
'widget' => 'choice',
'with_seconds' => true,
));
@@ -443,7 +450,7 @@ public function testIsPartiallyFilledReturnsTrueIfChoiceAndMinuteEmpty()
{
$this->markTestIncomplete('Needs to be reimplemented using validators');
- $form = $this->factory->create('time', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\TimeType', null, array(
'widget' => 'choice',
'with_seconds' => true,
));
@@ -461,7 +468,7 @@ public function testIsPartiallyFilledReturnsTrueIfChoiceAndSecondsEmpty()
{
$this->markTestIncomplete('Needs to be reimplemented using validators');
- $form = $this->factory->create('time', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\TimeType', null, array(
'widget' => 'choice',
'with_seconds' => true,
));
@@ -480,12 +487,12 @@ public function testInitializeWithDateTime()
{
// Throws an exception if "data_class" option is not explicitly set
// to null in the type
- $this->factory->create('time', new \DateTime());
+ $this->factory->create('Symfony\Component\Form\Extension\Core\Type\TimeType', new \DateTime());
}
public function testSingleTextWidgetShouldUseTheRightInputType()
{
- $form = $this->factory->create('time', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\TimeType', null, array(
'widget' => 'single_text',
));
@@ -495,7 +502,7 @@ public function testSingleTextWidgetShouldUseTheRightInputType()
public function testSingleTextWidgetWithSecondsShouldHaveRightStepAttribute()
{
- $form = $this->factory->create('time', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\TimeType', null, array(
'widget' => 'single_text',
'with_seconds' => true,
));
@@ -507,7 +514,7 @@ public function testSingleTextWidgetWithSecondsShouldHaveRightStepAttribute()
public function testSingleTextWidgetWithSecondsShouldNotOverrideStepAttribute()
{
- $form = $this->factory->create('time', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\TimeType', null, array(
'widget' => 'single_text',
'with_seconds' => true,
'attr' => array(
@@ -522,7 +529,7 @@ public function testSingleTextWidgetWithSecondsShouldNotOverrideStepAttribute()
public function testDontPassHtml5TypeIfHtml5NotAllowed()
{
- $form = $this->factory->create('time', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\TimeType', null, array(
'widget' => 'single_text',
'html5' => false,
));
@@ -533,7 +540,7 @@ public function testDontPassHtml5TypeIfHtml5NotAllowed()
public function testPassDefaultPlaceholderToViewIfNotRequired()
{
- $form = $this->factory->create('time', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\TimeType', null, array(
'required' => false,
'with_seconds' => true,
));
@@ -546,7 +553,7 @@ public function testPassDefaultPlaceholderToViewIfNotRequired()
public function testPassNoPlaceholderToViewIfRequired()
{
- $form = $this->factory->create('time', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\TimeType', null, array(
'required' => true,
'with_seconds' => true,
));
@@ -559,7 +566,7 @@ public function testPassNoPlaceholderToViewIfRequired()
public function testPassPlaceholderAsString()
{
- $form = $this->factory->create('time', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\TimeType', null, array(
'placeholder' => 'Empty',
'with_seconds' => true,
));
@@ -572,7 +579,7 @@ public function testPassPlaceholderAsString()
public function testPassEmptyValueBC()
{
- $form = $this->factory->create('time', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\TimeType', null, array(
'empty_value' => 'Empty',
'with_seconds' => true,
));
@@ -588,7 +595,7 @@ public function testPassEmptyValueBC()
public function testPassPlaceholderAsArray()
{
- $form = $this->factory->create('time', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\TimeType', null, array(
'placeholder' => array(
'hour' => 'Empty hour',
'minute' => 'Empty minute',
@@ -605,7 +612,7 @@ public function testPassPlaceholderAsArray()
public function testPassPlaceholderAsPartialArrayAddEmptyIfNotRequired()
{
- $form = $this->factory->create('time', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\TimeType', null, array(
'required' => false,
'placeholder' => array(
'hour' => 'Empty hour',
@@ -622,7 +629,7 @@ public function testPassPlaceholderAsPartialArrayAddEmptyIfNotRequired()
public function testPassPlaceholderAsPartialArrayAddNullIfRequired()
{
- $form = $this->factory->create('time', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\TimeType', null, array(
'required' => true,
'placeholder' => array(
'hour' => 'Empty hour',
@@ -651,7 +658,7 @@ public function provideCompoundWidgets()
public function testHourErrorsBubbleUp($widget)
{
$error = new FormError('Invalid!');
- $form = $this->factory->create('time', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\TimeType', null, array(
'widget' => $widget,
));
$form['hour']->addError($error);
@@ -666,7 +673,7 @@ public function testHourErrorsBubbleUp($widget)
public function testMinuteErrorsBubbleUp($widget)
{
$error = new FormError('Invalid!');
- $form = $this->factory->create('time', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\TimeType', null, array(
'widget' => $widget,
));
$form['minute']->addError($error);
@@ -681,7 +688,7 @@ public function testMinuteErrorsBubbleUp($widget)
public function testSecondErrorsBubbleUp($widget)
{
$error = new FormError('Invalid!');
- $form = $this->factory->create('time', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\TimeType', null, array(
'widget' => $widget,
'with_seconds' => true,
));
@@ -696,7 +703,7 @@ public function testSecondErrorsBubbleUp($widget)
*/
public function testInitializeWithSecondsAndWithoutMinutes()
{
- $this->factory->create('time', null, array(
+ $this->factory->create('Symfony\Component\Form\Extension\Core\Type\TimeType', null, array(
'with_minutes' => false,
'with_seconds' => true,
));
@@ -707,7 +714,7 @@ public function testInitializeWithSecondsAndWithoutMinutes()
*/
public function testThrowExceptionIfHoursIsInvalid()
{
- $this->factory->create('time', null, array(
+ $this->factory->create('Symfony\Component\Form\Extension\Core\Type\TimeType', null, array(
'hours' => 'bad value',
));
}
@@ -717,7 +724,7 @@ public function testThrowExceptionIfHoursIsInvalid()
*/
public function testThrowExceptionIfMinutesIsInvalid()
{
- $this->factory->create('time', null, array(
+ $this->factory->create('Symfony\Component\Form\Extension\Core\Type\TimeType', null, array(
'minutes' => 'bad value',
));
}
@@ -727,7 +734,7 @@ public function testThrowExceptionIfMinutesIsInvalid()
*/
public function testThrowExceptionIfSecondsIsInvalid()
{
- $this->factory->create('time', null, array(
+ $this->factory->create('Symfony\Component\Form\Extension\Core\Type\TimeType', null, array(
'seconds' => 'bad value',
));
}
diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/Type/TimezoneTypeTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/TimezoneTypeTest.php
index 05e234698404c..7af15b5fd52b3 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/TimezoneTypeTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/TimezoneTypeTest.php
@@ -15,9 +15,16 @@
class TimezoneTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
{
- public function testTimezonesAreSelectable()
+ public function testLegacyName()
{
$form = $this->factory->create('timezone');
+
+ $this->assertSame('timezone', $form->getConfig()->getType()->getName());
+ }
+
+ public function testTimezonesAreSelectable()
+ {
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\TimezoneType');
$view = $form->createView();
$choices = $view->vars['choices'];
diff --git a/src/Symfony/Component/Form/Tests/Extension/Core/Type/UrlTypeTest.php b/src/Symfony/Component/Form/Tests/Extension/Core/Type/UrlTypeTest.php
index f5c38ea752193..eeb5ca59de57a 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Core/Type/UrlTypeTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Core/Type/UrlTypeTest.php
@@ -15,9 +15,16 @@
class UrlTypeTest extends TestCase
{
+ public function testLegacyName()
+ {
+ $form = $this->factory->create('url');
+
+ $this->assertSame('url', $form->getConfig()->getType()->getName());
+ }
+
public function testSubmitAddsDefaultProtocolIfNoneIsIncluded()
{
- $form = $this->factory->create('url', 'name');
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\UrlType', 'name');
$form->submit('www.domain.com');
@@ -27,7 +34,7 @@ public function testSubmitAddsDefaultProtocolIfNoneIsIncluded()
public function testSubmitAddsNoDefaultProtocolIfAlreadyIncluded()
{
- $form = $this->factory->create('url', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\UrlType', null, array(
'default_protocol' => 'http',
));
@@ -39,7 +46,7 @@ public function testSubmitAddsNoDefaultProtocolIfAlreadyIncluded()
public function testSubmitAddsNoDefaultProtocolIfEmpty()
{
- $form = $this->factory->create('url', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\UrlType', null, array(
'default_protocol' => 'http',
));
@@ -51,7 +58,7 @@ public function testSubmitAddsNoDefaultProtocolIfEmpty()
public function testSubmitAddsNoDefaultProtocolIfNull()
{
- $form = $this->factory->create('url', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\UrlType', null, array(
'default_protocol' => 'http',
));
@@ -63,7 +70,7 @@ public function testSubmitAddsNoDefaultProtocolIfNull()
public function testSubmitAddsNoDefaultProtocolIfSetToNull()
{
- $form = $this->factory->create('url', null, array(
+ $form = $this->factory->create('Symfony\Component\Form\Extension\Core\Type\UrlType', null, array(
'default_protocol' => null,
));
@@ -78,7 +85,7 @@ public function testSubmitAddsNoDefaultProtocolIfSetToNull()
*/
public function testThrowExceptionIfDefaultProtocolIsInvalid()
{
- $this->factory->create('url', null, array(
+ $this->factory->create('Symfony\Component\Form\Extension\Core\Type\UrlType', null, array(
'default_protocol' => array(),
));
}
diff --git a/src/Symfony/Component/Form/Tests/Extension/Csrf/Type/FormTypeCsrfExtensionTest.php b/src/Symfony/Component/Form/Tests/Extension/Csrf/Type/FormTypeCsrfExtensionTest.php
index bc78a4a442b91..1a1e15b53fe8f 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Csrf/Type/FormTypeCsrfExtensionTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Csrf/Type/FormTypeCsrfExtensionTest.php
@@ -24,12 +24,7 @@ public function buildForm(FormBuilderInterface $builder, array $options)
{
// The form needs a child in order to trigger CSRF protection by
// default
- $builder->add('name', 'text');
- }
-
- public function getName()
- {
- return 'csrf_collection_test';
+ $builder->add('name', 'Symfony\Component\Form\Extension\Core\Type\TextType');
}
}
@@ -71,7 +66,7 @@ protected function getExtensions()
public function testCsrfProtectionByDefaultIfRootAndCompound()
{
$view = $this->factory
- ->create('form', null, array(
+ ->create('Symfony\Component\Form\Extension\Core\Type\FormType', null, array(
'csrf_field_name' => 'csrf',
'compound' => true,
))
@@ -83,9 +78,9 @@ public function testCsrfProtectionByDefaultIfRootAndCompound()
public function testNoCsrfProtectionByDefaultIfCompoundButNotRoot()
{
$view = $this->factory
- ->createNamedBuilder('root', 'form')
+ ->createNamedBuilder('root', 'Symfony\Component\Form\Extension\Core\Type\FormType')
->add($this->factory
- ->createNamedBuilder('form', 'form', null, array(
+ ->createNamedBuilder('form', 'Symfony\Component\Form\Extension\Core\Type\FormType', null, array(
'csrf_field_name' => 'csrf',
'compound' => true,
))
@@ -100,7 +95,7 @@ public function testNoCsrfProtectionByDefaultIfCompoundButNotRoot()
public function testNoCsrfProtectionByDefaultIfRootButNotCompound()
{
$view = $this->factory
- ->create('form', null, array(
+ ->create('Symfony\Component\Form\Extension\Core\Type\FormType', null, array(
'csrf_field_name' => 'csrf',
'compound' => false,
))
@@ -112,7 +107,7 @@ public function testNoCsrfProtectionByDefaultIfRootButNotCompound()
public function testCsrfProtectionCanBeDisabled()
{
$view = $this->factory
- ->create('form', null, array(
+ ->create('Symfony\Component\Form\Extension\Core\Type\FormType', null, array(
'csrf_field_name' => 'csrf',
'csrf_protection' => false,
'compound' => true,
@@ -130,7 +125,7 @@ public function testGenerateCsrfToken()
->will($this->returnValue(new CsrfToken('TOKEN_ID', 'token')));
$view = $this->factory
- ->create('form', null, array(
+ ->create('Symfony\Component\Form\Extension\Core\Type\FormType', null, array(
'csrf_field_name' => 'csrf',
'csrf_token_manager' => $this->tokenManager,
'csrf_token_id' => 'TOKEN_ID',
@@ -149,7 +144,7 @@ public function testGenerateCsrfTokenUsesFormNameAsIntentionByDefault()
->will($this->returnValue('token'));
$view = $this->factory
- ->createNamed('FORM_NAME', 'form', null, array(
+ ->createNamed('FORM_NAME', 'Symfony\Component\Form\Extension\Core\Type\FormType', null, array(
'csrf_field_name' => 'csrf',
'csrf_token_manager' => $this->tokenManager,
'compound' => true,
@@ -167,7 +162,7 @@ public function testGenerateCsrfTokenUsesTypeClassAsIntentionIfEmptyFormName()
->will($this->returnValue('token'));
$view = $this->factory
- ->createNamed('', 'form', null, array(
+ ->createNamed('', 'Symfony\Component\Form\Extension\Core\Type\FormType', null, array(
'csrf_field_name' => 'csrf',
'csrf_token_manager' => $this->tokenManager,
'compound' => true,
@@ -196,13 +191,13 @@ public function testValidateTokenOnSubmitIfRootAndCompound($valid)
->will($this->returnValue($valid));
$form = $this->factory
- ->createBuilder('form', null, array(
+ ->createBuilder('Symfony\Component\Form\Extension\Core\Type\FormType', null, array(
'csrf_field_name' => 'csrf',
'csrf_token_manager' => $this->tokenManager,
'csrf_token_id' => 'TOKEN_ID',
'compound' => true,
))
- ->add('child', 'text')
+ ->add('child', 'Symfony\Component\Form\Extension\Core\Type\TextType')
->getForm();
$form->submit(array(
@@ -228,12 +223,12 @@ public function testValidateTokenOnSubmitIfRootAndCompoundUsesFormNameAsIntentio
->will($this->returnValue($valid));
$form = $this->factory
- ->createNamedBuilder('FORM_NAME', 'form', null, array(
+ ->createNamedBuilder('FORM_NAME', 'Symfony\Component\Form\Extension\Core\Type\FormType', null, array(
'csrf_field_name' => 'csrf',
'csrf_token_manager' => $this->tokenManager,
'compound' => true,
))
- ->add('child', 'text')
+ ->add('child', 'Symfony\Component\Form\Extension\Core\Type\TextType')
->getForm();
$form->submit(array(
@@ -259,12 +254,12 @@ public function testValidateTokenOnSubmitIfRootAndCompoundUsesTypeClassAsIntenti
->will($this->returnValue($valid));
$form = $this->factory
- ->createNamedBuilder('', 'form', null, array(
+ ->createNamedBuilder('', 'Symfony\Component\Form\Extension\Core\Type\FormType', null, array(
'csrf_field_name' => 'csrf',
'csrf_token_manager' => $this->tokenManager,
'compound' => true,
))
- ->add('child', 'text')
+ ->add('child', 'Symfony\Component\Form\Extension\Core\Type\TextType')
->getForm();
$form->submit(array(
@@ -285,13 +280,13 @@ public function testFailIfRootAndCompoundAndTokenMissing()
->method('isTokenValid');
$form = $this->factory
- ->createBuilder('form', null, array(
+ ->createBuilder('Symfony\Component\Form\Extension\Core\Type\FormType', null, array(
'csrf_field_name' => 'csrf',
'csrf_token_manager' => $this->tokenManager,
'csrf_token_id' => 'TOKEN_ID',
'compound' => true,
))
- ->add('child', 'text')
+ ->add('child', 'Symfony\Component\Form\Extension\Core\Type\TextType')
->getForm();
$form->submit(array(
@@ -312,9 +307,9 @@ public function testDontValidateTokenIfCompoundButNoRoot()
->method('isTokenValid');
$form = $this->factory
- ->createNamedBuilder('root', 'form')
+ ->createNamedBuilder('root', 'Symfony\Component\Form\Extension\Core\Type\FormType')
->add($this->factory
- ->createNamedBuilder('form', 'form', null, array(
+ ->createNamedBuilder('form', 'Symfony\Component\Form\Extension\Core\Type\FormType', null, array(
'csrf_field_name' => 'csrf',
'csrf_token_manager' => $this->tokenManager,
'csrf_token_id' => 'TOKEN_ID',
@@ -336,7 +331,7 @@ public function testDontValidateTokenIfRootButNotCompound()
->method('isTokenValid');
$form = $this->factory
- ->create('form', null, array(
+ ->create('Symfony\Component\Form\Extension\Core\Type\FormType', null, array(
'csrf_field_name' => 'csrf',
'csrf_token_manager' => $this->tokenManager,
'csrf_token_id' => 'TOKEN_ID',
@@ -351,8 +346,8 @@ public function testDontValidateTokenIfRootButNotCompound()
public function testNoCsrfProtectionOnPrototype()
{
$prototypeView = $this->factory
- ->create('collection', null, array(
- 'type' => new FormTypeCsrfExtensionTest_ChildType(),
+ ->create('Symfony\Component\Form\Extension\Core\Type\CollectionType', null, array(
+ 'type' => __CLASS__.'_ChildType',
'options' => array(
'csrf_field_name' => 'csrf',
),
@@ -379,7 +374,7 @@ public function testsTranslateCustomErrorMessage()
->will($this->returnValue('[trans]Foobar[/trans]'));
$form = $this->factory
- ->createBuilder('form', null, array(
+ ->createBuilder('Symfony\Component\Form\Extension\Core\Type\FormType', null, array(
'csrf_field_name' => 'csrf',
'csrf_token_manager' => $this->tokenManager,
'csrf_message' => 'Foobar',
diff --git a/src/Symfony/Component/Form/Tests/Extension/Validator/Constraints/FormValidatorPerformanceTest.php b/src/Symfony/Component/Form/Tests/Extension/Validator/Constraints/FormValidatorPerformanceTest.php
index 65df79c857507..9e957d55fe5cb 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Validator/Constraints/FormValidatorPerformanceTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Validator/Constraints/FormValidatorPerformanceTest.php
@@ -36,10 +36,10 @@ public function testValidationPerformance()
{
$this->setMaxRunningTime(1);
- $builder = $this->factory->createBuilder('form');
+ $builder = $this->factory->createBuilder('Symfony\Component\Form\Extension\Core\Type\FormType');
for ($i = 0; $i < 40; ++$i) {
- $builder->add($i, 'form');
+ $builder->add($i, 'Symfony\Component\Form\Extension\Core\Type\FormType');
$builder->get($i)
->add('a')
diff --git a/src/Symfony/Component/Form/Tests/Extension/Validator/Type/FormTypeValidatorExtensionTest.php b/src/Symfony/Component/Form/Tests/Extension/Validator/Type/FormTypeValidatorExtensionTest.php
index f24f8404418c2..644d51a46a9d8 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Validator/Type/FormTypeValidatorExtensionTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Validator/Type/FormTypeValidatorExtensionTest.php
@@ -20,13 +20,13 @@ class FormTypeValidatorExtensionTest extends BaseValidatorExtensionTest
public function testSubmitValidatesData()
{
$builder = $this->factory->createBuilder(
- 'form',
+ 'Symfony\Component\Form\Extension\Core\Type\FormType',
null,
array(
'validation_groups' => 'group',
)
);
- $builder->add('firstName', 'form');
+ $builder->add('firstName', 'Symfony\Component\Form\Extension\Core\Type\FormType');
$form = $builder->getForm();
$this->validator->expects($this->once())
@@ -93,6 +93,6 @@ public function testInvalidValidatorInterface()
protected function createForm(array $options = array())
{
- return $this->factory->create('form', null, $options);
+ return $this->factory->create('Symfony\Component\Form\Extension\Core\Type\FormType', null, $options);
}
}
diff --git a/src/Symfony/Component/Form/Tests/Extension/Validator/Type/SubmitTypeValidatorExtensionTest.php b/src/Symfony/Component/Form/Tests/Extension/Validator/Type/SubmitTypeValidatorExtensionTest.php
index c37cf6733c445..48fc8de51d9c8 100644
--- a/src/Symfony/Component/Form/Tests/Extension/Validator/Type/SubmitTypeValidatorExtensionTest.php
+++ b/src/Symfony/Component/Form/Tests/Extension/Validator/Type/SubmitTypeValidatorExtensionTest.php
@@ -15,6 +15,6 @@ class SubmitTypeValidatorExtensionTest extends BaseValidatorExtensionTest
{
protected function createForm(array $options = array())
{
- return $this->factory->create('submit', null, $options);
+ return $this->factory->create('Symfony\Component\Form\Extension\Core\Type\SubmitType', null, $options);
}
}
diff --git a/src/Symfony/Component/Form/Tests/Fixtures/AlternatingRowType.php b/src/Symfony/Component/Form/Tests/Fixtures/AlternatingRowType.php
index ee7d135339dcf..131b3fd614457 100644
--- a/src/Symfony/Component/Form/Tests/Fixtures/AlternatingRowType.php
+++ b/src/Symfony/Component/Form/Tests/Fixtures/AlternatingRowType.php
@@ -15,13 +15,10 @@ public function buildForm(FormBuilderInterface $builder, array $options)
$builder->addEventListener(FormEvents::PRE_SET_DATA, function (FormEvent $event) use ($formFactory) {
$form = $event->getForm();
- $type = $form->getName() % 2 === 0 ? 'text' : 'textarea';
+ $type = $form->getName() % 2 === 0
+ ? 'Symfony\Component\Form\Extension\Core\Type\TextType'
+ : 'Symfony\Component\Form\Extension\Core\Type\TextareaType';
$form->add('title', $type);
});
}
-
- public function getName()
- {
- return 'alternating_row';
- }
}
diff --git a/src/Symfony/Component/Form/Tests/Fixtures/AuthorType.php b/src/Symfony/Component/Form/Tests/Fixtures/AuthorType.php
index 62c80cbb37669..504f812dff3a5 100644
--- a/src/Symfony/Component/Form/Tests/Fixtures/AuthorType.php
+++ b/src/Symfony/Component/Form/Tests/Fixtures/AuthorType.php
@@ -16,11 +16,6 @@ public function buildForm(FormBuilderInterface $builder, array $options)
;
}
- public function getName()
- {
- return 'author';
- }
-
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults(array(
diff --git a/src/Symfony/Component/Form/Tests/Fixtures/FBooType.php b/src/Symfony/Component/Form/Tests/Fixtures/FBooType.php
new file mode 100644
index 0000000000000..fd9ca41dfbc85
--- /dev/null
+++ b/src/Symfony/Component/Form/Tests/Fixtures/FBooType.php
@@ -0,0 +1,18 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Component\Form\Tests\Fixtures;
+
+use Symfony\Component\Form\AbstractType;
+
+class FBooType extends AbstractType
+{
+}
diff --git a/src/Symfony/Component/Form/Tests/Fixtures/Foo.php b/src/Symfony/Component/Form/Tests/Fixtures/Foo.php
new file mode 100644
index 0000000000000..0920bc3d72756
--- /dev/null
+++ b/src/Symfony/Component/Form/Tests/Fixtures/Foo.php
@@ -0,0 +1,18 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Component\Form\Tests\Fixtures;
+
+use Symfony\Component\Form\AbstractType;
+
+class Foo extends AbstractType
+{
+}
diff --git a/src/Symfony/Component/Form/Tests/Fixtures/Foo1Bar2Type.php b/src/Symfony/Component/Form/Tests/Fixtures/Foo1Bar2Type.php
new file mode 100644
index 0000000000000..17bef7ba1f2db
--- /dev/null
+++ b/src/Symfony/Component/Form/Tests/Fixtures/Foo1Bar2Type.php
@@ -0,0 +1,18 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Component\Form\Tests\Fixtures;
+
+use Symfony\Component\Form\AbstractType;
+
+class Foo1Bar2Type extends AbstractType
+{
+}
diff --git a/src/Symfony/Component/Form/Tests/Fixtures/FooBarHTMLType.php b/src/Symfony/Component/Form/Tests/Fixtures/FooBarHTMLType.php
new file mode 100644
index 0000000000000..c9969273530e6
--- /dev/null
+++ b/src/Symfony/Component/Form/Tests/Fixtures/FooBarHTMLType.php
@@ -0,0 +1,18 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Component\Form\Tests\Fixtures;
+
+use Symfony\Component\Form\AbstractType;
+
+class FooBarHTMLType extends AbstractType
+{
+}
diff --git a/src/Symfony/Component/Form/Tests/Fixtures/FooSubType.php b/src/Symfony/Component/Form/Tests/Fixtures/FooSubType.php
index 52cefb44cfdc8..e4a4f3612e19d 100644
--- a/src/Symfony/Component/Form/Tests/Fixtures/FooSubType.php
+++ b/src/Symfony/Component/Form/Tests/Fixtures/FooSubType.php
@@ -15,13 +15,8 @@
class FooSubType extends AbstractType
{
- public function getName()
- {
- return 'foo_sub_type';
- }
-
public function getParent()
{
- return 'foo';
+ return __NAMESPACE__.'\FooType';
}
}
diff --git a/src/Symfony/Component/Form/Tests/Fixtures/FooType.php b/src/Symfony/Component/Form/Tests/Fixtures/FooType.php
index bc19110792185..2e144ad0bd1c4 100644
--- a/src/Symfony/Component/Form/Tests/Fixtures/FooType.php
+++ b/src/Symfony/Component/Form/Tests/Fixtures/FooType.php
@@ -15,11 +15,6 @@
class FooType extends AbstractType
{
- public function getName()
- {
- return 'foo';
- }
-
public function getParent()
{
}
diff --git a/src/Symfony/Component/Form/Tests/Fixtures/FooTypeBarExtension.php b/src/Symfony/Component/Form/Tests/Fixtures/FooTypeBarExtension.php
index c5f92e1191b2b..8d72132f2f1f6 100644
--- a/src/Symfony/Component/Form/Tests/Fixtures/FooTypeBarExtension.php
+++ b/src/Symfony/Component/Form/Tests/Fixtures/FooTypeBarExtension.php
@@ -30,6 +30,6 @@ public function getAllowedOptionValues()
public function getExtendedType()
{
- return 'foo';
+ return __NAMESPACE__.'\FooType';
}
}
diff --git a/src/Symfony/Component/Form/Tests/Fixtures/FooTypeBazExtension.php b/src/Symfony/Component/Form/Tests/Fixtures/FooTypeBazExtension.php
index 2e364754498de..646d41f7ffe00 100644
--- a/src/Symfony/Component/Form/Tests/Fixtures/FooTypeBazExtension.php
+++ b/src/Symfony/Component/Form/Tests/Fixtures/FooTypeBazExtension.php
@@ -23,6 +23,6 @@ public function buildForm(FormBuilderInterface $builder, array $options)
public function getExtendedType()
{
- return 'foo';
+ return __NAMESPACE__.'\FooType';
}
}
diff --git a/src/Symfony/Component/Form/Tests/Fixtures/LegacyFooSubType.php b/src/Symfony/Component/Form/Tests/Fixtures/LegacyFooSubType.php
new file mode 100644
index 0000000000000..7b309f42f64ec
--- /dev/null
+++ b/src/Symfony/Component/Form/Tests/Fixtures/LegacyFooSubType.php
@@ -0,0 +1,27 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Component\Form\Tests\Fixtures;
+
+use Symfony\Component\Form\AbstractType;
+
+class LegacyFooSubType extends AbstractType
+{
+ public function getName()
+ {
+ return 'foo_sub_type';
+ }
+
+ public function getParent()
+ {
+ return 'foo';
+ }
+}
diff --git a/src/Symfony/Component/Form/Tests/Fixtures/FooSubTypeWithParentInstance.php b/src/Symfony/Component/Form/Tests/Fixtures/LegacyFooSubTypeWithParentInstance.php
similarity index 82%
rename from src/Symfony/Component/Form/Tests/Fixtures/FooSubTypeWithParentInstance.php
rename to src/Symfony/Component/Form/Tests/Fixtures/LegacyFooSubTypeWithParentInstance.php
index 9416d7b4ed5d3..29123a6b72551 100644
--- a/src/Symfony/Component/Form/Tests/Fixtures/FooSubTypeWithParentInstance.php
+++ b/src/Symfony/Component/Form/Tests/Fixtures/LegacyFooSubTypeWithParentInstance.php
@@ -13,7 +13,7 @@
use Symfony\Component\Form\AbstractType;
-class FooSubTypeWithParentInstance extends AbstractType
+class LegacyFooSubTypeWithParentInstance extends AbstractType
{
public function getName()
{
@@ -22,6 +22,6 @@ public function getName()
public function getParent()
{
- return new FooType();
+ return new LegacyFooType();
}
}
diff --git a/src/Symfony/Component/Form/Tests/Fixtures/LegacyFooType.php b/src/Symfony/Component/Form/Tests/Fixtures/LegacyFooType.php
new file mode 100644
index 0000000000000..717183a8632d7
--- /dev/null
+++ b/src/Symfony/Component/Form/Tests/Fixtures/LegacyFooType.php
@@ -0,0 +1,26 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Component\Form\Tests\Fixtures;
+
+use Symfony\Component\Form\AbstractType;
+
+class LegacyFooType extends AbstractType
+{
+ public function getName()
+ {
+ return 'foo';
+ }
+
+ public function getParent()
+ {
+ }
+}
diff --git a/src/Symfony/Component/Form/Tests/Fixtures/LegacyFooTypeBarExtension.php b/src/Symfony/Component/Form/Tests/Fixtures/LegacyFooTypeBarExtension.php
new file mode 100644
index 0000000000000..c1e2888836173
--- /dev/null
+++ b/src/Symfony/Component/Form/Tests/Fixtures/LegacyFooTypeBarExtension.php
@@ -0,0 +1,35 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Component\Form\Tests\Fixtures;
+
+use Symfony\Component\Form\AbstractTypeExtension;
+use Symfony\Component\Form\FormBuilderInterface;
+
+class LegacyFooTypeBarExtension extends AbstractTypeExtension
+{
+ public function buildForm(FormBuilderInterface $builder, array $options)
+ {
+ $builder->setAttribute('bar', 'x');
+ }
+
+ public function getAllowedOptionValues()
+ {
+ return array(
+ 'a_or_b' => array('c'),
+ );
+ }
+
+ public function getExtendedType()
+ {
+ return 'foo';
+ }
+}
diff --git a/src/Symfony/Component/Form/Tests/Fixtures/LegacyFooTypeBazExtension.php b/src/Symfony/Component/Form/Tests/Fixtures/LegacyFooTypeBazExtension.php
new file mode 100644
index 0000000000000..49aba3f004650
--- /dev/null
+++ b/src/Symfony/Component/Form/Tests/Fixtures/LegacyFooTypeBazExtension.php
@@ -0,0 +1,28 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Component\Form\Tests\Fixtures;
+
+use Symfony\Component\Form\AbstractTypeExtension;
+use Symfony\Component\Form\FormBuilderInterface;
+
+class LegacyFooTypeBazExtension extends AbstractTypeExtension
+{
+ public function buildForm(FormBuilderInterface $builder, array $options)
+ {
+ $builder->setAttribute('baz', 'x');
+ }
+
+ public function getExtendedType()
+ {
+ return 'foo';
+ }
+}
diff --git a/src/Symfony/Component/Form/Tests/Fixtures/TestExtension.php b/src/Symfony/Component/Form/Tests/Fixtures/TestExtension.php
index f9de560f031d3..8e8628ab8fc67 100644
--- a/src/Symfony/Component/Form/Tests/Fixtures/TestExtension.php
+++ b/src/Symfony/Component/Form/Tests/Fixtures/TestExtension.php
@@ -31,7 +31,7 @@ public function __construct(FormTypeGuesserInterface $guesser)
public function addType(FormTypeInterface $type)
{
- $this->types[$type->getName()] = $type;
+ $this->types[$type->getName() ?: get_class($type)] = $type;
}
public function getType($name)
diff --git a/src/Symfony/Component/Form/Tests/Fixtures/Type.php b/src/Symfony/Component/Form/Tests/Fixtures/Type.php
new file mode 100644
index 0000000000000..61ca7d1319886
--- /dev/null
+++ b/src/Symfony/Component/Form/Tests/Fixtures/Type.php
@@ -0,0 +1,18 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Component\Form\Tests\Fixtures;
+
+use Symfony\Component\Form\AbstractType;
+
+class Type extends AbstractType
+{
+}
diff --git a/src/Symfony/Component/Form/Tests/FormBuilderTest.php b/src/Symfony/Component/Form/Tests/FormBuilderTest.php
index 8c7b96587dc0b..86f50b50ecee0 100644
--- a/src/Symfony/Component/Form/Tests/FormBuilderTest.php
+++ b/src/Symfony/Component/Form/Tests/FormBuilderTest.php
@@ -67,21 +67,21 @@ public function testAddWithGuessFluent()
public function testAddIsFluent()
{
- $builder = $this->builder->add('foo', 'text', array('bar' => 'baz'));
+ $builder = $this->builder->add('foo', 'Symfony\Component\Form\Extension\Core\Type\TextType', array('bar' => 'baz'));
$this->assertSame($builder, $this->builder);
}
public function testAdd()
{
$this->assertFalse($this->builder->has('foo'));
- $this->builder->add('foo', 'text');
+ $this->builder->add('foo', 'Symfony\Component\Form\Extension\Core\Type\TextType');
$this->assertTrue($this->builder->has('foo'));
}
public function testAddIntegerName()
{
$this->assertFalse($this->builder->has(0));
- $this->builder->add(0, 'text');
+ $this->builder->add(0, 'Symfony\Component\Form\Extension\Core\Type\TextType');
$this->assertTrue($this->builder->has(0));
}
@@ -89,13 +89,13 @@ public function testAll()
{
$this->factory->expects($this->once())
->method('createNamedBuilder')
- ->with('foo', 'text')
+ ->with('foo', 'Symfony\Component\Form\Extension\Core\Type\TextType')
->will($this->returnValue(new FormBuilder('foo', null, $this->dispatcher, $this->factory)));
$this->assertCount(0, $this->builder->all());
$this->assertFalse($this->builder->has('foo'));
- $this->builder->add('foo', 'text');
+ $this->builder->add('foo', 'Symfony\Component\Form\Extension\Core\Type\TextType');
$children = $this->builder->all();
$this->assertTrue($this->builder->has('foo'));
@@ -108,9 +108,9 @@ public function testAll()
*/
public function testMaintainOrderOfLazyAndExplicitChildren()
{
- $this->builder->add('foo', 'text');
+ $this->builder->add('foo', 'Symfony\Component\Form\Extension\Core\Type\TextType');
$this->builder->add($this->getFormBuilder('bar'));
- $this->builder->add('baz', 'text');
+ $this->builder->add('baz', 'Symfony\Component\Form\Extension\Core\Type\TextType');
$children = $this->builder->all();
@@ -126,7 +126,7 @@ public function testAddFormType()
public function testRemove()
{
- $this->builder->add('foo', 'text');
+ $this->builder->add('foo', 'Symfony\Component\Form\Extension\Core\Type\TextType');
$this->builder->remove('foo');
$this->assertFalse($this->builder->has('foo'));
}
@@ -140,7 +140,7 @@ public function testRemoveUnknown()
// https://github.com/symfony/symfony/pull/4826
public function testRemoveAndGetForm()
{
- $this->builder->add('foo', 'text');
+ $this->builder->add('foo', 'Symfony\Component\Form\Extension\Core\Type\TextType');
$this->builder->remove('foo');
$form = $this->builder->getForm();
$this->assertInstanceOf('Symfony\Component\Form\Form', $form);
@@ -150,7 +150,7 @@ public function testCreateNoTypeNo()
{
$this->factory->expects($this->once())
->method('createNamedBuilder')
- ->with('foo', 'text', null, array())
+ ->with('foo', 'Symfony\Component\Form\Extension\Core\Type\TextType', null, array())
;
$this->builder->create('foo');
@@ -170,7 +170,7 @@ public function testGetUnknown()
public function testGetExplicitType()
{
- $expectedType = 'text';
+ $expectedType = 'Symfony\Component\Form\Extension\Core\Type\TextType';
$expectedName = 'foo';
$expectedOptions = array('bar' => 'baz');
diff --git a/src/Symfony/Component/Form/Tests/FormFactoryBuilderTest.php b/src/Symfony/Component/Form/Tests/FormFactoryBuilderTest.php
index 2c3ab000ffe30..20a1c0052c0ee 100644
--- a/src/Symfony/Component/Form/Tests/FormFactoryBuilderTest.php
+++ b/src/Symfony/Component/Form/Tests/FormFactoryBuilderTest.php
@@ -12,7 +12,7 @@
namespace Symfony\Component\Form\Tests;
use Symfony\Component\Form\FormFactoryBuilder;
-use Symfony\Component\Form\Tests\Fixtures\FooType;
+use Symfony\Component\Form\Tests\Fixtures\LegacyFooType;
class FormFactoryBuilderTest extends \PHPUnit_Framework_TestCase
{
@@ -27,7 +27,7 @@ protected function setUp()
$this->registry->setAccessible(true);
$this->guesser = $this->getMock('Symfony\Component\Form\FormTypeGuesserInterface');
- $this->type = new FooType();
+ $this->type = new LegacyFooType();
}
public function testAddType()
diff --git a/src/Symfony/Component/Form/Tests/FormFactoryTest.php b/src/Symfony/Component/Form/Tests/FormFactoryTest.php
index d89969f021be0..28e14bbebc61a 100644
--- a/src/Symfony/Component/Form/Tests/FormFactoryTest.php
+++ b/src/Symfony/Component/Form/Tests/FormFactoryTest.php
@@ -16,9 +16,9 @@
use Symfony\Component\Form\Guess\Guess;
use Symfony\Component\Form\Guess\ValueGuess;
use Symfony\Component\Form\Guess\TypeGuess;
-use Symfony\Component\Form\Tests\Fixtures\FooType;
-use Symfony\Component\Form\Tests\Fixtures\FooSubType;
-use Symfony\Component\Form\Tests\Fixtures\FooSubTypeWithParentInstance;
+use Symfony\Component\Form\Tests\Fixtures\LegacyFooType;
+use Symfony\Component\Form\Tests\Fixtures\LegacyFooSubType;
+use Symfony\Component\Form\Tests\Fixtures\LegacyFooSubTypeWithParentInstance;
/**
* @author Bernhard Schussek
@@ -99,11 +99,14 @@ public function testCreateNamedBuilderWithTypeName()
$this->assertSame($this->builder, $this->factory->createNamedBuilder('name', 'type', null, $options));
}
+ /**
+ * @group legacy
+ */
public function testCreateNamedBuilderWithTypeInstance()
{
$options = array('a' => '1', 'b' => '2');
$resolvedOptions = array('a' => '2', 'b' => '3');
- $type = new FooType();
+ $type = new LegacyFooType();
$resolvedType = $this->getMockResolvedType();
$this->resolvedTypeFactory->expects($this->once())
@@ -127,11 +130,14 @@ public function testCreateNamedBuilderWithTypeInstance()
$this->assertSame($this->builder, $this->factory->createNamedBuilder('name', $type, null, $options));
}
+ /**
+ * @group legacy
+ */
public function testCreateNamedBuilderWithTypeInstanceWithParentType()
{
$options = array('a' => '1', 'b' => '2');
$resolvedOptions = array('a' => '2', 'b' => '3');
- $type = new FooSubType();
+ $type = new LegacyFooSubType();
$resolvedType = $this->getMockResolvedType();
$parentResolvedType = $this->getMockResolvedType();
@@ -161,11 +167,14 @@ public function testCreateNamedBuilderWithTypeInstanceWithParentType()
$this->assertSame($this->builder, $this->factory->createNamedBuilder('name', $type, null, $options));
}
+ /**
+ * @group legacy
+ */
public function testCreateNamedBuilderWithTypeInstanceWithParentTypeInstance()
{
$options = array('a' => '1', 'b' => '2');
$resolvedOptions = array('a' => '2', 'b' => '3');
- $type = new FooSubTypeWithParentInstance();
+ $type = new LegacyFooSubTypeWithParentInstance();
$resolvedType = $this->getMockResolvedType();
$parentResolvedType = $this->getMockResolvedType();
@@ -195,6 +204,9 @@ public function testCreateNamedBuilderWithTypeInstanceWithParentTypeInstance()
$this->assertSame($this->builder, $this->factory->createNamedBuilder('name', $type, null, $options));
}
+ /**
+ * @group legacy
+ */
public function testCreateNamedBuilderWithResolvedTypeInstance()
{
$options = array('a' => '1', 'b' => '2');
@@ -312,6 +324,164 @@ public function testCreateUsesTypeNameIfTypeGivenAsString()
$this->assertSame('FORM', $this->factory->create('TYPE', null, $options));
}
+ public function testCreateStripsNamespaceOffTypeName()
+ {
+ $options = array('a' => '1', 'b' => '2');
+ $resolvedOptions = array('a' => '2', 'b' => '3');
+ $resolvedType = $this->getMockResolvedType();
+
+ $this->registry->expects($this->once())
+ ->method('getType')
+ ->with('Vendor\Name\Space\UserForm')
+ ->will($this->returnValue($resolvedType));
+
+ $resolvedType->expects($this->once())
+ ->method('createBuilder')
+ ->with($this->factory, 'user_form', $options)
+ ->will($this->returnValue($this->builder));
+
+ $this->builder->expects($this->any())
+ ->method('getOptions')
+ ->will($this->returnValue($resolvedOptions));
+
+ $resolvedType->expects($this->once())
+ ->method('buildForm')
+ ->with($this->builder, $resolvedOptions);
+
+ $this->builder->expects($this->once())
+ ->method('getForm')
+ ->will($this->returnValue('FORM'));
+
+ $this->assertSame('FORM', $this->factory->create('Vendor\Name\Space\UserForm', null, $options));
+ }
+
+ public function testLegacyCreateStripsNamespaceOffTypeNameAccessByFQCN()
+ {
+ $options = array('a' => '1', 'b' => '2');
+ $resolvedOptions = array('a' => '2', 'b' => '3');
+ $resolvedType = $this->getMockResolvedType();
+
+ $this->registry->expects($this->once())
+ ->method('getType')
+ ->with('userform')
+ ->will($this->returnValue($resolvedType));
+
+ $resolvedType->expects($this->once())
+ ->method('createBuilder')
+ ->with($this->factory, 'userform', $options)
+ ->will($this->returnValue($this->builder));
+
+ $this->builder->expects($this->any())
+ ->method('getOptions')
+ ->will($this->returnValue($resolvedOptions));
+
+ $resolvedType->expects($this->once())
+ ->method('buildForm')
+ ->with($this->builder, $resolvedOptions);
+
+ $this->builder->expects($this->once())
+ ->method('getForm')
+ ->will($this->returnValue('FORM'));
+
+ $this->assertSame('FORM', $this->factory->create('userform', null, $options));
+ }
+
+ public function testCreateStripsTypeSuffixOffTypeName()
+ {
+ $options = array('a' => '1', 'b' => '2');
+ $resolvedOptions = array('a' => '2', 'b' => '3');
+ $resolvedType = $this->getMockResolvedType();
+
+ $this->registry->expects($this->once())
+ ->method('getType')
+ ->with('Vendor\Name\Space\UserType')
+ ->will($this->returnValue($resolvedType));
+
+ $resolvedType->expects($this->once())
+ ->method('createBuilder')
+ ->with($this->factory, 'user', $options)
+ ->will($this->returnValue($this->builder));
+
+ $this->builder->expects($this->any())
+ ->method('getOptions')
+ ->will($this->returnValue($resolvedOptions));
+
+ $resolvedType->expects($this->once())
+ ->method('buildForm')
+ ->with($this->builder, $resolvedOptions);
+
+ $this->builder->expects($this->once())
+ ->method('getForm')
+ ->will($this->returnValue('FORM'));
+
+ $this->assertSame('FORM', $this->factory->create('Vendor\Name\Space\UserType', null, $options));
+ }
+
+ public function testCreateDoesNotStripTypeSuffixIfResultEmpty()
+ {
+ $options = array('a' => '1', 'b' => '2');
+ $resolvedOptions = array('a' => '2', 'b' => '3');
+ $resolvedType = $this->getMockResolvedType();
+
+ $this->registry->expects($this->once())
+ ->method('getType')
+ ->with('Vendor\Name\Space\Type')
+ ->will($this->returnValue($resolvedType));
+
+ $resolvedType->expects($this->once())
+ ->method('createBuilder')
+ ->with($this->factory, 'type', $options)
+ ->will($this->returnValue($this->builder));
+
+ $this->builder->expects($this->any())
+ ->method('getOptions')
+ ->will($this->returnValue($resolvedOptions));
+
+ $resolvedType->expects($this->once())
+ ->method('buildForm')
+ ->with($this->builder, $resolvedOptions);
+
+ $this->builder->expects($this->once())
+ ->method('getForm')
+ ->will($this->returnValue('FORM'));
+
+ $this->assertSame('FORM', $this->factory->create('Vendor\Name\Space\Type', null, $options));
+ }
+
+ public function testCreateConvertsTypeToUnderscoreSyntax()
+ {
+ $options = array('a' => '1', 'b' => '2');
+ $resolvedOptions = array('a' => '2', 'b' => '3');
+ $resolvedType = $this->getMockResolvedType();
+
+ $this->registry->expects($this->once())
+ ->method('getType')
+ ->with('Vendor\Name\Space\MyProfileHTMLType')
+ ->will($this->returnValue($resolvedType));
+
+ $resolvedType->expects($this->once())
+ ->method('createBuilder')
+ ->with($this->factory, 'my_profile_html', $options)
+ ->will($this->returnValue($this->builder));
+
+ $this->builder->expects($this->any())
+ ->method('getOptions')
+ ->will($this->returnValue($resolvedOptions));
+
+ $resolvedType->expects($this->once())
+ ->method('buildForm')
+ ->with($this->builder, $resolvedOptions);
+
+ $this->builder->expects($this->once())
+ ->method('getForm')
+ ->will($this->returnValue('FORM'));
+
+ $this->assertSame('FORM', $this->factory->create('Vendor\Name\Space\MyProfileHTMLType', null, $options));
+ }
+
+ /**
+ * @group legacy
+ */
public function testCreateUsesTypeNameIfTypeGivenAsObject()
{
$options = array('a' => '1', 'b' => '2');
@@ -383,7 +553,7 @@ public function testCreateBuilderForPropertyWithoutTypeGuesser()
$factory->expects($this->once())
->method('createNamedBuilder')
- ->with('firstName', 'text', null, array())
+ ->with('firstName', 'Symfony\Component\Form\Extension\Core\Type\TextType', null, array())
->will($this->returnValue('builderInstance'));
$this->builder = $factory->createBuilderForProperty('Application\Author', 'firstName');
@@ -397,7 +567,7 @@ public function testCreateBuilderForPropertyCreatesFormWithHighestConfidence()
->method('guessType')
->with('Application\Author', 'firstName')
->will($this->returnValue(new TypeGuess(
- 'text',
+ 'Symfony\Component\Form\Extension\Core\Type\TextType',
array('attr' => array('maxlength' => 10)),
Guess::MEDIUM_CONFIDENCE
)));
@@ -434,7 +604,7 @@ public function testCreateBuilderCreatesTextFormIfNoGuess()
$factory->expects($this->once())
->method('createNamedBuilder')
- ->with('firstName', 'text')
+ ->with('firstName', 'Symfony\Component\Form\Extension\Core\Type\TextType')
->will($this->returnValue('builderInstance'));
$this->builder = $factory->createBuilderForProperty('Application\Author', 'firstName');
@@ -448,7 +618,7 @@ public function testOptionsCanBeOverridden()
->method('guessType')
->with('Application\Author', 'firstName')
->will($this->returnValue(new TypeGuess(
- 'text',
+ 'Symfony\Component\Form\Extension\Core\Type\TextType',
array('attr' => array('maxlength' => 10)),
Guess::MEDIUM_CONFIDENCE
)));
@@ -457,7 +627,7 @@ public function testOptionsCanBeOverridden()
$factory->expects($this->once())
->method('createNamedBuilder')
- ->with('firstName', 'text', null, array('attr' => array('maxlength' => 11)))
+ ->with('firstName', 'Symfony\Component\Form\Extension\Core\Type\TextType', null, array('attr' => array('maxlength' => 11)))
->will($this->returnValue('builderInstance'));
$this->builder = $factory->createBuilderForProperty(
@@ -492,7 +662,7 @@ public function testCreateBuilderUsesMaxLengthIfFound()
$factory->expects($this->once())
->method('createNamedBuilder')
- ->with('firstName', 'text', null, array('attr' => array('maxlength' => 20)))
+ ->with('firstName', 'Symfony\Component\Form\Extension\Core\Type\TextType', null, array('attr' => array('maxlength' => 20)))
->will($this->returnValue('builderInstance'));
$this->builder = $factory->createBuilderForProperty(
@@ -525,7 +695,7 @@ public function testCreateBuilderUsesMaxLengthAndPattern()
$factory->expects($this->once())
->method('createNamedBuilder')
- ->with('firstName', 'text', null, array('attr' => array('maxlength' => 20, 'pattern' => '.{5,}', 'class' => 'tinymce')))
+ ->with('firstName', 'Symfony\Component\Form\Extension\Core\Type\TextType', null, array('attr' => array('maxlength' => 20, 'pattern' => '.{5,}', 'class' => 'tinymce')))
->will($this->returnValue('builderInstance'));
$this->builder = $factory->createBuilderForProperty(
@@ -560,7 +730,7 @@ public function testCreateBuilderUsesRequiredSettingWithHighestConfidence()
$factory->expects($this->once())
->method('createNamedBuilder')
- ->with('firstName', 'text', null, array('required' => false))
+ ->with('firstName', 'Symfony\Component\Form\Extension\Core\Type\TextType', null, array('required' => false))
->will($this->returnValue('builderInstance'));
$this->builder = $factory->createBuilderForProperty(
@@ -593,7 +763,7 @@ public function testCreateBuilderUsesPatternIfFound()
$factory->expects($this->once())
->method('createNamedBuilder')
- ->with('firstName', 'text', null, array('attr' => array('pattern' => '[a-zA-Z]')))
+ ->with('firstName', 'Symfony\Component\Form\Extension\Core\Type\TextType', null, array('attr' => array('pattern' => '[a-zA-Z]')))
->will($this->returnValue('builderInstance'));
$this->builder = $factory->createBuilderForProperty(
diff --git a/src/Symfony/Component/Form/Tests/FormRegistryTest.php b/src/Symfony/Component/Form/Tests/FormRegistryTest.php
index 0c8bb6b44151a..849f49476a49e 100644
--- a/src/Symfony/Component/Form/Tests/FormRegistryTest.php
+++ b/src/Symfony/Component/Form/Tests/FormRegistryTest.php
@@ -13,12 +13,18 @@
use Symfony\Component\Form\FormRegistry;
use Symfony\Component\Form\FormTypeGuesserChain;
-use Symfony\Component\Form\Tests\Fixtures\TestExtension;
-use Symfony\Component\Form\Tests\Fixtures\FooSubTypeWithParentInstance;
+use Symfony\Component\Form\ResolvedFormType;
+use Symfony\Component\Form\ResolvedFormTypeFactoryInterface;
use Symfony\Component\Form\Tests\Fixtures\FooSubType;
-use Symfony\Component\Form\Tests\Fixtures\FooTypeBazExtension;
-use Symfony\Component\Form\Tests\Fixtures\FooTypeBarExtension;
use Symfony\Component\Form\Tests\Fixtures\FooType;
+use Symfony\Component\Form\Tests\Fixtures\FooTypeBarExtension;
+use Symfony\Component\Form\Tests\Fixtures\FooTypeBazExtension;
+use Symfony\Component\Form\Tests\Fixtures\TestExtension;
+use Symfony\Component\Form\Tests\Fixtures\LegacyFooSubTypeWithParentInstance;
+use Symfony\Component\Form\Tests\Fixtures\LegacyFooSubType;
+use Symfony\Component\Form\Tests\Fixtures\LegacyFooTypeBazExtension;
+use Symfony\Component\Form\Tests\Fixtures\LegacyFooTypeBarExtension;
+use Symfony\Component\Form\Tests\Fixtures\LegacyFooType;
/**
* @author Bernhard Schussek
@@ -31,7 +37,7 @@ class FormRegistryTest extends \PHPUnit_Framework_TestCase
private $registry;
/**
- * @var \PHPUnit_Framework_MockObject_MockObject
+ * @var \PHPUnit_Framework_MockObject_MockObject|ResolvedFormTypeFactoryInterface
*/
private $resolvedTypeFactory;
@@ -71,22 +77,64 @@ protected function setUp()
public function testGetTypeFromExtension()
{
$type = new FooType();
- $resolvedType = $this->getMock('Symfony\Component\Form\ResolvedFormTypeInterface');
+ $resolvedType = new ResolvedFormType($type);
$this->extension2->addType($type);
$this->resolvedTypeFactory->expects($this->once())
->method('createResolvedType')
->with($type)
- ->will($this->returnValue($resolvedType));
+ ->willReturn($resolvedType);
+
+ $this->assertSame($resolvedType, $this->registry->getType(get_class($type)));
+ }
+
+ public function testLoadUnregisteredType()
+ {
+ $type = new FooType();
+ $resolvedType = new ResolvedFormType($type);
+
+ $this->resolvedTypeFactory->expects($this->once())
+ ->method('createResolvedType')
+ ->with($type)
+ ->willReturn($resolvedType);
+
+ $this->assertSame($resolvedType, $this->registry->getType('Symfony\Component\Form\Tests\Fixtures\FooType'));
+ }
+
+ /**
+ * @expectedException \Symfony\Component\Form\Exception\InvalidArgumentException
+ */
+ public function testFailIfUnregisteredTypeNoClass()
+ {
+ $this->registry->getType('Symfony\Blubb');
+ }
+
+ /**
+ * @expectedException \Symfony\Component\Form\Exception\InvalidArgumentException
+ */
+ public function testFailIfUnregisteredTypeNoFormType()
+ {
+ $this->registry->getType('stdClass');
+ }
- $resolvedType->expects($this->any())
- ->method('getName')
- ->will($this->returnValue('foo'));
+ public function testLegacyGetTypeFromExtension()
+ {
+ $type = new LegacyFooType();
+ $resolvedType = new ResolvedFormType($type);
- $resolvedType = $this->registry->getType('foo');
+ $this->extension2->addType($type);
+
+ $this->resolvedTypeFactory->expects($this->once())
+ ->method('createResolvedType')
+ ->with($type)
+ ->willReturn($resolvedType);
$this->assertSame($resolvedType, $this->registry->getType('foo'));
+
+ // Even types with explicit getName() methods must support access by
+ // FQCN to support a smooth transition from 2.8 => 3.0
+ $this->assertSame($resolvedType, $this->registry->getType(get_class($type)));
}
public function testGetTypeWithTypeExtensions()
@@ -94,7 +142,7 @@ public function testGetTypeWithTypeExtensions()
$type = new FooType();
$ext1 = new FooTypeBarExtension();
$ext2 = new FooTypeBazExtension();
- $resolvedType = $this->getMock('Symfony\Component\Form\ResolvedFormTypeInterface');
+ $resolvedType = new ResolvedFormType($type, array($ext1, $ext2));
$this->extension2->addType($type);
$this->extension1->addTypeExtension($ext1);
@@ -103,11 +151,26 @@ public function testGetTypeWithTypeExtensions()
$this->resolvedTypeFactory->expects($this->once())
->method('createResolvedType')
->with($type, array($ext1, $ext2))
- ->will($this->returnValue($resolvedType));
+ ->willReturn($resolvedType);
+
+ $this->assertSame($resolvedType, $this->registry->getType(get_class($type)));
+ }
+
+ public function testLegacyGetTypeWithTypeExtensions()
+ {
+ $type = new LegacyFooType();
+ $ext1 = new LegacyFooTypeBarExtension();
+ $ext2 = new LegacyFooTypeBazExtension();
+ $resolvedType = new ResolvedFormType($type, array($ext1, $ext2));
- $resolvedType->expects($this->any())
- ->method('getName')
- ->will($this->returnValue('foo'));
+ $this->extension2->addType($type);
+ $this->extension1->addTypeExtension($ext1);
+ $this->extension2->addTypeExtension($ext2);
+
+ $this->resolvedTypeFactory->expects($this->once())
+ ->method('createResolvedType')
+ ->with($type, array($ext1, $ext2))
+ ->willReturn($resolvedType);
$this->assertSame($resolvedType, $this->registry->getType('foo'));
}
@@ -116,8 +179,8 @@ public function testGetTypeConnectsParent()
{
$parentType = new FooType();
$type = new FooSubType();
- $parentResolvedType = $this->getMock('Symfony\Component\Form\ResolvedFormTypeInterface');
- $resolvedType = $this->getMock('Symfony\Component\Form\ResolvedFormTypeInterface');
+ $parentResolvedType = new ResolvedFormType($parentType);
+ $resolvedType = new ResolvedFormType($type);
$this->extension1->addType($parentType);
$this->extension2->addType($type);
@@ -125,49 +188,59 @@ public function testGetTypeConnectsParent()
$this->resolvedTypeFactory->expects($this->at(0))
->method('createResolvedType')
->with($parentType)
- ->will($this->returnValue($parentResolvedType));
+ ->willReturn($parentResolvedType);
$this->resolvedTypeFactory->expects($this->at(1))
->method('createResolvedType')
->with($type, array(), $parentResolvedType)
- ->will($this->returnValue($resolvedType));
+ ->willReturn($resolvedType);
+
+ $this->assertSame($resolvedType, $this->registry->getType(get_class($type)));
+ }
+
+ public function testLegacyGetTypeConnectsParent()
+ {
+ $parentType = new LegacyFooType();
+ $type = new LegacyFooSubType();
+ $parentResolvedType = new ResolvedFormType($parentType);
+ $resolvedType = new ResolvedFormType($type);
- $parentResolvedType->expects($this->any())
- ->method('getName')
- ->will($this->returnValue('foo'));
+ $this->extension1->addType($parentType);
+ $this->extension2->addType($type);
- $resolvedType->expects($this->any())
- ->method('getName')
- ->will($this->returnValue('foo_sub_type'));
+ $this->resolvedTypeFactory->expects($this->at(0))
+ ->method('createResolvedType')
+ ->with($parentType)
+ ->willReturn($parentResolvedType);
+
+ $this->resolvedTypeFactory->expects($this->at(1))
+ ->method('createResolvedType')
+ ->with($type, array(), $parentResolvedType)
+ ->willReturn($resolvedType);
$this->assertSame($resolvedType, $this->registry->getType('foo_sub_type'));
}
+ /**
+ * @group legacy
+ */
public function testGetTypeConnectsParentIfGetParentReturnsInstance()
{
- $type = new FooSubTypeWithParentInstance();
- $parentResolvedType = $this->getMock('Symfony\Component\Form\ResolvedFormTypeInterface');
- $resolvedType = $this->getMock('Symfony\Component\Form\ResolvedFormTypeInterface');
+ $type = new LegacyFooSubTypeWithParentInstance();
+ $parentResolvedType = new ResolvedFormType($type->getParent());
+ $resolvedType = new ResolvedFormType($type);
$this->extension1->addType($type);
$this->resolvedTypeFactory->expects($this->at(0))
->method('createResolvedType')
- ->with($this->isInstanceOf('Symfony\Component\Form\Tests\Fixtures\FooType'))
- ->will($this->returnValue($parentResolvedType));
+ ->with($type->getParent())
+ ->willReturn($parentResolvedType);
$this->resolvedTypeFactory->expects($this->at(1))
->method('createResolvedType')
->with($type, array(), $parentResolvedType)
- ->will($this->returnValue($resolvedType));
-
- $parentResolvedType->expects($this->any())
- ->method('getName')
- ->will($this->returnValue('foo'));
-
- $resolvedType->expects($this->any())
- ->method('getName')
- ->will($this->returnValue('foo_sub_type_parent_instance'));
+ ->willReturn($resolvedType);
$this->assertSame($resolvedType, $this->registry->getType('foo_sub_type_parent_instance'));
}
@@ -184,6 +257,18 @@ public function testGetTypeThrowsExceptionIfParentNotFound()
$this->registry->getType($type);
}
+ /**
+ * @expectedException \Symfony\Component\Form\Exception\UnexpectedTypeException
+ */
+ public function testLegacyGetTypeThrowsExceptionIfParentNotFound()
+ {
+ $type = new LegacyFooSubType();
+
+ $this->extension1->addType($type);
+
+ $this->registry->getType($type);
+ }
+
/**
* @expectedException \Symfony\Component\Form\Exception\InvalidArgumentException
*/
@@ -203,18 +288,42 @@ public function testGetTypeThrowsExceptionIfNoString()
public function testHasTypeAfterLoadingFromExtension()
{
$type = new FooType();
- $resolvedType = $this->getMock('Symfony\Component\Form\ResolvedFormTypeInterface');
+ $resolvedType = new ResolvedFormType($type);
$this->resolvedTypeFactory->expects($this->once())
->method('createResolvedType')
->with($type)
- ->will($this->returnValue($resolvedType));
+ ->willReturn($resolvedType);
- $resolvedType->expects($this->any())
- ->method('getName')
- ->will($this->returnValue('foo'));
+ $this->extension2->addType($type);
+
+ $this->assertTrue($this->registry->hasType(get_class($type)));
+ }
+
+ public function testHasTypeIfFQCN()
+ {
+ $this->assertTrue($this->registry->hasType('Symfony\Component\Form\Tests\Fixtures\FooType'));
+ }
- $this->assertFalse($this->registry->hasType('foo'));
+ public function testDoesNotHaveTypeIfNonExistingClass()
+ {
+ $this->assertFalse($this->registry->hasType('Symfony\Blubb'));
+ }
+
+ public function testDoesNotHaveTypeIfNoFormType()
+ {
+ $this->assertFalse($this->registry->hasType('stdClass'));
+ }
+
+ public function testLegacyHasTypeAfterLoadingFromExtension()
+ {
+ $type = new LegacyFooType();
+ $resolvedType = new ResolvedFormType($type);
+
+ $this->resolvedTypeFactory->expects($this->once())
+ ->method('createResolvedType')
+ ->with($type)
+ ->willReturn($resolvedType);
$this->extension2->addType($type);
@@ -229,7 +338,8 @@ public function testGetTypeGuesser()
$registry = new FormRegistry(
array($this->getMock('Symfony\Component\Form\FormExtensionInterface')),
- $this->resolvedTypeFactory);
+ $this->resolvedTypeFactory
+ );
$this->assertNull($registry->getTypeGuesser());
}
diff --git a/src/Symfony/Component/Form/Tests/ResolvedFormTypeTest.php b/src/Symfony/Component/Form/Tests/ResolvedFormTypeTest.php
index 234d52cf3903e..36804ebebe8bc 100644
--- a/src/Symfony/Component/Form/Tests/ResolvedFormTypeTest.php
+++ b/src/Symfony/Component/Form/Tests/ResolvedFormTypeTest.php
@@ -11,6 +11,8 @@
namespace Symfony\Component\Form\Tests;
+use Symfony\Component\Form\FormTypeExtensionInterface;
+use Symfony\Component\Form\FormTypeInterface;
use Symfony\Component\Form\ResolvedFormType;
use Symfony\Component\Form\FormBuilder;
use Symfony\Component\OptionsResolver\OptionsResolver;
@@ -34,11 +36,35 @@ class ResolvedFormTypeTest extends \PHPUnit_Framework_TestCase
* @var \PHPUnit_Framework_MockObject_MockObject
*/
private $dataMapper;
+
+ /**
+ * @var \PHPUnit_Framework_MockObject_MockObject|FormTypeInterface
+ */
private $parentType;
+
+ /**
+ * @var \PHPUnit_Framework_MockObject_MockObject|FormTypeInterface
+ */
private $type;
+
+ /**
+ * @var \PHPUnit_Framework_MockObject_MockObject|FormTypeExtensionInterface
+ */
private $extension1;
+
+ /**
+ * @var \PHPUnit_Framework_MockObject_MockObject|FormTypeExtensionInterface
+ */
private $extension2;
+
+ /**
+ * @var ResolvedFormType
+ */
private $parentResolvedType;
+
+ /**
+ * @var ResolvedFormType
+ */
private $resolvedType;
protected function setUp()
@@ -305,12 +331,107 @@ public function testFinishView()
$this->resolvedType->finishView($view, $form, $options);
}
+ /**
+ * @dataProvider provideValidNames
+ */
+ public function testGetName($name)
+ {
+ $this->type->expects($this->once())
+ ->method('getName')
+ ->willReturn($name);
+
+ $resolvedType = new ResolvedFormType($this->type);
+
+ $this->assertSame($name, $resolvedType->getName());
+ }
+
+ /**
+ * @dataProvider provideInvalidNames
+ * @expectedException \Symfony\Component\Form\Exception\InvalidArgumentException
+ */
+ public function testGetNameFailsIfInvalidChars($name)
+ {
+ $this->type->expects($this->once())
+ ->method('getName')
+ ->willReturn($name);
+
+ new ResolvedFormType($this->type);
+ }
+
+ public function provideValidNames()
+ {
+ return array(
+ array('text'),
+ array('type123'),
+ array('my_type123'),
+ );
+ }
+
+ public function provideInvalidNames()
+ {
+ return array(
+ array('my-type'),
+ array('my[type]'),
+ array('my{type}'),
+ );
+ }
+
+ public function testGetBlockPrefix()
+ {
+ $this->type->expects($this->once())
+ ->method('getBlockPrefix')
+ ->willReturn('my_prefix');
+
+ $resolvedType = new ResolvedFormType($this->type);
+
+ $this->assertSame('my_prefix', $resolvedType->getBlockPrefix());
+ }
+
+ /**
+ * @group legacy
+ */
+ public function testBlockPrefixDefaultsToNameIfSet()
+ {
+ // Type without getBlockPrefix() method
+ $type = $this->getMock('Symfony\Component\Form\FormTypeInterface');
+
+ $type->expects($this->once())
+ ->method('getName')
+ ->willReturn('my_prefix');
+
+ $resolvedType = new ResolvedFormType($type);
+
+ $this->assertSame('my_prefix', $resolvedType->getBlockPrefix());
+ }
+
+ /**
+ * @dataProvider provideTypeClassBlockPrefixTuples
+ */
+ public function testBlockPrefixDefaultsToFQCNIfNoName($typeClass, $blockPrefix)
+ {
+ $resolvedType = new ResolvedFormType(new $typeClass());
+
+ $this->assertSame($blockPrefix, $resolvedType->getBlockPrefix());
+ }
+
+ public function provideTypeClassBlockPrefixTuples()
+ {
+ return array(
+ array(__NAMESPACE__.'\Fixtures\FooType', 'foo'),
+ array(__NAMESPACE__.'\Fixtures\Foo', 'foo'),
+ array(__NAMESPACE__.'\Fixtures\Type', 'type'),
+ array(__NAMESPACE__.'\Fixtures\FooBarHTMLType', 'foo_bar_html'),
+ array(__NAMESPACE__.'\Fixtures\Foo1Bar2Type', 'foo1_bar2'),
+ array(__NAMESPACE__.'\Fixtures\FBooType', 'f_boo'),
+ );
+ }
+
/**
* @return \PHPUnit_Framework_MockObject_MockObject
*/
- private function getMockFormType()
+ private function getMockFormType($typeClass = 'Symfony\Component\Form\AbstractType')
{
- return $this->getMock('Symfony\Component\Form\AbstractType', array('getName', 'configureOptions', 'finishView', 'buildView', 'buildForm'));
+ return $this->getMock($typeClass, array('getName', 'getBlockPrefix', 'configureOptions', 'finishView', 'buildView', 'buildForm'));
}
/**
diff --git a/src/Symfony/Component/Form/Tests/SimpleFormTest.php b/src/Symfony/Component/Form/Tests/SimpleFormTest.php
index 6fb24a8cdc9c7..9f5de6dfd764c 100644
--- a/src/Symfony/Component/Form/Tests/SimpleFormTest.php
+++ b/src/Symfony/Component/Form/Tests/SimpleFormTest.php
@@ -1063,7 +1063,7 @@ public function testInitializeFailsIfParent()
*/
public function testCustomOptionsResolver()
{
- $fooType = new Fixtures\FooType();
+ $fooType = new Fixtures\LegacyFooType();
$resolver = new Fixtures\CustomOptionsResolver();
$fooType->setDefaultOptions($resolver);
}
diff --git a/src/Symfony/Component/Form/Util/StringUtil.php b/src/Symfony/Component/Form/Util/StringUtil.php
index 2f51e74afcaac..ee71ae7a52e14 100644
--- a/src/Symfony/Component/Form/Util/StringUtil.php
+++ b/src/Symfony/Component/Form/Util/StringUtil.php
@@ -39,4 +39,19 @@ public static function trim($string)
return trim($string);
}
+
+ /**
+ * Converts a fully-qualified class name to a block prefix.
+ *
+ * @param string $fqcn The fully-qualified class name
+ *
+ * @return string|null The block prefix or null if not a valid FQCN
+ */
+ public static function fqcnToBlockPrefix($fqcn)
+ {
+ // Non-greedy ("+?") to match "type" suffix, if present
+ if (preg_match('~([^\\\\]+?)(type)?$~i', $fqcn, $matches)) {
+ return strtolower(preg_replace(array('/([A-Z]+)([A-Z][a-z])/', '/([a-z\d])([A-Z])/'), array('\\1_\\2', '\\1_\\2'), $matches[1]));
+ }
+ }
}
From 6325b4caf6eeeb56cbecffb1af417c2c7f14c1fb Mon Sep 17 00:00:00 2001
From: Bernhard Schussek
Date: Thu, 2 Jul 2015 11:55:36 +0200
Subject: [PATCH 0005/3475] [Form] Added upgrade notes for #15061
---
UPGRADE-2.7.md | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 54 insertions(+)
diff --git a/UPGRADE-2.7.md b/UPGRADE-2.7.md
index 5123df9205ee4..ab1021fcdcaac 100644
--- a/UPGRADE-2.7.md
+++ b/UPGRADE-2.7.md
@@ -665,3 +665,57 @@ Security
* `SwitchUserListener`
* `AccessListener`
* `RememberMeListener`
+
+UPGRADE FROM 2.7.1 to 2.7.2
+===========================
+
+Form
+----
+
+ * In order to fix a few regressions in the new `ChoiceList` implementation,
+ a few details had to be changed compared to 2.7.
+
+ The legacy `Symfony\Component\Form\Extension\Core\ChoiceList\ChoiceListInterface`
+ now does not extend the new `Symfony\Component\Form\ChoiceList\ChoiceListInterface`
+ anymore. If you pass an implementation of the old interface in a context
+ where the new interface is required, wrap the list into a
+ `LegacyChoiceListAdapter`:
+
+ Before:
+
+ ```php
+ use Symfony\Component\Form\ChoiceList\ChoiceListInterface;
+
+ function doSomething(ChoiceListInterface $choiceList)
+ {
+ // ...
+ }
+
+ doSomething($legacyList);
+ ```
+
+ After:
+
+ ```php
+ use Symfony\Component\Form\ChoiceList\ChoiceListInterface;
+ use Symfony\Component\Form\ChoiceList\LegacyChoiceListAdapter;
+
+ function doSomething(ChoiceListInterface $choiceList)
+ {
+ // ...
+ }
+
+ doSomething(new LegacyChoiceListAdapter($legacyList));
+ ```
+
+ The new `ChoiceListInterface` now has two additional methods
+ `getStructuredValues()` and `getOriginalKeys()`. You should add these methods
+ if you implement this interface. See their doc blocks and the implementation
+ of the core choice lists for inspiration.
+
+ The method `ArrayKeyChoiceList::toArrayKey()` was marked as internal. This
+ method was never supposed to be used outside the class.
+
+ The method `ChoiceListFactoryInterface::createView()` does not accept arrays
+ and `Traversable` instances anymore for the `$groupBy` parameter. Pass a
+ callable instead.
From cf86a03b98f6e02871c34a2fb3cc3551d004cc7c Mon Sep 17 00:00:00 2001
From: Christian Flothmann
Date: Thu, 2 Jul 2015 23:04:32 +0200
Subject: [PATCH 0006/3475] fix for legacy asset() with EmptyVersionStrategy
---
.../Bridge/Twig/Extension/AssetExtension.php | 14 +++++++++-----
.../Twig/Tests/Extension/AssetExtensionTest.php | 11 +++++++++++
2 files changed, 20 insertions(+), 5 deletions(-)
diff --git a/src/Symfony/Bridge/Twig/Extension/AssetExtension.php b/src/Symfony/Bridge/Twig/Extension/AssetExtension.php
index d138b1de1e710..f7b9c8750089b 100644
--- a/src/Symfony/Bridge/Twig/Extension/AssetExtension.php
+++ b/src/Symfony/Bridge/Twig/Extension/AssetExtension.php
@@ -108,11 +108,15 @@ private function getLegacyAssetUrl($path, $packageName = null, $absolute = false
$v->setAccessible(true);
$currentVersionStrategy = $v->getValue($package);
- $f = new \ReflectionProperty($currentVersionStrategy, 'format');
- $f->setAccessible(true);
- $format = $f->getValue($currentVersionStrategy);
-
- $v->setValue($package, new StaticVersionStrategy($version, $format));
+ if (property_exists($currentVersionStrategy, 'format')) {
+ $f = new \ReflectionProperty($currentVersionStrategy, 'format');
+ $f->setAccessible(true);
+ $format = $f->getValue($currentVersionStrategy);
+
+ $v->setValue($package, new StaticVersionStrategy($version, $format));
+ } else {
+ $v->setValue($package, new StaticVersionStrategy($version));
+ }
}
try {
diff --git a/src/Symfony/Bridge/Twig/Tests/Extension/AssetExtensionTest.php b/src/Symfony/Bridge/Twig/Tests/Extension/AssetExtensionTest.php
index ab73179394975..474d8c33956b7 100644
--- a/src/Symfony/Bridge/Twig/Tests/Extension/AssetExtensionTest.php
+++ b/src/Symfony/Bridge/Twig/Tests/Extension/AssetExtensionTest.php
@@ -15,6 +15,7 @@
use Symfony\Component\Asset\Package;
use Symfony\Component\Asset\Packages;
use Symfony\Component\Asset\PathPackage;
+use Symfony\Component\Asset\VersionStrategy\EmptyVersionStrategy;
use Symfony\Component\Asset\VersionStrategy\StaticVersionStrategy;
class AssetExtensionTest extends \PHPUnit_Framework_TestCase
@@ -41,6 +42,16 @@ public function testGetAssetUrlWithPackageSubClass()
$this->assertEquals('/foo/me.png?version=42', $extension->getAssetUrl('me.png', null, false, 42));
}
+ /**
+ * @group legacy
+ */
+ public function testGetAssetUrlWithEmptyVersionStrategy()
+ {
+ $extension = $this->createExtension(new PathPackage('foo', new EmptyVersionStrategy()));
+
+ $this->assertEquals('/foo/me.png?42', $extension->getAssetUrl('me.png', null, false, 42));
+ }
+
private function createExtension(Package $package)
{
$foundationExtension = $this->getMockBuilder('Symfony\Bridge\Twig\Extension\HttpFoundationExtension')->disableOriginalConstructor()->getMock();
From 5f4015c3cded4f20f6333c60bd52156bc70b0086 Mon Sep 17 00:00:00 2001
From: Nicolas Grekas
Date: Fri, 3 Jul 2015 07:54:45 +0200
Subject: [PATCH 0007/3475] Enhance hhvm test skip message
---
src/Symfony/Component/Debug/Tests/ErrorHandlerTest.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/Symfony/Component/Debug/Tests/ErrorHandlerTest.php b/src/Symfony/Component/Debug/Tests/ErrorHandlerTest.php
index 115f599f56118..563bd0997e95d 100644
--- a/src/Symfony/Component/Debug/Tests/ErrorHandlerTest.php
+++ b/src/Symfony/Component/Debug/Tests/ErrorHandlerTest.php
@@ -40,7 +40,7 @@ protected function tearDown()
public function testCompileTimeError()
{
if (defined('HHVM_VERSION')) {
- $this->markTestSkipped('HHVM behaves differently in this test case.');
+ $this->markTestSkipped('HHVM does not trigger strict notices.');
}
// the ContextErrorException must not be loaded to test the workaround
From 3233c2fc142210a60d7deba084de21ac82c99a45 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?K=C3=A9vin=20Dunglas?=
Date: Fri, 3 Jul 2015 10:25:38 +0200
Subject: [PATCH 0008/3475] [Serializer] Fix Groups PHPDoc
---
src/Symfony/Component/Serializer/Annotation/Groups.php | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/src/Symfony/Component/Serializer/Annotation/Groups.php b/src/Symfony/Component/Serializer/Annotation/Groups.php
index 9e7801f842704..519837a55b73e 100644
--- a/src/Symfony/Component/Serializer/Annotation/Groups.php
+++ b/src/Symfony/Component/Serializer/Annotation/Groups.php
@@ -30,7 +30,8 @@ class Groups
/**
* @param array $data
- * @throws \InvalidArgumentException
+ *
+ * @throws InvalidArgumentException
*/
public function __construct(array $data)
{
@@ -52,7 +53,7 @@ public function __construct(array $data)
}
/**
- * Gets groups
+ * Gets groups.
*
* @return array
*/
From da5218f2ae7fb3724c08dbe047e196766374ac49 Mon Sep 17 00:00:00 2001
From: Dave Hulbert
Date: Fri, 3 Jul 2015 22:02:27 +0100
Subject: [PATCH 0009/3475] Remove var not used due to returning early
(introduced in 8982c32)
---
src/Symfony/Component/HttpFoundation/Request.php | 1 -
1 file changed, 1 deletion(-)
diff --git a/src/Symfony/Component/HttpFoundation/Request.php b/src/Symfony/Component/HttpFoundation/Request.php
index 8babb395c59dc..84b3a69adebec 100644
--- a/src/Symfony/Component/HttpFoundation/Request.php
+++ b/src/Symfony/Component/HttpFoundation/Request.php
@@ -476,7 +476,6 @@ public function __clone()
*/
public function __toString()
{
- $content = '';
try {
$content = $this->getContent();
} catch (\LogicException $e) {
From e195fd7c1bccde4cefea2b9766ffb8f715de5405 Mon Sep 17 00:00:00 2001
From: Kevin Robatel
Date: Fri, 3 Jul 2015 16:45:06 +0200
Subject: [PATCH 0010/3475] Remove duplicate example
---
UPGRADE-3.0.md | 4 ----
1 file changed, 4 deletions(-)
diff --git a/UPGRADE-3.0.md b/UPGRADE-3.0.md
index 14520c1c6fa7a..2d2590a7c110d 100644
--- a/UPGRADE-3.0.md
+++ b/UPGRADE-3.0.md
@@ -273,10 +273,6 @@ UPGRADE FROM 2.x to 3.0
echo $form->getErrors(true, false);
```
- ```php
- echo $form->getErrors(true, false);
- ```
-
### FrameworkBundle
* The `getRequest` method of the base `Controller` class has been deprecated
From 2bd8fb8f979327c61caa2e137acba27edf1bf028 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?K=C3=A9vin=20Dunglas?=
Date: Fri, 3 Jul 2015 14:43:05 +0200
Subject: [PATCH 0011/3475] [Serializer] Fix Groups tests.
---
.../Component/Serializer/Tests/Annotation/GroupsTest.php | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/Symfony/Component/Serializer/Tests/Annotation/GroupsTest.php b/src/Symfony/Component/Serializer/Tests/Annotation/GroupsTest.php
index b427325f08640..72b877729dc83 100644
--- a/src/Symfony/Component/Serializer/Tests/Annotation/GroupsTest.php
+++ b/src/Symfony/Component/Serializer/Tests/Annotation/GroupsTest.php
@@ -19,7 +19,7 @@
class GroupsTest extends \PHPUnit_Framework_TestCase
{
/**
- * @expectedException \InvalidArgumentException
+ * @expectedException \Symfony\Component\Serializer\Exception\InvalidArgumentException
*/
public function testEmptyGroupsParameter()
{
@@ -27,7 +27,7 @@ public function testEmptyGroupsParameter()
}
/**
- * @expectedException \InvalidArgumentException
+ * @expectedException \Symfony\Component\Serializer\Exception\InvalidArgumentException
*/
public function testNotAnArrayGroupsParameter()
{
@@ -35,7 +35,7 @@ public function testNotAnArrayGroupsParameter()
}
/**
- * @expectedException \InvalidArgumentException
+ * @expectedException \Symfony\Component\Serializer\Exception\InvalidArgumentException
*/
public function testInvalidGroupsParameter()
{
From e500a716da44e6d34b2ad04f979d83bc0795dd1e Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?K=C3=A9vin=20Dunglas?=
Date: Mon, 15 Jun 2015 09:35:28 +0200
Subject: [PATCH 0012/3475] [FrameworkBundle] Configurable Serializer name
converter
---
.../FrameworkBundle/DependencyInjection/Configuration.php | 1 +
.../DependencyInjection/FrameworkExtension.php | 4 ++++
.../Resources/config/schema/symfony-1.0.xsd | 1 +
.../Bundle/FrameworkBundle/Resources/config/serializer.xml | 5 ++++-
.../Tests/DependencyInjection/Fixtures/php/full.php | 7 ++++++-
.../Tests/DependencyInjection/Fixtures/xml/full.xml | 2 +-
.../Tests/DependencyInjection/Fixtures/yml/full.yml | 6 +++++-
.../Tests/DependencyInjection/FrameworkExtensionTest.php | 7 +++++++
8 files changed, 29 insertions(+), 4 deletions(-)
diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php
index 977c0669c409c..7c24a60210c0a 100644
--- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php
+++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php
@@ -660,6 +660,7 @@ private function addSerializerSection(ArrayNodeDefinition $rootNode)
->children()
->booleanNode('enable_annotations')->defaultFalse()->end()
->scalarNode('cache')->end()
+ ->scalarNode('name_converter')->end()
->end()
->end()
->end()
diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php
index 2d00a462ee3fb..9805e289ce670 100644
--- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php
+++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php
@@ -970,6 +970,10 @@ private function registerSerializerConfiguration(array $config, ContainerBuilder
1, new Reference($config['cache'])
);
}
+
+ if ($config['name_converter']) {
+ $container->getDefinition('serializer.normalizer.object')->replaceArgument(1, new Reference($config['name_converter']));
+ }
}
/**
diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/config/schema/symfony-1.0.xsd b/src/Symfony/Bundle/FrameworkBundle/Resources/config/schema/symfony-1.0.xsd
index e1ca041e6114f..78dff1ebd9e28 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Resources/config/schema/symfony-1.0.xsd
+++ b/src/Symfony/Bundle/FrameworkBundle/Resources/config/schema/symfony-1.0.xsd
@@ -217,5 +217,6 @@
+
diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/config/serializer.xml b/src/Symfony/Bundle/FrameworkBundle/Resources/config/serializer.xml
index e5b53e94938e2..db5cdb8a54c86 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Resources/config/serializer.xml
+++ b/src/Symfony/Bundle/FrameworkBundle/Resources/config/serializer.xml
@@ -22,7 +22,7 @@
- null
+ null
@@ -55,5 +55,8 @@
+
+
+
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/full.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/full.php
index a035b56d70029..b4196c6052664 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/full.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/full.php
@@ -61,7 +61,12 @@
'debug' => true,
'file_cache_dir' => '%kernel.cache_dir%/annotations',
),
- 'serializer' => array('enabled' => true),
+ 'serializer' => array(
+ 'enabled' => true,
+ 'enable_annotations' => true,
+ 'cache' => 'serializer.mapping.cache.apc',
+ 'name_converter' => 'serializer.name_converter.camel_case_to_snake_case',
+ ),
'ide' => 'file%%link%%format',
'request' => array(
'formats' => array(
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/full.xml b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/full.xml
index bf4537b910e8b..723ed6b607939 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/full.xml
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/full.xml
@@ -39,6 +39,6 @@
-
+
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/full.yml b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/full.yml
index 47513b1f665b5..b5e9faa6a1320 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/full.yml
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/full.yml
@@ -47,7 +47,11 @@ framework:
cache: file
debug: true
file_cache_dir: %kernel.cache_dir%/annotations
- serializer: { enabled: true }
+ serializer:
+ enabled: true
+ enable_annotations: true
+ cache: serializer.mapping.cache.apc
+ name_converter: serializer.name_converter.camel_case_to_snake_case
ide: file%%link%%format
request:
formats:
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php
index edace5bf7a9ad..aca665f585626 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php
@@ -446,6 +446,13 @@ public function testSerializerEnabled()
{
$container = $this->createContainerFromFile('full');
$this->assertTrue($container->has('serializer'));
+
+ $argument = $container->getDefinition('serializer.mapping.chain_loader')->getArgument(0);
+
+ $this->assertCount(1, $argument);
+ $this->assertEquals('Symfony\Component\Serializer\Mapping\Loader\AnnotationLoader', $argument[0]->getClass());
+ $this->assertEquals(new Reference('serializer.mapping.cache.apc'), $container->getDefinition('serializer.mapping.class_metadata_factory')->getArgument(1));
+ $this->assertEquals(new Reference('serializer.name_converter.camel_case_to_snake_case'), $container->getDefinition('serializer.normalizer.object')->getArgument(1));
}
public function testAssetHelperWhenAssetsAreEnabled()
From 9b0dfd426755d24701ccd16ddf83e9d11122693d Mon Sep 17 00:00:00 2001
From: Christian Flothmann
Date: Sun, 5 Jul 2015 10:40:11 +0200
Subject: [PATCH 0013/3475] [Security] allow to use `method` in XML configs
Before this change, you always had to use the `methods` key which is
inconsistent compared to other options like `roles` and `ips` for which
it was possible to use their singular versions.
---
.../SecurityBundle/DependencyInjection/MainConfiguration.php | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/Symfony/Bundle/SecurityBundle/DependencyInjection/MainConfiguration.php b/src/Symfony/Bundle/SecurityBundle/DependencyInjection/MainConfiguration.php
index 73498f76da2cd..c79868c523c7a 100644
--- a/src/Symfony/Bundle/SecurityBundle/DependencyInjection/MainConfiguration.php
+++ b/src/Symfony/Bundle/SecurityBundle/DependencyInjection/MainConfiguration.php
@@ -158,6 +158,7 @@ private function addAccessControlSection(ArrayNodeDefinition $rootNode)
->cannotBeOverwritten()
->prototype('array')
->fixXmlConfig('ip')
+ ->fixXmlConfig('method')
->children()
->scalarNode('requires_channel')->defaultNull()->end()
->scalarNode('path')
From 0096266009223b569172a978a9083e80efd31754 Mon Sep 17 00:00:00 2001
From: Daniel Wehner
Date: Fri, 26 Jun 2015 15:47:25 +0200
Subject: [PATCH 0014/3475] Add a way to reset the singleton
---
.../HttpFoundation/File/MimeType/MimeTypeGuesser.php | 7 +++++++
.../Component/HttpFoundation/Tests/File/FileTest.php | 12 ++++++++++++
.../Tests/File/Fixtures/other-file.example | 0
3 files changed, 19 insertions(+)
create mode 100644 src/Symfony/Component/HttpFoundation/Tests/File/Fixtures/other-file.example
diff --git a/src/Symfony/Component/HttpFoundation/File/MimeType/MimeTypeGuesser.php b/src/Symfony/Component/HttpFoundation/File/MimeType/MimeTypeGuesser.php
index 81b2b02bd46fd..4ae6487bad097 100644
--- a/src/Symfony/Component/HttpFoundation/File/MimeType/MimeTypeGuesser.php
+++ b/src/Symfony/Component/HttpFoundation/File/MimeType/MimeTypeGuesser.php
@@ -67,6 +67,13 @@ public static function getInstance()
return self::$instance;
}
+ /**
+ * Resets the singleton instance.
+ */
+ public static function reset() {
+ self::$instance = null;
+ }
+
/**
* Registers all natively provided mime type guessers.
*/
diff --git a/src/Symfony/Component/HttpFoundation/Tests/File/FileTest.php b/src/Symfony/Component/HttpFoundation/Tests/File/FileTest.php
index 1f89c391d5ed0..f325d003c69da 100644
--- a/src/Symfony/Component/HttpFoundation/Tests/File/FileTest.php
+++ b/src/Symfony/Component/HttpFoundation/Tests/File/FileTest.php
@@ -45,6 +45,18 @@ public function testGuessExtensionIsBasedOnMimeType()
$this->assertEquals('gif', $file->guessExtension());
}
+ public function testGuessExtensionWithReset() {
+ $file = new File(__DIR__.'/Fixtures/other-file.example');
+ $guesser = $this->createMockGuesser($file->getPathname(), 'image/gif');
+ MimeTypeGuesser::getInstance()->register($guesser);
+
+ $this->assertEquals('gif', $file->guessExtension());
+
+ MimeTypeGuesser::reset();
+
+ $this->assertNull($file->guessExtension());
+ }
+
public function testConstructWhenFileNotExists()
{
$this->setExpectedException('Symfony\Component\HttpFoundation\File\Exception\FileNotFoundException');
diff --git a/src/Symfony/Component/HttpFoundation/Tests/File/Fixtures/other-file.example b/src/Symfony/Component/HttpFoundation/Tests/File/Fixtures/other-file.example
new file mode 100644
index 0000000000000..e69de29bb2d1d
From e3b225f4ba5e1cd220eb4f525d40d66a9c8d61e9 Mon Sep 17 00:00:00 2001
From: Fabien Potencier
Date: Sun, 5 Jul 2015 15:20:07 +0200
Subject: [PATCH 0015/3475] fixed CS
---
.../Component/HttpFoundation/File/MimeType/MimeTypeGuesser.php | 3 ++-
src/Symfony/Component/HttpFoundation/Tests/File/FileTest.php | 3 ++-
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/src/Symfony/Component/HttpFoundation/File/MimeType/MimeTypeGuesser.php b/src/Symfony/Component/HttpFoundation/File/MimeType/MimeTypeGuesser.php
index 4ae6487bad097..ecc8a30ac25d1 100644
--- a/src/Symfony/Component/HttpFoundation/File/MimeType/MimeTypeGuesser.php
+++ b/src/Symfony/Component/HttpFoundation/File/MimeType/MimeTypeGuesser.php
@@ -70,7 +70,8 @@ public static function getInstance()
/**
* Resets the singleton instance.
*/
- public static function reset() {
+ public static function reset()
+ {
self::$instance = null;
}
diff --git a/src/Symfony/Component/HttpFoundation/Tests/File/FileTest.php b/src/Symfony/Component/HttpFoundation/Tests/File/FileTest.php
index f325d003c69da..08b7cccb52595 100644
--- a/src/Symfony/Component/HttpFoundation/Tests/File/FileTest.php
+++ b/src/Symfony/Component/HttpFoundation/Tests/File/FileTest.php
@@ -45,7 +45,8 @@ public function testGuessExtensionIsBasedOnMimeType()
$this->assertEquals('gif', $file->guessExtension());
}
- public function testGuessExtensionWithReset() {
+ public function testGuessExtensionWithReset()
+ {
$file = new File(__DIR__.'/Fixtures/other-file.example');
$guesser = $this->createMockGuesser($file->getPathname(), 'image/gif');
MimeTypeGuesser::getInstance()->register($guesser);
From 464b67ed09668168cabfd77b6b3cfa26ceb1b0b0 Mon Sep 17 00:00:00 2001
From: Dariusz Ruminski
Date: Sun, 5 Jul 2015 16:01:47 +0200
Subject: [PATCH 0016/3475] fix CS
---
.../Bridge/Doctrine/Tests/Logger/DbalLoggerTest.php | 4 ++--
src/Symfony/Component/BrowserKit/Cookie.php | 1 -
.../Component/DependencyInjection/Dumper/PhpDumper.php | 8 ++++----
src/Symfony/Component/DomCrawler/Tests/FormTest.php | 1 -
src/Symfony/Component/Form/PreloadedExtension.php | 6 +++---
.../Component/HttpFoundation/Tests/RequestTest.php | 1 -
.../Tests/EventListener/FragmentListenerTest.php | 1 -
.../Component/Routing/Matcher/Dumper/PhpMatcherDumper.php | 6 +++---
8 files changed, 12 insertions(+), 16 deletions(-)
diff --git a/src/Symfony/Bridge/Doctrine/Tests/Logger/DbalLoggerTest.php b/src/Symfony/Bridge/Doctrine/Tests/Logger/DbalLoggerTest.php
index eacbd4f3c9e26..482b4d7ed7711 100644
--- a/src/Symfony/Bridge/Doctrine/Tests/Logger/DbalLoggerTest.php
+++ b/src/Symfony/Bridge/Doctrine/Tests/Logger/DbalLoggerTest.php
@@ -91,7 +91,7 @@ public function testLogNonUtf8Array()
'utf8' => 'foo',
array(
'nonutf8' => DbalLogger::BINARY_DATA_VALUE,
- )
+ ),
)
)
;
@@ -100,7 +100,7 @@ public function testLogNonUtf8Array()
'utf8' => 'foo',
array(
'nonutf8' => "\x7F\xFF",
- )
+ ),
));
}
diff --git a/src/Symfony/Component/BrowserKit/Cookie.php b/src/Symfony/Component/BrowserKit/Cookie.php
index 18b9324403091..e690cdacd5114 100644
--- a/src/Symfony/Component/BrowserKit/Cookie.php
+++ b/src/Symfony/Component/BrowserKit/Cookie.php
@@ -82,7 +82,6 @@ public function __construct($name, $value, $expires = null, $path = null, $domai
$this->expires = $timestampAsDateTime->getTimestamp();
}
-
}
/**
diff --git a/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php b/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php
index 64d5fb9bb6d64..db0a9f97d21ba 100644
--- a/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php
+++ b/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php
@@ -797,8 +797,8 @@ public function __construct()
if (count($scopes = $this->container->getScopes()) > 0) {
$code .= "\n";
- $code .= " \$this->scopes = ".$this->dumpValue($scopes).";\n";
- $code .= " \$this->scopeChildren = ".$this->dumpValue($this->container->getScopeChildren()).";\n";
+ $code .= ' $this->scopes = '.$this->dumpValue($scopes).";\n";
+ $code .= ' $this->scopeChildren = '.$this->dumpValue($this->container->getScopeChildren()).";\n";
}
$code .= $this->addMethodMap();
@@ -843,8 +843,8 @@ public function __construct()
$code .= "\n";
if (count($scopes = $this->container->getScopes()) > 0) {
- $code .= " \$this->scopes = ".$this->dumpValue($scopes).";\n";
- $code .= " \$this->scopeChildren = ".$this->dumpValue($this->container->getScopeChildren()).";\n";
+ $code .= ' $this->scopes = '.$this->dumpValue($scopes).";\n";
+ $code .= ' $this->scopeChildren = '.$this->dumpValue($this->container->getScopeChildren()).";\n";
} else {
$code .= " \$this->scopes = array();\n";
$code .= " \$this->scopeChildren = array();\n";
diff --git a/src/Symfony/Component/DomCrawler/Tests/FormTest.php b/src/Symfony/Component/DomCrawler/Tests/FormTest.php
index c657e3639e178..79b1a3b118cce 100644
--- a/src/Symfony/Component/DomCrawler/Tests/FormTest.php
+++ b/src/Symfony/Component/DomCrawler/Tests/FormTest.php
@@ -805,7 +805,6 @@ public function testFormRegistrySetValueOnCompoundField()
*/
public function testFormRegistrySetArrayOnNotCompoundField()
{
-
$registry = new FormFieldRegistry();
$registry->add($this->getFormFieldMock('bar'));
diff --git a/src/Symfony/Component/Form/PreloadedExtension.php b/src/Symfony/Component/Form/PreloadedExtension.php
index f70ca8d4551e8..6b4f9ef6a170b 100644
--- a/src/Symfony/Component/Form/PreloadedExtension.php
+++ b/src/Symfony/Component/Form/PreloadedExtension.php
@@ -38,9 +38,9 @@ class PreloadedExtension implements FormExtensionInterface
/**
* Creates a new preloaded extension.
*
- * @param FormTypeInterface[] $types The types that the extension should support.
- * @param array[FormTypeExtensionInterface[]] typeExtensions The type extensions that the extension should support.
- * @param FormTypeGuesserInterface|null $typeGuesser The guesser that the extension should support.
+ * @param FormTypeInterface[] $types The types that the extension should support.
+ * @param array[FormTypeExtensionInterface[]] $typeExtensions The type extensions that the extension should support.
+ * @param FormTypeGuesserInterface|null $typeGuesser The guesser that the extension should support.
*/
public function __construct(array $types, array $typeExtensions, FormTypeGuesserInterface $typeGuesser = null)
{
diff --git a/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php b/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php
index 990d3a842d097..366b555f9266b 100644
--- a/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php
+++ b/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php
@@ -939,7 +939,6 @@ public function testGetContentCantBeCalledTwiceWithResources($first, $second)
}
/**
- *
* @dataProvider getContentCantBeCalledTwiceWithResourcesProvider
*/
public function testGetContentCanBeCalledTwiceWithResources($first, $second)
diff --git a/src/Symfony/Component/HttpKernel/Tests/EventListener/FragmentListenerTest.php b/src/Symfony/Component/HttpKernel/Tests/EventListener/FragmentListenerTest.php
index 18edee6123c79..fd5d63b167569 100644
--- a/src/Symfony/Component/HttpKernel/Tests/EventListener/FragmentListenerTest.php
+++ b/src/Symfony/Component/HttpKernel/Tests/EventListener/FragmentListenerTest.php
@@ -34,7 +34,6 @@ public function testOnlyTriggeredOnFragmentRoute()
$this->assertTrue($request->query->has('_path'));
}
-
public function testOnlyTriggeredIfControllerWasNotDefinedYet()
{
$request = Request::create('http://example.com/_fragment?_path=foo%3Dbar%26_controller%3Dfoo');
diff --git a/src/Symfony/Component/Routing/Matcher/Dumper/PhpMatcherDumper.php b/src/Symfony/Component/Routing/Matcher/Dumper/PhpMatcherDumper.php
index 49d137f4ab82b..605ee560ebc88 100644
--- a/src/Symfony/Component/Routing/Matcher/Dumper/PhpMatcherDumper.php
+++ b/src/Symfony/Component/Routing/Matcher/Dumper/PhpMatcherDumper.php
@@ -216,11 +216,11 @@ private function compileRoute(Route $route, $name, $supportsRedirections, $paren
$conditions[] = sprintf("rtrim(\$pathinfo, '/') === %s", var_export(rtrim(str_replace('\\', '', $m['url']), '/'), true));
$hasTrailingSlash = true;
} else {
- $conditions[] = sprintf("\$pathinfo === %s", var_export(str_replace('\\', '', $m['url']), true));
+ $conditions[] = sprintf('$pathinfo === %s', var_export(str_replace('\\', '', $m['url']), true));
}
} else {
if ($compiledRoute->getStaticPrefix() && $compiledRoute->getStaticPrefix() !== $parentPrefix) {
- $conditions[] = sprintf("0 === strpos(\$pathinfo, %s)", var_export($compiledRoute->getStaticPrefix(), true));
+ $conditions[] = sprintf('0 === strpos($pathinfo, %s)', var_export($compiledRoute->getStaticPrefix(), true));
}
$regex = $compiledRoute->getRegex();
@@ -228,7 +228,7 @@ private function compileRoute(Route $route, $name, $supportsRedirections, $paren
$regex = substr($regex, 0, $pos).'/?$'.substr($regex, $pos + 2);
$hasTrailingSlash = true;
}
- $conditions[] = sprintf("preg_match(%s, \$pathinfo, \$matches)", var_export($regex, true));
+ $conditions[] = sprintf('preg_match(%s, $pathinfo, $matches)', var_export($regex, true));
$matches = true;
}
From 15886b618e40fd9f943e46c0bccc6b7fc115ec12 Mon Sep 17 00:00:00 2001
From: MatTheCat
Date: Tue, 7 Jul 2015 14:03:46 +0200
Subject: [PATCH 0017/3475] [Twig][Bridge] replaced `extends` with `use` in
bootstrap_3_horizontal_layout.html.twig
---
.../views/Form/bootstrap_3_horizontal_layout.html.twig | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/Symfony/Bridge/Twig/Resources/views/Form/bootstrap_3_horizontal_layout.html.twig b/src/Symfony/Bridge/Twig/Resources/views/Form/bootstrap_3_horizontal_layout.html.twig
index 6fc226da4fce4..f6b86715130a4 100644
--- a/src/Symfony/Bridge/Twig/Resources/views/Form/bootstrap_3_horizontal_layout.html.twig
+++ b/src/Symfony/Bridge/Twig/Resources/views/Form/bootstrap_3_horizontal_layout.html.twig
@@ -1,4 +1,4 @@
-{% extends "bootstrap_3_layout.html.twig" %}
+{% use "bootstrap_3_layout.html.twig" %}
{% block form_start -%}
{% set attr = attr|merge({class: (attr.class|default('') ~ ' form-horizontal')|trim}) %}
From 4a72c441d583557282df06a2252e7c06ac83f868 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gr=C3=A9goire=20Pineau?=
Date: Tue, 7 Jul 2015 14:38:28 +0200
Subject: [PATCH 0018/3475] [DependencyInjection] Freeze also
FrozenParameterBag::remove
---
.../ParameterBag/FrozenParameterBag.php | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/src/Symfony/Component/DependencyInjection/ParameterBag/FrozenParameterBag.php b/src/Symfony/Component/DependencyInjection/ParameterBag/FrozenParameterBag.php
index dc936a0bd6718..3ea6d9636ba26 100644
--- a/src/Symfony/Component/DependencyInjection/ParameterBag/FrozenParameterBag.php
+++ b/src/Symfony/Component/DependencyInjection/ParameterBag/FrozenParameterBag.php
@@ -69,4 +69,14 @@ public function set($name, $value)
{
throw new LogicException('Impossible to call set() on a frozen ParameterBag.');
}
+
+ /**
+ * {@inheritdoc}
+ *
+ * @api
+ */
+ public function remove($name)
+ {
+ throw new LogicException('Impossible to call remove() on a frozen ParameterBag.');
+ }
}
From 2aff5660b2eb41552640545f6e672307170b61bc Mon Sep 17 00:00:00 2001
From: Tomasz Kowalczyk
Date: Tue, 7 Jul 2015 16:19:30 +0200
Subject: [PATCH 0019/3475] [Finder] Command::addAtIndex() fails with Command
instance argument
---
.../Component/Finder/Shell/Command.php | 2 +-
.../Finder/Tests/Shell/CommandTest.php | 162 ++++++++++++++++++
2 files changed, 163 insertions(+), 1 deletion(-)
create mode 100644 src/Symfony/Component/Finder/Tests/Shell/CommandTest.php
diff --git a/src/Symfony/Component/Finder/Shell/Command.php b/src/Symfony/Component/Finder/Shell/Command.php
index ab070346fc1d1..c91dd16161420 100644
--- a/src/Symfony/Component/Finder/Shell/Command.php
+++ b/src/Symfony/Component/Finder/Shell/Command.php
@@ -289,7 +289,7 @@ function ($bit) { return null !== $bit; }
*/
public function addAtIndex($bit, $index)
{
- array_splice($this->bits, $index, 0, $bit);
+ array_splice($this->bits, $index, 0, $bit instanceof self ? array($bit) : $bit);
return $this;
}
diff --git a/src/Symfony/Component/Finder/Tests/Shell/CommandTest.php b/src/Symfony/Component/Finder/Tests/Shell/CommandTest.php
new file mode 100644
index 0000000000000..8c6c0064cda92
--- /dev/null
+++ b/src/Symfony/Component/Finder/Tests/Shell/CommandTest.php
@@ -0,0 +1,162 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Component\Finder\Tests\Shell;
+
+use Symfony\Component\Finder\Shell\Command;
+
+class CommandTest extends \PHPUnit_Framework_TestCase
+{
+ public function testCreate()
+ {
+ $this->assertInstanceOf('Symfony\Component\Finder\Shell\Command', Command::create());
+ }
+
+ public function testAdd()
+ {
+ $cmd = Command::create()->add('--force');
+ $this->assertSame('--force', $cmd->join());
+ }
+
+ public function testAddAsFirst()
+ {
+ $cmd = Command::create()->add('--force');
+
+ $cmd->addAtIndex(Command::create()->add('-F'), 0);
+ $this->assertSame('-F --force', $cmd->join());
+ }
+
+ public function testAddAsLast()
+ {
+ $cmd = Command::create()->add('--force');
+
+ $cmd->addAtIndex(Command::create()->add('-F'), 1);
+ $this->assertSame('--force -F', $cmd->join());
+ }
+
+ public function testAddInBetween()
+ {
+ $cmd = Command::create()->add('--force');
+ $cmd->addAtIndex(Command::create()->add('-F'), 0);
+
+ $cmd->addAtIndex(Command::create()->add('-X'), 1);
+ $this->assertSame('-F -X --force', $cmd->join());
+ }
+
+ public function testCount()
+ {
+ $cmd = Command::create();
+ $this->assertSame(0, $cmd->length());
+
+ $cmd->add('--force');
+ $this->assertSame(1, $cmd->length());
+
+ $cmd->add('--run');
+ $this->assertSame(2, $cmd->length());
+ }
+
+ public function testTop()
+ {
+ $cmd = Command::create()->add('--force');
+
+ $cmd->top('--run');
+ $this->assertSame('--run --force', $cmd->join());
+ }
+
+ public function testTopLabeled()
+ {
+ $cmd = Command::create()->add('--force');
+
+ $cmd->top('--run');
+ $cmd->ins('--something');
+ $cmd->top('--something');
+ $this->assertSame('--something --run --force ', $cmd->join());
+ }
+
+ public function testArg()
+ {
+ $cmd = Command::create()->add('--force');
+
+ $cmd->arg('--run');
+ $this->assertSame('--force \'--run\'', $cmd->join());
+ }
+
+ public function testCmd()
+ {
+ $cmd = Command::create()->add('--force');
+
+ $cmd->cmd('run');
+ $this->assertSame('--force run', $cmd->join());
+ }
+
+ public function testInsDuplicateLabelException()
+ {
+ $cmd = Command::create()->add('--force');
+
+ $cmd->ins('label');
+ $this->setExpectedException('RuntimeException');
+ $cmd->ins('label');
+ }
+
+ public function testEnd()
+ {
+ $parent = Command::create();
+ $cmd = Command::create($parent);
+
+ $this->assertSame($parent, $cmd->end());
+ }
+
+ public function testEndNoParentException()
+ {
+ $cmd = Command::create();
+
+ $this->setExpectedException('RuntimeException');
+ $cmd->end();
+ }
+
+ public function testGetMissingLabelException()
+ {
+ $cmd = Command::create();
+
+ $this->setExpectedException('RuntimeException');
+ $cmd->get('invalid');
+ }
+
+ public function testErrorHandler()
+ {
+ $cmd = Command::create();
+ $handler = function() { return 'error-handler'; };
+ $cmd->setErrorHandler($handler);
+
+ $this->assertSame($handler, $cmd->getErrorHandler());
+ }
+
+ public function testExecute()
+ {
+ $cmd = Command::create();
+ $cmd->add('php');
+ $cmd->add('--version');
+ $result = $cmd->execute();
+
+ $this->assertTrue(is_array($result));
+ $this->assertNotEmpty($result);
+ $this->assertRegexp('/PHP|HipHop/', $result[0]);
+ }
+
+ public function testCastToString()
+ {
+ $cmd = Command::create();
+ $cmd->add('--force');
+ $cmd->add('--run');
+
+ $this->assertSame('--force --run', (string) $cmd);
+ }
+}
From 1dac1277a37d1b7cb037418d8456564331ab1559 Mon Sep 17 00:00:00 2001
From: Vladimir Reznichenko
Date: Tue, 7 Jul 2015 21:01:23 +0200
Subject: [PATCH 0020/3475] [2.6] Static Code Analysis for Components and
Bundles
---
.../Command/TranslationDebugCommand.php | 4 ++--
.../Command/TranslationUpdateCommand.php | 6 +++---
.../Console/Descriptor/TextDescriptor.php | 12 ++++++------
.../DependencyInjection/FrameworkExtension.php | 12 ++++++------
.../CacheClearCommand/CacheClearCommandTest.php | 2 +-
.../Tests/Command/TranslationDebugCommandTest.php | 2 +-
.../Console/Descriptor/AbstractDescriptorTest.php | 2 +-
.../DependencyInjection/MainConfiguration.php | 2 +-
.../Security/UserProvider/InMemoryFactory.php | 2 +-
.../Bundle/TwigBundle/Command/DebugCommand.php | 4 ++--
.../TwigBundle/DependencyInjection/TwigExtension.php | 2 +-
.../Tests/DependencyInjection/TwigExtensionTest.php | 6 ++----
src/Symfony/Component/Config/Util/XmlUtils.php | 2 +-
src/Symfony/Component/Console/Helper/ProgressBar.php | 6 +++---
.../Component/Console/Question/ChoiceQuestion.php | 3 ++-
src/Symfony/Component/Debug/DebugClassLoader.php | 7 ++++---
.../Component/Debug/Tests/DebugClassLoaderTest.php | 4 ++--
.../Component/Debug/Tests/ErrorHandlerTest.php | 2 +-
.../ClassNotFoundFatalErrorHandlerTest.php | 4 ++--
.../UndefinedFunctionFatalErrorHandlerTest.php | 2 +-
.../UndefinedMethodFatalErrorHandlerTest.php | 2 +-
.../Filesystem/Tests/FilesystemTestCase.php | 4 ++--
.../Session/Storage/Handler/PdoSessionHandler.php | 6 +++---
.../Security/Core/Tests/Util/SecureRandomTest.php | 2 +-
.../Component/Translation/Loader/JsonFileLoader.php | 2 +-
.../Component/Translation/Tests/TranslatorTest.php | 2 +-
26 files changed, 52 insertions(+), 52 deletions(-)
diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/TranslationDebugCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/TranslationDebugCommand.php
index 0f8ab152d9394..1773794dea5de 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Command/TranslationDebugCommand.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Command/TranslationDebugCommand.php
@@ -95,7 +95,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
);
foreach ($bundlePaths as $path) {
- $path = $path.'views';
+ $path .= 'views';
if (is_dir($path)) {
$this->getContainer()->get('translation.extractor')->extract($path, $extractedCatalogue);
}
@@ -104,7 +104,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
// Load defined messages
$currentCatalogue = new MessageCatalogue($locale);
foreach ($bundlePaths as $path) {
- $path = $path.'translations';
+ $path .= 'translations';
if (is_dir($path)) {
$loader->loadMessages($path, $currentCatalogue);
}
diff --git a/src/Symfony/Bundle/FrameworkBundle/Command/TranslationUpdateCommand.php b/src/Symfony/Bundle/FrameworkBundle/Command/TranslationUpdateCommand.php
index c2b29cbc18cf4..0e3cd824ec225 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Command/TranslationUpdateCommand.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Command/TranslationUpdateCommand.php
@@ -108,7 +108,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
$extractor = $this->getContainer()->get('translation.extractor');
$extractor->setPrefix($input->getOption('prefix'));
foreach ($transPaths as $path) {
- $path = $path.'views';
+ $path .= 'views';
if (is_dir($path)) {
$extractor->extract($path, $extractedCatalogue);
}
@@ -119,7 +119,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
$output->writeln('Loading translation files');
$loader = $this->getContainer()->get('translation.loader');
foreach ($transPaths as $path) {
- $path = $path.'translations';
+ $path .= 'translations';
if (is_dir($path)) {
$loader->loadMessages($path, $currentCatalogue);
}
@@ -168,7 +168,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
$output->writeln('Writing files');
$bundleTransPath = false;
foreach ($transPaths as $path) {
- $path = $path.'translations';
+ $path .= 'translations';
if (is_dir($path)) {
$bundleTransPath = $path;
}
diff --git a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/TextDescriptor.php b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/TextDescriptor.php
index 43297595df999..13ac2a2bb2f8e 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/TextDescriptor.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Console/Descriptor/TextDescriptor.php
@@ -174,7 +174,7 @@ protected function describeContainerServices(ContainerBuilder $builder, array $o
$serviceIds = isset($options['tag']) && $options['tag'] ? array_keys($builder->findTaggedServiceIds($options['tag'])) : $builder->getServiceIds();
$maxTags = array();
- foreach ($serviceIds as $key => $serviceId) {
+ foreach ($serviceIds as $key => $serviceId) {
$definition = $this->resolveServiceDefinition($builder, $serviceId);
if ($definition instanceof Definition) {
// filter out private services unless shown explicitly
@@ -212,7 +212,7 @@ protected function describeContainerServices(ContainerBuilder $builder, array $o
foreach ($definition->getTag($showTag) as $key => $tag) {
$tagValues = array();
foreach ($tagsNames as $tagName) {
- $tagValues[] = isset($tag[$tagName]) ? $tag[$tagName] : "";
+ $tagValues[] = isset($tag[$tagName]) ? $tag[$tagName] : '';
}
if (0 === $key) {
$table->addRow(array_merge(array($serviceId), $tagValues, array($definition->getClass())));
@@ -225,10 +225,10 @@ protected function describeContainerServices(ContainerBuilder $builder, array $o
}
} elseif ($definition instanceof Alias) {
$alias = $definition;
- $table->addRow(array_merge(array($serviceId, sprintf('alias for "%s"', $alias)), $tagsCount ? array_fill(0, $tagsCount, "") : array()));
+ $table->addRow(array_merge(array($serviceId, sprintf('alias for "%s"', $alias)), $tagsCount ? array_fill(0, $tagsCount, '') : array()));
} else {
// we have no information (happens with "service_container")
- $table->addRow(array_merge(array($serviceId, get_class($definition)), $tagsCount ? array_fill(0, $tagsCount, "") : array()));
+ $table->addRow(array_merge(array($serviceId, get_class($definition)), $tagsCount ? array_fill(0, $tagsCount, '') : array()));
}
}
@@ -245,7 +245,7 @@ protected function describeContainerDefinition(Definition $definition, array $op
: array();
$description[] = sprintf('Service Id %s', isset($options['id']) ? $options['id'] : '-');
- $description[] = sprintf('Class %s', $definition->getClass() ?: "-");
+ $description[] = sprintf('Class %s', $definition->getClass() ?: '-');
$tags = $definition->getTags();
if (count($tags)) {
@@ -269,7 +269,7 @@ protected function describeContainerDefinition(Definition $definition, array $op
$description[] = sprintf('Abstract %s', $definition->isAbstract() ? 'yes' : 'no');
if ($definition->getFile()) {
- $description[] = sprintf('Required File %s', $definition->getFile() ? $definition->getFile() : '-');
+ $description[] = sprintf('Required File %s', $definition->getFile() ?: '-');
}
if ($definition->getFactoryClass()) {
diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php
index ac536e8d88a4f..40c6950cf2642 100644
--- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php
+++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php
@@ -642,22 +642,22 @@ private function registerTranslatorConfiguration(array $config, ContainerBuilder
if (class_exists('Symfony\Component\Validator\Validator')) {
$r = new \ReflectionClass('Symfony\Component\Validator\Validator');
- $dirs[] = dirname($r->getFilename()).'/Resources/translations';
+ $dirs[] = dirname($r->getFileName()).'/Resources/translations';
}
if (class_exists('Symfony\Component\Form\Form')) {
$r = new \ReflectionClass('Symfony\Component\Form\Form');
- $dirs[] = dirname($r->getFilename()).'/Resources/translations';
+ $dirs[] = dirname($r->getFileName()).'/Resources/translations';
}
if (class_exists('Symfony\Component\Security\Core\Exception\AuthenticationException')) {
$r = new \ReflectionClass('Symfony\Component\Security\Core\Exception\AuthenticationException');
- $dirs[] = dirname($r->getFilename()).'/../Resources/translations';
+ $dirs[] = dirname($r->getFileName()).'/../Resources/translations';
}
$overridePath = $container->getParameter('kernel.root_dir').'/Resources/%s/translations';
foreach ($container->getParameter('kernel.bundles') as $bundle => $class) {
$reflection = new \ReflectionClass($class);
- if (is_dir($dir = dirname($reflection->getFilename()).'/Resources/translations')) {
+ if (is_dir($dir = dirname($reflection->getFileName()).'/Resources/translations')) {
$dirs[] = $dir;
}
if (is_dir($dir = sprintf($overridePath, $bundle))) {
@@ -775,7 +775,7 @@ private function getValidatorXmlMappingFiles(ContainerBuilder $container)
foreach ($container->getParameter('kernel.bundles') as $bundle) {
$reflection = new \ReflectionClass($bundle);
- if (is_file($file = dirname($reflection->getFilename()).'/Resources/config/validation.xml')) {
+ if (is_file($file = dirname($reflection->getFileName()).'/Resources/config/validation.xml')) {
$files[] = realpath($file);
$container->addResource(new FileResource($file));
}
@@ -790,7 +790,7 @@ private function getValidatorYamlMappingFiles(ContainerBuilder $container)
foreach ($container->getParameter('kernel.bundles') as $bundle) {
$reflection = new \ReflectionClass($bundle);
- if (is_file($file = dirname($reflection->getFilename()).'/Resources/config/validation.yml')) {
+ if (is_file($file = dirname($reflection->getFileName()).'/Resources/config/validation.yml')) {
$files[] = realpath($file);
$container->addResource(new FileResource($file));
}
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Command/CacheClearCommand/CacheClearCommandTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Command/CacheClearCommand/CacheClearCommandTest.php
index 78ab561df1dc4..745e015d57d68 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/Command/CacheClearCommand/CacheClearCommandTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Command/CacheClearCommand/CacheClearCommandTest.php
@@ -24,7 +24,7 @@ protected function setUp()
{
$this->fs = new Filesystem();
$this->kernel = new TestAppKernel('test', true);
- $this->rootDir = sys_get_temp_dir().DIRECTORY_SEPARATOR.uniqid('sf2_cache_');
+ $this->rootDir = sys_get_temp_dir().DIRECTORY_SEPARATOR.uniqid('sf2_cache_', true);
$this->kernel->setRootDir($this->rootDir);
$this->fs->mkdir($this->rootDir);
}
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Command/TranslationDebugCommandTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Command/TranslationDebugCommandTest.php
index aed3513d0c4fb..4ec50ebbe0758 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/Command/TranslationDebugCommandTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Command/TranslationDebugCommandTest.php
@@ -56,7 +56,7 @@ public function testNoDefinedMessages()
protected function setUp()
{
$this->fs = new Filesystem();
- $this->translationDir = sys_get_temp_dir().'/'.uniqid('sf2_translation');
+ $this->translationDir = sys_get_temp_dir().'/'.uniqid('sf2_translation', true);
$this->fs->mkdir($this->translationDir.'/Resources/translations');
$this->fs->mkdir($this->translationDir.'/Resources/views');
}
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Console/Descriptor/AbstractDescriptorTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Console/Descriptor/AbstractDescriptorTest.php
index 481744aac0a91..14a69e6736cc4 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/Console/Descriptor/AbstractDescriptorTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Console/Descriptor/AbstractDescriptorTest.php
@@ -98,7 +98,7 @@ public function getDescribeContainerParameterTestData()
{
$data = $this->getDescriptionTestData(ObjectsProvider::getContainerParameter());
- array_push($data[0], array('parameter' => 'database_name'));
+ $data[0][] = array('parameter' => 'database_name');
return $data;
}
diff --git a/src/Symfony/Bundle/SecurityBundle/DependencyInjection/MainConfiguration.php b/src/Symfony/Bundle/SecurityBundle/DependencyInjection/MainConfiguration.php
index a1522fefc0b5d..463a8890821ca 100644
--- a/src/Symfony/Bundle/SecurityBundle/DependencyInjection/MainConfiguration.php
+++ b/src/Symfony/Bundle/SecurityBundle/DependencyInjection/MainConfiguration.php
@@ -286,7 +286,7 @@ private function addFirewallsSection(ArrayNodeDefinition $rootNode, array $facto
->arrayNode('anonymous')
->canBeUnset()
->children()
- ->scalarNode('key')->defaultValue(uniqid())->end()
+ ->scalarNode('key')->defaultValue(uniqid('', true))->end()
->end()
->end()
->arrayNode('switch_user')
diff --git a/src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/UserProvider/InMemoryFactory.php b/src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/UserProvider/InMemoryFactory.php
index 5debce9adbdd8..b184385f221fa 100644
--- a/src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/UserProvider/InMemoryFactory.php
+++ b/src/Symfony/Bundle/SecurityBundle/DependencyInjection/Security/UserProvider/InMemoryFactory.php
@@ -54,7 +54,7 @@ public function addConfiguration(NodeDefinition $node)
->useAttributeAsKey('name')
->prototype('array')
->children()
- ->scalarNode('password')->defaultValue(uniqid())->end()
+ ->scalarNode('password')->defaultValue(uniqid('', true))->end()
->arrayNode('roles')
->beforeNormalization()->ifString()->then(function ($v) { return preg_split('/\s*,\s*/', $v); })->end()
->prototype('scalar')->end()
diff --git a/src/Symfony/Bundle/TwigBundle/Command/DebugCommand.php b/src/Symfony/Bundle/TwigBundle/Command/DebugCommand.php
index f98fc8d457ed5..2d1c71b1ade9a 100644
--- a/src/Symfony/Bundle/TwigBundle/Command/DebugCommand.php
+++ b/src/Symfony/Bundle/TwigBundle/Command/DebugCommand.php
@@ -18,7 +18,7 @@
use Symfony\Component\Console\Output\OutputInterface;
/**
- * Lists twig functions, filters, globals and tests present in the current project
+ * Lists twig functions, filters, globals and tests present in the current project.
*
* @author Jordi Boggiano
*/
@@ -111,7 +111,7 @@ private function getMetadata($type, $entity)
if ($type === 'functions' || $type === 'filters') {
$args = array();
$cb = $entity->getCallable();
- if (is_null($cb)) {
+ if (null === $cb) {
return;
}
if (is_array($cb)) {
diff --git a/src/Symfony/Bundle/TwigBundle/DependencyInjection/TwigExtension.php b/src/Symfony/Bundle/TwigBundle/DependencyInjection/TwigExtension.php
index 93a9a377289c7..466963ad3d6b3 100644
--- a/src/Symfony/Bundle/TwigBundle/DependencyInjection/TwigExtension.php
+++ b/src/Symfony/Bundle/TwigBundle/DependencyInjection/TwigExtension.php
@@ -75,7 +75,7 @@ public function load(array $configs, ContainerBuilder $container)
}
$reflection = new \ReflectionClass($class);
- if (is_dir($dir = dirname($reflection->getFilename()).'/Resources/views')) {
+ if (is_dir($dir = dirname($reflection->getFileName()).'/Resources/views')) {
$this->addTwigPath($twigFilesystemLoaderDefinition, $dir, $bundle);
}
}
diff --git a/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/TwigExtensionTest.php b/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/TwigExtensionTest.php
index 05d8dd20d4f14..9987f1a05d389 100644
--- a/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/TwigExtensionTest.php
+++ b/src/Symfony/Bundle/TwigBundle/Tests/DependencyInjection/TwigExtensionTest.php
@@ -156,10 +156,8 @@ public function testTwigLoaderPaths($format)
$def = $container->getDefinition('twig.loader.filesystem');
$paths = array();
foreach ($def->getMethodCalls() as $call) {
- if ('addPath' === $call[0]) {
- if (false === strpos($call[1][0], 'Form')) {
- $paths[] = $call[1];
- }
+ if ('addPath' === $call[0] && false === strpos($call[1][0], 'Form')) {
+ $paths[] = $call[1];
}
}
diff --git a/src/Symfony/Component/Config/Util/XmlUtils.php b/src/Symfony/Component/Config/Util/XmlUtils.php
index 2ef881df81c27..d8d4eaa3b17a1 100644
--- a/src/Symfony/Component/Config/Util/XmlUtils.php
+++ b/src/Symfony/Component/Config/Util/XmlUtils.php
@@ -196,7 +196,7 @@ public static function phpize($value)
return '0' == $value[0] ? octdec($value) : (((string) $raw === (string) $cast) ? $cast : $raw);
case isset($value[1]) && '-' === $value[0] && ctype_digit(substr($value, 1)):
$raw = $value;
- $cast = intval($value);
+ $cast = (int) $value;
return '0' == $value[1] ? octdec($value) : (((string) $raw === (string) $cast) ? $cast : $raw);
case 'true' === $lowercaseValue:
diff --git a/src/Symfony/Component/Console/Helper/ProgressBar.php b/src/Symfony/Component/Console/Helper/ProgressBar.php
index 893664e412f54..1cae64b6e5f65 100644
--- a/src/Symfony/Component/Console/Helper/ProgressBar.php
+++ b/src/Symfony/Component/Console/Helper/ProgressBar.php
@@ -370,7 +370,7 @@ public function setCurrent($step)
}
/**
- * Sets whether to overwrite the progressbar, false for new line
+ * Sets whether to overwrite the progressbar, false for new line.
*
* @param bool $overwrite
*/
@@ -397,8 +397,8 @@ public function setProgress($step)
$this->max = $step;
}
- $prevPeriod = intval($this->step / $this->redrawFreq);
- $currPeriod = intval($step / $this->redrawFreq);
+ $prevPeriod = (int) ($this->step / $this->redrawFreq);
+ $currPeriod = (int) ($step / $this->redrawFreq);
$this->step = $step;
$this->percent = $this->max ? (float) $this->step / $this->max : 0;
if ($prevPeriod !== $currPeriod || $this->max === $step) {
diff --git a/src/Symfony/Component/Console/Question/ChoiceQuestion.php b/src/Symfony/Component/Console/Question/ChoiceQuestion.php
index e1da7a8c5e3a4..7a67e4c3a31c9 100644
--- a/src/Symfony/Component/Console/Question/ChoiceQuestion.php
+++ b/src/Symfony/Component/Console/Question/ChoiceQuestion.php
@@ -137,7 +137,8 @@ private function getDefaultValidator()
if (empty($choices[$value])) {
throw new \InvalidArgumentException(sprintf($errorMessage, $value));
}
- array_push($multiselectChoices, $choices[$value]);
+
+ $multiselectChoices[] = $choices[$value];
}
if ($multiselect) {
diff --git a/src/Symfony/Component/Debug/DebugClassLoader.php b/src/Symfony/Component/Debug/DebugClassLoader.php
index b70a4c4ac3d24..a82f101b22e7c 100644
--- a/src/Symfony/Component/Debug/DebugClassLoader.php
+++ b/src/Symfony/Component/Debug/DebugClassLoader.php
@@ -37,6 +37,7 @@ class DebugClassLoader
* @param callable|object $classLoader
*
* @api
+ *
* @deprecated since 2.5, passing an object is deprecated and support for it will be removed in 3.0
*/
public function __construct($classLoader)
@@ -69,7 +70,7 @@ public function getClassLoader()
}
/**
- * Wraps all autoloaders
+ * Wraps all autoloaders.
*/
public static function enable()
{
@@ -117,7 +118,7 @@ public static function disable()
}
/**
- * Finds a file by class name
+ * Finds a file by class name.
*
* @param string $class A class name to resolve to file
*
@@ -187,7 +188,7 @@ public function loadClass($class)
}
if (self::$caseCheck && preg_match('#([/\\\\][a-zA-Z_\x7F-\xFF][a-zA-Z0-9_\x7F-\xFF]*)+\.(php|hh)$#D', $file, $tail)) {
$tail = $tail[0];
- $real = $refl->getFilename();
+ $real = $refl->getFileName();
if (2 === self::$caseCheck) {
// realpath() on MacOSX doesn't normalize the case of characters
diff --git a/src/Symfony/Component/Debug/Tests/DebugClassLoaderTest.php b/src/Symfony/Component/Debug/Tests/DebugClassLoaderTest.php
index 8435397f66bb3..9c4e23a2c538e 100644
--- a/src/Symfony/Component/Debug/Tests/DebugClassLoaderTest.php
+++ b/src/Symfony/Component/Debug/Tests/DebugClassLoaderTest.php
@@ -112,10 +112,10 @@ class ChildTestingStacking extends TestingStacking { function foo($bar) {} }
restore_exception_handler();
$this->assertStringStartsWith(__FILE__, $exception->getFile());
if (PHP_VERSION_ID < 70000) {
- $this->assertRegexp('/^Runtime Notice: Declaration/', $exception->getMessage());
+ $this->assertRegExp('/^Runtime Notice: Declaration/', $exception->getMessage());
$this->assertEquals(E_STRICT, $exception->getSeverity());
} else {
- $this->assertRegexp('/^Warning: Declaration/', $exception->getMessage());
+ $this->assertRegExp('/^Warning: Declaration/', $exception->getMessage());
$this->assertEquals(E_WARNING, $exception->getSeverity());
}
} catch (\Exception $exception) {
diff --git a/src/Symfony/Component/Debug/Tests/ErrorHandlerTest.php b/src/Symfony/Component/Debug/Tests/ErrorHandlerTest.php
index 033b1c7f727f8..3b0cc7bdfa549 100644
--- a/src/Symfony/Component/Debug/Tests/ErrorHandlerTest.php
+++ b/src/Symfony/Component/Debug/Tests/ErrorHandlerTest.php
@@ -77,7 +77,7 @@ public function testNotice()
$this->assertEquals(E_NOTICE, $exception->getSeverity());
$this->assertEquals(__FILE__, $exception->getFile());
- $this->assertRegexp('/^Notice: Undefined variable: (foo|bar)/', $exception->getMessage());
+ $this->assertRegExp('/^Notice: Undefined variable: (foo|bar)/', $exception->getMessage());
$this->assertArrayHasKey('foobar', $exception->getContext());
$trace = $exception->getTrace();
diff --git a/src/Symfony/Component/Debug/Tests/FatalErrorHandler/ClassNotFoundFatalErrorHandlerTest.php b/src/Symfony/Component/Debug/Tests/FatalErrorHandler/ClassNotFoundFatalErrorHandlerTest.php
index 6ac3374d8e2c7..26eeede026605 100644
--- a/src/Symfony/Component/Debug/Tests/FatalErrorHandler/ClassNotFoundFatalErrorHandlerTest.php
+++ b/src/Symfony/Component/Debug/Tests/FatalErrorHandler/ClassNotFoundFatalErrorHandlerTest.php
@@ -61,7 +61,7 @@ public function testHandleClassNotFound($error, $translatedMessage, $autoloader
array_map('spl_autoload_register', $autoloaders);
}
- $this->assertInstanceof('Symfony\Component\Debug\Exception\ClassNotFoundException', $exception);
+ $this->assertInstanceOf('Symfony\Component\Debug\Exception\ClassNotFoundException', $exception);
$this->assertSame($translatedMessage, $exception->getMessage());
$this->assertSame($error['type'], $exception->getSeverity());
$this->assertSame($error['file'], $exception->getFile());
@@ -197,6 +197,6 @@ public function testCannotRedeclareClass()
$handler = new ClassNotFoundFatalErrorHandler();
$exception = $handler->handleError($error, new FatalErrorException('', 0, $error['type'], $error['file'], $error['line']));
- $this->assertInstanceof('Symfony\Component\Debug\Exception\ClassNotFoundException', $exception);
+ $this->assertInstanceOf('Symfony\Component\Debug\Exception\ClassNotFoundException', $exception);
}
}
diff --git a/src/Symfony/Component/Debug/Tests/FatalErrorHandler/UndefinedFunctionFatalErrorHandlerTest.php b/src/Symfony/Component/Debug/Tests/FatalErrorHandler/UndefinedFunctionFatalErrorHandlerTest.php
index ffe9edb062f5a..795b74781c23a 100644
--- a/src/Symfony/Component/Debug/Tests/FatalErrorHandler/UndefinedFunctionFatalErrorHandlerTest.php
+++ b/src/Symfony/Component/Debug/Tests/FatalErrorHandler/UndefinedFunctionFatalErrorHandlerTest.php
@@ -24,7 +24,7 @@ public function testUndefinedFunction($error, $translatedMessage)
$handler = new UndefinedFunctionFatalErrorHandler();
$exception = $handler->handleError($error, new FatalErrorException('', 0, $error['type'], $error['file'], $error['line']));
- $this->assertInstanceof('Symfony\Component\Debug\Exception\UndefinedFunctionException', $exception);
+ $this->assertInstanceOf('Symfony\Component\Debug\Exception\UndefinedFunctionException', $exception);
// class names are case insensitive and PHP/HHVM do not return the same
$this->assertSame(strtolower($translatedMessage), strtolower($exception->getMessage()));
$this->assertSame($error['type'], $exception->getSeverity());
diff --git a/src/Symfony/Component/Debug/Tests/FatalErrorHandler/UndefinedMethodFatalErrorHandlerTest.php b/src/Symfony/Component/Debug/Tests/FatalErrorHandler/UndefinedMethodFatalErrorHandlerTest.php
index 7837d1daa67f5..794bf4c3abdba 100644
--- a/src/Symfony/Component/Debug/Tests/FatalErrorHandler/UndefinedMethodFatalErrorHandlerTest.php
+++ b/src/Symfony/Component/Debug/Tests/FatalErrorHandler/UndefinedMethodFatalErrorHandlerTest.php
@@ -24,7 +24,7 @@ public function testUndefinedMethod($error, $translatedMessage)
$handler = new UndefinedMethodFatalErrorHandler();
$exception = $handler->handleError($error, new FatalErrorException('', 0, $error['type'], $error['file'], $error['line']));
- $this->assertInstanceof('Symfony\Component\Debug\Exception\UndefinedMethodException', $exception);
+ $this->assertInstanceOf('Symfony\Component\Debug\Exception\UndefinedMethodException', $exception);
$this->assertSame($translatedMessage, $exception->getMessage());
$this->assertSame($error['type'], $exception->getSeverity());
$this->assertSame($error['file'], $exception->getFile());
diff --git a/src/Symfony/Component/Filesystem/Tests/FilesystemTestCase.php b/src/Symfony/Component/Filesystem/Tests/FilesystemTestCase.php
index 80cd57e809673..74802fc31403a 100644
--- a/src/Symfony/Component/Filesystem/Tests/FilesystemTestCase.php
+++ b/src/Symfony/Component/Filesystem/Tests/FilesystemTestCase.php
@@ -16,7 +16,7 @@ class FilesystemTestCase extends \PHPUnit_Framework_TestCase
private $umask;
/**
- * @var string $workspace
+ * @var string
*/
protected $workspace = null;
@@ -40,7 +40,7 @@ public static function setUpBeforeClass()
protected function setUp()
{
$this->umask = umask(0);
- $this->workspace = rtrim(sys_get_temp_dir(), DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR.time().rand(0, 1000);
+ $this->workspace = rtrim(sys_get_temp_dir(), DIRECTORY_SEPARATOR).DIRECTORY_SEPARATOR.time().mt_rand(0, 1000);
mkdir($this->workspace, 0777, true);
$this->workspace = realpath($this->workspace);
}
diff --git a/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/PdoSessionHandler.php b/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/PdoSessionHandler.php
index 32b73968db686..48e81ee0f1d30 100644
--- a/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/PdoSessionHandler.php
+++ b/src/Symfony/Component/HttpFoundation/Session/Storage/Handler/PdoSessionHandler.php
@@ -126,7 +126,7 @@ class PdoSessionHandler implements \SessionHandlerInterface
private $lockMode = self::LOCK_TRANSACTIONAL;
/**
- * It's an array to support multiple reads before closing which is manual, non-standard usage
+ * It's an array to support multiple reads before closing which is manual, non-standard usage.
*
* @var \PDOStatement[] An array of statements to release advisory locks
*/
@@ -483,7 +483,7 @@ private function rollback()
if ('sqlite' === $this->driver) {
$this->pdo->exec('ROLLBACK');
} else {
- $this->pdo->rollback();
+ $this->pdo->rollBack();
}
$this->inTransaction = false;
}
@@ -680,7 +680,7 @@ private function getMergeSql()
}
/**
- * Return a PDO instance
+ * Return a PDO instance.
*
* @return \PDO
*/
diff --git a/src/Symfony/Component/Security/Core/Tests/Util/SecureRandomTest.php b/src/Symfony/Component/Security/Core/Tests/Util/SecureRandomTest.php
index 666af30d496b0..2e94cc14badd0 100644
--- a/src/Symfony/Component/Security/Core/Tests/Util/SecureRandomTest.php
+++ b/src/Symfony/Component/Security/Core/Tests/Util/SecureRandomTest.php
@@ -138,7 +138,7 @@ public function testLongRun($secureRandom)
*/
public function testSerialCorrelation($secureRandom)
{
- $shift = rand(1, 5000);
+ $shift = mt_rand(1, 5000);
$b = $this->getBitSequence($secureRandom, 20000);
$Z = 0;
diff --git a/src/Symfony/Component/Translation/Loader/JsonFileLoader.php b/src/Symfony/Component/Translation/Loader/JsonFileLoader.php
index 09138835a6070..81717f3d9418f 100644
--- a/src/Symfony/Component/Translation/Loader/JsonFileLoader.php
+++ b/src/Symfony/Component/Translation/Loader/JsonFileLoader.php
@@ -20,7 +20,7 @@
*
* @author singles
*/
-class JsonFileLoader extends ArrayLoader implements LoaderInterface
+class JsonFileLoader extends ArrayLoader
{
/**
* {@inheritdoc}
diff --git a/src/Symfony/Component/Translation/Tests/TranslatorTest.php b/src/Symfony/Component/Translation/Tests/TranslatorTest.php
index 3ee9be019dd25..cb361831883e9 100644
--- a/src/Symfony/Component/Translation/Tests/TranslatorTest.php
+++ b/src/Symfony/Component/Translation/Tests/TranslatorTest.php
@@ -502,7 +502,7 @@ public function testTransChoiceFallbackWithNoTranslation()
public function testGetMessages($resources, $locale, $expected)
{
$locales = array_keys($resources);
- $_locale = !is_null($locale) ? $locale : reset($locales);
+ $_locale = null !== $locale ? $locale : reset($locales);
$locales = array_slice($locales, 0, array_search($_locale, $locales));
$translator = new Translator($_locale, new MessageSelector());
From 2f4280110d46158e86d4567255c4cf26e3409667 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?K=C3=A9vin=20Dunglas?=
Date: Thu, 2 Jul 2015 12:39:07 +0200
Subject: [PATCH 0021/3475] [Serializer] Fix ClassMetadata::sleep()
---
.../Serializer/Mapping/ClassMetadata.php | 2 +-
.../Tests/Mapping/AttributeMetadataTest.php | 10 ++++++++++
.../Tests/Mapping/ClassMetadataTest.php | 17 +++++++++++++++++
3 files changed, 28 insertions(+), 1 deletion(-)
diff --git a/src/Symfony/Component/Serializer/Mapping/ClassMetadata.php b/src/Symfony/Component/Serializer/Mapping/ClassMetadata.php
index 3794a7451b55e..55ddf52a64bb5 100644
--- a/src/Symfony/Component/Serializer/Mapping/ClassMetadata.php
+++ b/src/Symfony/Component/Serializer/Mapping/ClassMetadata.php
@@ -110,7 +110,7 @@ public function __sleep()
{
return array(
'name',
- 'attributes',
+ 'attributesMetadata',
);
}
}
diff --git a/src/Symfony/Component/Serializer/Tests/Mapping/AttributeMetadataTest.php b/src/Symfony/Component/Serializer/Tests/Mapping/AttributeMetadataTest.php
index f22746bc5de75..4a32831cb698d 100644
--- a/src/Symfony/Component/Serializer/Tests/Mapping/AttributeMetadataTest.php
+++ b/src/Symfony/Component/Serializer/Tests/Mapping/AttributeMetadataTest.php
@@ -54,4 +54,14 @@ public function testMerge()
$this->assertEquals(array('a', 'b', 'c'), $attributeMetadata1->getGroups());
}
+
+ public function testSerialize()
+ {
+ $attributeMetadata = new AttributeMetadata('attribute');
+ $attributeMetadata->addGroup('a');
+ $attributeMetadata->addGroup('b');
+
+ $serialized = serialize($attributeMetadata);
+ $this->assertEquals($attributeMetadata, unserialize($serialized));
+ }
}
diff --git a/src/Symfony/Component/Serializer/Tests/Mapping/ClassMetadataTest.php b/src/Symfony/Component/Serializer/Tests/Mapping/ClassMetadataTest.php
index 90017580ac703..629c17b788d23 100644
--- a/src/Symfony/Component/Serializer/Tests/Mapping/ClassMetadataTest.php
+++ b/src/Symfony/Component/Serializer/Tests/Mapping/ClassMetadataTest.php
@@ -62,4 +62,21 @@ public function testMerge()
$this->assertEquals(array('a1' => $ac1), $classMetadata2->getAttributesMetadata());
}
+
+ public function testSerialize()
+ {
+ $classMetadata = new ClassMetadata('a');
+
+ $a1 = $this->getMock('Symfony\Component\Serializer\Mapping\AttributeMetadataInterface');
+ $a1->method('getName')->willReturn('b1');
+
+ $a2 = $this->getMock('Symfony\Component\Serializer\Mapping\AttributeMetadataInterface');
+ $a2->method('getName')->willReturn('b2');
+
+ $classMetadata->addAttributeMetadata($a1);
+ $classMetadata->addAttributeMetadata($a2);
+
+ $serialized = serialize($classMetadata);
+ $this->assertEquals($classMetadata, unserialize($serialized));
+ }
}
From eda5cb1c271ff7be919d8311a9032a6558436676 Mon Sep 17 00:00:00 2001
From: Jakub Zalas
Date: Wed, 8 Jul 2015 18:59:03 +0100
Subject: [PATCH 0022/3475] [HttpFoundation] Add a test case to confirm a bug
in session migration
---
.../Session/Storage/NativeSessionStorageTest.php | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/NativeSessionStorageTest.php b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/NativeSessionStorageTest.php
index 851e6752b0da8..c8743aba943ec 100644
--- a/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/NativeSessionStorageTest.php
+++ b/src/Symfony/Component/HttpFoundation/Tests/Session/Storage/NativeSessionStorageTest.php
@@ -119,6 +119,17 @@ public function testRegenerateDestroy()
$this->assertEquals(11, $storage->getBag('attributes')->get('legs'));
}
+ public function testSessionGlobalIsUpToDateAfterIdRegeneration()
+ {
+ $storage = $this->getStorage();
+ $storage->start();
+ $storage->getBag('attributes')->set('lucky', 7);
+ $storage->regenerate();
+ $storage->getBag('attributes')->set('lucky', 42);
+
+ $this->assertEquals(42, $_SESSION['_sf2_attributes']['lucky']);
+ }
+
public function testDefaultSessionCacheLimiter()
{
$this->iniSet('session.cache_limiter', 'nocache');
From 99b9c78b0034194d8ee27b9917e4d01fac8fb47f Mon Sep 17 00:00:00 2001
From: Jakub Zalas
Date: Wed, 8 Jul 2015 20:32:24 +0100
Subject: [PATCH 0023/3475] [HttpFoundation] Reload the session after
regenerating its id
---
.../Session/Storage/NativeSessionStorage.php | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php b/src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php
index a5bdbe91d8f05..db705db87c48f 100644
--- a/src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php
+++ b/src/Symfony/Component/HttpFoundation/Session/Storage/NativeSessionStorage.php
@@ -203,7 +203,13 @@ public function regenerate($destroy = false, $lifetime = null)
$this->metadataBag->stampNew();
}
- return session_regenerate_id($destroy);
+ $isRegenerated = session_regenerate_id($destroy);
+
+ // The reference to $_SESSION in session bags is lost in PHP7 and we need to re-create it.
+ // @see https://bugs.php.net/bug.php?id=70013
+ $this->loadSession();
+
+ return $isRegenerated;
}
/**
From fe4246aaa0fb861e312ae1e6d756393ea2448dc5 Mon Sep 17 00:00:00 2001
From: Giorgio Premi
Date: Fri, 10 Apr 2015 16:44:40 +0200
Subject: [PATCH 0024/3475] [DoctrineBridge][Form] Fix EntityChoiceList when
indexing by primary foreign key
---
.../Form/ChoiceList/EntityChoiceList.php | 97 ++++++++++++++++---
.../SingleAssociationToIntIdEntity.php | 38 ++++++++
...ChoiceListSingleAssociationToIntIdTest.php | 86 ++++++++++++++++
.../AbstractEntityChoiceListTest.php | 7 +-
...ChoiceListSingleAssociationToIntIdTest.php | 32 ++++++
...ChoiceListSingleAssociationToIntIdTest.php | 32 ++++++
...AssociationToIntIdWithQueryBuilderTest.php | 33 +++++++
7 files changed, 310 insertions(+), 15 deletions(-)
create mode 100644 src/Symfony/Bridge/Doctrine/Tests/Fixtures/SingleAssociationToIntIdEntity.php
create mode 100644 src/Symfony/Bridge/Doctrine/Tests/Form/ChoiceList/AbstractEntityChoiceListSingleAssociationToIntIdTest.php
create mode 100644 src/Symfony/Bridge/Doctrine/Tests/Form/ChoiceList/LoadedEntityChoiceListSingleAssociationToIntIdTest.php
create mode 100644 src/Symfony/Bridge/Doctrine/Tests/Form/ChoiceList/UnloadedEntityChoiceListSingleAssociationToIntIdTest.php
create mode 100644 src/Symfony/Bridge/Doctrine/Tests/Form/ChoiceList/UnloadedEntityChoiceListSingleAssociationToIntIdWithQueryBuilderTest.php
diff --git a/src/Symfony/Bridge/Doctrine/Form/ChoiceList/EntityChoiceList.php b/src/Symfony/Bridge/Doctrine/Form/ChoiceList/EntityChoiceList.php
index 964fbdc9354ac..976393e74b51f 100644
--- a/src/Symfony/Bridge/Doctrine/Form/ChoiceList/EntityChoiceList.php
+++ b/src/Symfony/Bridge/Doctrine/Form/ChoiceList/EntityChoiceList.php
@@ -40,6 +40,13 @@ class EntityChoiceList extends ObjectChoiceList
*/
private $classMetadata;
+ /**
+ * Metadata for target class of primary key association.
+ *
+ * @var ClassMetadata
+ */
+ private $idClassMetadata;
+
/**
* Contains the query builder that builds the query for fetching the
* entities.
@@ -107,16 +114,21 @@ public function __construct(ObjectManager $manager, $class, $labelPath = null, E
$this->class = $this->classMetadata->getName();
$this->loaded = is_array($entities) || $entities instanceof \Traversable;
$this->preferredEntities = $preferredEntities;
+ list(
+ $this->idAsIndex,
+ $this->idAsValue,
+ $this->idField
+ ) = $this->getIdentifierInfoForClass($this->classMetadata);
+
+ if (null !== $this->idField && $this->classMetadata->hasAssociation($this->idField)) {
+ $this->idClassMetadata = $this->em->getClassMetadata(
+ $this->classMetadata->getAssociationTargetClass($this->idField)
+ );
- $identifier = $this->classMetadata->getIdentifierFieldNames();
-
- if (1 === count($identifier)) {
- $this->idField = $identifier[0];
- $this->idAsValue = true;
-
- if (in_array($this->classMetadata->getTypeOfField($this->idField), array('integer', 'smallint', 'bigint'))) {
- $this->idAsIndex = true;
- }
+ list(
+ $this->idAsIndex,
+ $this->idAsValue
+ ) = $this->getIdentifierInfoForClass($this->idClassMetadata);
}
if (!$this->loaded) {
@@ -228,7 +240,7 @@ public function getChoicesForValues(array $values)
// "INDEX BY" clause to the Doctrine query in the loader,
// but I'm not sure whether that's doable in a generic fashion.
foreach ($unorderedEntities as $entity) {
- $value = $this->fixValue(current($this->getIdentifierValues($entity)));
+ $value = $this->fixValue($this->getSingleIdentifierValue($entity));
$entitiesByValue[$value] = $entity;
}
@@ -274,7 +286,7 @@ public function getValuesForChoices(array $entities)
foreach ($entities as $i => $entity) {
if ($entity instanceof $this->class) {
// Make sure to convert to the right format
- $values[$i] = $this->fixValue(current($this->getIdentifierValues($entity)));
+ $values[$i] = $this->fixValue($this->getSingleIdentifierValue($entity));
}
}
@@ -314,7 +326,7 @@ public function getIndicesForChoices(array $entities)
foreach ($entities as $i => $entity) {
if ($entity instanceof $this->class) {
// Make sure to convert to the right format
- $indices[$i] = $this->fixIndex(current($this->getIdentifierValues($entity)));
+ $indices[$i] = $this->fixIndex($this->getSingleIdentifierValue($entity));
}
}
@@ -372,7 +384,7 @@ public function getIndicesForValues(array $values)
protected function createIndex($entity)
{
if ($this->idAsIndex) {
- return $this->fixIndex(current($this->getIdentifierValues($entity)));
+ return $this->fixIndex($this->getSingleIdentifierValue($entity));
}
return parent::createIndex($entity);
@@ -392,7 +404,7 @@ protected function createIndex($entity)
protected function createValue($entity)
{
if ($this->idAsValue) {
- return (string) current($this->getIdentifierValues($entity));
+ return (string) $this->getSingleIdentifierValue($entity);
}
return parent::createValue($entity);
@@ -415,6 +427,36 @@ protected function fixIndex($index)
return $index;
}
+ /**
+ * Get identifier information for a class.
+ *
+ * @param ClassMetadata $classMetadata The entity metadata
+ *
+ * @return array Return an array with idAsIndex, idAsValue and identifier
+ */
+ private function getIdentifierInfoForClass(ClassMetadata $classMetadata)
+ {
+ $identifier = null;
+ $idAsIndex = false;
+ $idAsValue = false;
+
+ $identifiers = $classMetadata->getIdentifierFieldNames();
+
+ if (1 === count($identifiers)) {
+ $identifier = $identifiers[0];
+
+ if (!$classMetadata->hasAssociation($identifier)) {
+ $idAsValue = true;
+
+ if (in_array($classMetadata->getTypeOfField($identifier), array('integer', 'smallint', 'bigint'))) {
+ $idAsIndex = true;
+ }
+ }
+ }
+
+ return array($idAsIndex, $idAsValue, $identifier);
+ }
+
/**
* Loads the list with entities.
*
@@ -438,6 +480,33 @@ private function load()
$this->loaded = true;
}
+ /**
+ * Returns the first (and only) value of the identifier fields of an entity.
+ *
+ * Doctrine must know about this entity, that is, the entity must already
+ * be persisted or added to the identity map before. Otherwise an
+ * exception is thrown.
+ *
+ * @param object $entity The entity for which to get the identifier
+ *
+ * @return array The identifier values
+ *
+ * @throws RuntimeException If the entity does not exist in Doctrine's identity map
+ */
+ private function getSingleIdentifierValue($entity)
+ {
+ $value = current($this->getIdentifierValues($entity));
+
+ if ($this->idClassMetadata) {
+ $class = $this->idClassMetadata->getName();
+ if ($value instanceof $class) {
+ $value = current($this->idClassMetadata->getIdentifierValues($value));
+ }
+ }
+
+ return $value;
+ }
+
/**
* Returns the values of the identifier fields of an entity.
*
diff --git a/src/Symfony/Bridge/Doctrine/Tests/Fixtures/SingleAssociationToIntIdEntity.php b/src/Symfony/Bridge/Doctrine/Tests/Fixtures/SingleAssociationToIntIdEntity.php
new file mode 100644
index 0000000000000..954de338d3ca3
--- /dev/null
+++ b/src/Symfony/Bridge/Doctrine/Tests/Fixtures/SingleAssociationToIntIdEntity.php
@@ -0,0 +1,38 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Bridge\Doctrine\Tests\Fixtures;
+
+use Doctrine\ORM\Mapping\Id;
+use Doctrine\ORM\Mapping\Column;
+use Doctrine\ORM\Mapping\Entity;
+use Doctrine\ORM\Mapping\OneToOne;
+
+/** @Entity */
+class SingleAssociationToIntIdEntity
+{
+ /** @Id @OneToOne(targetEntity="SingleIntIdNoToStringEntity", cascade={"ALL"}) */
+ protected $entity;
+
+ /** @Column(type="string", nullable=true) */
+ public $name;
+
+ public function __construct(SingleIntIdNoToStringEntity $entity, $name)
+ {
+ $this->entity = $entity;
+ $this->name = $name;
+ }
+
+ public function __toString()
+ {
+ return (string) $this->name;
+ }
+}
diff --git a/src/Symfony/Bridge/Doctrine/Tests/Form/ChoiceList/AbstractEntityChoiceListSingleAssociationToIntIdTest.php b/src/Symfony/Bridge/Doctrine/Tests/Form/ChoiceList/AbstractEntityChoiceListSingleAssociationToIntIdTest.php
new file mode 100644
index 0000000000000..80710828e6c45
--- /dev/null
+++ b/src/Symfony/Bridge/Doctrine/Tests/Form/ChoiceList/AbstractEntityChoiceListSingleAssociationToIntIdTest.php
@@ -0,0 +1,86 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Bridge\Doctrine\Tests\Form\ChoiceList;
+
+use Symfony\Bridge\Doctrine\Tests\Fixtures\SingleAssociationToIntIdEntity;
+use Symfony\Bridge\Doctrine\Tests\Fixtures\SingleIntIdNoToStringEntity;
+use Symfony\Bridge\Doctrine\Form\ChoiceList\EntityChoiceList;
+
+/**
+ * Test choices generated from an entity with a primary foreign key.
+ *
+ * @author Premi Giorgio
+ * @author Bernhard Schussek
+ */
+abstract class AbstractEntityChoiceListSingleAssociationToIntIdTest extends AbstractEntityChoiceListTest
+{
+ protected function getEntityClass()
+ {
+ return 'Symfony\Bridge\Doctrine\Tests\Fixtures\SingleAssociationToIntIdEntity';
+ }
+
+ protected function getClassesMetadata()
+ {
+ return array(
+ $this->em->getClassMetadata($this->getEntityClass()),
+ $this->em->getClassMetadata('Symfony\Bridge\Doctrine\Tests\Fixtures\SingleIntIdNoToStringEntity'),
+ );
+ }
+
+ protected function createChoiceList()
+ {
+ return new EntityChoiceList($this->em, $this->getEntityClass(), 'name');
+ }
+
+ /**
+ * @return \Symfony\Component\Form\Extension\Core\ChoiceList\ChoiceListInterface
+ */
+ protected function createObjects()
+ {
+ $innerA = new SingleIntIdNoToStringEntity(-10, 'inner_A');
+ $innerB = new SingleIntIdNoToStringEntity(10, 'inner_B');
+ $innerC = new SingleIntIdNoToStringEntity(20, 'inner_C');
+ $innerD = new SingleIntIdNoToStringEntity(30, 'inner_D');
+
+ $this->em->persist($innerA);
+ $this->em->persist($innerB);
+ $this->em->persist($innerC);
+ $this->em->persist($innerD);
+
+ return array(
+ new SingleAssociationToIntIdEntity($innerA, 'A'),
+ new SingleAssociationToIntIdEntity($innerB, 'B'),
+ new SingleAssociationToIntIdEntity($innerC, 'C'),
+ new SingleAssociationToIntIdEntity($innerD, 'D'),
+ );
+ }
+
+ protected function getChoices()
+ {
+ return array('_10' => $this->obj1, 10 => $this->obj2, 20 => $this->obj3, 30 => $this->obj4);
+ }
+
+ protected function getLabels()
+ {
+ return array('_10' => 'A', 10 => 'B', 20 => 'C', 30 => 'D');
+ }
+
+ protected function getValues()
+ {
+ return array('_10' => '-10', 10 => '10', 20 => '20', 30 => '30');
+ }
+
+ protected function getIndices()
+ {
+ return array('_10', 10, 20, 30);
+ }
+}
diff --git a/src/Symfony/Bridge/Doctrine/Tests/Form/ChoiceList/AbstractEntityChoiceListTest.php b/src/Symfony/Bridge/Doctrine/Tests/Form/ChoiceList/AbstractEntityChoiceListTest.php
index 2b8bedf15b23a..4f3d54a30f15f 100644
--- a/src/Symfony/Bridge/Doctrine/Tests/Form/ChoiceList/AbstractEntityChoiceListTest.php
+++ b/src/Symfony/Bridge/Doctrine/Tests/Form/ChoiceList/AbstractEntityChoiceListTest.php
@@ -39,7 +39,7 @@ protected function setUp()
$this->em = DoctrineTestHelper::createTestEntityManager();
$schemaTool = new SchemaTool($this->em);
- $classes = array($this->em->getClassMetadata($this->getEntityClass()));
+ $classes = $this->getClassesMetadata();
try {
$schemaTool->dropSchema($classes);
@@ -73,6 +73,11 @@ abstract protected function getEntityClass();
abstract protected function createObjects();
+ protected function getClassesMetadata()
+ {
+ return array($this->em->getClassMetadata($this->getEntityClass()));
+ }
+
/**
* @return \Symfony\Component\Form\Extension\Core\ChoiceList\ChoiceListInterface
*/
diff --git a/src/Symfony/Bridge/Doctrine/Tests/Form/ChoiceList/LoadedEntityChoiceListSingleAssociationToIntIdTest.php b/src/Symfony/Bridge/Doctrine/Tests/Form/ChoiceList/LoadedEntityChoiceListSingleAssociationToIntIdTest.php
new file mode 100644
index 0000000000000..e16be91f46919
--- /dev/null
+++ b/src/Symfony/Bridge/Doctrine/Tests/Form/ChoiceList/LoadedEntityChoiceListSingleAssociationToIntIdTest.php
@@ -0,0 +1,32 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Bridge\Doctrine\Tests\Form\ChoiceList;
+
+/**
+ * @author Premi Giorgio
+ * @author Bernhard Schussek
+ */
+class LoadedEntityChoiceListSingleAssociationToIntIdTest extends AbstractEntityChoiceListSingleAssociationToIntIdTest
+{
+ /**
+ * @return \Symfony\Component\Form\Extension\Core\ChoiceList\ChoiceListInterface
+ */
+ protected function createChoiceList()
+ {
+ $list = parent::createChoiceList();
+
+ // load list
+ $list->getChoices();
+
+ return $list;
+ }
+}
diff --git a/src/Symfony/Bridge/Doctrine/Tests/Form/ChoiceList/UnloadedEntityChoiceListSingleAssociationToIntIdTest.php b/src/Symfony/Bridge/Doctrine/Tests/Form/ChoiceList/UnloadedEntityChoiceListSingleAssociationToIntIdTest.php
new file mode 100644
index 0000000000000..00a4f545aaf48
--- /dev/null
+++ b/src/Symfony/Bridge/Doctrine/Tests/Form/ChoiceList/UnloadedEntityChoiceListSingleAssociationToIntIdTest.php
@@ -0,0 +1,32 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Bridge\Doctrine\Tests\Form\ChoiceList;
+
+/**
+ * @author Premi Giorgio
+ * @author Bernhard Schussek
+ */
+class UnloadedEntityChoiceListSingleAssociationToIntIdTest extends AbstractEntityChoiceListSingleAssociationToIntIdTest
+{
+ public function testGetIndicesForValuesIgnoresNonExistingValues()
+ {
+ $this->markTestSkipped('Non-existing values are not detected for unloaded choice lists.');
+ }
+
+ /**
+ * @group legacy
+ */
+ public function testLegacyGetIndicesForValuesIgnoresNonExistingValues()
+ {
+ $this->markTestSkipped('Non-existing values are not detected for unloaded choice lists.');
+ }
+}
diff --git a/src/Symfony/Bridge/Doctrine/Tests/Form/ChoiceList/UnloadedEntityChoiceListSingleAssociationToIntIdWithQueryBuilderTest.php b/src/Symfony/Bridge/Doctrine/Tests/Form/ChoiceList/UnloadedEntityChoiceListSingleAssociationToIntIdWithQueryBuilderTest.php
new file mode 100644
index 0000000000000..4cad380552902
--- /dev/null
+++ b/src/Symfony/Bridge/Doctrine/Tests/Form/ChoiceList/UnloadedEntityChoiceListSingleAssociationToIntIdWithQueryBuilderTest.php
@@ -0,0 +1,33 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Bridge\Doctrine\Tests\Form\ChoiceList;
+
+use Symfony\Bridge\Doctrine\Form\ChoiceList\EntityChoiceList;
+use Symfony\Bridge\Doctrine\Form\ChoiceList\ORMQueryBuilderLoader;
+
+/**
+ * @author Premi Giorgio
+ * @author Bernhard Schussek
+ */
+class UnloadedEntityChoiceListSingleAssociationToIntIdWithQueryBuilderTest extends UnloadedEntityChoiceListSingleAssociationToIntIdTest
+{
+ /**
+ * @return \Symfony\Component\Form\Extension\Core\ChoiceList\ChoiceListInterface
+ */
+ protected function createChoiceList()
+ {
+ $qb = $this->em->createQueryBuilder()->select('s')->from($this->getEntityClass(), 's');
+ $loader = new ORMQueryBuilderLoader($qb);
+
+ return new EntityChoiceList($this->em, $this->getEntityClass(), null, $loader);
+ }
+}
From 799d0e0298ba017443c1a0bc88af80da9b7ba1d6 Mon Sep 17 00:00:00 2001
From: Giorgio Premi
Date: Thu, 9 Jul 2015 14:16:48 +0200
Subject: [PATCH 0025/3475] [DoctrineBridge][Form] Fix IdReader when indexing
by primary foreign key
---
.../Doctrine/Form/ChoiceList/IdReader.php | 24 +++-
.../SingleAssociationToIntIdEntity.php | 38 ++++++
.../Tests/Form/Type/EntityTypeTest.php | 111 ++++++++++++++++++
3 files changed, 172 insertions(+), 1 deletion(-)
create mode 100644 src/Symfony/Bridge/Doctrine/Tests/Fixtures/SingleAssociationToIntIdEntity.php
diff --git a/src/Symfony/Bridge/Doctrine/Form/ChoiceList/IdReader.php b/src/Symfony/Bridge/Doctrine/Form/ChoiceList/IdReader.php
index 43ca6a2fe7a30..6ae98b57f8d42 100644
--- a/src/Symfony/Bridge/Doctrine/Form/ChoiceList/IdReader.php
+++ b/src/Symfony/Bridge/Doctrine/Form/ChoiceList/IdReader.php
@@ -19,6 +19,7 @@
* A utility for reading object IDs.
*
* @since 1.0
+ *
* @author Bernhard Schussek
*
* @internal This class is meant for internal use only.
@@ -50,6 +51,11 @@ class IdReader
*/
private $idField;
+ /**
+ * @var IdReader|null
+ */
+ private $associationIdReader;
+
public function __construct(ObjectManager $om, ClassMetadata $classMetadata)
{
$ids = $classMetadata->getIdentifierFieldNames();
@@ -60,6 +66,16 @@ public function __construct(ObjectManager $om, ClassMetadata $classMetadata)
$this->singleId = 1 === count($ids);
$this->intId = $this->singleId && in_array($idType, array('integer', 'smallint', 'bigint'));
$this->idField = current($ids);
+
+ // single field association are resolved, since the schema column could be an int
+ if ($this->singleId && $classMetadata->hasAssociation($this->idField)) {
+ $this->associationIdReader = new self($om, $om->getClassMetadata(
+ $classMetadata->getAssociationTargetClass($this->idField)
+ ));
+
+ $this->singleId = $this->associationIdReader->isSingleId();
+ $this->intId = $this->associationIdReader->isIntId();
+ }
}
/**
@@ -108,7 +124,13 @@ public function getIdValue($object)
$this->om->initializeObject($object);
- return current($this->classMetadata->getIdentifierValues($object));
+ $idValue = current($this->classMetadata->getIdentifierValues($object));
+
+ if ($this->associationIdReader) {
+ $idValue = $this->associationIdReader->getIdValue($idValue);
+ }
+
+ return $idValue;
}
/**
diff --git a/src/Symfony/Bridge/Doctrine/Tests/Fixtures/SingleAssociationToIntIdEntity.php b/src/Symfony/Bridge/Doctrine/Tests/Fixtures/SingleAssociationToIntIdEntity.php
new file mode 100644
index 0000000000000..954de338d3ca3
--- /dev/null
+++ b/src/Symfony/Bridge/Doctrine/Tests/Fixtures/SingleAssociationToIntIdEntity.php
@@ -0,0 +1,38 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Bridge\Doctrine\Tests\Fixtures;
+
+use Doctrine\ORM\Mapping\Id;
+use Doctrine\ORM\Mapping\Column;
+use Doctrine\ORM\Mapping\Entity;
+use Doctrine\ORM\Mapping\OneToOne;
+
+/** @Entity */
+class SingleAssociationToIntIdEntity
+{
+ /** @Id @OneToOne(targetEntity="SingleIntIdNoToStringEntity", cascade={"ALL"}) */
+ protected $entity;
+
+ /** @Column(type="string", nullable=true) */
+ public $name;
+
+ public function __construct(SingleIntIdNoToStringEntity $entity, $name)
+ {
+ $this->entity = $entity;
+ $this->name = $name;
+ }
+
+ public function __toString()
+ {
+ return (string) $this->name;
+ }
+}
diff --git a/src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypeTest.php b/src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypeTest.php
index e22db0093ca3e..2fca804ca69d8 100644
--- a/src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypeTest.php
+++ b/src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypeTest.php
@@ -30,12 +30,16 @@
use Symfony\Component\Form\Forms;
use Symfony\Component\Form\Test\TypeTestCase;
use Symfony\Component\PropertyAccess\PropertyAccess;
+use Symfony\Bridge\Doctrine\Tests\Fixtures\SingleAssociationToIntIdEntity;
+use Symfony\Bridge\Doctrine\Tests\Fixtures\SingleIntIdNoToStringEntity;
class EntityTypeTest extends TypeTestCase
{
const ITEM_GROUP_CLASS = 'Symfony\Bridge\Doctrine\Tests\Fixtures\GroupableEntity';
const SINGLE_IDENT_CLASS = 'Symfony\Bridge\Doctrine\Tests\Fixtures\SingleIntIdEntity';
+ const SINGLE_IDENT_NO_TO_STRING_CLASS = 'Symfony\Bridge\Doctrine\Tests\Fixtures\SingleIntIdNoToStringEntity';
const SINGLE_STRING_IDENT_CLASS = 'Symfony\Bridge\Doctrine\Tests\Fixtures\SingleStringIdEntity';
+ const SINGLE_ASSOC_IDENT_CLASS = 'Symfony\Bridge\Doctrine\Tests\Fixtures\SingleAssociationToIntIdEntity';
const COMPOSITE_IDENT_CLASS = 'Symfony\Bridge\Doctrine\Tests\Fixtures\CompositeIntIdEntity';
const COMPOSITE_STRING_IDENT_CLASS = 'Symfony\Bridge\Doctrine\Tests\Fixtures\CompositeStringIdEntity';
@@ -60,7 +64,9 @@ protected function setUp()
$classes = array(
$this->em->getClassMetadata(self::ITEM_GROUP_CLASS),
$this->em->getClassMetadata(self::SINGLE_IDENT_CLASS),
+ $this->em->getClassMetadata(self::SINGLE_IDENT_NO_TO_STRING_CLASS),
$this->em->getClassMetadata(self::SINGLE_STRING_IDENT_CLASS),
+ $this->em->getClassMetadata(self::SINGLE_ASSOC_IDENT_CLASS),
$this->em->getClassMetadata(self::COMPOSITE_IDENT_CLASS),
$this->em->getClassMetadata(self::COMPOSITE_STRING_IDENT_CLASS),
);
@@ -304,6 +310,31 @@ public function testSubmitSingleNonExpandedSingleIdentifier()
$this->assertSame('2', $field->getViewData());
}
+ public function testSubmitSingleNonExpandedSingleAssocIdentifier()
+ {
+ $innerEntity1 = new SingleIntIdNoToStringEntity(1, 'InFoo');
+ $innerEntity2 = new SingleIntIdNoToStringEntity(2, 'InBar');
+
+ $entity1 = new SingleAssociationToIntIdEntity($innerEntity1, 'Foo');
+ $entity2 = new SingleAssociationToIntIdEntity($innerEntity2, 'Bar');
+
+ $this->persist(array($innerEntity1, $innerEntity2, $entity1, $entity2));
+
+ $field = $this->factory->createNamed('name', 'entity', null, array(
+ 'multiple' => false,
+ 'expanded' => false,
+ 'em' => 'default',
+ 'class' => self::SINGLE_ASSOC_IDENT_CLASS,
+ 'choice_label' => 'name',
+ ));
+
+ $field->submit('2');
+
+ $this->assertTrue($field->isSynchronized());
+ $this->assertSame($entity2, $field->getData());
+ $this->assertSame('2', $field->getViewData());
+ }
+
public function testSubmitSingleNonExpandedCompositeIdentifier()
{
$entity1 = new CompositeIntIdEntity(10, 20, 'Foo');
@@ -352,6 +383,35 @@ public function testSubmitMultipleNonExpandedSingleIdentifier()
$this->assertSame(array('1', '3'), $field->getViewData());
}
+ public function testSubmitMultipleNonExpandedSingleAssocIdentifier()
+ {
+ $innerEntity1 = new SingleIntIdNoToStringEntity(1, 'InFoo');
+ $innerEntity2 = new SingleIntIdNoToStringEntity(2, 'InBar');
+ $innerEntity3 = new SingleIntIdNoToStringEntity(3, 'InBaz');
+
+ $entity1 = new SingleAssociationToIntIdEntity($innerEntity1, 'Foo');
+ $entity2 = new SingleAssociationToIntIdEntity($innerEntity2, 'Bar');
+ $entity3 = new SingleAssociationToIntIdEntity($innerEntity3, 'Baz');
+
+ $this->persist(array($innerEntity1, $innerEntity2, $innerEntity3, $entity1, $entity2, $entity3));
+
+ $field = $this->factory->createNamed('name', 'entity', null, array(
+ 'multiple' => true,
+ 'expanded' => false,
+ 'em' => 'default',
+ 'class' => self::SINGLE_ASSOC_IDENT_CLASS,
+ 'choice_label' => 'name',
+ ));
+
+ $field->submit(array('1', '3'));
+
+ $expected = new ArrayCollection(array($entity1, $entity3));
+
+ $this->assertTrue($field->isSynchronized());
+ $this->assertEquals($expected, $field->getData());
+ $this->assertSame(array('1', '3'), $field->getViewData());
+ }
+
public function testSubmitMultipleNonExpandedSingleIdentifierForExistingData()
{
$entity1 = new SingleIntIdEntity(1, 'Foo');
@@ -611,6 +671,29 @@ public function testDisallowChoicesThatAreNotIncludedChoicesSingleIdentifier()
$this->assertNull($field->getData());
}
+ public function testDisallowChoicesThatAreNotIncludedChoicesSingleAssocIdentifier()
+ {
+ $innerEntity1 = new SingleIntIdNoToStringEntity(1, 'InFoo');
+ $innerEntity2 = new SingleIntIdNoToStringEntity(2, 'InBar');
+
+ $entity1 = new SingleAssociationToIntIdEntity($innerEntity1, 'Foo');
+ $entity2 = new SingleAssociationToIntIdEntity($innerEntity2, 'Bar');
+
+ $this->persist(array($innerEntity1, $innerEntity2, $entity1, $entity2));
+
+ $field = $this->factory->createNamed('name', 'entity', null, array(
+ 'em' => 'default',
+ 'class' => self::SINGLE_ASSOC_IDENT_CLASS,
+ 'choices' => array($entity1, $entity2),
+ 'choice_label' => 'name',
+ ));
+
+ $field->submit('3');
+
+ $this->assertFalse($field->isSynchronized());
+ $this->assertNull($field->getData());
+ }
+
public function testDisallowChoicesThatAreNotIncludedChoicesCompositeIdentifier()
{
$entity1 = new CompositeIntIdEntity(10, 20, 'Foo');
@@ -656,6 +739,34 @@ public function testDisallowChoicesThatAreNotIncludedQueryBuilderSingleIdentifie
$this->assertNull($field->getData());
}
+ public function testDisallowChoicesThatAreNotIncludedQueryBuilderSingleAssocIdentifier()
+ {
+ $innerEntity1 = new SingleIntIdNoToStringEntity(1, 'InFoo');
+ $innerEntity2 = new SingleIntIdNoToStringEntity(2, 'InBar');
+ $innerEntity3 = new SingleIntIdNoToStringEntity(3, 'InBaz');
+
+ $entity1 = new SingleAssociationToIntIdEntity($innerEntity1, 'Foo');
+ $entity2 = new SingleAssociationToIntIdEntity($innerEntity2, 'Bar');
+ $entity3 = new SingleAssociationToIntIdEntity($innerEntity3, 'Baz');
+
+ $this->persist(array($innerEntity1, $innerEntity2, $innerEntity3, $entity1, $entity2, $entity3));
+
+ $repository = $this->em->getRepository(self::SINGLE_ASSOC_IDENT_CLASS);
+
+ $field = $this->factory->createNamed('name', 'entity', null, array(
+ 'em' => 'default',
+ 'class' => self::SINGLE_ASSOC_IDENT_CLASS,
+ 'query_builder' => $repository->createQueryBuilder('e')
+ ->where('e.entity IN (1, 2)'),
+ 'choice_label' => 'name',
+ ));
+
+ $field->submit('3');
+
+ $this->assertFalse($field->isSynchronized());
+ $this->assertNull($field->getData());
+ }
+
public function testDisallowChoicesThatAreNotIncludedQueryBuilderAsClosureSingleIdentifier()
{
$entity1 = new SingleIntIdEntity(1, 'Foo');
From c4bf2e637c3947df90d6fa3e87dbcf144c730e90 Mon Sep 17 00:00:00 2001
From: Joshua Thijssen
Date: Thu, 9 Jul 2015 10:53:40 +0200
Subject: [PATCH 0026/3475] Added 'default' color
---
.../Component/Console/Formatter/OutputFormatterStyle.php | 2 ++
.../Console/Tests/Formatter/OutputFormatterStyleTest.php | 6 ++++++
2 files changed, 8 insertions(+)
diff --git a/src/Symfony/Component/Console/Formatter/OutputFormatterStyle.php b/src/Symfony/Component/Console/Formatter/OutputFormatterStyle.php
index 48e9850725f02..0438d4bc0393a 100644
--- a/src/Symfony/Component/Console/Formatter/OutputFormatterStyle.php
+++ b/src/Symfony/Component/Console/Formatter/OutputFormatterStyle.php
@@ -29,6 +29,7 @@ class OutputFormatterStyle implements OutputFormatterStyleInterface
'magenta' => 35,
'cyan' => 36,
'white' => 37,
+ 'default' => 39,
);
private static $availableBackgroundColors = array(
'black' => 40,
@@ -39,6 +40,7 @@ class OutputFormatterStyle implements OutputFormatterStyleInterface
'magenta' => 45,
'cyan' => 46,
'white' => 47,
+ 'default' => 49,
);
private static $availableOptions = array(
'bold' => 1,
diff --git a/src/Symfony/Component/Console/Tests/Formatter/OutputFormatterStyleTest.php b/src/Symfony/Component/Console/Tests/Formatter/OutputFormatterStyleTest.php
index 6890a9b839e88..d0ebb27512311 100644
--- a/src/Symfony/Component/Console/Tests/Formatter/OutputFormatterStyleTest.php
+++ b/src/Symfony/Component/Console/Tests/Formatter/OutputFormatterStyleTest.php
@@ -37,6 +37,9 @@ public function testForeground()
$style->setForeground('blue');
$this->assertEquals("\033[34mfoo\033[0m", $style->apply('foo'));
+ $style->setForeground('default');
+ $this->assertEquals("\033[39mfoo\033[39m", $style->apply('foo'));
+
$this->setExpectedException('InvalidArgumentException');
$style->setForeground('undefined-color');
}
@@ -51,6 +54,9 @@ public function testBackground()
$style->setBackground('yellow');
$this->assertEquals("\033[43mfoo\033[0m", $style->apply('foo'));
+ $style->setBackground('default');
+ $this->assertEquals("\033[49mfoo\033[49m", $style->apply('foo'));
+
$this->setExpectedException('InvalidArgumentException');
$style->setBackground('undefined-color');
}
From 85ae760d05c21b74e9626027a96b08bb93c2d5ee Mon Sep 17 00:00:00 2001
From: Damien Alexandre
Date: Sun, 28 Jun 2015 23:42:39 +0200
Subject: [PATCH 0027/3475] [Translation] Add parameters to
DataCollectorTranslator
---
.../views/Collector/translation.html.twig | 31 +++++++++++++++++++
.../TranslationDataCollector.php | 5 +++
.../Translation/DataCollectorTranslator.php | 12 ++++---
.../TranslationDataCollectorTest.php | 29 ++++++++++++++++-
.../Tests/DataCollectorTranslatorTest.php | 18 +++++++++++
5 files changed, 90 insertions(+), 5 deletions(-)
diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/translation.html.twig b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/translation.html.twig
index 2f5c5cf0fddba..840e7cd1acc80 100644
--- a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/translation.html.twig
+++ b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/translation.html.twig
@@ -114,12 +114,43 @@
{{ message.domain }}
{{ message.id }}
+
{% if message.count > 1 %}(used {{ message.count }} times) {% endif %}
+ {% if message.transChoiceNumber is not null %}(use pluralization) {% endif %}
+
+ {% if message.parameters|length > 0 %}
+
+ [
+
+
+ Parameters
+ ]
+
+
+ {% for parameters in message.parameters %}
+ {{ profiler_dump(parameters) }}
+ {% if not loop.last %} {% endif %}
+ {% endfor %}
+
+
+ {% endif %}
{{ message.translation }}
{% endfor %}
+
+
{% endblock %}
{% macro state(translation) %}
diff --git a/src/Symfony/Component/Translation/DataCollector/TranslationDataCollector.php b/src/Symfony/Component/Translation/DataCollector/TranslationDataCollector.php
index eb9d1e7333067..f33a7e5dd91b0 100644
--- a/src/Symfony/Component/Translation/DataCollector/TranslationDataCollector.php
+++ b/src/Symfony/Component/Translation/DataCollector/TranslationDataCollector.php
@@ -101,9 +101,14 @@ private function sanitizeCollectedMessages($messages)
if (!isset($result[$messageId])) {
$message['count'] = 1;
+ $message['parameters'] = !empty($message['parameters']) ? array($message['parameters']) : array();
$messages[$key]['translation'] = $this->sanitizeString($message['translation']);
$result[$messageId] = $message;
} else {
+ if (!empty($message['parameters'])) {
+ $result[$messageId]['parameters'][] = $message['parameters'];
+ }
+
$result[$messageId]['count']++;
}
diff --git a/src/Symfony/Component/Translation/DataCollectorTranslator.php b/src/Symfony/Component/Translation/DataCollectorTranslator.php
index 813a85760ae14..a7478da3740e9 100644
--- a/src/Symfony/Component/Translation/DataCollectorTranslator.php
+++ b/src/Symfony/Component/Translation/DataCollectorTranslator.php
@@ -48,7 +48,7 @@ public function __construct(TranslatorInterface $translator)
public function trans($id, array $parameters = array(), $domain = null, $locale = null)
{
$trans = $this->translator->trans($id, $parameters, $domain, $locale);
- $this->collectMessage($locale, $domain, $id, $trans);
+ $this->collectMessage($locale, $domain, $id, $trans, $parameters);
return $trans;
}
@@ -59,7 +59,7 @@ public function trans($id, array $parameters = array(), $domain = null, $locale
public function transChoice($id, $number, array $parameters = array(), $domain = null, $locale = null)
{
$trans = $this->translator->transChoice($id, $number, $parameters, $domain, $locale);
- $this->collectMessage($locale, $domain, $id, $trans);
+ $this->collectMessage($locale, $domain, $id, $trans, $parameters, $number);
return $trans;
}
@@ -112,9 +112,11 @@ public function getCollectedMessages()
* @param string|null $locale
* @param string|null $domain
* @param string $id
- * @param string $trans
+ * @param string $translation
+ * @param array|null $parameters
+ * @param int|null $number
*/
- private function collectMessage($locale, $domain, $id, $translation)
+ private function collectMessage($locale, $domain, $id, $translation, $parameters = array(), $number = null)
{
if (null === $domain) {
$domain = 'messages';
@@ -146,6 +148,8 @@ private function collectMessage($locale, $domain, $id, $translation)
'domain' => $domain,
'id' => $id,
'translation' => $translation,
+ 'parameters' => $parameters,
+ 'transChoiceNumber' => $number,
'state' => $state,
);
}
diff --git a/src/Symfony/Component/Translation/Tests/DataCollector/TranslationDataCollectorTest.php b/src/Symfony/Component/Translation/Tests/DataCollector/TranslationDataCollectorTest.php
index 085d31267b3a4..3d1e86e22cbed 100644
--- a/src/Symfony/Component/Translation/Tests/DataCollector/TranslationDataCollectorTest.php
+++ b/src/Symfony/Component/Translation/Tests/DataCollector/TranslationDataCollectorTest.php
@@ -46,6 +46,8 @@ public function testCollect()
'locale' => 'en',
'domain' => 'messages',
'state' => DataCollectorTranslator::MESSAGE_DEFINED,
+ 'parameters' => array(),
+ 'transChoiceNumber' => null,
),
array(
'id' => 'bar',
@@ -53,6 +55,8 @@ public function testCollect()
'locale' => 'fr',
'domain' => 'messages',
'state' => DataCollectorTranslator::MESSAGE_EQUALS_FALLBACK,
+ 'parameters' => array(),
+ 'transChoiceNumber' => null,
),
array(
'id' => 'choice',
@@ -60,6 +64,8 @@ public function testCollect()
'locale' => 'en',
'domain' => 'messages',
'state' => DataCollectorTranslator::MESSAGE_MISSING,
+ 'parameters' => array('%count%' => 3),
+ 'transChoiceNumber' => 3,
),
array(
'id' => 'choice',
@@ -67,6 +73,17 @@ public function testCollect()
'locale' => 'en',
'domain' => 'messages',
'state' => DataCollectorTranslator::MESSAGE_MISSING,
+ 'parameters' => array('%count%' => 3),
+ 'transChoiceNumber' => 3,
+ ),
+ array(
+ 'id' => 'choice',
+ 'translation' => 'choice',
+ 'locale' => 'en',
+ 'domain' => 'messages',
+ 'state' => DataCollectorTranslator::MESSAGE_MISSING,
+ 'parameters' => array('%count%' => 4, '%foo%' => 'bar'),
+ 'transChoiceNumber' => 4,
),
);
$expectedMessages = array(
@@ -77,6 +94,8 @@ public function testCollect()
'domain' => 'messages',
'state' => DataCollectorTranslator::MESSAGE_DEFINED,
'count' => 1,
+ 'parameters' => array(),
+ 'transChoiceNumber' => null,
),
array(
'id' => 'bar',
@@ -85,6 +104,8 @@ public function testCollect()
'domain' => 'messages',
'state' => DataCollectorTranslator::MESSAGE_EQUALS_FALLBACK,
'count' => 1,
+ 'parameters' => array(),
+ 'transChoiceNumber' => null,
),
array(
'id' => 'choice',
@@ -92,7 +113,13 @@ public function testCollect()
'locale' => 'en',
'domain' => 'messages',
'state' => DataCollectorTranslator::MESSAGE_MISSING,
- 'count' => 2,
+ 'count' => 3,
+ 'parameters' => array(
+ array('%count%' => 3),
+ array('%count%' => 3),
+ array('%count%' => 4, '%foo%' => 'bar'),
+ ),
+ 'transChoiceNumber' => 3,
),
);
diff --git a/src/Symfony/Component/Translation/Tests/DataCollectorTranslatorTest.php b/src/Symfony/Component/Translation/Tests/DataCollectorTranslatorTest.php
index 8e98ad31f43c8..31be3f2f15ebe 100644
--- a/src/Symfony/Component/Translation/Tests/DataCollectorTranslatorTest.php
+++ b/src/Symfony/Component/Translation/Tests/DataCollectorTranslatorTest.php
@@ -32,6 +32,7 @@ public function testCollectMessages()
$collector->trans('bar');
$collector->transChoice('choice', 0);
$collector->trans('bar_ru');
+ $collector->trans('bar_ru', array('foo' => 'bar'));
$expectedMessages = array();
$expectedMessages[] = array(
@@ -40,6 +41,8 @@ public function testCollectMessages()
'locale' => 'en',
'domain' => 'messages',
'state' => DataCollectorTranslator::MESSAGE_DEFINED,
+ 'parameters' => array(),
+ 'transChoiceNumber' => null,
);
$expectedMessages[] = array(
'id' => 'bar',
@@ -47,6 +50,8 @@ public function testCollectMessages()
'locale' => 'fr',
'domain' => 'messages',
'state' => DataCollectorTranslator::MESSAGE_EQUALS_FALLBACK,
+ 'parameters' => array(),
+ 'transChoiceNumber' => null,
);
$expectedMessages[] = array(
'id' => 'choice',
@@ -54,6 +59,8 @@ public function testCollectMessages()
'locale' => 'en',
'domain' => 'messages',
'state' => DataCollectorTranslator::MESSAGE_MISSING,
+ 'parameters' => array(),
+ 'transChoiceNumber' => 0,
);
$expectedMessages[] = array(
'id' => 'bar_ru',
@@ -61,6 +68,17 @@ public function testCollectMessages()
'locale' => 'ru',
'domain' => 'messages',
'state' => DataCollectorTranslator::MESSAGE_EQUALS_FALLBACK,
+ 'parameters' => array(),
+ 'transChoiceNumber' => null,
+ );
+ $expectedMessages[] = array(
+ 'id' => 'bar_ru',
+ 'translation' => 'bar (ru)',
+ 'locale' => 'ru',
+ 'domain' => 'messages',
+ 'state' => DataCollectorTranslator::MESSAGE_EQUALS_FALLBACK,
+ 'parameters' => array('foo' => 'bar'),
+ 'transChoiceNumber' => null,
);
$this->assertEquals($expectedMessages, $collector->getCollectedMessages());
From c104bc291a2b691abd4408f8d5f9595c93a689ae Mon Sep 17 00:00:00 2001
From: Fabien Potencier
Date: Thu, 9 Jul 2015 18:32:09 +0200
Subject: [PATCH 0028/3475] fixed merge
---
.../DependencyInjection/FrameworkExtension.php | 10 +---------
1 file changed, 1 insertion(+), 9 deletions(-)
diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php
index ded218e3f7e98..2183004d85315 100644
--- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php
+++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php
@@ -820,15 +820,7 @@ private function getValidatorMappingFiles(ContainerBuilder $container)
$files[1][] = $file->getRealpath();
}
-<<<<<<< HEAD
$container->addResource(new DirectoryResource($dir));
-=======
- foreach ($container->getParameter('kernel.bundles') as $bundle) {
- $reflection = new \ReflectionClass($bundle);
- if (is_file($file = dirname($reflection->getFileName()).'/Resources/config/validation.yml')) {
- $files[] = realpath($file);
- $container->addResource(new FileResource($file));
->>>>>>> 2.6
}
}
@@ -923,7 +915,7 @@ private function registerSerializerConfiguration(array $config, ContainerBuilder
$bundles = $container->getParameter('kernel.bundles');
foreach ($bundles as $bundle) {
$reflection = new \ReflectionClass($bundle);
- $dirname = dirname($reflection->getFilename());
+ $dirname = dirname($reflection->getFileName());
if (is_file($file = $dirname.'/Resources/config/serialization.xml')) {
$definition = new Definition('Symfony\Component\Serializer\Mapping\Loader\XmlFileLoader', array(realpath($file)));
From b1b52ada41adda3522984c7b5da9891ded993869 Mon Sep 17 00:00:00 2001
From: Ilya Antipenko
Date: Thu, 9 Jul 2015 21:38:49 +0300
Subject: [PATCH 0029/3475] Remove excess whitespace
---
src/Symfony/Component/Form/Form.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/Symfony/Component/Form/Form.php b/src/Symfony/Component/Form/Form.php
index de229064d58f7..7a18dcb80078a 100644
--- a/src/Symfony/Component/Form/Form.php
+++ b/src/Symfony/Component/Form/Form.php
@@ -357,7 +357,7 @@ public function setData($modelData)
if (!FormUtil::isEmpty($viewData)) {
$dataClass = $this->config->getDataClass();
- $actualType = is_object($viewData) ? 'an instance of class '.get_class($viewData) : ' a(n) '.gettype($viewData);
+ $actualType = is_object($viewData) ? 'an instance of class '.get_class($viewData) : 'a(n) '.gettype($viewData);
if (null === $dataClass && is_object($viewData) && !$viewData instanceof \ArrayAccess) {
$expectedType = 'scalar, array or an instance of \ArrayAccess';
From 1dcca1a8df40258168e22a58077873a87b3b623a Mon Sep 17 00:00:00 2001
From: Nicolas Macherey
Date: Thu, 9 Jul 2015 13:44:18 +0200
Subject: [PATCH 0030/3475] =?UTF-8?q?[PropertyAccess]=C2=A0setValue=20&=20?=
=?UTF-8?q?isWritable=20loops=20must=20only=20stops=20on=20reference=20and?=
=?UTF-8?q?=20object.=20References=20can=20also=20be=20arrays=20and=20if?=
=?UTF-8?q?=20the=20loop=20stops=20the=20value=20is=20never=20set=20in=20t?=
=?UTF-8?q?he=20object.=20(Breaks=20since=202.6.5=20commit=20e3e4695)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
| Q | A
| ------------- | ---
| Bug fix? | yes
| New feature? | no
| BC breaks? | no
| Deprecations? | no
| Tests pass? | yes
| Fixed tickets |
| License | MIT
| Doc PR |
This merge request fixes the following cases taht was working with version previous to 2.6.5:
A class with a property myArray which can be a multi dimensional array can now be accesed using myArray[foo][bar][baz]
Previously only myArray[foo] was working. The break is since commit e3e4695
This commit adds additionnal testing, and is rebased from 2.6 upstream
---
.../PropertyAccess/PropertyAccessor.php | 4 +-
.../Tests/Fixtures/TestClassIsWritable.php | 27 +++++++++++
.../Tests/Fixtures/TestClassSetValue.php | 32 +++++++++++++
.../Tests/PropertyAccessorTest.php | 45 ++++++++++++++++++-
4 files changed, 105 insertions(+), 3 deletions(-)
create mode 100644 src/Symfony/Component/PropertyAccess/Tests/Fixtures/TestClassIsWritable.php
create mode 100644 src/Symfony/Component/PropertyAccess/Tests/Fixtures/TestClassSetValue.php
diff --git a/src/Symfony/Component/PropertyAccess/PropertyAccessor.php b/src/Symfony/Component/PropertyAccess/PropertyAccessor.php
index f13a5c9175064..182d9fc024734 100644
--- a/src/Symfony/Component/PropertyAccess/PropertyAccessor.php
+++ b/src/Symfony/Component/PropertyAccess/PropertyAccessor.php
@@ -88,7 +88,7 @@ public function setValue(&$objectOrArray, $propertyPath, $value)
$this->writeProperty($objectOrArray, $property, $value);
}
- if ($propertyValues[$i][self::IS_REF]) {
+ if ($propertyValues[$i][self::IS_REF] && is_object($objectOrArray)) {
return;
}
@@ -149,7 +149,7 @@ public function isWritable($objectOrArray, $propertyPath)
}
}
- if ($propertyValues[$i][self::IS_REF]) {
+ if ($propertyValues[$i][self::IS_REF] && is_object($objectOrArray)) {
return true;
}
}
diff --git a/src/Symfony/Component/PropertyAccess/Tests/Fixtures/TestClassIsWritable.php b/src/Symfony/Component/PropertyAccess/Tests/Fixtures/TestClassIsWritable.php
new file mode 100644
index 0000000000000..d07c7c0fa80c0
--- /dev/null
+++ b/src/Symfony/Component/PropertyAccess/Tests/Fixtures/TestClassIsWritable.php
@@ -0,0 +1,27 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Component\PropertyAccess\Tests\Fixtures;
+
+class TestClassIsWritable
+{
+ protected $value;
+
+ public function getValue()
+ {
+ return $this->value;
+ }
+
+ public function __construct($value)
+ {
+ $this->value = $value;
+ }
+}
\ No newline at end of file
diff --git a/src/Symfony/Component/PropertyAccess/Tests/Fixtures/TestClassSetValue.php b/src/Symfony/Component/PropertyAccess/Tests/Fixtures/TestClassSetValue.php
new file mode 100644
index 0000000000000..638afee6af84a
--- /dev/null
+++ b/src/Symfony/Component/PropertyAccess/Tests/Fixtures/TestClassSetValue.php
@@ -0,0 +1,32 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Component\PropertyAccess\Tests\Fixtures;
+
+class TestClassSetValue
+{
+ protected $value;
+
+ public function getValue()
+ {
+ return $this->value;
+ }
+
+ public function setValue($value)
+ {
+ $this->value = $value;
+ }
+
+ public function __construct($value)
+ {
+ $this->value = $value;
+ }
+}
\ No newline at end of file
diff --git a/src/Symfony/Component/PropertyAccess/Tests/PropertyAccessorTest.php b/src/Symfony/Component/PropertyAccess/Tests/PropertyAccessorTest.php
index 9a5324f781076..aedca2e822f01 100644
--- a/src/Symfony/Component/PropertyAccess/Tests/PropertyAccessorTest.php
+++ b/src/Symfony/Component/PropertyAccess/Tests/PropertyAccessorTest.php
@@ -16,6 +16,8 @@
use Symfony\Component\PropertyAccess\Tests\Fixtures\TestClassMagicCall;
use Symfony\Component\PropertyAccess\Tests\Fixtures\TestClassMagicGet;
use Symfony\Component\PropertyAccess\Tests\Fixtures\Ticket5775Object;
+use Symfony\Component\PropertyAccess\Tests\Fixtures\TestClassSetValue;
+use Symfony\Component\PropertyAccess\Tests\Fixtures\TestClassIsWritable;
class PropertyAccessorTest extends \PHPUnit_Framework_TestCase
{
@@ -446,4 +448,45 @@ public function testSetValueDeepWithMagicGetter()
$this->propertyAccessor->setValue($obj, 'publicProperty[foo][bar]', 'Updated');
$this->assertSame('Updated', $obj->publicProperty['foo']['bar']);
}
-}
+
+ public function getReferenceChainObjectsForSetValue()
+ {
+ return array(
+ array(array('a' => array('b' => array('c' => 'old-value'))), '[a][b][c]', 'new-value'),
+ array(new TestClassSetValue(new TestClassSetValue('old-value')), 'value.value', 'new-value'),
+ array(new TestClassSetValue(array('a' => array('b' => array('c' => new TestClassSetValue('old-value'))))), 'value[a][b][c].value', 'new-value'),
+ array(new TestClassSetValue(array('a' => array('b' => 'old-value'))), 'value[a][b]', 'new-value'),
+ array(new \ArrayIterator(array('a' => array('b' => array('c' => 'old-value')))), '[a][b][c]', 'new-value'),
+ );
+
+ }
+
+ /**
+ * @dataProvider getReferenceChainObjectsForSetValue
+ */
+ public function testSetValueForReferenceChainIssue($object, $path, $value)
+ {
+ $this->propertyAccessor->setValue($object, $path, $value);
+
+ $this->assertEquals($value, $this->propertyAccessor->getValue($object, $path));
+ }
+
+ public function getReferenceChainObjectsForIsWritable()
+ {
+ return array(
+ array(new TestClassIsWritable(array('a' => array('b' => 'old-value'))), 'value[a][b]', false),
+ array(new TestClassIsWritable(new \ArrayIterator(array('a' => array('b' => 'old-value')))), 'value[a][b]', true),
+ array(new TestClassIsWritable(array('a' => array('b' => array('c' => new TestClassSetValue('old-value'))))), 'value[a][b][c].value', true),
+ );
+
+ }
+
+ /**
+ * @dataProvider getReferenceChainObjectsForIsWritable
+ */
+ public function testIsWritableForReferenceChainIssue($object, $path, $value)
+ {
+ $this->assertEquals($value, $this->propertyAccessor->isWritable($object, $path));
+ }
+
+}
\ No newline at end of file
From 88a2b562fef002c348172acfc3ee0c42dac64cfd Mon Sep 17 00:00:00 2001
From: Fabien Potencier
Date: Mon, 13 Jul 2015 11:08:56 +0200
Subject: [PATCH 0031/3475] fixed some tests
---
.../Console/Tests/Formatter/OutputFormatterStyleTest.php | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/Symfony/Component/Console/Tests/Formatter/OutputFormatterStyleTest.php b/src/Symfony/Component/Console/Tests/Formatter/OutputFormatterStyleTest.php
index d0ebb27512311..7cff68e5ebcaa 100644
--- a/src/Symfony/Component/Console/Tests/Formatter/OutputFormatterStyleTest.php
+++ b/src/Symfony/Component/Console/Tests/Formatter/OutputFormatterStyleTest.php
@@ -38,7 +38,7 @@ public function testForeground()
$this->assertEquals("\033[34mfoo\033[0m", $style->apply('foo'));
$style->setForeground('default');
- $this->assertEquals("\033[39mfoo\033[39m", $style->apply('foo'));
+ $this->assertEquals("\033[39mfoo\033[0m", $style->apply('foo'));
$this->setExpectedException('InvalidArgumentException');
$style->setForeground('undefined-color');
@@ -55,7 +55,7 @@ public function testBackground()
$this->assertEquals("\033[43mfoo\033[0m", $style->apply('foo'));
$style->setBackground('default');
- $this->assertEquals("\033[49mfoo\033[49m", $style->apply('foo'));
+ $this->assertEquals("\033[49mfoo\033[0m", $style->apply('foo'));
$this->setExpectedException('InvalidArgumentException');
$style->setBackground('undefined-color');
From c57c3f547922e8602bd9a8ff4db2265ae7082615 Mon Sep 17 00:00:00 2001
From: Fabien Potencier
Date: Mon, 13 Jul 2015 11:09:47 +0200
Subject: [PATCH 0032/3475] fixed tests
---
.../Console/Tests/Formatter/OutputFormatterStyleTest.php | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/Symfony/Component/Console/Tests/Formatter/OutputFormatterStyleTest.php b/src/Symfony/Component/Console/Tests/Formatter/OutputFormatterStyleTest.php
index cb9b7d28ba034..0abfb3ce27559 100644
--- a/src/Symfony/Component/Console/Tests/Formatter/OutputFormatterStyleTest.php
+++ b/src/Symfony/Component/Console/Tests/Formatter/OutputFormatterStyleTest.php
@@ -38,7 +38,7 @@ public function testForeground()
$this->assertEquals("\033[34mfoo\033[39m", $style->apply('foo'));
$style->setForeground('default');
- $this->assertEquals("\033[39mfoo\033[0m", $style->apply('foo'));
+ $this->assertEquals("\033[39mfoo\033[39m", $style->apply('foo'));
$this->setExpectedException('InvalidArgumentException');
$style->setForeground('undefined-color');
@@ -55,7 +55,7 @@ public function testBackground()
$this->assertEquals("\033[43mfoo\033[49m", $style->apply('foo'));
$style->setBackground('default');
- $this->assertEquals("\033[49mfoo\033[0m", $style->apply('foo'));
+ $this->assertEquals("\033[49mfoo\033[49m", $style->apply('foo'));
$this->setExpectedException('InvalidArgumentException');
$style->setBackground('undefined-color');
From 38dc79faf31c3ee3f5b18f7f7eeb23796ea9b128 Mon Sep 17 00:00:00 2001
From: Fabien Potencier
Date: Mon, 13 Jul 2015 11:11:40 +0200
Subject: [PATCH 0033/3475] updated CHANGELOG for 2.3.31
---
CHANGELOG-2.3.md | 31 +++++++++++++++++++++++++++++++
1 file changed, 31 insertions(+)
diff --git a/CHANGELOG-2.3.md b/CHANGELOG-2.3.md
index 84a17f9fdc28c..e261767b557f0 100644
--- a/CHANGELOG-2.3.md
+++ b/CHANGELOG-2.3.md
@@ -7,6 +7,37 @@ in 2.3 minor versions.
To get the diff for a specific change, go to https://github.com/symfony/symfony/commit/XXX where XXX is the change hash
To get the diff between two versions, go to https://github.com/symfony/symfony/compare/v2.3.0...v2.3.1
+* 2.3.31 (2015-07-13)
+
+ * bug #15248 Added 'default' color (jaytaph)
+ * bug #15243 Reload the session after regenerating its id (jakzal)
+ * bug #15202 [Security] allow to use `method` in XML configs (xabbuh)
+ * bug #15223 [Finder] Command::addAtIndex() fails with Command instance argument (thunderer)
+ * bug #15220 [DependencyInjection] Freeze also FrozenParameterBag::remove (lyrixx)
+ * bug #15110 Add a way to reset the singleton (dawehner)
+ * bug #15163 Update DateTimeToArrayTransformer.php (zhil)
+ * bug #15150 [Translation] Azerbaijani language pluralization rule is wrong (shehi)
+ * bug #15146 Towards 100% HHVM compat (nicolas-grekas)
+ * bug #15069 [Form] Fixed: Data mappers always receive forms indexed by their names (webmozart)
+ * bug #15137 [Security] Initialize SwitchUserEvent::targetUser on attemptExitUser (Rvanlaak, xabbuh)
+ * bug #15083 [DependencyInjection] Fail when dumping a Definition with no class nor factory (nicolas-grekas)
+ * bug #15127 [Validator] fix validation for Maestro UK card numbers (xabbuh)
+ * bug #15128 DbalLogger: Small nonutf8 array fix (vpetrovych, weaverryan)
+ * bug #15048 [Translation][Form][choice] empty_value shouldn't be translated when it has an empty value (Restless-ET)
+ * bug #15117 [Form] fixed sending non array data on submit to ResizeListener (BruceWouaigne)
+ * bug #15086 Fixed the regexp for the validator of Maestro-based credit/debit cards (javiereguiluz)
+ * bug #15058 [Console] Fix STDERR output text on IBM iSeries OS400 (johnkary)
+ * bug #15065 [Form] Fixed: remove quoted strings from Intl date formats (e.g. es_ES full pattern) (webmozart)
+ * bug #15039 [Translation][update cmd] taken account into bundle overrides path. (aitboudad)
+ * bug #14964 [bugfix][MonologBridge] WebProcessor: passing $extraFields to BaseWebProcessor (MacDada)
+ * bug #15027 [Form] Fixed: Filter non-integers when selecting entities by int ID (webmozart, nicolas-grekas)
+ * bug #15000 [Debug] Fix fatal-errors handling on HHVM (nicolas-grekas)
+ * bug #14897 Allow new lines in Messages translated with transchoice() (replacement for #14867) (azine)
+ * bug #14895 [Form] Support DateTimeImmutable in transform() (c960657)
+ * bug #14859 Improve the config validation in TwigBundle (stof)
+ * bug #14785 [BrowserKit] Fix bug when uri starts with http. (amouhzi)
+ * bug #14807 [Security][Acl] enforce string identifiers (xabbuh)
+
* 2.3.30 (2015-05-30)
* bug #14262 [REVERTED] [TwigBundle] Refresh twig paths when resources change. (aitboudad)
From 14e95b221a880a9717f1c44f20a8ff82addfb019 Mon Sep 17 00:00:00 2001
From: Fabien Potencier
Date: Mon, 13 Jul 2015 11:11:54 +0200
Subject: [PATCH 0034/3475] update CONTRIBUTORS for 2.3.31
---
CONTRIBUTORS.md | 111 +++++++++++++++++++++++++++++++-----------------
1 file changed, 71 insertions(+), 40 deletions(-)
diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md
index f3397b53ec150..af5724f4a7af9 100644
--- a/CONTRIBUTORS.md
+++ b/CONTRIBUTORS.md
@@ -15,11 +15,11 @@ Symfony is the result of the work of many people who made the code better
- Christophe Coevoet (stof)
- Jakub Zalas (jakubzalas)
- Pascal Borreli (pborreli)
+ - Christian Flothmann (xabbuh)
- Hugo Hamon (hhamon)
- Joseph Bielawski (stloyd)
- Karma Dordrak (drak)
- Ryan Weaver (weaverryan)
- - Christian Flothmann (xabbuh)
- Lukas Kahwe Smith (lsmith)
- Romain Neutron (romain)
- Jeremy Mikola (jmikola)
@@ -27,22 +27,23 @@ Symfony is the result of the work of many people who made the code better
- Benjamin Eberlei (beberlei)
- Igor Wiedler (igorw)
- Martin Hasoň (hason)
- - Eriksen Costa (eriksencosta)
- Abdellatif Ait boudad (aitboudad)
+ - Eriksen Costa (eriksencosta)
- Grégoire Pineau (lyrixx)
- Wouter De Jong (wouterj)
- Jonathan Wage (jwage)
- Alexandre Salomé (alexandresalome)
- William Durand (couac)
+ - Kévin Dunglas (dunglas)
- ornicar
- stealth35 (stealth35)
- Alexander Mols (asm89)
- - Kévin Dunglas (dunglas)
- Bulat Shakirzyanov (avalanche123)
- Francis Besset (francisbesset)
- Saša Stamenković (umpirsky)
- Henrik Bjørnskov (henrikbjorn)
- Miha Vrhovnik
+ - Diego Saint Esteben (dii3g0)
- Sarah Khalil (saro0h)
- Konstantin Kudryashov (everzet)
- Bilal Amarni (bamarni)
@@ -55,15 +56,14 @@ Symfony is the result of the work of many people who made the code better
- Arnout Boks (aboks)
- Christian Raue
- Michel Weimerskirch (mweimerskirch)
- - Diego Saint Esteben (dii3g0)
- Lee McDermott
- Brandon Turner
- Luis Cordova (cordoval)
- Douglas Greenshields (shieldo)
+ - Kevin Bond (kbond)
- Daniel Holmes (dholmes)
- Bart van den Burg (burgov)
- Jordan Alliot (jalliot)
- - Kevin Bond (kbond)
- John Wards (johnwards)
- Fran Moreno (franmomu)
- Antoine Hérault (herzult)
@@ -71,6 +71,7 @@ Symfony is the result of the work of many people who made the code better
- Gábor Egyed (1ed)
- Arnaud Le Blanc (arnaud-lb)
- Tim Nagel (merk)
+ - Maxime Steinhausser (ogizanagi)
- Brice BERNARD (brikou)
- marc.weistroff
- lenar
@@ -83,16 +84,16 @@ Symfony is the result of the work of many people who made the code better
- excelwebzone
- Jacob Dreesen (jdreesen)
- Matthias Pigulla (mpdude)
+ - Javier Eguiluz (javier.eguiluz)
- Fabien Pennequin (fabienpennequin)
- - Peter Kokot (maastermedia)
- Peter Rehm (rpet)
- - Michal Piotrowski (eventhorizon)
- - Stefano Sala (stefano.sala)
- - Javier Eguiluz (javier.eguiluz)
+ - Peter Kokot (maastermedia)
- Gordon Franke (gimler)
- Robert Schönthal (digitalkaoz)
- - Juti Noppornpitak (shiroyuki)
- Dariusz Ruminski
+ - Michal Piotrowski (eventhorizon)
+ - Stefano Sala (stefano.sala)
+ - Juti Noppornpitak (shiroyuki)
- Sebastian Hörl (blogsh)
- Daniel Gomes (danielcsgomes)
- Hidenori Goto (hidenorigoto)
@@ -102,10 +103,13 @@ Symfony is the result of the work of many people who made the code better
- Pablo Godel (pgodel)
- Eric GELOEN (gelo)
- Jérémie Augustin (jaugustin)
- - Rafael Dohms (rdohms)
- - Tigran Azatyan (tigranazatyan)
- Alexander Schwenn (xelaris)
+ - Rafael Dohms (rdohms)
- Arnaud Kleinpeter (nanocom)
+ - Joshua Thijssen
+ - Vladimir Reznichenko (kalessil)
+ - Tigran Azatyan (tigranazatyan)
+ - Issei Murasawa (issei_m)
- Richard Shank (iampersistent)
- Clemens Tolboom
- Helmer Aaviksoo
@@ -113,15 +117,16 @@ Symfony is the result of the work of many people who made the code better
- Hiromi Hishida (77web)
- Matthieu Ouellette-Vachon (maoueh)
- Michał Pipa (michal.pipa)
- - Issei Murasawa (issei_m)
- Amal Raghav (kertz)
- Jonathan Ingram (jonathaningram)
- Artur Kotyrba
+ - Iltar van der Berg
- Rouven Weßling (realityking)
- Andréia Bohner (andreia)
- Dmitrii Chekaliuk (lazyhammer)
- Clément JOBEILI (dator)
- Dorian Villet (gnutix)
+ - Javier Spagnoletti (phansys)
- Richard Miller (mr_r_miller)
- hacfi (hifi)
- Mario A. Alvarez Garcia (nomack84)
@@ -136,21 +141,17 @@ Symfony is the result of the work of many people who made the code better
- Larry Garfield (crell)
- Martin Schuhfuß (usefulthink)
- Thomas Rabaix (rande)
- - Javier Spagnoletti (phansys)
- Matthieu Bontemps (mbontemps)
- Pierre Minnieur (pminnieur)
- fivestar
- Dominique Bongiraud
- - Iltar van der Berg
- Leszek Prabucki (l3l0)
- François Zaninotto (fzaninotto)
- Dustin Whittle (dustinwhittle)
- jeff
- - Maxime Steinhausser (ogizanagi)
- - Joshua Thijssen
- Justin Hileman (bobthecow)
- Sven Paulus (subsven)
- - Vladimir Reznichenko (kalessil)
+ - Warnar Boekkooi (boekkooi)
- Lars Strojny (lstrojny)
- Rui Marinho (ruimarinho)
- Mikael Pajunen
@@ -158,11 +159,14 @@ Symfony is the result of the work of many people who made the code better
- Tugdual Saunier (tucksaun)
- Sergey Linnik (linniksa)
- Marcel Beerta (mazen)
+ - Vincent AUBERT (vincent)
- julien pauli (jpauli)
- Francois Zaninotto
- Alexander Kotynia (olden)
- Daniel Tschinder
+ - Alexander M. Turek (derrabus)
- Elnur Abdurrakhimov (elnur)
+ - John Kary (johnkary)
- Manuel Reinhard (sprain)
- Danny Berger (dpb587)
- Roman Marintšenko (inori)
@@ -187,11 +191,10 @@ Symfony is the result of the work of many people who made the code better
- Jeremy Livingston (jeremylivingston)
- Nikita Konstantinov
- Wodor Wodorski
- - Vincent AUBERT (vincent)
- Matthieu Auger (matthieuauger)
+ - Sébastien Lavoie (lavoiesl)
- Beau Simensen (simensen)
- Robert Kiss (kepten)
- - John Kary (johnkary)
- Ruben Gonzalez (rubenrua)
- Kim Hemsø Rasmussen (kimhemsoe)
- Florian Lonqueu-Brochard (florianlb)
@@ -199,8 +202,8 @@ Symfony is the result of the work of many people who made the code better
- Wouter Van Hecke
- Peter Kruithof (pkruithof)
- Michael Holm (hollo)
- - Warnar Boekkooi (boekkooi)
- Marc Weistroff (futurecat)
+ - Kristen Gilden (kgilden)
- Chris Smith (cs278)
- Florian Klein (docteurklein)
- Manuel Kiessling (manuelkiessling)
@@ -226,6 +229,7 @@ Symfony is the result of the work of many people who made the code better
- Julien Galenski (ruian)
- Bongiraud Dominique
- janschoenherr
+ - Thomas Schulz (king2500)
- Marco Pivetta (ocramius)
- Ricard Clau (ricardclau)
- Erin Millard
@@ -235,18 +239,18 @@ Symfony is the result of the work of many people who made the code better
- Vitaliy Zakharov (zakharovvi)
- Tobias Sjösten (tobiassjosten)
- Gyula Sallai (salla)
- - Alexander M. Turek (derrabus)
- Konstantin Myakshin (koc)
- Inal DJAFAR (inalgnu)
- Christian Gärtner (dagardner)
+ - Tomasz Kowalczyk (thunderer)
+ - Daniel Wehner
- Felix Labrecque
- Yaroslav Kiliba
- - Sébastien Lavoie (lavoiesl)
- Stepan Anchugov (kix)
- Terje Bråten
- - Kristen Gilden (kgilden)
- Robbert Klarenbeek (robbertkl)
- Blanchon Vincent (blanchonvincent)
+ - Dawid Nowak
- hossein zolfi (ocean)
- Clément Gautier (clementgautier)
- Eduardo Gulias (egulias)
@@ -261,6 +265,7 @@ Symfony is the result of the work of many people who made the code better
- Loïc Chardonnet (gnusat)
- Marek Kalnik (marekkalnik)
- Vyacheslav Salakhutdinov (megazoll)
+ - Hassan Amouhzi
- Tamas Szijarto
- Pavel Volokitin (pvolok)
- Endre Fejes
@@ -283,9 +288,9 @@ Symfony is the result of the work of many people who made the code better
- Oscar Cubo Medina (ocubom)
- Karel Souffriau
- Christophe L. (christophelau)
+ - Massimiliano Arione (garak)
- Anthon Pang (robocoder)
- Jáchym Toušek
- - Thomas Schulz (king2500)
- Jannik Zschiesche (apfelbox)
- Emanuele Gaspari (inmarelibero)
- Dariusz Rumiński
@@ -304,7 +309,6 @@ Symfony is the result of the work of many people who made the code better
- Asier Illarramendi (doup)
- Chris Sedlmayr (catchamonkey)
- Seb Koelen
- - Daniel Wehner
- Christoph Mewes (xrstf)
- Vitaliy Tverdokhlib (vitaliytv)
- Ariel Ferrandini (aferrandini)
@@ -313,7 +317,9 @@ Symfony is the result of the work of many people who made the code better
- Jonas Flodén (flojon)
- Christian Schmidt
- Marcin Sikoń (marphi)
+ - Dominik Zogg (dominik.zogg)
- franek (franek)
+ - Damien Alexandre (damienalexandre)
- Adam Harvey
- Alex Bakhturin
- François-Xavier de Guillebon (de-gui_f)
@@ -322,7 +328,6 @@ Symfony is the result of the work of many people who made the code better
- Jérôme Macias (jeromemacias)
- Fabian Lange (codingfabian)
- Yoshio HANAWA
- - Tomasz Kowalczyk (thunderer)
- Sebastian Bergmann
- Pablo Díez (pablodip)
- Kevin McBride
@@ -359,6 +364,7 @@ Symfony is the result of the work of many people who made the code better
- Nils Adermann (naderman)
- Gábor Fási
- Benjamin Leveque (benji07)
+ - Ivan Kurnosov
- sasezaki
- Dawid Pakuła (zulusx)
- Florian Rey (nervo)
@@ -369,13 +375,14 @@ Symfony is the result of the work of many people who made the code better
- Daniel Tschinder
- Ryan
- Alexander Deruwe (aderuwe)
+ - Dave Hulbert (dave1010)
- François Pluchino (francoispluchino)
- - Massimiliano Arione (garak)
- Ivan Rey (ivanrey)
- Marcin Chyłek (songoq)
- Ned Schwartz
- Ziumin
- Lenar Lõhmus
+ - Benjamin Laugueux (yzalis)
- Zach Badgett (zachbadgett)
- Aurélien Fredouelle
- Pavel Campr (pcampr)
@@ -416,6 +423,7 @@ Symfony is the result of the work of many people who made the code better
- David Fuhr
- Kamil Kokot (pamil)
- Rostyslav Kinash
+ - Maciej Malarz (malarzm)
- Daisuke Ohata
- Vincent Simonin
- Stefan Warman
@@ -428,7 +436,6 @@ Symfony is the result of the work of many people who made the code better
- umpirski
- Chris Heng (gigablah)
- Ulumuddin Yunus (joenoez)
- - Dominik Zogg (dominik.zogg)
- Luc Vieillescazes (iamluc)
- Johann Saunier (prophet777)
- Antoine Corcy
@@ -461,9 +468,11 @@ Symfony is the result of the work of many people who made the code better
- Alexander Volochnev (exelenz)
- Michael Piecko
- yclian
+ - Sergio Santoro
- Sebastian Grodzicki (sgrodzicki)
- Pascal Helfenstein
- Baldur Rensch (brensch)
+ - Vladyslav Petrovych
- Alex Xandra Albert Sim
- Yuen-Chi Lian
- Besnik Br
@@ -485,6 +494,7 @@ Symfony is the result of the work of many people who made the code better
- Marc Morera (mmoreram)
- Andrew Hilobok (hilobok)
- Christian Soronellas (theunic)
+ - Romain Gautier (mykiwi)
- Yosmany Garcia (yosmanyga)
- Degory Valentine
- Benoit Lévêque (benoit_leveque)
@@ -501,7 +511,7 @@ Symfony is the result of the work of many people who made the code better
- fago
- Harm van Tilborg
- Jan Prieser
- - Damien Alexandre (damienalexandre)
+ - Artur Melo (restless)
- James Michael DuPont
- Tom Klingenberg
- Christopher Hall (mythmakr)
@@ -510,14 +520,17 @@ Symfony is the result of the work of many people who made the code better
- Berny Cantos (xphere81)
- Reen Lokum
- Martin Parsiegla (spea)
+ - Possum
+ - Denis Charrier (brucewouaigne)
- Quentin Schuler
- Pierre Vanliefland (pvanliefland)
- frost-nzcr4
+ - Oskar Stark (oskarstark)
- Abhoryo
- Fabian Vogler (fabian)
- Korvin Szanto
+ - MatTheCat
- Maksim Kotlyar (makasim)
- - Ivan Kurnosov
- Neil Ferreira
- Dmitry Parnas (parnas)
- DQNEO
@@ -541,10 +554,11 @@ Symfony is the result of the work of many people who made the code better
- Shin Ohno (ganchiku)
- Geert De Deckere (geertdd)
- Jan Kramer (jankramer)
+ - Jean-Baptiste GOMOND (mjbgo)
+ - Richard van Laak (rvanlaak)
- abdul malik ikhsan (samsonasik)
- Henry Snoek (snoek09)
- Timothée Barray (tyx)
- - Benjamin Laugueux (yzalis)
- Christian Morgan
- Alexander Miehe (engerim)
- Morgan Auchede (mauchede)
@@ -578,6 +592,7 @@ Symfony is the result of the work of many people who made the code better
- Raul Fraile (raulfraile)
- sensio
- Patrick Kaufmann
+ - Reece Fowell (reecefowell)
- stefan.r
- Matthieu Napoli (mnapoli)
- Ben Ramsey (ramsey)
@@ -594,22 +609,26 @@ Symfony is the result of the work of many people who made the code better
- Michael Tibben
- Sander Marechal
- Radosław Benkel
+ - Gennady Telegin (gtelegin)
- Marcos Sánchez
- ttomor
- Mei Gwilym (meigwilym)
- Michael H. Arieli (excelwebzone)
- Luciano Mammino (loige)
- fabios
+ - Jérôme Vasseur
- Sander Coolen (scoolen)
- Nicolas Le Goff (nlegoff)
- Manuele Menozzi
- Anton Babenko (antonbabenko)
- Irmantas Šiupšinskas (irmantas)
+ - Charles-Henri Bruyand
- Danilo Silva
- Zachary Tong (polyfractal)
- Hryhorii Hrebiniuk
- dantleech
- Xavier Leune
+ - Christian Schmidt
- Tero Alén (tero)
- DerManoMann
- Guillaume Royer
@@ -671,12 +690,12 @@ Symfony is the result of the work of many people who made the code better
- Marcin Chwedziak
- Roland Franssen (ro0)
- Tony Cosentino (tony-co)
- - Maciej Malarz
- Rodrigo Díez Villamuera (rodrigodiez)
- e-ivanov
- Jochen Bayer (jocl)
- Jeremy Bush
- wizhippo
+ - Diego Saint Esteben (dosten)
- rpg600
- Péter Buri (burci)
- Davide Borsatto (davide.borsatto)
@@ -701,6 +720,7 @@ Symfony is the result of the work of many people who made the code better
- Brooks Boyd
- Roger Webb
- Dmitriy Simushev
+ - Martin Hujer (martinhujer)
- Max Voloshin (maxvoloshin)
- Nicolas Fabre (nfabre)
- Raul Rodriguez (raul782)
@@ -747,6 +767,7 @@ Symfony is the result of the work of many people who made the code better
- Tatsuya Tsuruoka
- Ross Tuck
- Kévin Gomez (kevin)
+ - azine
- Dawid Sajdak
- Ludek Stepan
- Geoffrey Brier
@@ -769,6 +790,7 @@ Symfony is the result of the work of many people who made the code better
- Cédric Lahouste (rapotor)
- Samuel Vogel (samuelvogel)
- Berat Doğan
+ - twifty
- Anthony Ferrara
- ShiraNai7
- Janusz Jabłoński (yanoosh)
@@ -812,6 +834,7 @@ Symfony is the result of the work of many people who made the code better
- Samuel Gordalina (gordalina)
- Max Romanovsky (maxromanovsky)
- Mathieu Morlon
+ - Daniel Tschinder
- Rafał Muszyński (rafmus90)
- Timothy Anido (xanido)
- Rick Prent
@@ -829,7 +852,6 @@ Symfony is the result of the work of many people who made the code better
- Thomas Chmielowiec (chmielot)
- Jānis Lukss
- rkerner
- - Vladyslav Petrovych
- Matthew J Mucklo
- fdgdfg (psampaz)
- Stéphane Seng
@@ -846,6 +868,7 @@ Symfony is the result of the work of many people who made the code better
- Jonathan Gough
- Benjamin Bender
- Konrad Mohrfeldt
+ - Lance Chen
- kor3k kor3k (kor3k)
- Stelian Mocanita (stelian)
- Flavian (2much)
@@ -877,7 +900,6 @@ Symfony is the result of the work of many people who made the code better
- Adrian Olek (adrianolek)
- Przemysław Piechota (kibao)
- Leonid Terentyev (li0n)
- - Oskar Stark (oskarstark)
- Adam Prager (padam87)
- ryunosuke
- victoria
@@ -892,7 +914,6 @@ Symfony is the result of the work of many people who made the code better
- catch
- Alexandre Segura
- Josef Cech
- - Possum
- Arnau González (arnaugm)
- Nate (frickenate)
- Matthew Foster (mfoster)
@@ -930,6 +951,7 @@ Symfony is the result of the work of many people who made the code better
- Grayson Koonce (breerly)
- Karim Cassam Chenaï (ka)
- Nicolas Bastien (nicolas_bastien)
+ - Andrew Zhilin (zhil)
- Andy Stanberry
- Luiz “Felds” Liscia
- Thomas Rothe
@@ -937,11 +959,13 @@ Symfony is the result of the work of many people who made the code better
- avi123
- alsar
- Mike Meier
+ - michalmarcinkowski
- Warwick
- Chris
- efeen
- Michał Dąbrowski (defrag)
- Simone Fumagalli (hpatoio)
+ - Brian Graham (incognito)
- Kevin Vergauwen (innocenzo)
- Alessio Baglio (ioalessio)
- John Bafford (jbafford)
@@ -960,7 +984,6 @@ Symfony is the result of the work of many people who made the code better
- Daan van Renterghem
- Bram Van der Sype (brammm)
- Julien Moulin (lizjulien)
- - Romain Gautier (mykiwi)
- Nikita Nefedov (nikita2206)
- Mauro Foti (skler)
- Yannick Warnier (ywarnier)
@@ -989,7 +1012,6 @@ Symfony is the result of the work of many people who made the code better
- Mark de Haan (markdehaan)
- Dan Patrick (mdpatrick)
- Rares Vlaseanu (raresvla)
- - Artur Melo (restless)
- Sofiane HADDAG (sofhad)
- tante kinast (tante)
- Vincent LEFORT (vlefort)
@@ -1013,7 +1035,6 @@ Symfony is the result of the work of many people who made the code better
- Florian Pfitzer (marmelatze)
- Martin Mayer (martin)
- Grzegorz Łukaszewicz (newicz)
- - Richard van Laak (rvanlaak)
- grifx
- Robert Campbell
- Matt Lehner
@@ -1022,6 +1043,7 @@ Symfony is the result of the work of many people who made the code better
- Ruben Kruiswijk
- Michael J
- Joseph Maarek
+ - Alexander Menk
- Alex Pods
- timaschew
- Ian Phillips
@@ -1040,6 +1062,7 @@ Symfony is the result of the work of many people who made the code better
- Maerlyn
- Even André Fiskvik
- Diego Agulló
+ - Gerrit Drost
- Lenar Lõhmus
- Cristian Gonzalez
- Juan M Martínez
@@ -1056,7 +1079,6 @@ Symfony is the result of the work of many people who made the code better
- Jeroen Thora (bolle)
- Masao Maeda (brtriver)
- Darius Leskauskas (darles)
- - Dave Hulbert (dave1010)
- David Joos (djoos)
- Denis Klementjev (dklementjev)
- Tomáš Polívka (draczris)
@@ -1085,6 +1107,7 @@ Symfony is the result of the work of many people who made the code better
- akimsko
- Youpie
- srsbiz
+ - Taylan Kasap
- Nicolas A. Bérard-Nault
- Gladhon
- Saem Ghani
@@ -1108,6 +1131,7 @@ Symfony is the result of the work of many people who made the code better
- Wotre
- goohib
- Xavier HAUSHERR
+ - Mantas Urnieža
- Cas
- Dusan Kasan
- Myke79
@@ -1142,6 +1166,7 @@ Symfony is the result of the work of many people who made the code better
- andreabreu98
- Michael Schneider
- n-aleha
+ - Şəhriyar İmanov
- Kaipi Yann
- Sam Williams
- Adrian Philipp
@@ -1150,6 +1175,7 @@ Symfony is the result of the work of many people who made the code better
- Ondrej Slinták
- vlechemin
- Brian Corrigan
+ - Ladislav Tánczos
- Brian Freytag
- Skorney
- mieszko4
@@ -1175,6 +1201,7 @@ Symfony is the result of the work of many people who made the code better
- Sergiy Sokolenko
- dinitrol
- Penny Leach
+ - Richard Trebichavský
- g123456789l
- Giorgio Premi
- oscartv
@@ -1200,6 +1227,7 @@ Symfony is the result of the work of many people who made the code better
- Alex Olmos (alexolmos)
- Antonio Mansilla (amansilla)
- Juan Ases García (ases)
+ - Siragusa (asiragusa)
- Daniel Basten (axhm3a)
- DUPUCH (bdupuch)
- Bill Hance (billhance)
@@ -1239,6 +1267,7 @@ Symfony is the result of the work of many people who made the code better
- Adam Monsen (meonkeys)
- Ala Eddine Khefifi (nayzo)
- emilienbouard (neime)
+ - Nicholas Byfleet (nickbyfleet)
- ollie harridge (ollietb)
- Paul Andrieux (paulandrieux)
- Paweł Szczepanek (pauluz)
@@ -1270,6 +1299,7 @@ Symfony is the result of the work of many people who made the code better
- Jesper Søndergaard Pedersen (zerrvox)
- Florent Cailhol
- szymek
+ - Kovacs Nicolas
- craigmarvelley
- Stano Turza
- simpson
@@ -1281,6 +1311,7 @@ Symfony is the result of the work of many people who made the code better
- fh-github@fholzhauer.de
- Mark Topper
- Xavier REN
+ - Zander Baldwin
- Philipp Scheit
- max
- Mohamed Karnichi (amiral)
From bd506a5e84fdce41966ef4986255fff1e31fc056 Mon Sep 17 00:00:00 2001
From: Fabien Potencier
Date: Mon, 13 Jul 2015 11:12:26 +0200
Subject: [PATCH 0035/3475] updated VERSION for 2.3.31
---
src/Symfony/Component/HttpKernel/Kernel.php | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/Symfony/Component/HttpKernel/Kernel.php b/src/Symfony/Component/HttpKernel/Kernel.php
index 5391021318276..a6cc4e600100b 100644
--- a/src/Symfony/Component/HttpKernel/Kernel.php
+++ b/src/Symfony/Component/HttpKernel/Kernel.php
@@ -60,12 +60,12 @@ abstract class Kernel implements KernelInterface, TerminableInterface
protected $startTime;
protected $loadClassCache;
- const VERSION = '2.3.31-DEV';
+ const VERSION = '2.3.31';
const VERSION_ID = '20331';
const MAJOR_VERSION = '2';
const MINOR_VERSION = '3';
const RELEASE_VERSION = '31';
- const EXTRA_VERSION = 'DEV';
+ const EXTRA_VERSION = '';
/**
* Constructor.
From 9962f36f97753b725c2c53d50b7c3159d0d1f560 Mon Sep 17 00:00:00 2001
From: Fabien Potencier
Date: Mon, 13 Jul 2015 11:30:54 +0200
Subject: [PATCH 0036/3475] bumped Symfony version to 2.3.32
---
src/Symfony/Component/HttpKernel/Kernel.php | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/Symfony/Component/HttpKernel/Kernel.php b/src/Symfony/Component/HttpKernel/Kernel.php
index a6cc4e600100b..5655275e53184 100644
--- a/src/Symfony/Component/HttpKernel/Kernel.php
+++ b/src/Symfony/Component/HttpKernel/Kernel.php
@@ -60,12 +60,12 @@ abstract class Kernel implements KernelInterface, TerminableInterface
protected $startTime;
protected $loadClassCache;
- const VERSION = '2.3.31';
- const VERSION_ID = '20331';
+ const VERSION = '2.3.32-DEV';
+ const VERSION_ID = '20332';
const MAJOR_VERSION = '2';
const MINOR_VERSION = '3';
- const RELEASE_VERSION = '31';
- const EXTRA_VERSION = '';
+ const RELEASE_VERSION = '32';
+ const EXTRA_VERSION = 'DEV';
/**
* Constructor.
From 524ccac97c9e3b180461cac46a9e14e27a60897d Mon Sep 17 00:00:00 2001
From: Fabien Potencier
Date: Mon, 13 Jul 2015 11:34:21 +0200
Subject: [PATCH 0037/3475] updated CHANGELOG for 2.6.10
---
CHANGELOG-2.6.md | 49 ++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 49 insertions(+)
diff --git a/CHANGELOG-2.6.md b/CHANGELOG-2.6.md
index 8d179c384ce44..e466668f8f88c 100644
--- a/CHANGELOG-2.6.md
+++ b/CHANGELOG-2.6.md
@@ -7,6 +7,55 @@ in 2.6 minor versions.
To get the diff for a specific change, go to https://github.com/symfony/symfony/commit/XXX where XXX is the change hash
To get the diff between two versions, go to https://github.com/symfony/symfony/compare/v2.6.0...v2.6.1
+* 2.6.10 (2015-07-13)
+
+ * bug #15248 Added 'default' color (jaytaph)
+ * bug #15243 Reload the session after regenerating its id (jakzal)
+ * bug #15202 [Security] allow to use `method` in XML configs (xabbuh)
+ * bug #15218 [Twig][Bridge] replaced `extends` with `use` in bootstrap_3_horizontal_layout.html.twig (MatTheCat)
+ * bug #15223 [Finder] Command::addAtIndex() fails with Command instance argument (thunderer)
+ * bug #15220 [DependencyInjection] Freeze also FrozenParameterBag::remove (lyrixx)
+ * bug #15110 Add a way to reset the singleton (dawehner)
+ * bug #15115 [Validator] always evaluate binary format when changed (xabbuh)
+ * bug #15163 Update DateTimeToArrayTransformer.php (zhil)
+ * bug #15150 [Translation] Azerbaijani language pluralization rule is wrong (shehi)
+ * bug #15159 Towards 100% HHVM compat (nicolas-grekas)
+ * bug #15146 Towards 100% HHVM compat (nicolas-grekas)
+ * bug #15069 [Form] Fixed: Data mappers always receive forms indexed by their names (webmozart)
+ * bug #15137 [Security] Initialize SwitchUserEvent::targetUser on attemptExitUser (Rvanlaak, xabbuh)
+ * bug #15126 [Validator] Fix BC for Validator's validate method (michalmarcinkowski)
+ * bug #15083 [DependencyInjection] Fail when dumping a Definition with no class nor factory (nicolas-grekas)
+ * bug #15127 [Validator] fix validation for Maestro UK card numbers (xabbuh)
+ * bug #15128 DbalLogger: Small nonutf8 array fix (vpetrovych, weaverryan)
+ * bug #15048 [Translation][Form][choice] empty_value shouldn't be translated when it has an empty value (Restless-ET)
+ * bug #15117 [Form] fixed sending non array data on submit to ResizeListener (BruceWouaigne)
+ * bug #15102 [Translation][debug cmd] fixed failing tests. (aitboudad)
+ * bug #13750 [DependencyInjection] Fixed decoration of service for service with parent (hason)
+ * bug #15086 Fixed the regexp for the validator of Maestro-based credit/debit cards (javiereguiluz)
+ * bug #15058 [Console] Fix STDERR output text on IBM iSeries OS400 (johnkary)
+ * bug #14853 [Validator] more strict e-mail validation regex (xabbuh)
+ * bug #15065 [Form] Fixed: remove quoted strings from Intl date formats (e.g. es_ES full pattern) (webmozart)
+ * bug #15039 [Translation][update cmd] taken account into bundle overrides path. (aitboudad)
+ * bug #15038 [Translation][debug cmd] taken account into bundle overrides path. (aitboudad)
+ * bug #14964 [bugfix][MonologBridge] WebProcessor: passing $extraFields to BaseWebProcessor (MacDada)
+ * bug #15036 [VarDumper] Fix dump output for better readability (nicolas-grekas)
+ * bug #15027 [Form] Fixed: Filter non-integers when selecting entities by int ID (webmozart, nicolas-grekas)
+ * bug #15000 [Debug] Fix fatal-errors handling on HHVM (nicolas-grekas)
+ * bug #14999 [Debug] Fix fatal-errors handling on HHVM (nicolas-grekas, digitalkaoz)
+ * bug #14959 [Debug+VarDumper] Fix handling of PHP7 "Throwable" exceptions (nicolas-grekas)
+ * bug #15010 [Debug] Fix log level of stacked errors (nicolas-grekas)
+ * bug #15017 [VarDumper] Fix uninitialized id in HtmlDumper (nicolas-grekas)
+ * bug #14980 Fixed fluent interface (jaytaph)
+ * bug #14974 [Security][Translation] #14920 update translations (vincentaubert)
+ * bug #14930 Bug #14836 [HttpFoundation] Moves default JSON encoding assignment fr… (Incognito)
+ * bug #14897 Allow new lines in Messages translated with transchoice() (replacement for #14867) (azine)
+ * bug #14895 [Form] Support DateTimeImmutable in transform() (c960657)
+ * bug #14891 without this change allways the legacy code get called (dominikzogg)
+ * bug #14859 Improve the config validation in TwigBundle (stof)
+ * bug #14785 [BrowserKit] Fix bug when uri starts with http. (amouhzi)
+ * bug #14807 [Security][Acl] enforce string identifiers (xabbuh)
+ * bug #14808 [WebProfilerBundle][logger] added missing deprecation message. (aitboudad)
+
* 2.6.9 (2015-05-30)
* bug #14777 Avoid using the app global variable in the profiler templates (stof)
From e246af5f3bdf64fa5a85936ee78e3574e094cf5f Mon Sep 17 00:00:00 2001
From: Fabien Potencier
Date: Mon, 13 Jul 2015 11:34:32 +0200
Subject: [PATCH 0038/3475] updated VERSION for 2.6.10
---
src/Symfony/Component/HttpKernel/Kernel.php | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/Symfony/Component/HttpKernel/Kernel.php b/src/Symfony/Component/HttpKernel/Kernel.php
index 3efc7d52eadc9..99dd895a96038 100644
--- a/src/Symfony/Component/HttpKernel/Kernel.php
+++ b/src/Symfony/Component/HttpKernel/Kernel.php
@@ -60,12 +60,12 @@ abstract class Kernel implements KernelInterface, TerminableInterface
protected $startTime;
protected $loadClassCache;
- const VERSION = '2.6.10-DEV';
+ const VERSION = '2.6.10';
const VERSION_ID = '20610';
const MAJOR_VERSION = '2';
const MINOR_VERSION = '6';
const RELEASE_VERSION = '10';
- const EXTRA_VERSION = 'DEV';
+ const EXTRA_VERSION = '';
/**
* Constructor.
From 1e668dd8058b12c4fb787907eb0ca5518ad304d8 Mon Sep 17 00:00:00 2001
From: Fabien Potencier
Date: Mon, 13 Jul 2015 11:49:29 +0200
Subject: [PATCH 0039/3475] bumped Symfony version to 2.6.11
---
src/Symfony/Component/HttpKernel/Kernel.php | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/Symfony/Component/HttpKernel/Kernel.php b/src/Symfony/Component/HttpKernel/Kernel.php
index 99dd895a96038..7bae3bc5ce953 100644
--- a/src/Symfony/Component/HttpKernel/Kernel.php
+++ b/src/Symfony/Component/HttpKernel/Kernel.php
@@ -60,12 +60,12 @@ abstract class Kernel implements KernelInterface, TerminableInterface
protected $startTime;
protected $loadClassCache;
- const VERSION = '2.6.10';
- const VERSION_ID = '20610';
+ const VERSION = '2.6.11-DEV';
+ const VERSION_ID = '20611';
const MAJOR_VERSION = '2';
const MINOR_VERSION = '6';
- const RELEASE_VERSION = '10';
- const EXTRA_VERSION = '';
+ const RELEASE_VERSION = '11';
+ const EXTRA_VERSION = 'DEV';
/**
* Constructor.
From e816d28a065925c4ecad07fd40201c753ccef060 Mon Sep 17 00:00:00 2001
From: Fabien Potencier
Date: Mon, 13 Jul 2015 20:24:43 +0200
Subject: [PATCH 0040/3475] updated CHANGELOG for 2.7.2
---
CHANGELOG-2.7.md | 54 ++++++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 54 insertions(+)
diff --git a/CHANGELOG-2.7.md b/CHANGELOG-2.7.md
index 1d6ef7e6a0520..ed61259f28946 100644
--- a/CHANGELOG-2.7.md
+++ b/CHANGELOG-2.7.md
@@ -7,6 +7,60 @@ in 2.7 minor versions.
To get the diff for a specific change, go to https://github.com/symfony/symfony/commit/XXX where XXX is the change hash
To get the diff between two versions, go to https://github.com/symfony/symfony/compare/v2.7.0...v2.7.1
+* 2.7.2 (2015-07-13)
+
+ * bug #15248 Added 'default' color (jaytaph)
+ * bug #15243 Reload the session after regenerating its id (jakzal)
+ * bug #15176 [Serializer] Fix ClassMetadata::sleep() (dunglas)
+ * bug #15202 [Security] allow to use `method` in XML configs (xabbuh)
+ * bug #15218 [Twig][Bridge] replaced `extends` with `use` in bootstrap_3_horizontal_layout.html.twig (MatTheCat)
+ * bug #15223 [Finder] Command::addAtIndex() fails with Command instance argument (thunderer)
+ * bug #15220 [DependencyInjection] Freeze also FrozenParameterBag::remove (lyrixx)
+ * bug #15110 Add a way to reset the singleton (dawehner)
+ * bug #15183 [TwigBridge] fix for legacy asset() with EmptyVersionStrategy (xabbuh)
+ * bug #15115 [Validator] always evaluate binary format when changed (xabbuh)
+ * bug #15163 Update DateTimeToArrayTransformer.php (zhil)
+ * bug #15150 [Translation] Azerbaijani language pluralization rule is wrong (shehi)
+ * bug #15159 Towards 100% HHVM compat (nicolas-grekas)
+ * bug #15146 Towards 100% HHVM compat (nicolas-grekas)
+ * bug #15061 [Form] Fixed handling of choices passed in choice groups (webmozart)
+ * bug #15145 [Bridge/PhpUnit] Enforce a consistent locale (nicolas-grekas)
+ * bug #15069 [Form] Fixed: Data mappers always receive forms indexed by their names (webmozart)
+ * bug #15137 [Security] Initialize SwitchUserEvent::targetUser on attemptExitUser (Rvanlaak, xabbuh)
+ * bug #15142 Fix choice translation domain for expanded choice widget (jvasseur)
+ * bug #15126 [Validator] Fix BC for Validator's validate method (michalmarcinkowski)
+ * bug #15101 [Form] Fixed compatibility with FormTypeInterface implementations that don't extend AbstractType (webmozart)
+ * bug #15083 [DependencyInjection] Fail when dumping a Definition with no class nor factory (nicolas-grekas)
+ * bug #15127 [Validator] fix validation for Maestro UK card numbers (xabbuh)
+ * bug #15128 DbalLogger: Small nonutf8 array fix (vpetrovych, weaverryan)
+ * bug #15048 [Translation][Form][choice] empty_value shouldn't be translated when it has an empty value (Restless-ET)
+ * bug #15117 [Form] fixed sending non array data on submit to ResizeListener (BruceWouaigne)
+ * bug #15122 [Console] respect multi-character shortcuts (xabbuh)
+ * bug #15012 [Validator] don't trigger deprecation with empty group array (xabbuh)
+ * bug #15102 [Translation][debug cmd] fixed failing tests. (aitboudad)
+ * bug #13750 [DependencyInjection] Fixed decoration of service for service with parent (hason)
+ * bug #15086 Fixed the regexp for the validator of Maestro-based credit/debit cards (javiereguiluz)
+ * bug #15058 [Console] Fix STDERR output text on IBM iSeries OS400 (johnkary)
+ * bug #14853 [Validator] more strict e-mail validation regex (xabbuh)
+ * bug #15064 [Form] Fixed: Support objects with __toString() in choice groups (webmozart)
+ * bug #15065 [Form] Fixed: remove quoted strings from Intl date formats (e.g. es_ES full pattern) (webmozart)
+ * bug #15039 [Translation][update cmd] taken account into bundle overrides path. (aitboudad)
+ * bug #15038 [Translation][debug cmd] taken account into bundle overrides path. (aitboudad)
+ * bug #14964 [bugfix][MonologBridge] WebProcessor: passing $extraFields to BaseWebProcessor (MacDada)
+ * bug #14989 [FrameworkBundle] Reuse PropertyAccessor service for ObjectNormalizer (dunglas)
+ * bug #15036 [VarDumper] Fix dump output for better readability (nicolas-grekas)
+ * bug #15031 [PhpUnitBridge] Enforce @-silencing of deprecation notices according to new policy (nicolas-grekas)
+ * bug #15027 [Form] Fixed: Filter non-integers when selecting entities by int ID (webmozart, nicolas-grekas)
+ * bug #15000 [Debug] Fix fatal-errors handling on HHVM (nicolas-grekas)
+ * bug #14999 [Debug] Fix fatal-errors handling on HHVM (nicolas-grekas, digitalkaoz)
+ * bug #14959 [Debug+VarDumper] Fix handling of PHP7 "Throwable" exceptions (nicolas-grekas)
+ * bug #15010 [Debug] Fix log level of stacked errors (nicolas-grekas)
+ * bug #15017 [VarDumper] Fix uninitialized id in HtmlDumper (nicolas-grekas)
+ * bug #14980 Fixed fluent interface (jaytaph)
+ * bug #14974 [Security][Translation] #14920 update translations (vincentaubert)
+ * bug #14950 [Form] Fixed: Filter non-integers when selecting entities by int ID (webmozart)
+ * bug #14930 Bug #14836 [HttpFoundation] Moves default JSON encoding assignment fr… (Incognito)
+
* 2.7.1 (2015-06-11)
* bug #14835 [DependencyInjection] Fixed resolving of service configurators containing Definition objects (webmozart)
From 969d709ad428076bf1084e386dc26dd904d9fb84 Mon Sep 17 00:00:00 2001
From: Fabien Potencier
Date: Mon, 13 Jul 2015 21:27:49 +0200
Subject: [PATCH 0041/3475] updated VERSION for 2.7.2
---
src/Symfony/Component/HttpKernel/Kernel.php | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/Symfony/Component/HttpKernel/Kernel.php b/src/Symfony/Component/HttpKernel/Kernel.php
index 2da885a815166..73c4b8b419fd8 100644
--- a/src/Symfony/Component/HttpKernel/Kernel.php
+++ b/src/Symfony/Component/HttpKernel/Kernel.php
@@ -60,12 +60,12 @@ abstract class Kernel implements KernelInterface, TerminableInterface
protected $startTime;
protected $loadClassCache;
- const VERSION = '2.7.2-DEV';
+ const VERSION = '2.7.2';
const VERSION_ID = '20702';
const MAJOR_VERSION = '2';
const MINOR_VERSION = '7';
const RELEASE_VERSION = '2';
- const EXTRA_VERSION = 'DEV';
+ const EXTRA_VERSION = '';
const END_OF_MAINTENANCE = '05/2018';
const END_OF_LIFE = '05/2019';
From 095bfd61ca0d68f04f4121c18aa4518cb28e960c Mon Sep 17 00:00:00 2001
From: Fabien Potencier
Date: Mon, 13 Jul 2015 22:39:19 +0200
Subject: [PATCH 0042/3475] bumped Symfony version to 2.7.3
---
src/Symfony/Component/HttpKernel/Kernel.php | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/Symfony/Component/HttpKernel/Kernel.php b/src/Symfony/Component/HttpKernel/Kernel.php
index 73c4b8b419fd8..b9e6a52c13889 100644
--- a/src/Symfony/Component/HttpKernel/Kernel.php
+++ b/src/Symfony/Component/HttpKernel/Kernel.php
@@ -60,12 +60,12 @@ abstract class Kernel implements KernelInterface, TerminableInterface
protected $startTime;
protected $loadClassCache;
- const VERSION = '2.7.2';
- const VERSION_ID = '20702';
+ const VERSION = '2.7.3-DEV';
+ const VERSION_ID = '20703';
const MAJOR_VERSION = '2';
const MINOR_VERSION = '7';
- const RELEASE_VERSION = '2';
- const EXTRA_VERSION = '';
+ const RELEASE_VERSION = '3';
+ const EXTRA_VERSION = 'DEV';
const END_OF_MAINTENANCE = '05/2018';
const END_OF_LIFE = '05/2019';
From 3fcf61e664ccb12e9dd8ae98b33418cbfd095460 Mon Sep 17 00:00:00 2001
From: Sebastiaan Stok
Date: Tue, 14 Jul 2015 11:47:38 +0200
Subject: [PATCH 0043/3475] fix broken ChoiceQuestion
---
src/Symfony/Component/Console/Question/ChoiceQuestion.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/Symfony/Component/Console/Question/ChoiceQuestion.php b/src/Symfony/Component/Console/Question/ChoiceQuestion.php
index a61b410d519e0..a36c739e56a8f 100644
--- a/src/Symfony/Component/Console/Question/ChoiceQuestion.php
+++ b/src/Symfony/Component/Console/Question/ChoiceQuestion.php
@@ -162,7 +162,7 @@ private function getDefaultValidator()
throw new \InvalidArgumentException(sprintf($errorMessage, $value));
}
- $multiselectChoices[] = $choices[(string) $result];
+ $multiselectChoices[] = (string) $result;
}
if ($multiselect) {
From cd42e2de93c7ea1394aa2b83367756a3affee03e Mon Sep 17 00:00:00 2001
From: Jakub Zalas
Date: Tue, 14 Jul 2015 14:59:01 +0100
Subject: [PATCH 0044/3475] [FrameworkBundle] Add path verification to the
template parsing test cases
---
.../Templating/TemplateNameParserTest.php | 33 ++++++++++---------
1 file changed, 17 insertions(+), 16 deletions(-)
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/TemplateNameParserTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/TemplateNameParserTest.php
index ca10c3a8fe861..d8e69a6a73f81 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/TemplateNameParserTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/TemplateNameParserTest.php
@@ -43,30 +43,31 @@ protected function tearDown()
}
/**
- * @dataProvider getLogicalNameToTemplateProvider
+ * @dataProvider parseProvider
*/
- public function testParse($name, $ref)
+ public function testParse($name, $logicalName, $path, $ref)
{
$template = $this->parser->parse($name);
- $this->assertEquals($template->getLogicalName(), $ref->getLogicalName());
- $this->assertEquals($template->getLogicalName(), $name);
+ $this->assertSame($ref->getLogicalName(), $template->getLogicalName());
+ $this->assertSame($logicalName, $template->getLogicalName());
+ $this->assertSame($path, $template->getPath());
}
- public function getLogicalNameToTemplateProvider()
+ public function parseProvider()
{
return array(
- array('FooBundle:Post:index.html.php', new TemplateReference('FooBundle', 'Post', 'index', 'html', 'php')),
- array('FooBundle:Post:index.html.twig', new TemplateReference('FooBundle', 'Post', 'index', 'html', 'twig')),
- array('FooBundle:Post:index.xml.php', new TemplateReference('FooBundle', 'Post', 'index', 'xml', 'php')),
- array('SensioFooBundle:Post:index.html.php', new TemplateReference('SensioFooBundle', 'Post', 'index', 'html', 'php')),
- array('SensioCmsFooBundle:Post:index.html.php', new TemplateReference('SensioCmsFooBundle', 'Post', 'index', 'html', 'php')),
- array(':Post:index.html.php', new TemplateReference('', 'Post', 'index', 'html', 'php')),
- array('::index.html.php', new TemplateReference('', '', 'index', 'html', 'php')),
- array('FooBundle:Post:foo.bar.index.html.php', new TemplateReference('FooBundle', 'Post', 'foo.bar.index', 'html', 'php')),
- array('/path/to/section/name.php', new BaseTemplateReference('/path/to/section/name.php', 'php')),
- array('name.twig', new BaseTemplateReference('name.twig', 'twig')),
- array('name', new BaseTemplateReference('name')),
+ array('FooBundle:Post:index.html.php', 'FooBundle:Post:index.html.php', '@FooBundle/Resources/views/Post/index.html.php', new TemplateReference('FooBundle', 'Post', 'index', 'html', 'php')),
+ array('FooBundle:Post:index.html.twig', 'FooBundle:Post:index.html.twig', '@FooBundle/Resources/views/Post/index.html.twig', new TemplateReference('FooBundle', 'Post', 'index', 'html', 'twig')),
+ array('FooBundle:Post:index.xml.php', 'FooBundle:Post:index.xml.php', '@FooBundle/Resources/views/Post/index.xml.php', new TemplateReference('FooBundle', 'Post', 'index', 'xml', 'php')),
+ array('SensioFooBundle:Post:index.html.php', 'SensioFooBundle:Post:index.html.php', '@SensioFooBundle/Resources/views/Post/index.html.php', new TemplateReference('SensioFooBundle', 'Post', 'index', 'html', 'php')),
+ array('SensioCmsFooBundle:Post:index.html.php', 'SensioCmsFooBundle:Post:index.html.php', '@SensioCmsFooBundle/Resources/views/Post/index.html.php', new TemplateReference('SensioCmsFooBundle', 'Post', 'index', 'html', 'php')),
+ array(':Post:index.html.php', ':Post:index.html.php', 'views/Post/index.html.php', new TemplateReference('', 'Post', 'index', 'html', 'php')),
+ array('::index.html.php', '::index.html.php', 'views/index.html.php', new TemplateReference('', '', 'index', 'html', 'php')),
+ array('FooBundle:Post:foo.bar.index.html.php', 'FooBundle:Post:foo.bar.index.html.php', '@FooBundle/Resources/views/Post/foo.bar.index.html.php', new TemplateReference('FooBundle', 'Post', 'foo.bar.index', 'html', 'php')),
+ array('/path/to/section/name.php', '/path/to/section/name.php', '/path/to/section/name.php', new BaseTemplateReference('/path/to/section/name.php', 'php')),
+ array('name.twig', 'name.twig', 'name.twig', new BaseTemplateReference('name.twig', 'twig')),
+ array('name', 'name', 'name', new BaseTemplateReference('name')),
);
}
From 03642b8ffeaf68b25a61308a7ee9f60e3993bdba Mon Sep 17 00:00:00 2001
From: Jakub Zalas
Date: Tue, 14 Jul 2015 19:21:52 +0100
Subject: [PATCH 0045/3475] [Form] Fix a BC break in the entity
---
.../Doctrine/Form/Type/DoctrineType.php | 2 +-
.../Tests/Form/Type/EntityTypeTest.php | 25 +++++++++++++++++++
2 files changed, 26 insertions(+), 1 deletion(-)
diff --git a/src/Symfony/Bridge/Doctrine/Form/Type/DoctrineType.php b/src/Symfony/Bridge/Doctrine/Form/Type/DoctrineType.php
index 2c5012dedff2c..f84d4965bf174 100644
--- a/src/Symfony/Bridge/Doctrine/Form/Type/DoctrineType.php
+++ b/src/Symfony/Bridge/Doctrine/Form/Type/DoctrineType.php
@@ -87,7 +87,7 @@ public static function createChoiceLabel($choice)
*/
public static function createChoiceName($choice, $key, $value)
{
- return (string) $value;
+ return str_replace('-', '_', (string) $value);
}
/**
diff --git a/src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypeTest.php b/src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypeTest.php
index e22db0093ca3e..b9680b45e5521 100644
--- a/src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypeTest.php
+++ b/src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypeTest.php
@@ -495,6 +495,31 @@ public function testSubmitMultipleExpanded()
$this->assertSame('3', $field['3']->getViewData());
}
+ public function testSubmitMultipleExpandedWithNegativeIntegerId()
+ {
+ $entity1 = new SingleIntIdEntity(-1, 'Foo');
+ $entity2 = new SingleIntIdEntity(2, 'Bar');
+
+ $this->persist(array($entity1, $entity2));
+
+ $field = $this->factory->createNamed('name', 'entity', null, array(
+ 'multiple' => true,
+ 'expanded' => true,
+ 'em' => 'default',
+ 'class' => self::SINGLE_IDENT_CLASS,
+ 'choice_label' => 'name',
+ ));
+
+ $field->submit(array('-1'));
+
+ $expected = new ArrayCollection(array($entity1));
+
+ $this->assertTrue($field->isSynchronized());
+ $this->assertEquals($expected, $field->getData());
+ $this->assertTrue($field['_1']->getData());
+ $this->assertFalse($field['2']->getData());
+ }
+
public function testOverrideChoices()
{
$entity1 = new SingleIntIdEntity(1, 'Foo');
From 132a4e4b6fb8382b41032f6f7b7eb2b35f2790c5 Mon Sep 17 00:00:00 2001
From: Jakub Zalas
Date: Wed, 15 Jul 2015 08:00:45 +0100
Subject: [PATCH 0046/3475] [FrameworkBundle] Fix template location for PHP
templates
---
.../Bundle/FrameworkBundle/Templating/TemplateNameParser.php | 2 +-
.../FrameworkBundle/Tests/Templating/TemplateNameParserTest.php | 2 ++
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/src/Symfony/Bundle/FrameworkBundle/Templating/TemplateNameParser.php b/src/Symfony/Bundle/FrameworkBundle/Templating/TemplateNameParser.php
index 4777fbeadbb49..46e2983f5deab 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Templating/TemplateNameParser.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Templating/TemplateNameParser.php
@@ -56,7 +56,7 @@ public function parse($name)
throw new \RuntimeException(sprintf('Template name "%s" contains invalid characters.', $name));
}
- if (!preg_match('/^([^:]*):([^:]*):(.+)\.([^\.]+)\.([^\.]+)$/', $name, $matches)) {
+ if (!preg_match('/^(?:([^:]*):)?(?:([^:]*):)?(.+)\.([^\.]+)\.([^\.]+)$/', $name, $matches)) {
return parent::parse($name);
}
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/TemplateNameParserTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/TemplateNameParserTest.php
index d8e69a6a73f81..4ff824bf7ca82 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/TemplateNameParserTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/TemplateNameParserTest.php
@@ -64,10 +64,12 @@ public function parseProvider()
array('SensioCmsFooBundle:Post:index.html.php', 'SensioCmsFooBundle:Post:index.html.php', '@SensioCmsFooBundle/Resources/views/Post/index.html.php', new TemplateReference('SensioCmsFooBundle', 'Post', 'index', 'html', 'php')),
array(':Post:index.html.php', ':Post:index.html.php', 'views/Post/index.html.php', new TemplateReference('', 'Post', 'index', 'html', 'php')),
array('::index.html.php', '::index.html.php', 'views/index.html.php', new TemplateReference('', '', 'index', 'html', 'php')),
+ array('index.html.php', '::index.html.php', 'views/index.html.php', new TemplateReference('', '', 'index', 'html', 'php')),
array('FooBundle:Post:foo.bar.index.html.php', 'FooBundle:Post:foo.bar.index.html.php', '@FooBundle/Resources/views/Post/foo.bar.index.html.php', new TemplateReference('FooBundle', 'Post', 'foo.bar.index', 'html', 'php')),
array('/path/to/section/name.php', '/path/to/section/name.php', '/path/to/section/name.php', new BaseTemplateReference('/path/to/section/name.php', 'php')),
array('name.twig', 'name.twig', 'name.twig', new BaseTemplateReference('name.twig', 'twig')),
array('name', 'name', 'name', new BaseTemplateReference('name')),
+ array('default/index.html.php', '::default/index.html.php', 'views/default/index.html.php', new TemplateReference(null, null, 'default/index', 'html', 'php')),
);
}
From 23bc2649ba7b155e846d11e9e4f88ae1d850ff3b Mon Sep 17 00:00:00 2001
From: Jakub Zalas
Date: Wed, 15 Jul 2015 08:34:36 +0100
Subject: [PATCH 0047/3475] [Console] Set QuestionHelper max attempts in tests
Otherwise the process will block if a test fails.
---
.../Component/Console/Tests/Helper/QuestionHelperTest.php | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/src/Symfony/Component/Console/Tests/Helper/QuestionHelperTest.php b/src/Symfony/Component/Console/Tests/Helper/QuestionHelperTest.php
index 99c89edc0e457..a1f85b174012f 100644
--- a/src/Symfony/Component/Console/Tests/Helper/QuestionHelperTest.php
+++ b/src/Symfony/Component/Console/Tests/Helper/QuestionHelperTest.php
@@ -36,15 +36,18 @@ public function testAskChoice()
$questionHelper->setInputStream($this->getInputStream("\n1\n 1 \nFabien\n1\nFabien\n1\n0,2\n 0 , 2 \n\n\n"));
$question = new ChoiceQuestion('What is your favorite superhero?', $heroes, '2');
+ $question->setMaxAttempts(1);
// first answer is an empty answer, we're supposed to receive the default value
$this->assertEquals('Spiderman', $questionHelper->ask($this->createInputInterfaceMock(), $this->createOutputInterface(), $question));
$question = new ChoiceQuestion('What is your favorite superhero?', $heroes);
+ $question->setMaxAttempts(1);
$this->assertEquals('Batman', $questionHelper->ask($this->createInputInterfaceMock(), $this->createOutputInterface(), $question));
$this->assertEquals('Batman', $questionHelper->ask($this->createInputInterfaceMock(), $this->createOutputInterface(), $question));
$question = new ChoiceQuestion('What is your favorite superhero?', $heroes);
$question->setErrorMessage('Input "%s" is not a superhero!');
+ $question->setMaxAttempts(2);
$this->assertEquals('Batman', $questionHelper->ask($this->createInputInterfaceMock(), $output = $this->createOutputInterface(), $question));
rewind($output->getStream());
@@ -61,6 +64,7 @@ public function testAskChoice()
}
$question = new ChoiceQuestion('What is your favorite superhero?', $heroes, null);
+ $question->setMaxAttempts(1);
$question->setMultiselect(true);
$this->assertEquals(array('Batman'), $questionHelper->ask($this->createInputInterfaceMock(), $this->createOutputInterface(), $question));
@@ -68,11 +72,13 @@ public function testAskChoice()
$this->assertEquals(array('Superman', 'Spiderman'), $questionHelper->ask($this->createInputInterfaceMock(), $this->createOutputInterface(), $question));
$question = new ChoiceQuestion('What is your favorite superhero?', $heroes, '0,1');
+ $question->setMaxAttempts(1);
$question->setMultiselect(true);
$this->assertEquals(array('Superman', 'Batman'), $questionHelper->ask($this->createInputInterfaceMock(), $this->createOutputInterface(), $question));
$question = new ChoiceQuestion('What is your favorite superhero?', $heroes, ' 0 , 1 ');
+ $question->setMaxAttempts(1);
$question->setMultiselect(true);
$this->assertEquals(array('Superman', 'Batman'), $questionHelper->ask($this->createInputInterfaceMock(), $this->createOutputInterface(), $question));
@@ -227,6 +233,7 @@ public function testSelectChoiceFromSimpleChoices($providedAnswer, $expectedValu
$dialog->setHelperSet($helperSet);
$question = new ChoiceQuestion('Please select the environment to load', $possibleChoices);
+ $question->setMaxAttempts(1);
$answer = $dialog->ask($this->createInputInterfaceMock(), $this->createOutputInterface(), $question);
$this->assertSame($expectedValue, $answer);
From ba6000baff99addb29890b134fabb4792be506dd Mon Sep 17 00:00:00 2001
From: Tristan Darricau
Date: Wed, 15 Jul 2015 10:22:14 +0200
Subject: [PATCH 0048/3475] [HttpFoundation] Behaviour change in PHP7 for
substr
In PHP7 the behaviour of substr() changed.
To resume: "Truncating an entire string should result in a string."
See: https://bugs.php.net/bug.php?id=62922
---
src/Symfony/Component/HttpFoundation/Request.php | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/src/Symfony/Component/HttpFoundation/Request.php b/src/Symfony/Component/HttpFoundation/Request.php
index 84b3a69adebec..3b31d8e59311c 100644
--- a/src/Symfony/Component/HttpFoundation/Request.php
+++ b/src/Symfony/Component/HttpFoundation/Request.php
@@ -1790,7 +1790,8 @@ protected function preparePathInfo()
$requestUri = substr($requestUri, 0, $pos);
}
- if (null !== $baseUrl && false === $pathInfo = substr($requestUri, strlen($baseUrl))) {
+ $pathInfo = substr($requestUri, strlen($baseUrl));
+ if (null !== $baseUrl && (false === $pathInfo || '' === $pathInfo)) {
// If substr() returns false then PATH_INFO is set to an empty string
return '/';
} elseif (null === $baseUrl) {
From d4473f30f89b618b449b02cdfd926502169ab35b Mon Sep 17 00:00:00 2001
From: Christian Flothmann
Date: Wed, 15 Jul 2015 19:30:30 +0200
Subject: [PATCH 0049/3475] [Config] deprecate cannotBeEmpty() for boolean and
numeric nodes
---
.../Definition/Builder/BooleanNodeDefinition.php | 12 ++++++++++++
.../Definition/Builder/NumericNodeDefinition.php | 12 ++++++++++++
2 files changed, 24 insertions(+)
diff --git a/src/Symfony/Component/Config/Definition/Builder/BooleanNodeDefinition.php b/src/Symfony/Component/Config/Definition/Builder/BooleanNodeDefinition.php
index db7ebc24117a1..7f8eb2681d9e9 100644
--- a/src/Symfony/Component/Config/Definition/Builder/BooleanNodeDefinition.php
+++ b/src/Symfony/Component/Config/Definition/Builder/BooleanNodeDefinition.php
@@ -30,6 +30,18 @@ public function __construct($name, NodeParentInterface $parent = null)
$this->nullEquivalent = true;
}
+ /**
+ * {@inheritdoc}
+ *
+ * @deprecated Deprecated since version 2.8, to be removed in 3.0.
+ */
+ public function cannotBeEmpty()
+ {
+ @trigger_error('The '.__METHOD__.' method is deprecated since version 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
+
+ return parent::cannotBeEmpty();
+ }
+
/**
* Instantiate a Node.
*
diff --git a/src/Symfony/Component/Config/Definition/Builder/NumericNodeDefinition.php b/src/Symfony/Component/Config/Definition/Builder/NumericNodeDefinition.php
index ddd716d06a7b5..a1cd49b73cab4 100644
--- a/src/Symfony/Component/Config/Definition/Builder/NumericNodeDefinition.php
+++ b/src/Symfony/Component/Config/Definition/Builder/NumericNodeDefinition.php
@@ -58,4 +58,16 @@ public function min($min)
return $this;
}
+
+ /**
+ * {@inheritdoc}
+ *
+ * @deprecated Deprecated since version 2.8, to be removed in 3.0.
+ */
+ public function cannotBeEmpty()
+ {
+ @trigger_error('The '.__METHOD__.' method is deprecated since version 2.8 and will be removed in 3.0.', E_USER_DEPRECATED);
+
+ return parent::cannotBeEmpty();
+ }
}
From 0199fbf5450a4972a2f21e551d48c9fc380ae805 Mon Sep 17 00:00:00 2001
From: Christian Flothmann
Date: Thu, 2 Jul 2015 00:01:41 +0200
Subject: [PATCH 0050/3475] [Config] type specific check for emptiness
---
.../Config/Definition/BooleanNode.php | 9 ++++
.../Config/Definition/NumericNode.php | 9 ++++
.../Config/Definition/ScalarNode.php | 8 ++++
.../Config/Definition/VariableNode.php | 18 ++++++-
.../Tests/Definition/BooleanNodeTest.php | 13 +++++
.../Config/Tests/Definition/FloatNodeTest.php | 13 +++++
.../Tests/Definition/IntegerNodeTest.php | 13 +++++
.../Tests/Definition/ScalarNodeTest.php | 47 +++++++++++++++++++
8 files changed, 129 insertions(+), 1 deletion(-)
diff --git a/src/Symfony/Component/Config/Definition/BooleanNode.php b/src/Symfony/Component/Config/Definition/BooleanNode.php
index 939e86fa731ab..02bedd8ed4ab2 100644
--- a/src/Symfony/Component/Config/Definition/BooleanNode.php
+++ b/src/Symfony/Component/Config/Definition/BooleanNode.php
@@ -36,4 +36,13 @@ protected function validateType($value)
throw $ex;
}
}
+
+ /**
+ * {@inheritdoc}
+ */
+ protected function isValueEmpty($value)
+ {
+ // a boolean value cannot be empty
+ return false;
+ }
}
diff --git a/src/Symfony/Component/Config/Definition/NumericNode.php b/src/Symfony/Component/Config/Definition/NumericNode.php
index 2304ad9987120..439935e4559f8 100644
--- a/src/Symfony/Component/Config/Definition/NumericNode.php
+++ b/src/Symfony/Component/Config/Definition/NumericNode.php
@@ -52,4 +52,13 @@ protected function finalizeValue($value)
return $value;
}
+
+ /**
+ * {@inheritdoc}
+ */
+ protected function isValueEmpty($value)
+ {
+ // a numeric value cannot be empty
+ return false;
+ }
}
diff --git a/src/Symfony/Component/Config/Definition/ScalarNode.php b/src/Symfony/Component/Config/Definition/ScalarNode.php
index 44ccfc56b289d..7f29734ac1c61 100644
--- a/src/Symfony/Component/Config/Definition/ScalarNode.php
+++ b/src/Symfony/Component/Config/Definition/ScalarNode.php
@@ -43,4 +43,12 @@ protected function validateType($value)
throw $ex;
}
}
+
+ /**
+ * {@inheritdoc}
+ */
+ protected function isValueEmpty($value)
+ {
+ return null === $value || '' === $value;
+ }
}
diff --git a/src/Symfony/Component/Config/Definition/VariableNode.php b/src/Symfony/Component/Config/Definition/VariableNode.php
index d253a00859a7f..b3cd8a3f02acf 100644
--- a/src/Symfony/Component/Config/Definition/VariableNode.php
+++ b/src/Symfony/Component/Config/Definition/VariableNode.php
@@ -84,7 +84,7 @@ protected function validateType($value)
*/
protected function finalizeValue($value)
{
- if (!$this->allowEmptyValue && empty($value)) {
+ if (!$this->allowEmptyValue && $this->isValueEmpty($value)) {
$ex = new InvalidConfigurationException(sprintf(
'The path "%s" cannot contain an empty value, but got %s.',
$this->getPath(),
@@ -113,4 +113,20 @@ protected function mergeValues($leftSide, $rightSide)
{
return $rightSide;
}
+
+ /**
+ * Evaluates if the given value is to be treated as empty.
+ *
+ * By default, PHP's empty() function is used to test for emptiness. This
+ * method may be overridden by subtypes to better match their understanding
+ * of empty data.
+ *
+ * @param mixed $value
+ *
+ * @return bool
+ */
+ protected function isValueEmpty($value)
+ {
+ return empty($value);
+ }
}
diff --git a/src/Symfony/Component/Config/Tests/Definition/BooleanNodeTest.php b/src/Symfony/Component/Config/Tests/Definition/BooleanNodeTest.php
index 0753d64b4fecc..b0cb079e96fbc 100644
--- a/src/Symfony/Component/Config/Tests/Definition/BooleanNodeTest.php
+++ b/src/Symfony/Component/Config/Tests/Definition/BooleanNodeTest.php
@@ -24,6 +24,19 @@ public function testNormalize($value)
$this->assertSame($value, $node->normalize($value));
}
+ /**
+ * @dataProvider getValidValues
+ *
+ * @param bool $value
+ */
+ public function testValidNonEmptyValues($value)
+ {
+ $node = new BooleanNode('test');
+ $node->setAllowEmptyValue(false);
+
+ $this->assertSame($value, $node->finalize($value));
+ }
+
public function getValidValues()
{
return array(
diff --git a/src/Symfony/Component/Config/Tests/Definition/FloatNodeTest.php b/src/Symfony/Component/Config/Tests/Definition/FloatNodeTest.php
index 4f308ca76b77c..84afd6c104223 100644
--- a/src/Symfony/Component/Config/Tests/Definition/FloatNodeTest.php
+++ b/src/Symfony/Component/Config/Tests/Definition/FloatNodeTest.php
@@ -24,6 +24,19 @@ public function testNormalize($value)
$this->assertSame($value, $node->normalize($value));
}
+ /**
+ * @dataProvider getValidValues
+ *
+ * @param int $value
+ */
+ public function testValidNonEmptyValues($value)
+ {
+ $node = new FloatNode('test');
+ $node->setAllowEmptyValue(false);
+
+ $this->assertSame($value, $node->finalize($value));
+ }
+
public function getValidValues()
{
return array(
diff --git a/src/Symfony/Component/Config/Tests/Definition/IntegerNodeTest.php b/src/Symfony/Component/Config/Tests/Definition/IntegerNodeTest.php
index 1527db7a70206..58d21485993f1 100644
--- a/src/Symfony/Component/Config/Tests/Definition/IntegerNodeTest.php
+++ b/src/Symfony/Component/Config/Tests/Definition/IntegerNodeTest.php
@@ -24,6 +24,19 @@ public function testNormalize($value)
$this->assertSame($value, $node->normalize($value));
}
+ /**
+ * @dataProvider getValidValues
+ *
+ * @param int $value
+ */
+ public function testValidNonEmptyValues($value)
+ {
+ $node = new IntegerNode('test');
+ $node->setAllowEmptyValue(false);
+
+ $this->assertSame($value, $node->finalize($value));
+ }
+
public function getValidValues()
{
return array(
diff --git a/src/Symfony/Component/Config/Tests/Definition/ScalarNodeTest.php b/src/Symfony/Component/Config/Tests/Definition/ScalarNodeTest.php
index 056dd73b0786f..9f8dada086b51 100644
--- a/src/Symfony/Component/Config/Tests/Definition/ScalarNodeTest.php
+++ b/src/Symfony/Component/Config/Tests/Definition/ScalarNodeTest.php
@@ -57,4 +57,51 @@ public function getInvalidValues()
array(new \stdClass()),
);
}
+
+ /**
+ * @dataProvider getValidNonEmptyValues
+ *
+ * @param mixed $value
+ */
+ public function testValidNonEmptyValues($value)
+ {
+ $node = new ScalarNode('test');
+ $node->setAllowEmptyValue(false);
+
+ $this->assertSame($value, $node->finalize($value));
+ }
+
+ public function getValidNonEmptyValues()
+ {
+ return array(
+ array(false),
+ array(true),
+ array('foo'),
+ array(0),
+ array(1),
+ array(0.0),
+ array(0.1),
+ );
+ }
+
+ /**
+ * @dataProvider getEmptyValues
+ * @expectedException \Symfony\Component\Config\Definition\Exception\InvalidConfigurationException
+ *
+ * @param mixed $value
+ */
+ public function testNotAllowedEmptyValuesThrowException($value)
+ {
+ $node = new ScalarNode('test');
+ $node->setAllowEmptyValue(false);
+ $node->finalize($value);
+ }
+
+ public function getEmptyValues()
+ {
+ return array(
+ array(null),
+ array(''),
+ );
+ }
}
From 7fa79dadbad26f4091742dde8800f001941bf3f9 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?K=C3=A9vin=20Dunglas?=
Date: Wed, 15 Jul 2015 23:26:13 +0200
Subject: [PATCH 0051/3475] [DependencyInjection] Remove unused code in
XmlFileLoader
---
.../Component/DependencyInjection/Loader/XmlFileLoader.php | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php b/src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php
index 08067fa7984c8..95470ce7f7681 100644
--- a/src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php
+++ b/src/Symfony/Component/DependencyInjection/Loader/XmlFileLoader.php
@@ -48,7 +48,7 @@ public function load($resource, $type = null)
$this->parseImports($xml, $path);
// parameters
- $this->parseParameters($xml, $path);
+ $this->parseParameters($xml);
// extensions
$this->loadFromExtensions($xml);
@@ -69,9 +69,8 @@ public function supports($resource, $type = null)
* Parses parameters.
*
* @param SimpleXMLElement $xml
- * @param string $file
*/
- private function parseParameters(SimpleXMLElement $xml, $file)
+ private function parseParameters(SimpleXMLElement $xml)
{
if (!$xml->parameters) {
return;
From b65d0a26eaf37994a180cfdc5fe44f784cdeac55 Mon Sep 17 00:00:00 2001
From: Alexander Schwenn
Date: Tue, 7 Apr 2015 23:28:35 +0200
Subject: [PATCH 0052/3475] [WebProfilerBundle] Add link to show profile of
latest request
---
.../Controller/ProfilerController.php | 4 ++++
.../Resources/views/Profiler/info.html.twig | 15 +++++++++++----
.../Resources/views/Profiler/layout.html.twig | 1 +
.../Resources/views/Profiler/profiler.css.twig | 2 +-
4 files changed, 17 insertions(+), 5 deletions(-)
diff --git a/src/Symfony/Bundle/WebProfilerBundle/Controller/ProfilerController.php b/src/Symfony/Bundle/WebProfilerBundle/Controller/ProfilerController.php
index 2748910a19ae8..cada4ee6ca435 100644
--- a/src/Symfony/Bundle/WebProfilerBundle/Controller/ProfilerController.php
+++ b/src/Symfony/Bundle/WebProfilerBundle/Controller/ProfilerController.php
@@ -91,6 +91,10 @@ public function panelAction(Request $request, $token)
$panel = $request->query->get('panel', 'request');
$page = $request->query->get('page', 'home');
+ if ('latest' === $token && $latest = current($this->profiler->find(null, null, 1, null, null, null))) {
+ $token = $latest['token'];
+ }
+
if (!$profile = $this->profiler->loadProfile($token)) {
return new Response($this->twig->render('@WebProfiler/Profiler/info.html.twig', array('about' => 'no_token', 'token' => $token)), 200, array('Content-Type' => 'text/html'));
}
diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/info.html.twig b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/info.html.twig
index aeffb2cf256bb..9be617a3ecab7 100644
--- a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/info.html.twig
+++ b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/info.html.twig
@@ -25,10 +25,17 @@
The token already exists in the database.
{% elseif about == 'no_token' %}
- Token not found
-
- Token "{{ token }}" was not found in the database.
-
+ {% if token == 'latest' %}
+ No profiles
+
+ No profiles found in the database.
+
+ {% else %}
+ Token not found
+
+ Token "{{ token }}" was not found in the database.
+
+ {% endif %}
{% endif %}
{% endblock %}
diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/layout.html.twig b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/layout.html.twig
index 12728b964df0f..6df82890c180b 100644
--- a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/layout.html.twig
+++ b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/layout.html.twig
@@ -14,6 +14,7 @@
{% if profile %}
View last 10
+
View latest
Profile for:
{{ profile.method|upper }}
{% if profile.method|upper in ['GET', 'HEAD'] %}
diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/profiler.css.twig b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/profiler.css.twig
index 4d84a6931ccea..fd32565347953 100644
--- a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/profiler.css.twig
+++ b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/profiler.css.twig
@@ -217,7 +217,7 @@ li {
border-top-right-radius: 16px;
line-height: 18px;
}
-a#resume-view-all {
+a#resume-view-all, a#resume-view-latest {
display: inline-block;
padding: 0.2em 0.7em;
margin-right: 0.5em;
From 1adb065d7017f07d6b79d345b7bd33448d426959 Mon Sep 17 00:00:00 2001
From: Nicolas Grekas
Date: Thu, 16 Jul 2015 10:43:55 +0200
Subject: [PATCH 0053/3475] [HttpFoundation] Fix Response::closeOutputBuffers()
for HHVM 3.3
---
src/Symfony/Component/HttpFoundation/Response.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/Symfony/Component/HttpFoundation/Response.php b/src/Symfony/Component/HttpFoundation/Response.php
index dc7203a8d1c86..17fb98102bfa8 100644
--- a/src/Symfony/Component/HttpFoundation/Response.php
+++ b/src/Symfony/Component/HttpFoundation/Response.php
@@ -1242,7 +1242,7 @@ public static function closeOutputBuffers($targetLevel, $flush)
{
$status = ob_get_status(true);
$level = count($status);
- $flags = PHP_VERSION_ID >= 50400 ? PHP_OUTPUT_HANDLER_REMOVABLE | ($flush ? PHP_OUTPUT_HANDLER_FLUSHABLE : PHP_OUTPUT_HANDLER_CLEANABLE) : -1;
+ $flags = defined('PHP_OUTPUT_HANDLER_REMOVABLE') ? PHP_OUTPUT_HANDLER_REMOVABLE | ($flush ? PHP_OUTPUT_HANDLER_FLUSHABLE : PHP_OUTPUT_HANDLER_CLEANABLE) : -1;
while ($level-- > $targetLevel && ($s = $status[$level]) && (!isset($s['del']) ? !isset($s['flags']) || $flags === ($s['flags'] & $flags) : $s['del'])) {
if ($flush) {
From ba129041ba19b6d5a62cfa34789d3b05e6efbacf Mon Sep 17 00:00:00 2001
From: Jakub Zalas
Date: Thu, 16 Jul 2015 09:25:41 +0100
Subject: [PATCH 0054/3475] [DependencyInjection] Forbid container cloning
---
.../Component/DependencyInjection/Container.php | 4 ++++
.../DependencyInjection/Tests/ContainerTest.php | 10 ++++++++++
2 files changed, 14 insertions(+)
diff --git a/src/Symfony/Component/DependencyInjection/Container.php b/src/Symfony/Component/DependencyInjection/Container.php
index 2b9fc5f4877a7..0222d7063b09e 100644
--- a/src/Symfony/Component/DependencyInjection/Container.php
+++ b/src/Symfony/Component/DependencyInjection/Container.php
@@ -604,4 +604,8 @@ public static function underscore($id)
{
return strtolower(preg_replace(array('/([A-Z]+)([A-Z][a-z])/', '/([a-z\d])([A-Z])/'), array('\\1_\\2', '\\1_\\2'), strtr($id, '_', '.')));
}
+
+ private function __clone()
+ {
+ }
}
diff --git a/src/Symfony/Component/DependencyInjection/Tests/ContainerTest.php b/src/Symfony/Component/DependencyInjection/Tests/ContainerTest.php
index 603269ccc6962..09b4a12e2fe1d 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/ContainerTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/ContainerTest.php
@@ -662,6 +662,16 @@ public function testAlias()
$this->assertTrue($c->has('alias'));
$this->assertSame($c->get('alias'), $c->get('bar'));
}
+
+ public function testThatCloningIsNotSupported()
+ {
+ $class = new \ReflectionClass('Symfony\Component\DependencyInjection\Container');
+ $clone = $class->getMethod('__clone');
+ if (PHP_VERSION_ID >= 540000) {
+ $this->assertFalse($class->isCloneable());
+ }
+ $this->assertTrue($clone->isPrivate());
+ }
}
class ProjectServiceContainer extends Container
From 059964daf33055015d42365f5404d7d97afc1afd Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?K=C3=A9vin=20Dunglas?=
Date: Thu, 9 Jul 2015 11:23:44 +0200
Subject: [PATCH 0055/3475] [HttpFoundation] [PSR-7] Allow to use resources as
content body and to return resources from string content
---
.../Component/HttpFoundation/Request.php | 52 +++++++++++++------
.../HttpFoundation/Tests/RequestTest.php | 21 +++++++-
2 files changed, 57 insertions(+), 16 deletions(-)
diff --git a/src/Symfony/Component/HttpFoundation/Request.php b/src/Symfony/Component/HttpFoundation/Request.php
index 84b3a69adebec..2d282517f7a3d 100644
--- a/src/Symfony/Component/HttpFoundation/Request.php
+++ b/src/Symfony/Component/HttpFoundation/Request.php
@@ -199,13 +199,13 @@ class Request
/**
* Constructor.
*
- * @param array $query The GET parameters
- * @param array $request The POST parameters
- * @param array $attributes The request attributes (parameters parsed from the PATH_INFO, ...)
- * @param array $cookies The COOKIE parameters
- * @param array $files The FILES parameters
- * @param array $server The SERVER parameters
- * @param string $content The raw body data
+ * @param array $query The GET parameters
+ * @param array $request The POST parameters
+ * @param array $attributes The request attributes (parameters parsed from the PATH_INFO, ...)
+ * @param array $cookies The COOKIE parameters
+ * @param array $files The FILES parameters
+ * @param array $server The SERVER parameters
+ * @param string|resource $content The raw body data
*
* @api
*/
@@ -219,13 +219,13 @@ public function __construct(array $query = array(), array $request = array(), ar
*
* This method also re-initializes all properties.
*
- * @param array $query The GET parameters
- * @param array $request The POST parameters
- * @param array $attributes The request attributes (parameters parsed from the PATH_INFO, ...)
- * @param array $cookies The COOKIE parameters
- * @param array $files The FILES parameters
- * @param array $server The SERVER parameters
- * @param string $content The raw body data
+ * @param array $query The GET parameters
+ * @param array $request The POST parameters
+ * @param array $attributes The request attributes (parameters parsed from the PATH_INFO, ...)
+ * @param array $cookies The COOKIE parameters
+ * @param array $files The FILES parameters
+ * @param array $server The SERVER parameters
+ * @param string|resource $content The raw body data
*
* @api
*/
@@ -1465,16 +1465,38 @@ public function isMethodSafe()
*/
public function getContent($asResource = false)
{
- if (PHP_VERSION_ID < 50600 && (false === $this->content || (true === $asResource && null !== $this->content))) {
+ $currentContentIsResource = is_resource($this->content);
+ if (PHP_VERSION_ID < 50600 && false === $this->content) {
throw new \LogicException('getContent() can only be called once when using the resource return type and PHP below 5.6.');
}
if (true === $asResource) {
+ if ($currentContentIsResource) {
+ rewind($this->content);
+
+ return $this->content;
+ }
+
+ // Content passed in parameter (test)
+ if (is_string($this->content)) {
+ $resource = fopen('php://temp','r+');
+ fwrite($resource, $this->content);
+ rewind($resource);
+
+ return $resource;
+ }
+
$this->content = false;
return fopen('php://input', 'rb');
}
+ if ($currentContentIsResource) {
+ rewind($this->content);
+
+ return stream_get_contents($this->content);
+ }
+
if (null === $this->content) {
$this->content = file_get_contents('php://input');
}
diff --git a/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php b/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php
index 366b555f9266b..797a00acda7bc 100644
--- a/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php
+++ b/src/Symfony/Component/HttpFoundation/Tests/RequestTest.php
@@ -923,6 +923,26 @@ public function testGetContentReturnsResource()
$this->assertTrue(feof($retval));
}
+ public function testGetContentReturnsResourceWhenContentSetInConstructor()
+ {
+ $req = new Request(array(), array(), array(), array(), array(), array(), 'MyContent');
+ $resource = $req->getContent(true);
+
+ $this->assertTrue(is_resource($resource));
+ $this->assertEquals('MyContent', stream_get_contents($resource));
+ }
+
+ public function testContentAsResource()
+ {
+ $resource = fopen('php://memory','r+');
+ fwrite($resource, 'My other content');
+ rewind($resource);
+
+ $req = new Request(array(), array(), array(), array(), array(), array(), $resource);
+ $this->assertEquals('My other content', stream_get_contents($req->getContent(true)));
+ $this->assertEquals('My other content', $req->getContent());
+ }
+
/**
* @expectedException \LogicException
* @dataProvider getContentCantBeCalledTwiceWithResourcesProvider
@@ -967,7 +987,6 @@ public function getContentCantBeCalledTwiceWithResourcesProvider()
return array(
'Resource then fetch' => array(true, false),
'Resource then resource' => array(true, true),
- 'Fetch then resource' => array(false, true),
);
}
From 72dce303095ace5643a8e1e2859a9f986ceb3a8f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?K=C3=A9vin=20Dunglas?=
Date: Sun, 19 Jul 2015 14:40:25 +0200
Subject: [PATCH 0056/3475] [Serializer] Simplify
AbstractNormalizer::prepareForDenormalization()
---
.../Serializer/Normalizer/AbstractNormalizer.php | 14 +-------------
1 file changed, 1 insertion(+), 13 deletions(-)
diff --git a/src/Symfony/Component/Serializer/Normalizer/AbstractNormalizer.php b/src/Symfony/Component/Serializer/Normalizer/AbstractNormalizer.php
index 78c82ff990a10..4de4771770b54 100644
--- a/src/Symfony/Component/Serializer/Normalizer/AbstractNormalizer.php
+++ b/src/Symfony/Component/Serializer/Normalizer/AbstractNormalizer.php
@@ -272,19 +272,7 @@ protected function getAllowedAttributes($classOrObject, array $context, $attribu
*/
protected function prepareForDenormalization($data)
{
- if (is_array($data) || is_object($data) && $data instanceof \ArrayAccess) {
- $normalizedData = $data;
- } elseif (is_object($data)) {
- $normalizedData = array();
-
- foreach ($data as $attribute => $value) {
- $normalizedData[$attribute] = $value;
- }
- } else {
- $normalizedData = array();
- }
-
- return $normalizedData;
+ return (array) $data;
}
/**
From 6ecc38afd41c36b95c8e8e14adf9b30426a10deb Mon Sep 17 00:00:00 2001
From: Kevin Robatel
Date: Tue, 21 Jul 2015 16:40:08 +0200
Subject: [PATCH 0057/3475] Fix typo 'assets.package' => 'assets.packages' in
UPGRADE-2.7
---
UPGRADE-2.7.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/UPGRADE-2.7.md b/UPGRADE-2.7.md
index ab1021fcdcaac..8fd61b41fd2c3 100644
--- a/UPGRADE-2.7.md
+++ b/UPGRADE-2.7.md
@@ -599,7 +599,7 @@ FrameworkBundle
* The `templating.helper.assets` was refactored and returns now an object of the type
`Symfony\Bundle\FrameworkBundle\Templating\Helper\AssetsHelper` instead of
`Symfony\Component\Templating\Helper\CoreAssetsHelper`. You can update your class definition
- or use the `assets.package` service instead. Using the `assets.package` service is the recommended
+ or use the `assets.packages` service instead. Using the `assets.packages` service is the recommended
way. The `templating.helper.assets` service will be removed in Symfony 3.0.
Before:
From 1c9b43396f992f0aa89b6395a908e47bc5bfdb2e Mon Sep 17 00:00:00 2001
From: Nicolas Grekas
Date: Tue, 21 Jul 2015 15:40:18 +0200
Subject: [PATCH 0058/3475] [travis] Fix deps=high jobs
---
.gitignore | 11 +++--
.travis.php | 45 +++++++++++++++++++
.travis.sh | 24 ----------
.travis.yml | 3 +-
src/Symfony/Bridge/Twig/composer.json | 2 +-
.../Bundle/FrameworkBundle/composer.json | 6 +--
6 files changed, 56 insertions(+), 35 deletions(-)
create mode 100644 .travis.php
delete mode 100644 .travis.sh
diff --git a/.gitignore b/.gitignore
index f16d739d03d08..76f1ab9a39367 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,8 +1,7 @@
-.php_cs.cache
-autoload.php
+vendor/
composer.lock
-composer.phar
-package*.tar
-packages.json
phpunit.xml
-/vendor/
+.php_cs.cache
+composer.phar
+package.tar
+/packages.json
diff --git a/.travis.php b/.travis.php
new file mode 100644
index 0000000000000..c27942913a741
--- /dev/null
+++ b/.travis.php
@@ -0,0 +1,45 @@
+ $_SERVER['argc']) {
+ echo "Usage: commit-range branch dir1 dir2 ... dirN\n";
+ exit(1);
+}
+
+$dirs = $_SERVER['argv'];
+array_shift($dirs);
+$range = array_shift($dirs);
+$branch = array_shift($dirs);
+
+$packages = array();
+$flags = PHP_VERSION_ID >= 50400 ? JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE : 0;
+
+foreach ($dirs as $dir) {
+ if (!`git diff --name-only $range -- $dir`) {
+ continue;
+ }
+ echo "$dir\n";
+
+ $package = json_decode(file_get_contents($dir.'/composer.json'));
+
+ $package->repositories = array(array(
+ 'type' => 'composer',
+ 'url' => 'file://'.__DIR__.'/',
+ ));
+ file_put_contents($dir.'/composer.json', json_encode($package, $flags));
+ passthru("cd $dir && tar -cf package.tar --exclude='package.tar' *");
+
+ $package->version = $branch.'.x-dev';
+ $package->dist['type'] = 'tar';
+ $package->dist['url'] = 'file://'.__DIR__."/$dir/package.tar";
+
+ $packages[$package->name][$package->version] = $package;
+
+ $versions = file_get_contents('https://packagist.org/packages/'.$package->name.'.json');
+ $versions = json_decode($versions);
+
+ foreach ($versions->package->versions as $version => $package) {
+ $packages[$package->name] += array($version => $package);
+ }
+}
+
+file_put_contents('packages.json', json_encode(compact('packages'), $flags));
diff --git a/.travis.sh b/.travis.sh
deleted file mode 100644
index 55020cb012785..0000000000000
--- a/.travis.sh
+++ /dev/null
@@ -1,24 +0,0 @@
-branch=$1
-if [ -z "$branch" ]; then
- echo 'Usage: branch dir1 dir2 ... dirN'
- exit 1
-fi
-shift
-components=$*
-if [ -z "$components" ]; then
- echo 'Usage: branch dir1 dir2 ... dirN'
- exit 1
-fi
-echo '{"packages": {' > packages.json
-for c in $components; do
- sed -i ':a;N;$!ba;s#^{\n\(\s*\)\("name"\)#{\n\1"repositories": \[{ "type": "composer", "url": "file://'$(pwd)'/" }\],\n\1\2#' $c/composer.json
- n=$(php -r '$n=json_decode(file_get_contents("'$c'/composer.json"));echo $n->name;')
- echo '"'$n'": {"'$branch'.x-dev": ' >> packages.json
- cat $c/composer.json >> packages.json
- echo '"version": "'$branch.x-dev'",\n "dist": {"type": "tar", "url": "file://'$(pwd)/$c'/package'$branch'.tar"}\n}},' >> packages.json
-done;
-sed -i ':a;N;$!ba;s/\n}\n"/,\n "/g' packages.json
-sed -i ':a;N;$!ba;s/}},$/\n}}\n}}/' packages.json
-for c in $components; do
- (cd $c && tar -cf package$branch.tar --exclude='package*.tar' *)
-done
diff --git a/.travis.yml b/.travis.yml
index 915d6325cbac1..a780aa1d61f03 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -33,6 +33,7 @@ env:
before_install:
- composer self-update
+ - 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" != "nightly" ]] && [[ "$TRAVIS_PHP_VERSION" != "hhvm" ]]; then phpenv config-rm xdebug.ini; fi;
- if [[ "$TRAVIS_PHP_VERSION" != "nightly" ]] && [[ "$TRAVIS_PHP_VERSION" != "hhvm" ]]; then echo "extension = mongo.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini; fi;
- if [[ "$TRAVIS_PHP_VERSION" != "nightly" ]] && [[ "$TRAVIS_PHP_VERSION" != "hhvm" ]] && [ $(php -r "echo PHP_MINOR_VERSION;") -le 4 ]; then echo "extension = apc.so" >> ~/.phpenv/versions/$(phpenv version-name)/etc/php.ini; fi;
@@ -44,7 +45,7 @@ before_install:
install:
- if [ "$deps" = "no" ]; then composer --prefer-source install; fi;
- components=$(find src/Symfony -mindepth 3 -type f -name phpunit.xml.dist -printf '%h\n')
- - if [ "$deps" != "no" ]; then sh .travis.sh $TRAVIS_BRANCH $components; fi;
+ - if [ "$deps" != "no" ]; then php .travis.php $TRAVIS_COMMIT_RANGE $TRAVIS_BRANCH $components; fi;
script:
- if [ "$deps" = "no" ]; then echo "$components" | parallel --gnu --keep-order 'echo -e "\\nRunning {} tests"; phpunit --exclude-group tty,benchmark,intl-data {} || (echo -e "\\e[41mKO\\e[0m {}" && $(exit 1));'; fi;
diff --git a/src/Symfony/Bridge/Twig/composer.json b/src/Symfony/Bridge/Twig/composer.json
index 66aa1587a1015..b1952b9f5e7af 100644
--- a/src/Symfony/Bridge/Twig/composer.json
+++ b/src/Symfony/Bridge/Twig/composer.json
@@ -22,7 +22,7 @@
"require-dev": {
"symfony/phpunit-bridge": "~2.7",
"symfony/finder": "~2.3",
- "symfony/form": "~2.3.5",
+ "symfony/form": "~2.3.31",
"symfony/http-kernel": "~2.3",
"symfony/intl": "~2.3",
"symfony/routing": "~2.2",
diff --git a/src/Symfony/Bundle/FrameworkBundle/composer.json b/src/Symfony/Bundle/FrameworkBundle/composer.json
index f77297a293029..1ef5af58a1ed0 100644
--- a/src/Symfony/Bundle/FrameworkBundle/composer.json
+++ b/src/Symfony/Bundle/FrameworkBundle/composer.json
@@ -17,8 +17,8 @@
],
"require": {
"php": ">=5.3.3",
- "symfony/dependency-injection" : "~2.3",
- "symfony/config" : "~2.3,>=2.3.12",
+ "symfony/dependency-injection": "~2.3",
+ "symfony/config": "~2.3,>=2.3.12",
"symfony/event-dispatcher": "~2.1",
"symfony/http-foundation": "~2.3,>=2.3.19",
"symfony/http-kernel": "~2.3,>=2.3.22",
@@ -38,7 +38,7 @@
"symfony/finder": "~2.0,>=2.0.5",
"symfony/intl": "~2.3",
"symfony/security": "~2.3",
- "symfony/form": "~2.3.0,>=2.3.5",
+ "symfony/form": "~2.3.31",
"symfony/class-loader": "~2.1",
"symfony/process": "~2.0,>=2.0.5",
"symfony/validator": "~2.1",
From b483ee2d02109321c13f37c7073cda494d71cda9 Mon Sep 17 00:00:00 2001
From: "Issei.M"
Date: Wed, 22 Jul 2015 01:25:33 +0900
Subject: [PATCH 0059/3475] [Form] updated exception message of
ButtonBuilder::setRequestHandler()
---
src/Symfony/Component/Form/ButtonBuilder.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/Symfony/Component/Form/ButtonBuilder.php b/src/Symfony/Component/Form/ButtonBuilder.php
index 24bc2f89166b4..e8f7805561fd6 100644
--- a/src/Symfony/Component/Form/ButtonBuilder.php
+++ b/src/Symfony/Component/Form/ButtonBuilder.php
@@ -498,7 +498,7 @@ public function setMethod($method)
*/
public function setRequestHandler(RequestHandlerInterface $requestHandler)
{
- throw new BadMethodCallException('Buttons do not support form processors.');
+ throw new BadMethodCallException('Buttons do not support request handlers.');
}
/**
From 6585fe45a22e02994077667b1c5588d11a9c9a61 Mon Sep 17 00:00:00 2001
From: Christian Flothmann
Date: Tue, 21 Jul 2015 20:37:10 +0200
Subject: [PATCH 0060/3475] [Security] fix check for empty usernames
---
.../Component/Security/Acl/Domain/UserSecurityIdentity.php | 2 +-
.../Core/Authentication/Provider/UserAuthenticationProvider.php | 2 +-
.../Security/Core/Authentication/RememberMe/PersistentToken.php | 2 +-
src/Symfony/Component/Security/Core/User/User.php | 2 +-
4 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/src/Symfony/Component/Security/Acl/Domain/UserSecurityIdentity.php b/src/Symfony/Component/Security/Acl/Domain/UserSecurityIdentity.php
index 3bf277f364328..ea17c635d512c 100644
--- a/src/Symfony/Component/Security/Acl/Domain/UserSecurityIdentity.php
+++ b/src/Symfony/Component/Security/Acl/Domain/UserSecurityIdentity.php
@@ -36,7 +36,7 @@ final class UserSecurityIdentity implements SecurityIdentityInterface
*/
public function __construct($username, $class)
{
- if (empty($username)) {
+ if ('' === $username || null === $username) {
throw new \InvalidArgumentException('$username must not be empty.');
}
if (empty($class)) {
diff --git a/src/Symfony/Component/Security/Core/Authentication/Provider/UserAuthenticationProvider.php b/src/Symfony/Component/Security/Core/Authentication/Provider/UserAuthenticationProvider.php
index b65a16bbb2406..a624ccfe63bb9 100644
--- a/src/Symfony/Component/Security/Core/Authentication/Provider/UserAuthenticationProvider.php
+++ b/src/Symfony/Component/Security/Core/Authentication/Provider/UserAuthenticationProvider.php
@@ -62,7 +62,7 @@ public function authenticate(TokenInterface $token)
}
$username = $token->getUsername();
- if (empty($username)) {
+ if ('' === $username || null === $username) {
$username = 'NONE_PROVIDED';
}
diff --git a/src/Symfony/Component/Security/Core/Authentication/RememberMe/PersistentToken.php b/src/Symfony/Component/Security/Core/Authentication/RememberMe/PersistentToken.php
index 92fcb4f2f7fd0..d85572d0e07db 100644
--- a/src/Symfony/Component/Security/Core/Authentication/RememberMe/PersistentToken.php
+++ b/src/Symfony/Component/Security/Core/Authentication/RememberMe/PersistentToken.php
@@ -40,7 +40,7 @@ public function __construct($class, $username, $series, $tokenValue, \DateTime $
if (empty($class)) {
throw new \InvalidArgumentException('$class must not be empty.');
}
- if (empty($username)) {
+ if ('' === $username || null === $username) {
throw new \InvalidArgumentException('$username must not be empty.');
}
if (empty($series)) {
diff --git a/src/Symfony/Component/Security/Core/User/User.php b/src/Symfony/Component/Security/Core/User/User.php
index ea2c6a4da633e..86f1acd7757bb 100644
--- a/src/Symfony/Component/Security/Core/User/User.php
+++ b/src/Symfony/Component/Security/Core/User/User.php
@@ -30,7 +30,7 @@ final class User implements AdvancedUserInterface
public function __construct($username, $password, array $roles = array(), $enabled = true, $userNonExpired = true, $credentialsNonExpired = true, $userNonLocked = true)
{
- if (empty($username)) {
+ if ('' === $username || null === $username) {
throw new \InvalidArgumentException('The username cannot be empty.');
}
From 534d9fc560a1d25b30148debae80a752cae4bc55 Mon Sep 17 00:00:00 2001
From: Jakub Zalas
Date: Wed, 22 Jul 2015 09:03:09 +0100
Subject: [PATCH 0061/3475] [Console] Fix console output with closed stdout
---
.../Console/Output/ConsoleOutput.php | 27 +++++++++++++++----
1 file changed, 22 insertions(+), 5 deletions(-)
diff --git a/src/Symfony/Component/Console/Output/ConsoleOutput.php b/src/Symfony/Component/Console/Output/ConsoleOutput.php
index 708d171445bae..50ef4df9004ce 100644
--- a/src/Symfony/Component/Console/Output/ConsoleOutput.php
+++ b/src/Symfony/Component/Console/Output/ConsoleOutput.php
@@ -46,12 +46,9 @@ class ConsoleOutput extends StreamOutput implements ConsoleOutputInterface
*/
public function __construct($verbosity = self::VERBOSITY_NORMAL, $decorated = null, OutputFormatterInterface $formatter = null)
{
- $outputStream = $this->hasStdoutSupport() ? 'php://stdout' : 'php://output';
- $errorStream = $this->hasStderrSupport() ? 'php://stderr' : 'php://output';
-
- parent::__construct(fopen($outputStream, 'w'), $verbosity, $decorated, $formatter);
+ parent::__construct($this->openOutputStream(), $verbosity, $decorated, $formatter);
- $this->stderr = new StreamOutput(fopen($errorStream, 'w'), $verbosity, $decorated, $this->getFormatter());
+ $this->stderr = new StreamOutput($this->openErrorStream(), $verbosity, $decorated, $this->getFormatter());
}
/**
@@ -129,4 +126,24 @@ private function isRunningOS400()
{
return 'OS400' === php_uname('s');
}
+
+ /**
+ * @return resource
+ */
+ private function openOutputStream()
+ {
+ $outputStream = $this->hasStdoutSupport() ? 'php://stdout' : 'php://output';
+
+ return @fopen($outputStream, 'w') ?: fopen('php://output', 'w');
+ }
+
+ /**
+ * @return resource
+ */
+ private function openErrorStream()
+ {
+ $errorStream = $this->hasStderrSupport() ? 'php://stderr' : 'php://output';
+
+ return fopen($errorStream, 'w');
+ }
}
From 445774592920ecd9a1e752f3c447507f11193805 Mon Sep 17 00:00:00 2001
From: Christophe Coevoet
Date: Fri, 3 Jul 2015 00:05:34 +0200
Subject: [PATCH 0062/3475] Implement resettable containers
This allows to remove references to all services during shutdown, giving
much more chances to destruct services and the container through
refcounting rather than waiting GC, as it will break cycles between the
container and container-aware services.
---
.../DependencyInjection/CHANGELOG.md | 1 +
.../DependencyInjection/Container.php | 15 ++++++-
.../ResettableContainerInterface.php | 31 +++++++++++++
.../Tests/ContainerTest.php | 43 +++++++++++++++++++
src/Symfony/Component/HttpKernel/Kernel.php | 5 +++
5 files changed, 94 insertions(+), 1 deletion(-)
create mode 100644 src/Symfony/Component/DependencyInjection/ResettableContainerInterface.php
diff --git a/src/Symfony/Component/DependencyInjection/CHANGELOG.md b/src/Symfony/Component/DependencyInjection/CHANGELOG.md
index 7c4ff51e8cdd7..c13da0b280b3b 100644
--- a/src/Symfony/Component/DependencyInjection/CHANGELOG.md
+++ b/src/Symfony/Component/DependencyInjection/CHANGELOG.md
@@ -7,6 +7,7 @@ CHANGELOG
* allowed specifying a directory to recursively load all configuration files it contains
* deprecated the concept of scopes
* added `Definition::setShared()` and `Definition::isShared()`
+ * added ResettableContainerInterface to be able to reset the container to release memory on shutdown
2.7.0
-----
diff --git a/src/Symfony/Component/DependencyInjection/Container.php b/src/Symfony/Component/DependencyInjection/Container.php
index 0222d7063b09e..513fc9de0f45f 100644
--- a/src/Symfony/Component/DependencyInjection/Container.php
+++ b/src/Symfony/Component/DependencyInjection/Container.php
@@ -13,6 +13,7 @@
use Symfony\Component\DependencyInjection\Exception\InactiveScopeException;
use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
+use Symfony\Component\DependencyInjection\Exception\LogicException;
use Symfony\Component\DependencyInjection\Exception\RuntimeException;
use Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException;
use Symfony\Component\DependencyInjection\Exception\ServiceCircularReferenceException;
@@ -60,7 +61,7 @@
*
* @api
*/
-class Container implements IntrospectableContainerInterface
+class Container implements IntrospectableContainerInterface, ResettableContainerInterface
{
/**
* @var ParameterBagInterface
@@ -375,6 +376,18 @@ public function initialized($id)
return isset($this->services[$id]) || array_key_exists($id, $this->services);
}
+ /**
+ * {@inheritdoc}
+ */
+ public function reset()
+ {
+ if (!empty($this->scopedServices)) {
+ throw new LogicException('Resetting the container is not allowed when a scope is active.');
+ }
+
+ $this->services = array();
+ }
+
/**
* Gets all service ids.
*
diff --git a/src/Symfony/Component/DependencyInjection/ResettableContainerInterface.php b/src/Symfony/Component/DependencyInjection/ResettableContainerInterface.php
new file mode 100644
index 0000000000000..b74e676245714
--- /dev/null
+++ b/src/Symfony/Component/DependencyInjection/ResettableContainerInterface.php
@@ -0,0 +1,31 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Component\DependencyInjection;
+
+/**
+ * ResettableContainerInterface defines additional resetting functionality
+ * for containers, allowing to release shared services when the container is
+ * not needed anymore.
+ *
+ * @author Christophe Coevoet
+ */
+interface ResettableContainerInterface extends ContainerInterface
+{
+ /**
+ * Resets shared services from the container.
+ *
+ * The container is not intended to be used again after being reset in a normal workflow. This method is
+ * meant as a way to release references for ref-counting.
+ * A subsequent call to ContainerInterface::get will recreate a new instance of the shared service.
+ */
+ public function reset();
+}
diff --git a/src/Symfony/Component/DependencyInjection/Tests/ContainerTest.php b/src/Symfony/Component/DependencyInjection/Tests/ContainerTest.php
index 09b4a12e2fe1d..cffef3900802f 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/ContainerTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/ContainerTest.php
@@ -320,6 +320,49 @@ public function testInitialized()
$this->assertTrue($sc->initialized('alias'), '->initialized() returns true for alias if aliased service is initialized');
}
+ public function testReset()
+ {
+ $c = new Container();
+ $c->set('bar', new \stdClass());
+
+ $c->reset();
+
+ $this->assertNull($c->get('bar', ContainerInterface::NULL_ON_INVALID_REFERENCE));
+ }
+
+ /**
+ * @expectedException \Symfony\Component\DependencyInjection\Exception\LogicException
+ * @expectedExceptionMessage Resetting the container is not allowed when a scope is active.
+ * @group legacy
+ */
+ public function testCannotResetInActiveScope()
+ {
+ $c = new Container();
+ $c->addScope(new Scope('foo'));
+ $c->set('bar', new \stdClass());
+
+ $c->enterScope('foo');
+
+ $c->reset();
+ }
+
+ /**
+ * @group legacy
+ */
+ public function testResetAfterLeavingScope()
+ {
+ $c = new Container();
+ $c->addScope(new Scope('foo'));
+ $c->set('bar', new \stdClass());
+
+ $c->enterScope('foo');
+ $c->leaveScope('foo');
+
+ $c->reset();
+
+ $this->assertNull($c->get('bar', ContainerInterface::NULL_ON_INVALID_REFERENCE));
+ }
+
/**
* @group legacy
*/
diff --git a/src/Symfony/Component/HttpKernel/Kernel.php b/src/Symfony/Component/HttpKernel/Kernel.php
index 5f714d97d5378..d70439bd0822c 100644
--- a/src/Symfony/Component/HttpKernel/Kernel.php
+++ b/src/Symfony/Component/HttpKernel/Kernel.php
@@ -23,6 +23,7 @@
use Symfony\Component\DependencyInjection\Loader\PhpFileLoader;
use Symfony\Component\DependencyInjection\Loader\DirectoryLoader;
use Symfony\Component\DependencyInjection\Loader\ClosureLoader;
+use Symfony\Component\DependencyInjection\ResettableContainerInterface;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Bundle\BundleInterface;
@@ -180,6 +181,10 @@ public function shutdown()
$bundle->setContainer(null);
}
+ if ($this->container instanceof ResettableContainerInterface) {
+ $this->container->reset();
+ }
+
$this->container = null;
}
From 07b3fa9c1cf0d15c325542393b789c371c0ae44e Mon Sep 17 00:00:00 2001
From: Nicolas Grekas
Date: Wed, 22 Jul 2015 13:18:53 +0200
Subject: [PATCH 0063/3475] [HttpKernel] Fix lowest dep
---
src/Symfony/Component/HttpKernel/composer.json | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/Symfony/Component/HttpKernel/composer.json b/src/Symfony/Component/HttpKernel/composer.json
index 2602186c1b62a..584afc263e441 100644
--- a/src/Symfony/Component/HttpKernel/composer.json
+++ b/src/Symfony/Component/HttpKernel/composer.json
@@ -17,7 +17,7 @@
],
"require": {
"php": ">=5.3.3",
- "symfony/event-dispatcher": "~2.5.9|~2.6,>=2.6.2",
+ "symfony/event-dispatcher": "~2.6,>=2.6.7",
"symfony/http-foundation": "~2.5,>=2.5.4",
"symfony/debug": "~2.6,>=2.6.2",
"psr/log": "~1.0"
From d3874eca2cdbd1d3e915e1666c6f4aff9f93390e Mon Sep 17 00:00:00 2001
From: Nicolas Grekas
Date: Wed, 22 Jul 2015 13:57:38 +0200
Subject: [PATCH 0064/3475] [travis] Tests deps=low with PHP 5.6
---
.travis.yml | 1 -
1 file changed, 1 deletion(-)
diff --git a/.travis.yml b/.travis.yml
index a780aa1d61f03..b27111e4966e1 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -15,7 +15,6 @@ matrix:
- php: 5.4
- php: 5.5
- php: 5.6
- - php: 5.3
env: deps=low
- php: 5.6
env: deps=high
From 753812e746077dac7daf56d78fa7e99fb3da54f2 Mon Sep 17 00:00:00 2001
From: Nicolas Grekas
Date: Thu, 2 Jul 2015 20:36:17 +0200
Subject: [PATCH 0065/3475] [2.8] Fix 3.0 incompatible deps
---
src/Symfony/Bridge/Twig/composer.json | 2 +-
.../Tests/Console/Descriptor/AbstractDescriptorTest.php | 3 +++
src/Symfony/Bundle/FrameworkBundle/composer.json | 6 +++---
src/Symfony/Bundle/SecurityBundle/composer.json | 6 +++---
src/Symfony/Component/Form/composer.json | 2 +-
src/Symfony/Component/HttpKernel/composer.json | 2 +-
6 files changed, 12 insertions(+), 9 deletions(-)
diff --git a/src/Symfony/Bridge/Twig/composer.json b/src/Symfony/Bridge/Twig/composer.json
index 1963ece7f1256..605901bc8a5ae 100644
--- a/src/Symfony/Bridge/Twig/composer.json
+++ b/src/Symfony/Bridge/Twig/composer.json
@@ -23,7 +23,7 @@
"symfony/phpunit-bridge": "~2.7|~3.0.0",
"symfony/asset": "~2.7|~3.0.0",
"symfony/finder": "~2.3|~3.0.0",
- "symfony/form": "~2.8|~3.0.0",
+ "symfony/form": "~2.8",
"symfony/http-kernel": "~2.3|~3.0.0",
"symfony/intl": "~2.3|~3.0.0",
"symfony/routing": "~2.2|~3.0.0",
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Console/Descriptor/AbstractDescriptorTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Console/Descriptor/AbstractDescriptorTest.php
index 8a9800bc865bd..38dda10ba7d7c 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/Console/Descriptor/AbstractDescriptorTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Console/Descriptor/AbstractDescriptorTest.php
@@ -75,6 +75,9 @@ public function testLegacyDescribeSynchronizedServiceDefinition(Definition $defi
$this->assertDescription($expectedDescription, $definition);
}
+ /**
+ * @group legacy
+ */
public function provideLegacySynchronizedServiceDefinitionTestData()
{
return $this->getDescriptionTestData(ObjectsProvider::getLegacyContainerDefinitions());
diff --git a/src/Symfony/Bundle/FrameworkBundle/composer.json b/src/Symfony/Bundle/FrameworkBundle/composer.json
index 3253eb1891b3d..843a4cce7be4a 100644
--- a/src/Symfony/Bundle/FrameworkBundle/composer.json
+++ b/src/Symfony/Bundle/FrameworkBundle/composer.json
@@ -22,14 +22,14 @@
"symfony/config": "~2.4",
"symfony/event-dispatcher": "~2.8|~3.0.0",
"symfony/http-foundation": "~2.4.9|~2.5,>=2.5.4|~3.0.0",
- "symfony/http-kernel": "~2.7|~3.0.0",
+ "symfony/http-kernel": "~2.7",
"symfony/filesystem": "~2.3|~3.0.0",
"symfony/routing": "~2.8|~3.0.0",
"symfony/security-core": "~2.6|~3.0.0",
"symfony/security-csrf": "~2.6|~3.0.0",
"symfony/stopwatch": "~2.3|~3.0.0",
"symfony/templating": "~2.1|~3.0.0",
- "symfony/translation": "~2.7|~3.0.0",
+ "symfony/translation": "~2.7",
"doctrine/annotations": "~1.0"
},
"require-dev": {
@@ -41,7 +41,7 @@
"symfony/finder": "~2.0,>=2.0.5|~3.0.0",
"symfony/intl": "~2.3|~3.0.0",
"symfony/security": "~2.6|~3.0.0",
- "symfony/form": "~2.8|~3.0.0",
+ "symfony/form": "~2.8",
"symfony/class-loader": "~2.1|~3.0.0",
"symfony/expression-language": "~2.6|~3.0.0",
"symfony/process": "~2.0,>=2.0.5|~3.0.0",
diff --git a/src/Symfony/Bundle/SecurityBundle/composer.json b/src/Symfony/Bundle/SecurityBundle/composer.json
index ee648d131ef11..a929eb09b8887 100644
--- a/src/Symfony/Bundle/SecurityBundle/composer.json
+++ b/src/Symfony/Bundle/SecurityBundle/composer.json
@@ -18,7 +18,7 @@
"require": {
"php": ">=5.3.9",
"symfony/security": "~2.8|~3.0.0",
- "symfony/http-kernel": "~2.2|~3.0.0"
+ "symfony/http-kernel": "~2.2"
},
"require-dev": {
"symfony/phpunit-bridge": "~2.7|~3.0.0",
@@ -28,8 +28,8 @@
"symfony/css-selector": "~2.0,>=2.0.5|~3.0.0",
"symfony/dependency-injection": "~2.6,>=2.6.6|~3.0.0",
"symfony/dom-crawler": "~2.0,>=2.0.5|~3.0.0",
- "symfony/form": "~2.7|~3.0.0",
- "symfony/framework-bundle": "~2.7|~3.0.0",
+ "symfony/form": "~2.7",
+ "symfony/framework-bundle": "~2.7",
"symfony/http-foundation": "~2.4|~3.0.0",
"symfony/twig-bundle": "~2.7|~3.0.0",
"symfony/twig-bridge": "~2.7|~3.0.0",
diff --git a/src/Symfony/Component/Form/composer.json b/src/Symfony/Component/Form/composer.json
index 5cd6feceae554..37c1d933044f5 100644
--- a/src/Symfony/Component/Form/composer.json
+++ b/src/Symfony/Component/Form/composer.json
@@ -25,7 +25,7 @@
"require-dev": {
"symfony/phpunit-bridge": "~2.7|~3.0.0",
"doctrine/collections": "~1.0",
- "symfony/validator": "~2.6,>=2.6.8|~3.0.0",
+ "symfony/validator": "~2.8|~3.0.0",
"symfony/http-foundation": "~2.2|~3.0.0",
"symfony/http-kernel": "~2.4|~3.0.0",
"symfony/security-csrf": "~2.4|~3.0.0",
diff --git a/src/Symfony/Component/HttpKernel/composer.json b/src/Symfony/Component/HttpKernel/composer.json
index a3439e2903cb0..d702fac80863f 100644
--- a/src/Symfony/Component/HttpKernel/composer.json
+++ b/src/Symfony/Component/HttpKernel/composer.json
@@ -29,7 +29,7 @@
"symfony/config": "~2.7",
"symfony/console": "~2.3|~3.0.0",
"symfony/css-selector": "~2.0,>=2.0.5|~3.0.0",
- "symfony/dependency-injection": "~2.2|~3.0.0",
+ "symfony/dependency-injection": "~2.8|~3.0.0",
"symfony/dom-crawler": "~2.0,>=2.0.5|~3.0.0",
"symfony/expression-language": "~2.4|~3.0.0",
"symfony/finder": "~2.0,>=2.0.5|~3.0.0",
From 1fc03155d4fd869ac629e91c49862122c7a1e389 Mon Sep 17 00:00:00 2001
From: Hugo Hamon
Date: Wed, 22 Jul 2015 15:05:05 +0200
Subject: [PATCH 0066/3475] [Security] removed useless else condition in
SwitchUserListener class.
---
.../Component/Security/Http/Firewall/SwitchUserListener.php | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/Symfony/Component/Security/Http/Firewall/SwitchUserListener.php b/src/Symfony/Component/Security/Http/Firewall/SwitchUserListener.php
index c5ecf780f5bd0..79b715aa3cdf4 100644
--- a/src/Symfony/Component/Security/Http/Firewall/SwitchUserListener.php
+++ b/src/Symfony/Component/Security/Http/Firewall/SwitchUserListener.php
@@ -116,9 +116,9 @@ private function attemptSwitchUser(Request $request)
if (false !== $originalToken) {
if ($token->getUsername() === $request->get($this->usernameParameter)) {
return $token;
- } else {
- throw new \LogicException(sprintf('You are already switched to "%s" user.', $token->getUsername()));
}
+
+ throw new \LogicException(sprintf('You are already switched to "%s" user.', $token->getUsername()));
}
if (false === $this->accessDecisionManager->decide($token, array($this->role))) {
From ebb20640af518a39133b1098a03436dd4e0568f4 Mon Sep 17 00:00:00 2001
From: WouterJ
Date: Sun, 28 Jun 2015 14:36:46 +0200
Subject: [PATCH 0067/3475] [Security] Moved
Simple{Form,Pre}AuthenticatorInterfaces to Security\Http
---
src/Symfony/Component/Security/CHANGELOG.md | 4 ++++
.../SimpleFormAuthenticatorInterface.php | 2 ++
.../SimplePreAuthenticatorInterface.php | 2 ++
.../SimpleFormAuthenticatorInterface.php | 21 +++++++++++++++++++
.../SimplePreAuthenticatorInterface.php | 21 +++++++++++++++++++
5 files changed, 50 insertions(+)
create mode 100644 src/Symfony/Component/Security/Http/Authentication/SimpleFormAuthenticatorInterface.php
create mode 100644 src/Symfony/Component/Security/Http/Authentication/SimplePreAuthenticatorInterface.php
diff --git a/src/Symfony/Component/Security/CHANGELOG.md b/src/Symfony/Component/Security/CHANGELOG.md
index 2b601a575f684..f2026929296a4 100644
--- a/src/Symfony/Component/Security/CHANGELOG.md
+++ b/src/Symfony/Component/Security/CHANGELOG.md
@@ -6,6 +6,10 @@ CHANGELOG
* deprecated `getKey()` of the `AnonymousToken`, `RememberMeToken` and `AbstractRememberMeServices` classes
in favor of `getSecret()`.
+ * deprecated `Symfony\Component\Security\Core\Authentication\SimplePreAuthenticatorInterface`, use
+ `Symfony\Component\Security\Http\Authentication\SimplePreAuthenticatorInterface` instead
+ * deprecated `Symfony\Component\Security\Core\Authentication\SimpleFormAuthenticatorInterface`, use
+ `Symfony\Component\Security\Http\Authentication\SimpleFormAuthenticatorInterface` instead
2.7.0
-----
diff --git a/src/Symfony/Component/Security/Core/Authentication/SimpleFormAuthenticatorInterface.php b/src/Symfony/Component/Security/Core/Authentication/SimpleFormAuthenticatorInterface.php
index 95ee881c18d82..ae2b58b19f12d 100644
--- a/src/Symfony/Component/Security/Core/Authentication/SimpleFormAuthenticatorInterface.php
+++ b/src/Symfony/Component/Security/Core/Authentication/SimpleFormAuthenticatorInterface.php
@@ -14,6 +14,8 @@
use Symfony\Component\HttpFoundation\Request;
/**
+ * @deprecated Deprecated since version 2.8, to be removed in 3.0. Use the same interface from Security\Http\Authentication instead.
+ *
* @author Jordi Boggiano
*/
interface SimpleFormAuthenticatorInterface extends SimpleAuthenticatorInterface
diff --git a/src/Symfony/Component/Security/Core/Authentication/SimplePreAuthenticatorInterface.php b/src/Symfony/Component/Security/Core/Authentication/SimplePreAuthenticatorInterface.php
index 6164e7d9860a7..c01f064765ea0 100644
--- a/src/Symfony/Component/Security/Core/Authentication/SimplePreAuthenticatorInterface.php
+++ b/src/Symfony/Component/Security/Core/Authentication/SimplePreAuthenticatorInterface.php
@@ -14,6 +14,8 @@
use Symfony\Component\HttpFoundation\Request;
/**
+ * @deprecated Since version 2.8, to be removed in 3.0. Use the same interface from Security\Http\Authentication instead.
+ *
* @author Jordi Boggiano
*/
interface SimplePreAuthenticatorInterface extends SimpleAuthenticatorInterface
diff --git a/src/Symfony/Component/Security/Http/Authentication/SimpleFormAuthenticatorInterface.php b/src/Symfony/Component/Security/Http/Authentication/SimpleFormAuthenticatorInterface.php
new file mode 100644
index 0000000000000..112688c97ca6a
--- /dev/null
+++ b/src/Symfony/Component/Security/Http/Authentication/SimpleFormAuthenticatorInterface.php
@@ -0,0 +1,21 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Component\Security\Http\Authentication;
+
+use Symfony\Component\Security\Core\Authentication\SimpleFormAuthenticatorInterface as BaseSimpleFormAuthenticatorInterface;
+
+/**
+ * @author Jordi Boggiano
+ */
+interface SimpleFormAuthenticatorInterface extends BaseSimpleFormAuthenticatorInterface
+{
+}
diff --git a/src/Symfony/Component/Security/Http/Authentication/SimplePreAuthenticatorInterface.php b/src/Symfony/Component/Security/Http/Authentication/SimplePreAuthenticatorInterface.php
new file mode 100644
index 0000000000000..afa8049508e4a
--- /dev/null
+++ b/src/Symfony/Component/Security/Http/Authentication/SimplePreAuthenticatorInterface.php
@@ -0,0 +1,21 @@
+
+ *
+ * For the full copyright and license information, please view the LICENSE
+ * file that was distributed with this source code.
+ */
+
+namespace Symfony\Component\Security\Http\Authentication;
+
+use Symfony\Component\Security\Core\Authentication\SimplePreAuthenticatorInterface as BaseSimplePreAuthenticatorInterface;
+
+/**
+ * @author Jordi Boggiano
+ */
+interface SimplePreAuthenticatorInterface extends BaseSimplePreAuthenticatorInterface
+{
+}
From 5ef7ae9647a7992dc2c8e6efd7003b6a50f56625 Mon Sep 17 00:00:00 2001
From: Nicolas Grekas
Date: Wed, 22 Jul 2015 19:02:20 +0200
Subject: [PATCH 0068/3475] [Form] Fix not-BC test assertion
---
.../AbstractConstraintValidatorTest.php | 26 ++++++-------------
1 file changed, 8 insertions(+), 18 deletions(-)
diff --git a/src/Symfony/Component/Validator/Tests/Constraints/AbstractConstraintValidatorTest.php b/src/Symfony/Component/Validator/Tests/Constraints/AbstractConstraintValidatorTest.php
index 2204fedcd7016..5a5fa51a0af48 100644
--- a/src/Symfony/Component/Validator/Tests/Constraints/AbstractConstraintValidatorTest.php
+++ b/src/Symfony/Component/Validator/Tests/Constraints/AbstractConstraintValidatorTest.php
@@ -216,24 +216,14 @@ protected function expectNoValidate()
protected function expectValidateAt($i, $propertyPath, $value, $group)
{
- switch ($this->getApiVersion()) {
- case Validation::API_VERSION_2_4:
- $this->context->expects($this->at($i))
- ->method('validate')
- ->with($value, $propertyPath, $group);
- break;
- case Validation::API_VERSION_2_5:
- case Validation::API_VERSION_2_5_BC:
- $validator = $this->context->getValidator()->inContext($this->context);
- $validator->expects($this->at(2 * $i))
- ->method('atPath')
- ->with($propertyPath)
- ->will($this->returnValue($validator));
- $validator->expects($this->at(2 * $i + 1))
- ->method('validate')
- ->with($value, $this->logicalOr(null, array(), $this->isInstanceOf('\Symfony\Component\Validator\Constraints\Valid')), $group);
- break;
- }
+ $validator = $this->context->getValidator()->inContext($this->context);
+ $validator->expects($this->at(2 * $i))
+ ->method('atPath')
+ ->with($propertyPath)
+ ->will($this->returnValue($validator));
+ $validator->expects($this->at(2 * $i + 1))
+ ->method('validate')
+ ->with($value, $this->logicalOr(null, array(), $this->isInstanceOf('\Symfony\Component\Validator\Constraints\Valid')), $group);
}
protected function expectValidateValueAt($i, $propertyPath, $value, $constraints, $group = null)
From 65e9f268fea48a814c938890e05a3fdfd102b776 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?K=C3=A9vin=20Dunglas?=
Date: Wed, 22 Jul 2015 21:42:44 +0200
Subject: [PATCH 0069/3475] [Serializer] Fix bugs reported in
https://github.com/symfony/symfony/commit/b5990be49149501bef7bb83a797a1aea2eb5fbe0#commitcomment-12301266
---
.../Normalizer/AbstractNormalizer.php | 2 +-
.../Normalizer/GetSetMethodNormalizer.php | 3 +-
.../Normalizer/GetSetMethodNormalizerTest.php | 50 ++++++++++++++++++-
3 files changed, 51 insertions(+), 4 deletions(-)
diff --git a/src/Symfony/Component/Serializer/Normalizer/AbstractNormalizer.php b/src/Symfony/Component/Serializer/Normalizer/AbstractNormalizer.php
index 4de4771770b54..93dfba9a396b5 100644
--- a/src/Symfony/Component/Serializer/Normalizer/AbstractNormalizer.php
+++ b/src/Symfony/Component/Serializer/Normalizer/AbstractNormalizer.php
@@ -291,7 +291,7 @@ protected function prepareForDenormalization($data)
*
* @throws RuntimeException
*/
- protected function instantiateObject(array $data, $class, array &$context, \ReflectionClass $reflectionClass, $allowedAttributes)
+ protected function instantiateObject(array &$data, $class, array &$context, \ReflectionClass $reflectionClass, $allowedAttributes)
{
if (
isset($context['object_to_populate']) &&
diff --git a/src/Symfony/Component/Serializer/Normalizer/GetSetMethodNormalizer.php b/src/Symfony/Component/Serializer/Normalizer/GetSetMethodNormalizer.php
index de4c3ece1dc98..44a71cf1b487f 100644
--- a/src/Symfony/Component/Serializer/Normalizer/GetSetMethodNormalizer.php
+++ b/src/Symfony/Component/Serializer/Normalizer/GetSetMethodNormalizer.php
@@ -102,6 +102,7 @@ public function denormalize($data, $class, $format = null, array $context = arra
$reflectionClass = new \ReflectionClass($class);
$object = $this->instantiateObject($normalizedData, $class, $context, $reflectionClass, $allowedAttributes);
+ $classMethods = get_class_methods($object);
foreach ($normalizedData as $attribute => $value) {
if ($this->nameConverter) {
$attribute = $this->nameConverter->denormalize($attribute);
@@ -113,7 +114,7 @@ public function denormalize($data, $class, $format = null, array $context = arra
if ($allowed && !$ignored) {
$setter = 'set'.ucfirst($attribute);
- if (method_exists($object, $setter)) {
+ if (in_array($setter, $classMethods)) {
$object->$setter($value);
}
}
diff --git a/src/Symfony/Component/Serializer/Tests/Normalizer/GetSetMethodNormalizerTest.php b/src/Symfony/Component/Serializer/Tests/Normalizer/GetSetMethodNormalizerTest.php
index 92051863d598a..32d729a211476 100644
--- a/src/Symfony/Component/Serializer/Tests/Normalizer/GetSetMethodNormalizerTest.php
+++ b/src/Symfony/Component/Serializer/Tests/Normalizer/GetSetMethodNormalizerTest.php
@@ -228,6 +228,12 @@ public function testConstructorWithObjectDenormalize()
$this->assertEquals('bar', $obj->getBar());
}
+ public function testConstructorWArgWithPrivateMutator()
+ {
+ $obj = $this->normalizer->denormalize(array('foo' => 'bar'), __NAMESPACE__.'\ObjectConstructorArgsWithPrivateMutatorDummy', 'any');
+ $this->assertEquals('bar', $obj->getFoo());
+ }
+
public function testGroupsNormalize()
{
$classMetadataFactory = new ClassMetadataFactory(new AnnotationLoader(new AnnotationReader()));
@@ -511,8 +517,8 @@ public function testObjectToPopulate()
public function testDenormalizeNonExistingAttribute()
{
$this->assertEquals(
- new PropertyDummy(),
- $this->normalizer->denormalize(array('non_existing' => true), __NAMESPACE__.'\PropertyDummy')
+ new GetSetDummy(),
+ $this->normalizer->denormalize(array('non_existing' => true), __NAMESPACE__.'\GetSetDummy')
);
}
@@ -520,6 +526,12 @@ public function testNoTraversableSupport()
{
$this->assertFalse($this->normalizer->supportsNormalization(new \ArrayObject()));
}
+
+ public function testPrivateSetter()
+ {
+ $obj = $this->normalizer->denormalize(array('foo' => 'foobar'), __NAMESPACE__.'\ObjectWithPrivateSetterDummy');
+ $this->assertEquals('bar', $obj->getFoo());
+ }
}
class GetSetDummy
@@ -726,3 +738,37 @@ public function getBar_foo()
return $this->bar_foo;
}
}
+
+class ObjectConstructorArgsWithPrivateMutatorDummy
+{
+ private $foo;
+
+ public function __construct($foo)
+ {
+ $this->setFoo($foo);
+ }
+
+ public function getFoo()
+ {
+ return $this->foo;
+ }
+
+ private function setFoo($foo)
+ {
+ $this->foo = $foo;
+ }
+}
+
+class ObjectWithPrivateSetterDummy
+{
+ private $foo = 'bar';
+
+ public function getFoo()
+ {
+ return $this->foo;
+ }
+
+ private function setFoo($foo)
+ {
+ }
+}
From 2d29ac1e1093ac0e8b37cacc10d283ff97b87828 Mon Sep 17 00:00:00 2001
From: Nicolas Grekas
Date: Wed, 22 Jul 2015 18:52:24 +0200
Subject: [PATCH 0070/3475] [Security/Http] Fix test relying on a private
property
---
.../Tests/Firewall/AnonymousAuthenticationListenerTest.php | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/src/Symfony/Component/Security/Http/Tests/Firewall/AnonymousAuthenticationListenerTest.php b/src/Symfony/Component/Security/Http/Tests/Firewall/AnonymousAuthenticationListenerTest.php
index 3bc4eb66d8f2c..9af479197432d 100644
--- a/src/Symfony/Component/Security/Http/Tests/Firewall/AnonymousAuthenticationListenerTest.php
+++ b/src/Symfony/Component/Security/Http/Tests/Firewall/AnonymousAuthenticationListenerTest.php
@@ -54,10 +54,9 @@ public function testHandleWithContextHavingNoToken()
$authenticationManager
->expects($this->once())
->method('authenticate')
- ->with(self::logicalAnd(
- $this->isInstanceOf('Symfony\Component\Security\Core\Authentication\Token\AnonymousToken'),
- $this->attributeEqualTo('key', 'TheKey')
- ))
+ ->with($this->callback(function ($token) {
+ return 'TheKey' === $token->getKey();
+ }))
->will($this->returnValue($anonymousToken))
;
From 37a235394ec277c97b660444e00212a13b59febe Mon Sep 17 00:00:00 2001
From: Vladimir Reznichenko
Date: Mon, 20 Jul 2015 23:51:01 +0200
Subject: [PATCH 0071/3475] [2.6] Static Code Analysis for Components
---
src/Symfony/Component/HttpKernel/Client.php | 2 +-
src/Symfony/Component/Intl/Resources/bin/update-data.php | 3 +--
2 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/src/Symfony/Component/HttpKernel/Client.php b/src/Symfony/Component/HttpKernel/Client.php
index 0503f5de58253..50895e713d298 100644
--- a/src/Symfony/Component/HttpKernel/Client.php
+++ b/src/Symfony/Component/HttpKernel/Client.php
@@ -101,7 +101,7 @@ protected function getScript($request)
$r = new \ReflectionClass('\\Symfony\\Component\\ClassLoader\\ClassLoader');
$requirePath = str_replace("'", "\\'", $r->getFileName());
- $symfonyPath = str_replace("'", "\\'", realpath(__DIR__.'/../../..'));
+ $symfonyPath = str_replace("'", "\\'", dirname(dirname(dirname(__DIR__))));
$errorReporting = error_reporting();
$code = <<
Date: Thu, 23 Jul 2015 11:09:02 +0200
Subject: [PATCH 0072/3475] [Twig+FrameworkBundle] Fix forward compat with Form
2.8
---
.../Resources/views/Form/form_div_layout.html.twig | 2 +-
.../Extension/FormExtensionBootstrap3LayoutTest.php | 10 ++++++++++
.../Tests/Extension/FormExtensionDivLayoutTest.php | 10 ++++++++++
.../Tests/Extension/FormExtensionTableLayoutTest.php | 10 ++++++++++
.../Resources/views/Form/widget_attributes.html.php | 2 +-
.../Templating/Helper/FormHelperDivLayoutTest.php | 10 ++++++++++
.../Templating/Helper/FormHelperTableLayoutTest.php | 10 ++++++++++
7 files changed, 52 insertions(+), 2 deletions(-)
diff --git a/src/Symfony/Bridge/Twig/Resources/views/Form/form_div_layout.html.twig b/src/Symfony/Bridge/Twig/Resources/views/Form/form_div_layout.html.twig
index 48a432e41a4c7..a0828b38003fd 100644
--- a/src/Symfony/Bridge/Twig/Resources/views/Form/form_div_layout.html.twig
+++ b/src/Symfony/Bridge/Twig/Resources/views/Form/form_div_layout.html.twig
@@ -314,7 +314,7 @@
{%- block widget_attributes -%}
id="{{ id }}" name="{{ full_name }}"
- {%- if read_only %} readonly="readonly"{% endif -%}
+ {%- if read_only and attr.readonly is not defined %} readonly="readonly"{% endif -%}
{%- if disabled %} disabled="disabled"{% endif -%}
{%- if required %} required="required"{% endif -%}
{%- for attrname, attrvalue in attr -%}
diff --git a/src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionBootstrap3LayoutTest.php b/src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionBootstrap3LayoutTest.php
index 8e76552697539..a9d161b2b909a 100644
--- a/src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionBootstrap3LayoutTest.php
+++ b/src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionBootstrap3LayoutTest.php
@@ -115,4 +115,14 @@ protected function setTheme(FormView $view, array $themes)
{
$this->extension->renderer->setTheme($view, $themes);
}
+
+ public function testRange()
+ {
+ // No-op for forward compatibility with AbstractLayoutTest 2.8
+ }
+
+ public function testRangeWithMinMaxValues()
+ {
+ // No-op for forward compatibility with AbstractLayoutTest 2.8
+ }
}
diff --git a/src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionDivLayoutTest.php b/src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionDivLayoutTest.php
index 2581144a1cd75..1bce43b83780c 100644
--- a/src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionDivLayoutTest.php
+++ b/src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionDivLayoutTest.php
@@ -208,4 +208,14 @@ public static function themeInheritanceProvider()
array(array('parent_label.html.twig'), array('child_label.html.twig')),
);
}
+
+ public function testRange()
+ {
+ // No-op for forward compatibility with AbstractLayoutTest 2.8
+ }
+
+ public function testRangeWithMinMaxValues()
+ {
+ // No-op for forward compatibility with AbstractLayoutTest 2.8
+ }
}
diff --git a/src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionTableLayoutTest.php b/src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionTableLayoutTest.php
index f8f3ddf3e5bce..555ea306fca89 100644
--- a/src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionTableLayoutTest.php
+++ b/src/Symfony/Bridge/Twig/Tests/Extension/FormExtensionTableLayoutTest.php
@@ -116,4 +116,14 @@ protected function setTheme(FormView $view, array $themes)
{
$this->extension->renderer->setTheme($view, $themes);
}
+
+ public function testRange()
+ {
+ // No-op for forward compatibility with AbstractLayoutTest 2.8
+ }
+
+ public function testRangeWithMinMaxValues()
+ {
+ // No-op for forward compatibility with AbstractLayoutTest 2.8
+ }
}
diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/widget_attributes.html.php b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/widget_attributes.html.php
index 118e764c8555a..14e65a7991c53 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/widget_attributes.html.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/widget_attributes.html.php
@@ -1,4 +1,4 @@
-id="escape($id) ?>" name="escape($full_name) ?>" readonly="readonly"
+id="escape($id) ?>" name="escape($full_name) ?>" readonly="readonly"
disabled="disabled"
required="required"
$v): ?>
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/FormHelperDivLayoutTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/FormHelperDivLayoutTest.php
index 52d91ec12758d..4af5b929cbb50 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/FormHelperDivLayoutTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/FormHelperDivLayoutTest.php
@@ -128,4 +128,14 @@ public static function themeInheritanceProvider()
array(array('TestBundle:Parent'), array('TestBundle:Child')),
);
}
+
+ public function testRange()
+ {
+ // No-op for forward compatibility with AbstractLayoutTest 2.8
+ }
+
+ public function testRangeWithMinMaxValues()
+ {
+ // No-op for forward compatibility with AbstractLayoutTest 2.8
+ }
}
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/FormHelperTableLayoutTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/FormHelperTableLayoutTest.php
index 4a5c025c6d371..1bf641fe1b93f 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/FormHelperTableLayoutTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Helper/FormHelperTableLayoutTest.php
@@ -115,4 +115,14 @@ protected function setTheme(FormView $view, array $themes)
{
$this->engine->get('form')->setTheme($view, $themes);
}
+
+ public function testRange()
+ {
+ // No-op for forward compatibility with AbstractLayoutTest 2.8
+ }
+
+ public function testRangeWithMinMaxValues()
+ {
+ // No-op for forward compatibility with AbstractLayoutTest 2.8
+ }
}
From a1772b6a23e847d60bdd54db66cb7539a9260db8 Mon Sep 17 00:00:00 2001
From: Hugo Hamon
Date: Sat, 25 Jul 2015 14:51:32 +0300
Subject: [PATCH 0073/3475] [Asset] removed unused private property.
---
src/Symfony/Component/Asset/UrlPackage.php | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/src/Symfony/Component/Asset/UrlPackage.php b/src/Symfony/Component/Asset/UrlPackage.php
index 0e9f82d0fa65a..6381a9c1cdbdf 100644
--- a/src/Symfony/Component/Asset/UrlPackage.php
+++ b/src/Symfony/Component/Asset/UrlPackage.php
@@ -36,7 +36,6 @@
class UrlPackage extends Package
{
private $baseUrls = array();
- private $sslUrls;
private $sslPackage;
/**
@@ -62,7 +61,7 @@ public function __construct($baseUrls = array(), VersionStrategyInterface $versi
$sslUrls = $this->getSslUrls($baseUrls);
if ($sslUrls && $baseUrls !== $sslUrls) {
- $this->sslPackage = new UrlPackage($sslUrls, $versionStrategy);
+ $this->sslPackage = new self($sslUrls, $versionStrategy);
}
}
From e3914460f377b0e5f94a5d3028c5914139c5210b Mon Sep 17 00:00:00 2001
From: Vincent AUBERT
Date: Fri, 24 Jul 2015 21:28:02 +0200
Subject: [PATCH 0074/3475] #15331 add infos about deprecated classes to
UPGRADE-3.0
---
UPGRADE-3.0.md | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/UPGRADE-3.0.md b/UPGRADE-3.0.md
index f8dcd0b5e460c..c819bc8987860 100644
--- a/UPGRADE-3.0.md
+++ b/UPGRADE-3.0.md
@@ -272,6 +272,17 @@ UPGRADE FROM 2.x to 3.0
```php
echo $form->getErrors(true, false);
```
+ * The `Symfony\Component\Form\Extension\Core\ChoiceList\ChoiceList` class has been removed in
+ favor of `Symfony\Component\Form\ChoiceList\ArrayChoiceList`.
+
+ * The `Symfony\Component\Form\Extension\Core\ChoiceList\LazyChoiceList` class has been removed in
+ favor of `Symfony\Component\Form\ChoiceList\LazyChoiceList`.
+
+ * The `Symfony\Component\Form\Extension\Core\ChoiceList\ObjectChoiceList` class has been removed in
+ favor of `Symfony\Component\Form\ChoiceList\ArrayChoiceList`.
+
+ * The `Symfony\Component\Form\Extension\Core\ChoiceList\SimpleChoiceList` class has been removed in
+ favor of `Symfony\Component\Form\ChoiceList\ArrayChoiceList`.
### FrameworkBundle
From aa7cbbd2053f56564450313d5d2e763df17a2a41 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marcos=20S=C3=A1nchez?=
Date: Wed, 22 Jul 2015 16:34:23 -0300
Subject: [PATCH 0075/3475] Introduce failing test case when a SplFileInfo
object is passed to the extract() method in the TwigExtractor.
The problem is that when there's a twig error, symfony expects the `getRelativePath` method that the native object doesn't have.
---
.../Twig/Tests/Translation/TwigExtractorTest.php | 16 ++++++++++++++--
1 file changed, 14 insertions(+), 2 deletions(-)
diff --git a/src/Symfony/Bridge/Twig/Tests/Translation/TwigExtractorTest.php b/src/Symfony/Bridge/Twig/Tests/Translation/TwigExtractorTest.php
index 94ac80d884b69..f2b15fc5dacc6 100644
--- a/src/Symfony/Bridge/Twig/Tests/Translation/TwigExtractorTest.php
+++ b/src/Symfony/Bridge/Twig/Tests/Translation/TwigExtractorTest.php
@@ -74,14 +74,26 @@ public function getExtractData()
/**
* @expectedException \Twig_Error
* @expectedExceptionMessageRegExp /Unclosed "block" in "extractor(\/|\\)syntax_error\.twig" at line 1/
+ * @dataProvider resourcesWithSyntaxErrorsProvider
*/
- public function testExtractSyntaxError()
+ public function testExtractSyntaxError($resources)
{
$twig = new \Twig_Environment(new \Twig_Loader_Array(array()));
$twig->addExtension(new TranslationExtension($this->getMock('Symfony\Component\Translation\TranslatorInterface')));
$extractor = new TwigExtractor($twig);
- $extractor->extract(__DIR__.'/../Fixtures', new MessageCatalogue('en'));
+ $extractor->extract($resources, new MessageCatalogue('en'));
+ }
+
+ /**
+ * @return array
+ */
+ public function resourcesWithSyntaxErrorsProvider()
+ {
+ return array(
+ array(__DIR__.'/../Fixtures'),
+ array(new \SplFileInfo(__DIR__.'/../Fixtures/extractor/syntax_error.twig')),
+ );
}
/**
From 2bf78e5f20d0d6ce60e052c9dcb0ae31da604305 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Marcos=20S=C3=A1nchez?=
Date: Thu, 23 Jul 2015 09:53:04 -0300
Subject: [PATCH 0076/3475] Resources as string have the same problem
---
src/Symfony/Bridge/Twig/Tests/Translation/TwigExtractorTest.php | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/Symfony/Bridge/Twig/Tests/Translation/TwigExtractorTest.php b/src/Symfony/Bridge/Twig/Tests/Translation/TwigExtractorTest.php
index f2b15fc5dacc6..fb860ec2adc42 100644
--- a/src/Symfony/Bridge/Twig/Tests/Translation/TwigExtractorTest.php
+++ b/src/Symfony/Bridge/Twig/Tests/Translation/TwigExtractorTest.php
@@ -92,6 +92,7 @@ public function resourcesWithSyntaxErrorsProvider()
{
return array(
array(__DIR__.'/../Fixtures'),
+ array(__DIR__.'/../Fixtures/extractor/syntax_error.twig'),
array(new \SplFileInfo(__DIR__.'/../Fixtures/extractor/syntax_error.twig')),
);
}
From 1e15761ac722e2459ebc775025e33f22cc996cc1 Mon Sep 17 00:00:00 2001
From: Christian Flothmann
Date: Sun, 26 Jul 2015 08:27:26 +0200
Subject: [PATCH 0077/3475] [TwigBridge] type-dependent path discovery
With the introduction of the `AbstractFileExtractor` in Symfony 2.7, the
`extract()` method in the `TwigExtractor` class does not necessarily
deal with `SplFileInfo` instances from the Finder component, but also
receives `\SplFileInfo` objects initialized by the base extractor class.
---
.../Bridge/Twig/Tests/Translation/TwigExtractorTest.php | 2 +-
src/Symfony/Bridge/Twig/Translation/TwigExtractor.php | 7 ++++++-
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/src/Symfony/Bridge/Twig/Tests/Translation/TwigExtractorTest.php b/src/Symfony/Bridge/Twig/Tests/Translation/TwigExtractorTest.php
index fb860ec2adc42..610d5a6068992 100644
--- a/src/Symfony/Bridge/Twig/Tests/Translation/TwigExtractorTest.php
+++ b/src/Symfony/Bridge/Twig/Tests/Translation/TwigExtractorTest.php
@@ -73,7 +73,7 @@ public function getExtractData()
/**
* @expectedException \Twig_Error
- * @expectedExceptionMessageRegExp /Unclosed "block" in "extractor(\/|\\)syntax_error\.twig" at line 1/
+ * @expectedExceptionMessageRegExp /Unclosed "block" in ".*extractor(\/|\\)syntax_error\.twig" at line 1/
* @dataProvider resourcesWithSyntaxErrorsProvider
*/
public function testExtractSyntaxError($resources)
diff --git a/src/Symfony/Bridge/Twig/Translation/TwigExtractor.php b/src/Symfony/Bridge/Twig/Translation/TwigExtractor.php
index ad3fd9fe33305..d892fe7303e71 100644
--- a/src/Symfony/Bridge/Twig/Translation/TwigExtractor.php
+++ b/src/Symfony/Bridge/Twig/Translation/TwigExtractor.php
@@ -12,6 +12,7 @@
namespace Symfony\Bridge\Twig\Translation;
use Symfony\Component\Finder\Finder;
+use Symfony\Component\Finder\SplFileInfo;
use Symfony\Component\Translation\Extractor\AbstractFileExtractor;
use Symfony\Component\Translation\Extractor\ExtractorInterface;
use Symfony\Component\Translation\MessageCatalogue;
@@ -60,7 +61,11 @@ public function extract($resource, MessageCatalogue $catalogue)
try {
$this->extractTemplate(file_get_contents($file->getPathname()), $catalogue);
} catch (\Twig_Error $e) {
- $e->setTemplateFile($file->getRelativePathname());
+ if ($file instanceof SplFileInfo) {
+ $e->setTemplateFile($file->getRelativePathname());
+ } elseif ($file instanceof \SplFileInfo) {
+ $e->setTemplateFile($file->getRealPath());
+ }
throw $e;
}
From adc6b3067da4a677204833a17894d108018ca6bc Mon Sep 17 00:00:00 2001
From: Christian Flothmann
Date: Wed, 22 Jul 2015 08:30:32 +0200
Subject: [PATCH 0078/3475] [Yaml] throw a ParseException on invalid data type
Without this check, PHP would trigger a warning when an array was passed
to `trim()`. The parser must throw a `ParseException` instance on a
malformed YAML string instead.
---
src/Symfony/Component/Yaml/Parser.php | 2 +-
src/Symfony/Component/Yaml/Tests/ParserTest.php | 15 +++++++++++++++
2 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/src/Symfony/Component/Yaml/Parser.php b/src/Symfony/Component/Yaml/Parser.php
index cd5e1dc571fd7..311ef18a376f0 100644
--- a/src/Symfony/Component/Yaml/Parser.php
+++ b/src/Symfony/Component/Yaml/Parser.php
@@ -234,7 +234,7 @@ public function parse($value, $exceptionOnInvalidType = false, $objectSupport =
}
// 1-liner optionally followed by newline(s)
- if ($this->lines[0] === trim($value)) {
+ if (is_string($value) && $this->lines[0] === trim($value)) {
try {
$value = Inline::parse($this->lines[0], $exceptionOnInvalidType, $objectSupport, $objectForMap, $this->refs);
} catch (ParseException $e) {
diff --git a/src/Symfony/Component/Yaml/Tests/ParserTest.php b/src/Symfony/Component/Yaml/Tests/ParserTest.php
index 6e39e7dc660ee..f434d5585d8ea 100644
--- a/src/Symfony/Component/Yaml/Tests/ParserTest.php
+++ b/src/Symfony/Component/Yaml/Tests/ParserTest.php
@@ -551,6 +551,21 @@ public function testMappingInASequence()
);
}
+ /**
+ * @expectedException \Symfony\Component\Yaml\Exception\ParseException
+ * @expectedExceptionMessage missing colon
+ */
+ public function testScalarInSequence()
+ {
+ Yaml::parse(<< It is an error for two equal keys to appear in the same mapping node.
* > In such a case the YAML processor may continue, ignoring the second
From 3ad0794aa14aa929eb57886973640026ce7f9aa7 Mon Sep 17 00:00:00 2001
From: Tomaz Ahlin
Date: Thu, 2 Jul 2015 10:07:17 +0200
Subject: [PATCH 0079/3475] =?UTF-8?q?[DependencyInjection]=20fixed=20Froze?=
=?UTF-8?q?nParameterBag=20and=20improved=20Parameter=E2=80=A6?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../ParameterBag/FrozenParameterBag.php | 8 ++++++++
.../ParameterBag/ParameterBagInterface.php | 7 +++++++
.../Tests/ParameterBag/FrozenParameterBagTest.php | 9 +++++++++
3 files changed, 24 insertions(+)
diff --git a/src/Symfony/Component/DependencyInjection/ParameterBag/FrozenParameterBag.php b/src/Symfony/Component/DependencyInjection/ParameterBag/FrozenParameterBag.php
index dc936a0bd6718..cb7e481ed23b8 100644
--- a/src/Symfony/Component/DependencyInjection/ParameterBag/FrozenParameterBag.php
+++ b/src/Symfony/Component/DependencyInjection/ParameterBag/FrozenParameterBag.php
@@ -69,4 +69,12 @@ public function set($name, $value)
{
throw new LogicException('Impossible to call set() on a frozen ParameterBag.');
}
+
+ /**
+ * {@inheritdoc}
+ */
+ public function remove($name)
+ {
+ throw new LogicException('Impossible to call remove() on a frozen ParameterBag.');
+ }
}
diff --git a/src/Symfony/Component/DependencyInjection/ParameterBag/ParameterBagInterface.php b/src/Symfony/Component/DependencyInjection/ParameterBag/ParameterBagInterface.php
index 96003547b69fb..ead76d738d320 100644
--- a/src/Symfony/Component/DependencyInjection/ParameterBag/ParameterBagInterface.php
+++ b/src/Symfony/Component/DependencyInjection/ParameterBag/ParameterBagInterface.php
@@ -11,6 +11,7 @@
namespace Symfony\Component\DependencyInjection\ParameterBag;
+use Symfony\Component\DependencyInjection\Exception\LogicException;
use Symfony\Component\DependencyInjection\Exception\ParameterNotFoundException;
/**
@@ -25,6 +26,8 @@ interface ParameterBagInterface
/**
* Clears all parameters.
*
+ * @throws LogicException if the ParameterBagInterface can not be cleared
+ *
* @api
*/
public function clear();
@@ -34,6 +37,8 @@ public function clear();
*
* @param array $parameters An array of parameters
*
+ * @throws LogicException if the parameter can not be added
+ *
* @api
*/
public function add(array $parameters);
@@ -66,6 +71,8 @@ public function get($name);
* @param string $name The parameter name
* @param mixed $value The parameter value
*
+ * @throws LogicException if the parameter can not be set
+ *
* @api
*/
public function set($name, $value);
diff --git a/src/Symfony/Component/DependencyInjection/Tests/ParameterBag/FrozenParameterBagTest.php b/src/Symfony/Component/DependencyInjection/Tests/ParameterBag/FrozenParameterBagTest.php
index e6e7fea2f17a9..6d963dc054566 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/ParameterBag/FrozenParameterBagTest.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/ParameterBag/FrozenParameterBagTest.php
@@ -57,4 +57,13 @@ public function testAdd()
$bag = new FrozenParameterBag(array());
$bag->add(array());
}
+
+ /**
+ * @expectedException \LogicException
+ */
+ public function testRemove()
+ {
+ $bag = new FrozenParameterBag(array('foo' => 'bar'));
+ $bag->remove('foo');
+ }
}
From 32d964ba3946cdc8572f0b95288b5c3446b24cfc Mon Sep 17 00:00:00 2001
From: Matt Farmer
Date: Fri, 17 Jul 2015 11:41:22 -0700
Subject: [PATCH 0080/3475] Fix calls to HttpCache#getSurrogate triggering
E_USER_DEPRECATED errors.
---
.../Component/HttpKernel/HttpCache/HttpCache.php | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/src/Symfony/Component/HttpKernel/HttpCache/HttpCache.php b/src/Symfony/Component/HttpKernel/HttpCache/HttpCache.php
index 445f59c6f0fff..da90600bba549 100644
--- a/src/Symfony/Component/HttpKernel/HttpCache/HttpCache.php
+++ b/src/Symfony/Component/HttpKernel/HttpCache/HttpCache.php
@@ -160,7 +160,11 @@ public function getKernel()
*/
public function getSurrogate()
{
- return $this->getEsi();
+ if (!$this->surrogate instanceof Esi) {
+ throw new \LogicException('This instance of HttpCache was not set up to use ESI as surrogate handler. You must overwrite and use createSurrogate');
+ }
+
+ return $this->surrogate;
}
/**
@@ -176,11 +180,7 @@ public function getEsi()
{
@trigger_error('The '.__METHOD__.' method is deprecated since version 2.6 and will be removed in 3.0. Use the getSurrogate() method instead.', E_USER_DEPRECATED);
- if (!$this->surrogate instanceof Esi) {
- throw new \LogicException('This instance of HttpCache was not set up to use ESI as surrogate handler. You must overwrite and use createSurrogate');
- }
-
- return $this->surrogate;
+ return $this->getSurrogate();
}
/**
From 335825363de8bac4d0dd55d9e82e19bdc963a252 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gr=C3=A9goire=20Pineau?=
Date: Fri, 24 Jul 2015 17:06:07 +0200
Subject: [PATCH 0081/3475] [Security] Do not save the target path in the
session for a stateless firewall
---
.../DependencyInjection/SecurityExtension.php | 5 +++--
.../Resources/config/security_listeners.xml | 1 +
.../Security/Http/Firewall/ExceptionListener.php | 8 ++++++--
3 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/src/Symfony/Bundle/SecurityBundle/DependencyInjection/SecurityExtension.php b/src/Symfony/Bundle/SecurityBundle/DependencyInjection/SecurityExtension.php
index 00f251765a0de..972b4f8f90c91 100644
--- a/src/Symfony/Bundle/SecurityBundle/DependencyInjection/SecurityExtension.php
+++ b/src/Symfony/Bundle/SecurityBundle/DependencyInjection/SecurityExtension.php
@@ -349,7 +349,7 @@ private function createFirewall(ContainerBuilder $container, $id, $firewall, &$a
$listeners[] = new Reference('security.access_listener');
// Exception listener
- $exceptionListener = new Reference($this->createExceptionListener($container, $firewall, $id, $configuredEntryPoint ?: $defaultEntryPoint));
+ $exceptionListener = new Reference($this->createExceptionListener($container, $firewall, $id, $configuredEntryPoint ?: $defaultEntryPoint, $firewall['stateless']));
return array($matcher, $listeners, $exceptionListener);
}
@@ -534,12 +534,13 @@ private function getUserProviderId($name)
return 'security.user.provider.concrete.'.$name;
}
- private function createExceptionListener($container, $config, $id, $defaultEntryPoint)
+ private function createExceptionListener($container, $config, $id, $defaultEntryPoint, $stateless)
{
$exceptionListenerId = 'security.exception_listener.'.$id;
$listener = $container->setDefinition($exceptionListenerId, new DefinitionDecorator('security.exception_listener'));
$listener->replaceArgument(3, $id);
$listener->replaceArgument(4, null === $defaultEntryPoint ? null : new Reference($defaultEntryPoint));
+ $listener->replaceArgument(8, $stateless);
// access denied handler setup
if (isset($config['access_denied_handler'])) {
diff --git a/src/Symfony/Bundle/SecurityBundle/Resources/config/security_listeners.xml b/src/Symfony/Bundle/SecurityBundle/Resources/config/security_listeners.xml
index b7e4adfd2a0e1..543ca38b7869e 100644
--- a/src/Symfony/Bundle/SecurityBundle/Resources/config/security_listeners.xml
+++ b/src/Symfony/Bundle/SecurityBundle/Resources/config/security_listeners.xml
@@ -186,6 +186,7 @@
%security.access.denied_url%
+ false
diff --git a/src/Symfony/Component/Security/Http/Firewall/ExceptionListener.php b/src/Symfony/Component/Security/Http/Firewall/ExceptionListener.php
index 57321fb24bd3c..8553c75b79d44 100644
--- a/src/Symfony/Component/Security/Http/Firewall/ExceptionListener.php
+++ b/src/Symfony/Component/Security/Http/Firewall/ExceptionListener.php
@@ -46,8 +46,9 @@ class ExceptionListener
private $errorPage;
private $logger;
private $httpUtils;
+ private $stateless;
- public function __construct(SecurityContextInterface $context, AuthenticationTrustResolverInterface $trustResolver, HttpUtils $httpUtils, $providerKey, AuthenticationEntryPointInterface $authenticationEntryPoint = null, $errorPage = null, AccessDeniedHandlerInterface $accessDeniedHandler = null, LoggerInterface $logger = null)
+ public function __construct(SecurityContextInterface $context, AuthenticationTrustResolverInterface $trustResolver, HttpUtils $httpUtils, $providerKey, AuthenticationEntryPointInterface $authenticationEntryPoint = null, $errorPage = null, AccessDeniedHandlerInterface $accessDeniedHandler = null, LoggerInterface $logger = null, $stateless = false)
{
$this->context = $context;
$this->accessDeniedHandler = $accessDeniedHandler;
@@ -57,6 +58,7 @@ public function __construct(SecurityContextInterface $context, AuthenticationTru
$this->authenticationTrustResolver = $trustResolver;
$this->errorPage = $errorPage;
$this->logger = $logger;
+ $this->stateless = $stateless;
}
/**
@@ -178,7 +180,9 @@ private function startAuthentication(Request $request, AuthenticationException $
$this->logger->debug('Calling Authentication entry point');
}
- $this->setTargetPath($request);
+ if (!$this->stateless) {
+ $this->setTargetPath($request);
+ }
if ($authException instanceof AccountStatusException) {
// remove the security token to prevent infinite redirect loops
From a336f0e98e1cd42a5bbf95cac7646c13440d5a3e Mon Sep 17 00:00:00 2001
From: WouterJ
Date: Mon, 27 Jul 2015 18:51:30 +0200
Subject: [PATCH 0082/3475] Skip ::class constant
---
.../ClassLoader/ClassMapGenerator.php | 19 +++++++++++++++++++
.../Tests/ClassMapGeneratorTest.php | 8 +++++++-
.../Tests/Fixtures/php5.5/class_cons.php | 11 +++++++++++
3 files changed, 37 insertions(+), 1 deletion(-)
create mode 100644 src/Symfony/Component/ClassLoader/Tests/Fixtures/php5.5/class_cons.php
diff --git a/src/Symfony/Component/ClassLoader/ClassMapGenerator.php b/src/Symfony/Component/ClassLoader/ClassMapGenerator.php
index 112bee87bddce..d242acdc1b46d 100644
--- a/src/Symfony/Component/ClassLoader/ClassMapGenerator.php
+++ b/src/Symfony/Component/ClassLoader/ClassMapGenerator.php
@@ -118,6 +118,25 @@ private static function findClasses($path)
case T_CLASS:
case T_INTERFACE:
case SYMFONY_TRAIT:
+ // Skip usage of ::class constant
+ $isClassConstant = false;
+ for ($j = $i - 1; $j > 0; --$j) {
+ if (is_string($tokens[$j])) {
+ break;
+ }
+
+ if (T_DOUBLE_COLON === $tokens[$j][0]) {
+ $isClassConstant = true;
+ break;
+ } elseif (!in_array($tokens[$j][0], array(T_WHITESPACE, T_DOC_COMMENT, T_COMMENT))) {
+ break;
+ }
+ }
+
+ if ($isClassConstant) {
+ continue;
+ }
+
// Find the classname
while (($t = $tokens[++$i]) && is_array($t)) {
if (T_STRING === $t[0]) {
diff --git a/src/Symfony/Component/ClassLoader/Tests/ClassMapGeneratorTest.php b/src/Symfony/Component/ClassLoader/Tests/ClassMapGeneratorTest.php
index 29c3288347dcc..e6756f1898d84 100644
--- a/src/Symfony/Component/ClassLoader/Tests/ClassMapGeneratorTest.php
+++ b/src/Symfony/Component/ClassLoader/Tests/ClassMapGeneratorTest.php
@@ -47,7 +47,7 @@ private function clean($file)
/**
* @dataProvider getTestCreateMapTests
*/
- public function testDump($directory, $expected)
+ public function testDump($directory)
{
$this->prepare_workspace();
@@ -115,6 +115,12 @@ public function getTestCreateMapTests()
));
}
+ if (PHP_VERSION_ID >= 50500) {
+ $data[] = array(__DIR__.'/Fixtures/php5.5', array(
+ 'ClassCons\\Foo' => __DIR__.'/Fixtures/php5.5/class_cons.php',
+ ));
+ }
+
return $data;
}
diff --git a/src/Symfony/Component/ClassLoader/Tests/Fixtures/php5.5/class_cons.php b/src/Symfony/Component/ClassLoader/Tests/Fixtures/php5.5/class_cons.php
new file mode 100644
index 0000000000000..0ed8d77fcafd6
--- /dev/null
+++ b/src/Symfony/Component/ClassLoader/Tests/Fixtures/php5.5/class_cons.php
@@ -0,0 +1,11 @@
+
Date: Mon, 27 Jul 2015 09:36:17 +0200
Subject: [PATCH 0083/3475] Change the default value of cookie_httponly to fix
#15303
---
UPGRADE-2.8.md | 30 ++++++++++++++-----
.../DependencyInjection/Configuration.php | 2 +-
.../DependencyInjection/Fixtures/php/full.php | 2 +-
.../DependencyInjection/Fixtures/xml/full.xml | 2 +-
.../DependencyInjection/Fixtures/yml/full.yml | 2 +-
.../FrameworkExtensionTest.php | 2 +-
6 files changed, 27 insertions(+), 13 deletions(-)
diff --git a/UPGRADE-2.8.md b/UPGRADE-2.8.md
index 966f1f4711132..0701ad8f8374e 100644
--- a/UPGRADE-2.8.md
+++ b/UPGRADE-2.8.md
@@ -8,32 +8,32 @@ Form
option together with the `Valid` constraint instead. Contrary to
"cascade_validation", "constraints" must be set on the respective child forms,
not the parent form.
-
+
Before:
-
+
```php
$form = $this->createForm('form', $article, array('cascade_validation' => true))
->add('author', new AuthorType())
->getForm();
```
-
+
After:
-
+
```php
use Symfony\Component\Validator\Constraints\Valid;
-
+
$form = $this->createForm('form', $article)
->add('author', new AuthorType(), array(
'constraints' => new Valid(),
))
->getForm();
```
-
+
Alternatively, you can set the `Valid` constraint in the model itself:
-
+
```php
use Symfony\Component\Validator\Constraints as Assert;
-
+
class Article
{
/**
@@ -136,3 +136,17 @@ DependencyInjection
```
+
+FrameworkBundle
+---------------
+
+ * The default value of the parameter `session`.`cookie_httponly` is now `true`.
+ It prevents scripting languages, such as JavaScript to access the cookie,
+ which help to reduce identity theft through XSS attacks. If your
+ application needs to access the session cookie, override this parameter:
+
+ ```yaml
+ framework:
+ session:
+ cookie_httponly: false
+ ```
diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php
index 977c0669c409c..b2ff3d7c59496 100644
--- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php
+++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php
@@ -340,7 +340,7 @@ private function addSessionSection(ArrayNodeDefinition $rootNode)
->scalarNode('cookie_path')->end()
->scalarNode('cookie_domain')->end()
->booleanNode('cookie_secure')->end()
- ->booleanNode('cookie_httponly')->end()
+ ->booleanNode('cookie_httponly')->defaultTrue()->end()
->scalarNode('gc_divisor')->end()
->scalarNode('gc_probability')->defaultValue(1)->end()
->scalarNode('gc_maxlifetime')->end()
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/full.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/full.php
index a035b56d70029..677d8e8c1020d 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/full.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/php/full.php
@@ -32,7 +32,7 @@
'cookie_path' => '/',
'cookie_domain' => 'example.com',
'cookie_secure' => true,
- 'cookie_httponly' => true,
+ 'cookie_httponly' => false,
'gc_maxlifetime' => 90000,
'gc_divisor' => 108,
'gc_probability' => 1,
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/full.xml b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/full.xml
index bf4537b910e8b..dfd651574e48d 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/full.xml
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/xml/full.xml
@@ -14,7 +14,7 @@
-
+
text/csv
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/full.yml b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/full.yml
index 47513b1f665b5..ad0b903e8637f 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/full.yml
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/full.yml
@@ -24,7 +24,7 @@ framework:
cookie_path: /
cookie_domain: example.com
cookie_secure: true
- cookie_httponly: true
+ cookie_httponly: false
gc_probability: 1
gc_divisor: 108
gc_maxlifetime: 90000
diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php
index edace5bf7a9ad..4eeee524fbc37 100644
--- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php
+++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php
@@ -149,7 +149,7 @@ public function testSession()
$this->assertEquals('/', $options['cookie_path']);
$this->assertEquals('example.com', $options['cookie_domain']);
$this->assertTrue($options['cookie_secure']);
- $this->assertTrue($options['cookie_httponly']);
+ $this->assertFalse($options['cookie_httponly']);
$this->assertEquals(108, $options['gc_divisor']);
$this->assertEquals(1, $options['gc_probability']);
$this->assertEquals(90000, $options['gc_maxlifetime']);
From 0e934637dfc8e43f288adf6874cc57abc977be34 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Deruss=C3=A9?=
Date: Tue, 28 Jul 2015 13:31:20 +0200
Subject: [PATCH 0084/3475] Small optimization in AccessDecisionManager
---
.../Security/Core/Authorization/AccessDecisionManager.php | 8 +-------
1 file changed, 1 insertion(+), 7 deletions(-)
diff --git a/src/Symfony/Component/Security/Core/Authorization/AccessDecisionManager.php b/src/Symfony/Component/Security/Core/Authorization/AccessDecisionManager.php
index 61debe39cce27..e021cc73547c8 100644
--- a/src/Symfony/Component/Security/Core/Authorization/AccessDecisionManager.php
+++ b/src/Symfony/Component/Security/Core/Authorization/AccessDecisionManager.php
@@ -150,7 +150,6 @@ private function decideConsensus(TokenInterface $token, array $attributes, $obje
{
$grant = 0;
$deny = 0;
- $abstain = 0;
foreach ($this->voters as $voter) {
$result = $voter->vote($token, $object, $attributes);
@@ -163,11 +162,6 @@ private function decideConsensus(TokenInterface $token, array $attributes, $obje
case VoterInterface::ACCESS_DENIED:
++$deny;
- break;
-
- default:
- ++$abstain;
-
break;
}
}
@@ -180,7 +174,7 @@ private function decideConsensus(TokenInterface $token, array $attributes, $obje
return false;
}
- if ($grant == $deny && $grant != 0) {
+ if ($grant > 0) {
return $this->allowIfEqualGrantedDeniedDecisions;
}
From 77ee866dd8601300209cc44ab5e2975bdb0b22ed Mon Sep 17 00:00:00 2001
From: Nicolas Grekas
Date: Tue, 28 Jul 2015 14:35:05 +0200
Subject: [PATCH 0085/3475] [php7] Fix for substr() always returning a string
---
src/Symfony/Component/Console/Input/ArgvInput.php | 4 ++--
src/Symfony/Component/Debug/Tests/ErrorHandlerTest.php | 4 ++--
src/Symfony/Component/Yaml/Parser.php | 2 +-
3 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/src/Symfony/Component/Console/Input/ArgvInput.php b/src/Symfony/Component/Console/Input/ArgvInput.php
index 43cbe725fb26e..a6c2132797086 100644
--- a/src/Symfony/Component/Console/Input/ArgvInput.php
+++ b/src/Symfony/Component/Console/Input/ArgvInput.php
@@ -215,8 +215,8 @@ private function addLongOption($name, $value)
$option = $this->definition->getOption($name);
- // Convert false values (from a previous call to substr()) to null
- if (false === $value) {
+ // Convert empty values to null
+ if (!isset($value[0])) {
$value = null;
}
diff --git a/src/Symfony/Component/Debug/Tests/ErrorHandlerTest.php b/src/Symfony/Component/Debug/Tests/ErrorHandlerTest.php
index 563bd0997e95d..a3ab18f89400b 100644
--- a/src/Symfony/Component/Debug/Tests/ErrorHandlerTest.php
+++ b/src/Symfony/Component/Debug/Tests/ErrorHandlerTest.php
@@ -121,11 +121,11 @@ public function testNotice()
$that->assertEquals('->', $trace[0]['type']);
$that->assertEquals(__FILE__, $trace[1]['file']);
- $that->assertEquals(__CLASS__, $trace[1]['class']);
+ $that->assertEquals('Symfony\Component\Debug\Tests\ErrorHandlerTest', $trace[1]['class']);
$that->assertEquals('triggerNotice', $trace[1]['function']);
$that->assertEquals('::', $trace[1]['type']);
- $that->assertEquals(__CLASS__, $trace[2]['class']);
+ $that->assertEquals('Symfony\Component\Debug\Tests\ErrorHandlerTest', $trace[2]['class']);
$that->assertEquals('testNotice', $trace[2]['function']);
$that->assertEquals('->', $trace[2]['type']);
};
diff --git a/src/Symfony/Component/Yaml/Parser.php b/src/Symfony/Component/Yaml/Parser.php
index fc46ab3caffeb..08cfac4224334 100644
--- a/src/Symfony/Component/Yaml/Parser.php
+++ b/src/Symfony/Component/Yaml/Parser.php
@@ -320,7 +320,7 @@ private function getNextEmbedBlock($indentation = null, $inSequence = false)
return;
}
- if ($inSequence && $oldLineIndentation === $newIndent && '-' === $data[0][0]) {
+ if ($inSequence && $oldLineIndentation === $newIndent && isset($data[0][0]) && '-' === $data[0][0]) {
// the previous line contained a dash but no item content, this line is a sequence item with the same indentation
// and therefore no nested list or mapping
$this->moveToPreviousLine();
From 5179acc29babde5ca01c7c7eba99d0f100a47eea Mon Sep 17 00:00:00 2001
From: bokonet
Date: Tue, 28 Jul 2015 16:52:34 +0200
Subject: [PATCH 0086/3475] fix issue #15377
---
.../SecurityBundle/DataCollector/SecurityDataCollector.php | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/src/Symfony/Bundle/SecurityBundle/DataCollector/SecurityDataCollector.php b/src/Symfony/Bundle/SecurityBundle/DataCollector/SecurityDataCollector.php
index 230172530cdf0..a6ea333d95b85 100644
--- a/src/Symfony/Bundle/SecurityBundle/DataCollector/SecurityDataCollector.php
+++ b/src/Symfony/Bundle/SecurityBundle/DataCollector/SecurityDataCollector.php
@@ -71,7 +71,7 @@ public function collect(Request $request, Response $response, \Exception $except
if (null !== $this->roleHierarchy) {
$allRoles = $this->roleHierarchy->getReachableRoles($assignedRoles);
foreach ($allRoles as $role) {
- if (!in_array($role, $assignedRoles)) {
+ if (!in_array($role, $assignedRoles, true)) {
$inheritedRoles[] = $role;
}
}
From d6dfe9871c4e4e0c2912c8019c75aeccd801a42c Mon Sep 17 00:00:00 2001
From: Nicolas Grekas
Date: Tue, 28 Jul 2015 17:12:55 +0200
Subject: [PATCH 0087/3475] [php7] Fix for substr() always returning a string
---
src/Symfony/Component/Console/Style/SymfonyStyle.php | 2 +-
.../Component/VarDumper/Tests/Caster/ReflectionCasterTest.php | 4 +---
2 files changed, 2 insertions(+), 4 deletions(-)
diff --git a/src/Symfony/Component/Console/Style/SymfonyStyle.php b/src/Symfony/Component/Console/Style/SymfonyStyle.php
index b3113a41e2d46..0d366c7e894bd 100644
--- a/src/Symfony/Component/Console/Style/SymfonyStyle.php
+++ b/src/Symfony/Component/Console/Style/SymfonyStyle.php
@@ -379,7 +379,7 @@ private function autoPrependBlock()
{
$chars = substr(str_replace(PHP_EOL, "\n", $this->bufferedOutput->fetch()), -2);
- if (false === $chars) {
+ if (!isset($chars[0])) {
return $this->newLine(); //empty history, so we should start with a new line.
}
//Prepend new line for each non LF chars (This means no blank line was output before)
diff --git a/src/Symfony/Component/VarDumper/Tests/Caster/ReflectionCasterTest.php b/src/Symfony/Component/VarDumper/Tests/Caster/ReflectionCasterTest.php
index ecf776d70f416..0fcc7e26bb36a 100644
--- a/src/Symfony/Component/VarDumper/Tests/Caster/ReflectionCasterTest.php
+++ b/src/Symfony/Component/VarDumper/Tests/Caster/ReflectionCasterTest.php
@@ -11,8 +11,6 @@
namespace Symfony\Component\VarDumper\Tests\Caster;
-use Symfony\Component\VarDumper\Cloner\VarCloner;
-use Symfony\Component\VarDumper\Dumper\CliDumper;
use Symfony\Component\VarDumper\Test\VarDumperTestCase;
/**
@@ -34,7 +32,7 @@ public function testReflectionCaster()
constants: array:3 [
"IS_IMPLICIT_ABSTRACT" => 16
"IS_EXPLICIT_ABSTRACT" => 32
- "IS_FINAL" => 64
+ "IS_FINAL" => %d
]
properties: array:%d [
"name" => ReflectionProperty {
From ecc3df5aae49298368f0fcc193b65a07baefd9df Mon Sep 17 00:00:00 2001
From: Christian Flothmann
Date: Mon, 30 Mar 2015 20:17:55 +0200
Subject: [PATCH 0088/3475] let Travis builds fail when PHP 7 jobs fail
---
.travis.yml | 2 --
1 file changed, 2 deletions(-)
diff --git a/.travis.yml b/.travis.yml
index b27111e4966e1..e06aab56b6473 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -19,8 +19,6 @@ matrix:
- php: 5.6
env: deps=high
- php: nightly
- allow_failures:
- - php: nightly
fast_finish: true
services: mongodb
From ad6cb10e6378bb0ebde43221b9650b23382fdc0c Mon Sep 17 00:00:00 2001
From: Christian Flothmann
Date: Tue, 28 Jul 2015 09:17:47 +0200
Subject: [PATCH 0089/3475] do not dump leading backslashes in class names
---
.../DependencyInjection/Dumper/GraphvizDumper.php | 8 +++++++-
.../Component/DependencyInjection/Dumper/PhpDumper.php | 10 ++++++++--
.../Component/DependencyInjection/Dumper/XmlDumper.php | 8 ++++++--
.../DependencyInjection/Dumper/YamlDumper.php | 8 ++++++--
.../Tests/Fixtures/containers/container9.php | 2 +-
5 files changed, 28 insertions(+), 8 deletions(-)
diff --git a/src/Symfony/Component/DependencyInjection/Dumper/GraphvizDumper.php b/src/Symfony/Component/DependencyInjection/Dumper/GraphvizDumper.php
index ed4f0b1fb3a91..f4b1a75ed8273 100644
--- a/src/Symfony/Component/DependencyInjection/Dumper/GraphvizDumper.php
+++ b/src/Symfony/Component/DependencyInjection/Dumper/GraphvizDumper.php
@@ -165,7 +165,13 @@ private function findNodes()
$container = $this->cloneContainer();
foreach ($container->getDefinitions() as $id => $definition) {
- $nodes[$id] = array('class' => str_replace('\\', '\\\\', $this->container->getParameterBag()->resolveValue($definition->getClass())), 'attributes' => array_merge($this->options['node.definition'], array('style' => ContainerInterface::SCOPE_PROTOTYPE !== $definition->getScope() ? 'filled' : 'dotted')));
+ $class = $definition->getClass();
+
+ if ('\\' === substr($class, 0, 1)) {
+ $class = substr($class, 1);
+ }
+
+ $nodes[$id] = array('class' => str_replace('\\', '\\\\', $this->container->getParameterBag()->resolveValue($class)), 'attributes' => array_merge($this->options['node.definition'], array('style' => ContainerInterface::SCOPE_PROTOTYPE !== $definition->getScope() ? 'filled' : 'dotted')));
$container->setDefinition($id, new Definition('stdClass'));
}
diff --git a/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php b/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php
index db0a9f97d21ba..18ab0a808045f 100644
--- a/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php
+++ b/src/Symfony/Component/DependencyInjection/Dumper/PhpDumper.php
@@ -358,7 +358,13 @@ private function addServiceReturn($id, $definition)
*/
private function addServiceInstance($id, $definition)
{
- $class = $this->dumpValue($definition->getClass());
+ $class = $definition->getClass();
+
+ if ('\\' === substr($class, 0, 1)) {
+ $class = substr($class, 1);
+ }
+
+ $class = $this->dumpValue($class);
if (0 === strpos($class, "'") && !preg_match('/^\'[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*(\\\{2}[a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*)*\'$/', $class)) {
throw new InvalidArgumentException(sprintf('"%s" is not a valid class name for the "%s" service.', $class, $id));
@@ -539,7 +545,7 @@ private function addService($id, $definition)
if ($definition->isSynthetic()) {
$return[] = '@throws RuntimeException always since this service is expected to be injected dynamically';
} elseif ($class = $definition->getClass()) {
- $return[] = sprintf('@return %s A %s instance.', 0 === strpos($class, '%') ? 'object' : '\\'.$class, $class);
+ $return[] = sprintf('@return %s A %s instance.', 0 === strpos($class, '%') ? 'object' : '\\'.ltrim($class, '\\'), ltrim($class, '\\'));
} elseif ($definition->getFactoryClass()) {
$return[] = sprintf('@return object An instance returned by %s::%s().', $definition->getFactoryClass(), $definition->getFactoryMethod());
} elseif ($definition->getFactoryService()) {
diff --git a/src/Symfony/Component/DependencyInjection/Dumper/XmlDumper.php b/src/Symfony/Component/DependencyInjection/Dumper/XmlDumper.php
index 363aa12099814..f8a42b5fe35c4 100644
--- a/src/Symfony/Component/DependencyInjection/Dumper/XmlDumper.php
+++ b/src/Symfony/Component/DependencyInjection/Dumper/XmlDumper.php
@@ -113,8 +113,12 @@ private function addService($definition, $id, \DOMElement $parent)
if (null !== $id) {
$service->setAttribute('id', $id);
}
- if ($definition->getClass()) {
- $service->setAttribute('class', $definition->getClass());
+ if ($class = $definition->getClass()) {
+ if ('\\' === substr($class, 0, 1)) {
+ $class = substr($class, 1);
+ }
+
+ $service->setAttribute('class', $class);
}
if ($definition->getFactoryMethod()) {
$service->setAttribute('factory-method', $definition->getFactoryMethod());
diff --git a/src/Symfony/Component/DependencyInjection/Dumper/YamlDumper.php b/src/Symfony/Component/DependencyInjection/Dumper/YamlDumper.php
index a3d9ea37b6226..ddf98d985cc1f 100644
--- a/src/Symfony/Component/DependencyInjection/Dumper/YamlDumper.php
+++ b/src/Symfony/Component/DependencyInjection/Dumper/YamlDumper.php
@@ -63,8 +63,12 @@ public function dump(array $options = array())
private function addService($id, $definition)
{
$code = " $id:\n";
- if ($definition->getClass()) {
- $code .= sprintf(" class: %s\n", $definition->getClass());
+ if ($class = $definition->getClass()) {
+ if ('\\' === substr($class, 0, 1)) {
+ $class = substr($class, 1);
+ }
+
+ $code .= sprintf(" class: %s\n", $class);
}
if (!$definition->isPublic()) {
diff --git a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container9.php b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container9.php
index 14f2dad275f9c..4739a6a833861 100644
--- a/src/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container9.php
+++ b/src/Symfony/Component/DependencyInjection/Tests/Fixtures/containers/container9.php
@@ -9,7 +9,7 @@
$container = new ContainerBuilder();
$container->
- register('foo', 'FooClass')->
+ register('foo', '\FooClass')->
addTag('foo', array('foo' => 'foo'))->
addTag('foo', array('bar' => 'bar', 'baz' => 'baz'))->
setFactoryClass('FooClass')->
From 0ce91a6019ef8ccebaea3b75fdb31f4aec671832 Mon Sep 17 00:00:00 2001
From: Daniel Espendiller
Date: Tue, 28 Jul 2015 17:20:14 +0200
Subject: [PATCH 0090/3475] Fix missing _route parameter notice in
RouterListener logging case
---
.../EventListener/RouterListener.php | 2 +-
.../EventListener/RouterListenerTest.php | 30 +++++++++++++++++++
2 files changed, 31 insertions(+), 1 deletion(-)
diff --git a/src/Symfony/Component/HttpKernel/EventListener/RouterListener.php b/src/Symfony/Component/HttpKernel/EventListener/RouterListener.php
index 2e9cb7b6bb4ed..704800a5cbd5f 100644
--- a/src/Symfony/Component/HttpKernel/EventListener/RouterListener.php
+++ b/src/Symfony/Component/HttpKernel/EventListener/RouterListener.php
@@ -103,7 +103,7 @@ public function onKernelRequest(GetResponseEvent $event)
}
if (null !== $this->logger) {
- $this->logger->info(sprintf('Matched route "%s" (parameters: %s)', $parameters['_route'], $this->parametersToString($parameters)));
+ $this->logger->info(sprintf('Matched route "%s" (parameters: %s)', isset($parameters['_route']) ? $parameters['_route'] : 'n/a', $this->parametersToString($parameters)));
}
$request->attributes->add($parameters);
diff --git a/src/Symfony/Component/HttpKernel/Tests/EventListener/RouterListenerTest.php b/src/Symfony/Component/HttpKernel/Tests/EventListener/RouterListenerTest.php
index 66fe6bd55d505..fd66a602a6f69 100644
--- a/src/Symfony/Component/HttpKernel/Tests/EventListener/RouterListenerTest.php
+++ b/src/Symfony/Component/HttpKernel/Tests/EventListener/RouterListenerTest.php
@@ -120,4 +120,34 @@ public function testSubRequestWithDifferentMethod()
$this->assertEquals('GET', $context->getMethod());
}
+
+ /**
+ * @dataProvider getLoggingParameterData
+ */
+ public function testLoggingParameter($parameter, $log)
+ {
+ $requestMatcher = $this->getMock('Symfony\Component\Routing\Matcher\RequestMatcherInterface');
+ $requestMatcher->expects($this->once())
+ ->method('matchRequest')
+ ->will($this->returnValue($parameter));
+
+ $logger = $this->getMock('Psr\Log\LoggerInterface');
+ $logger->expects($this->once())
+ ->method('info')
+ ->with($this->equalTo($log));
+
+ $kernel = $this->getMock('Symfony\Component\HttpKernel\HttpKernelInterface');
+ $request = Request::create('http://localhost/');
+
+ $listener = new RouterListener($requestMatcher, new RequestContext(), $logger, $this->requestStack);
+ $listener->onKernelRequest(new GetResponseEvent($kernel, $request, HttpKernelInterface::MASTER_REQUEST));
+ }
+
+ public function getLoggingParameterData()
+ {
+ return array(
+ array(array('_route' => 'foo'), 'Matched route "foo".'),
+ array(array(), 'Matched route "n/a".'),
+ );
+ }
}
From c2fcadc6fead1c9d6ada83e8099401d3a84984c6 Mon Sep 17 00:00:00 2001
From: Javier Eguiluz
Date: Wed, 1 Jul 2015 09:07:03 +0200
Subject: [PATCH 0091/3475] Redesigned the web debug toolbar
---
.../views/Collector/security.html.twig | 12 +-
.../Resources/views/Collector/ajax.html.twig | 6 +-
.../views/Collector/config.html.twig | 133 +++++------
.../Resources/views/Collector/form.html.twig | 14 +-
.../views/Collector/logger.html.twig | 39 +---
.../views/Collector/memory.html.twig | 16 +-
.../views/Collector/request.html.twig | 20 +-
.../Resources/views/Collector/time.html.twig | 11 +-
.../views/Collector/translation.html.twig | 39 +---
.../Resources/views/Collector/twig.html.twig | 9 +-
.../views/Profiler/base_js.html.twig | 2 +-
.../views/Profiler/profiler.css.twig | 8 +-
.../Resources/views/Profiler/toolbar.css.twig | 215 ++++++++++--------
.../views/Profiler/toolbar.html.twig | 6 +-
.../views/Profiler/toolbar_item.html.twig | 17 +-
.../views/Profiler/toolbar_js.html.twig | 2 +-
16 files changed, 275 insertions(+), 274 deletions(-)
diff --git a/src/Symfony/Bundle/SecurityBundle/Resources/views/Collector/security.html.twig b/src/Symfony/Bundle/SecurityBundle/Resources/views/Collector/security.html.twig
index a495829d3e517..1a1352ab320cd 100644
--- a/src/Symfony/Bundle/SecurityBundle/Resources/views/Collector/security.html.twig
+++ b/src/Symfony/Bundle/SecurityBundle/Resources/views/Collector/security.html.twig
@@ -2,17 +2,17 @@
{% block toolbar %}
{% if collector.tokenClass %}
- {% set color_code = (collector.enabled and collector.authenticated) ? 'green' : 'yellow' %}
+ {% set color_code = (collector.enabled and collector.authenticated) ? '' : 'yellow' %}
{% set authentication_color_code = (collector.enabled and collector.authenticated) ? 'green' : 'red' %}
{% set authentication_color_text = (collector.enabled and collector.authenticated) ? 'Yes' : 'No' %}
{% else %}
- {% set color_code = collector.enabled ? 'red' : 'black' %}
+ {% set color_code = collector.enabled ? 'red' : '' %}
{% endif %}
{% set text %}
{% if collector.tokenClass %}
Logged in as
- {{ collector.user }}
+ {{ collector.user }}
{% endspaceless %}
{% endset %}
- {% include '@WebProfiler/Profiler/toolbar_item.html.twig' with { 'link': false } %}
-
- {# Environment #}
- {% set debug_status_class %}sf-toolbar-status sf-toolbar-status-{{ collector.debug ? 'green' : 'red' }}{% endset %}
- {% set icon %}
-
- {{ token }}
- {% if 'n/a' != collector.appname or 'n/a' != collector.env %}
-
- {{ collector.appname }}
- {{ collector.env }}
-
- {% endif %}
- {% endset %}
- {% set text %}
- {% spaceless %}
- {% if 'n/a' != collector.appname %}
-
- Name
- {{ collector.appname }}
-
- {% endif %}
- {% if 'n/a' != collector.env %}
-
- Environment
- {{ collector.env }}
-
- {% endif %}
- {% if 'n/a' != collector.debug %}
-
- Debug
- {{ collector.debug ? 'en' : 'dis' }}abled
-
- {% endif %}
-
- {% endspaceless %}
- {% endset %}
- {% include '@WebProfiler/Profiler/toolbar_item.html.twig' with { 'link': profiler_url } %}
+ {% include '@WebProfiler/Profiler/toolbar_item.html.twig' with { 'link': false, 'block_name': 'config-php' } %}
{% endblock %}
{% block menu %}
diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/form.html.twig b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/form.html.twig
index f4342df72b1c9..6c4ad8a09dfc6 100644
--- a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/form.html.twig
+++ b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/form.html.twig
@@ -3,13 +3,19 @@
{% from _self import form_tree_entry, form_tree_details %}
{% block toolbar %}
- {% if collector.data|length %}
+ {% if collector.data.nb_errors > 0 or collector.data.forms|length %}
{% set icon %}
-
- {% if collector.data.nb_errors %}{{ collector.data.nb_errors }}{% else %}{{ collector.data.forms|length }}{% endif %}
+
+
+ {% if collector.data.nb_errors %}
+ {{ collector.data.nb_errors }}
+ {% else %}
+ {{ collector.data.forms|length }}
+ {% endif %}
+
{% endset %}
- {% include '@WebProfiler/Profiler/toolbar_item.html.twig' with { 'link': profiler_url } %}
+ {% include '@WebProfiler/Profiler/toolbar_item.html.twig' with { 'link': profiler_url, 'block_status': collector.data.nb_errors ? 'red' : '' } %}
{% endif %}
{% endblock %}
diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/logger.html.twig b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/logger.html.twig
index a6707da12d77e..fa78941f4d372 100644
--- a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/logger.html.twig
+++ b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/logger.html.twig
@@ -5,14 +5,10 @@
{% block toolbar %}
{% if collector.counterrors or collector.countdeprecations or collector.countscreams %}
{% set icon %}
-
- {% if collector.counterrors %}
- {% set status_color = "red" %}
- {% elseif collector.countdeprecations %}
- {% set status_color = "yellow" %}
- {% endif %}
+
+ {% set status_color = collector.counterrors ? 'red' : collector.countdeprecations ? 'yellow' : '' %}
{% set error_count = collector.counterrors + collector.countdeprecations + collector.countscreams %}
- {{ error_count }}
+ {{ error_count }}
{% endset %}
{% set text %}
{% if collector.counterrors %}
@@ -34,7 +30,7 @@
{% endif %}
{% endset %}
- {% include '@WebProfiler/Profiler/toolbar_item.html.twig' with { 'link': profiler_url } %}
+ {% include '@WebProfiler/Profiler/toolbar_item.html.twig' with { 'link': profiler_url, 'block_status': status_color } %}
{% endif %}
{% endblock %}
@@ -87,30 +83,20 @@
{% if collector.logs %}
-
-
- #
- Priority
- Channel
- Message and context
-
-
+
{% set log_loop_index = 0 %}
{% for log in collector.logs %}
{% set is_deprecation = log.context.level is defined and log.context.type is defined and (constant('E_DEPRECATED') == log.context.type or constant('E_USER_DEPRECATED') == log.context.type) %}
{% if priority == '-100' ? is_deprecation : log.priority >= priority %}
{% set log_loop_index = log_loop_index + 1 %}
-
- {{ log_loop_index }}
- {{ is_deprecation ? 'DEPRECATION' : log.priorityName }}
- {{ log.channel is defined ? log.channel }}
- {{ logger.display_message(loop.index, log, is_deprecation) }}
-
+
+ {{ logger.display_message(loop.index, log, is_deprecation) }}
+
{% endif %}
{% else %}
- No logs available for {{ priority }} priority.
+ No logs available for this priority.
{% endfor %}
-
+
{% else %}
No logs available.
@@ -120,13 +106,11 @@
{% macro display_message(log_index, log, is_deprecation) %}
- {{ is_deprecation ? 'DEPRECATED' : log.priorityName }} - {{ log.message }}
-
{% if is_deprecation %}
{% set stack = log.context.stack|default([]) %}
{% set id = 'sf-call-stack-' ~ log_index %}
- {{ log.message }}
+ DEPRECATED - {{ log.message }}
{% if stack %}
@@ -156,6 +140,7 @@
{% endif %}
{% endfor %}
{% else %}
+ {{ log.priorityName }} - {{ log.message }}
{% if log.context is defined and log.context is not empty %}
diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/memory.html.twig b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/memory.html.twig
index 397b5e8305927..0b7649e90ef6d 100644
--- a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/memory.html.twig
+++ b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/memory.html.twig
@@ -2,16 +2,22 @@
{% block toolbar %}
{% set icon %}
+ {% set status_color = (collector.memory / 1024 / 1024) > 50 ? 'yellow' : '' %}
-
- {{ '%.1f'|format(collector.memory / 1024 / 1024) }} MB
+ {{ '%.1f'|format(collector.memory / 1024 / 1024) }}
+ MB
{% endset %}
{% set text %}
- Memory usage
- {{ '%.1f'|format(collector.memory / 1024 / 1024) }} / {{ collector.memoryLimit == -1 ? '∞' : '%.1f'|format(collector.memoryLimit / 1024 / 1024)|escape }} MB
+ Peak memory usage
+ {{ '%.1f'|format(collector.memory / 1024 / 1024) }} MB
+
+
+
+ PHP memory limit
+ {{ collector.memoryLimit == -1 ? '∞' : '%.1f'|format(collector.memoryLimit / 1024 / 1024)|escape }} MB
{% endset %}
- {% include '@WebProfiler/Profiler/toolbar_item.html.twig' with { 'link': false } %}
+ {% include '@WebProfiler/Profiler/toolbar_item.html.twig' with { 'link': false, 'block_status': status_color } %}
{% endblock %}
diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/request.html.twig b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/request.html.twig
index 4d00a07d5fd8a..8eaf168be1604 100644
--- a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/request.html.twig
+++ b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/request.html.twig
@@ -16,26 +16,30 @@
{{ collector.controller }}
{% endif %}
{% endset %}
- {% set request_status_code_color = (400 > collector.statuscode) ? ((200 == collector.statuscode) ? 'green' : 'yellow') : 'red'%}
- {% set request_route = collector.route ? collector.route : 'NONE' %}
+
+ {% set request_status_code_color = (400 > collector.statuscode) ? ((200 == collector.statuscode) ? 'green' : 'yellow') : 'red' %}
+
{% set icon %}
-
- {{ collector.statuscode }}
- {{ request_handler }}
+ {{ collector.statuscode }}
+ {{ request_handler }}
{% endset %}
{% set text %}
{% spaceless %}
- Status
+ HTTP status
{{ collector.statuscode }} {{ collector.statustext }}
- Controller
+ Controller method
{{ request_handler }}
+
+ Controller file
+ {{ collector.controller.class }}
+
Route name
- {{ request_route }}
+ {{ collector.route|default('NONE') }}
{% endif %}
{% endset %}
- {% include '@WebProfiler/Profiler/toolbar_item.html.twig' with { 'link': profiler_url } %}
+ {% include '@WebProfiler/Profiler/toolbar_item.html.twig' with { 'link': profiler_url, 'block_status': status_color } %}
{% endif %}
{% endblock %}
@@ -57,14 +54,6 @@
{% endblock %}
{% block panelContent %}
- {% set filter = request.query.get('state', '-1') %}
- {% set filterOptions = {
- '-1': '',
- (constant('Symfony\\Component\\Translation\\DataCollectorTranslator::MESSAGE_DEFINED')): 'Defined messages',
- (constant('Symfony\\Component\\Translation\\DataCollectorTranslator::MESSAGE_MISSING')): 'Missing messages',
- (constant('Symfony\\Component\\Translation\\DataCollectorTranslator::MESSAGE_EQUALS_FALLBACK')): 'Fallback messages',
- } %}
-
Translation Stats
@@ -80,22 +69,6 @@
Missing messages
{{ collector.countMissings }}
-
- Filter
-
-
-
-
@@ -107,7 +80,7 @@
Id
Message Preview
- {% for message in collector.messages if message.state == filter or filter == '-1' %}
+ {% for message in collector.messages %}
{{ translator.state(message) }}
{{ message.locale }}
diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/twig.html.twig b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/twig.html.twig
index 0ecd469bd0732..5d102e137019a 100644
--- a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/twig.html.twig
+++ b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/twig.html.twig
@@ -1,10 +1,13 @@
{% extends '@WebProfiler/Profiler/layout.html.twig' %}
{% block toolbar %}
- {% set time = collector.templatecount ? '%0.0f ms'|format(collector.time) : 'n/a' %}
+ {% set time = collector.templatecount ? '%0.0f'|format(collector.time) : 'n/a' %}
{% set icon %}
-
- {{ time }}
+
+
+ {{ time }}
+ ms
+
{% endset %}
{% set text %}
diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/base_js.html.twig b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/base_js.html.twig
index e313380e51095..7cfcface334ac 100644
--- a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/base_js.html.twig
+++ b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/base_js.html.twig
@@ -180,7 +180,7 @@
requestCounter[0].textContent = requestStack.length;
- var className = 'sf-toolbar-ajax-requests sf-toolbar-status';
+ var className = 'sf-toolbar-ajax-requests sf-toolvar-value';
if (state == 'ok') {
className += ' sf-toolbar-status-green';
} else if (state == 'error') {
diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/profiler.css.twig b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/profiler.css.twig
index fd32565347953..3e453b0a212c9 100644
--- a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/profiler.css.twig
+++ b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/profiler.css.twig
@@ -179,7 +179,7 @@ pre, code {
width: 250px;
margin-left: -100%;
}
-table td {
+#collector-content table td {
background-color: white;
}
h1 {
@@ -273,15 +273,15 @@ ul.alt li {
ul.alt li.even {
background: #f1f7e2;
}
-ul.alt li.error, tr.error td {
+ul.alt li.error {
background-color: #f66;
margin-bottom: 1px;
}
-ul.alt li.warning, tr.warning td {
+ul.alt li.warning {
background-color: #ffcc00;
margin-bottom: 1px;
}
-ul.alt li.scream, ul.alt li.scream strong, tr.scream td, tr.scream strong {
+ul.alt li.scream, ul.alt li.scream strong {
color: gray;
}
ul.sf-call-stack li {
diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar.css.twig b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar.css.twig
index 8d736a716dd36..c31156d750b63 100644
--- a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar.css.twig
+++ b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar.css.twig
@@ -7,13 +7,7 @@
padding: 5px 5px 0;
- background-color: #f7f7f7;
- background-image: -moz-linear-gradient(top, #e4e4e4, #ffffff);
- background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#e4e4e4), to(#ffffff));
- background-image: -o-linear-gradient(top, #e4e4e4, #ffffff);
- background: linear-gradient(top, #e4e4e4, #ffffff);
-
- border-radius: 16px 0 0 0;
+ background-color: #222;
z-index: 6000000;
}
@@ -26,39 +20,32 @@
}
.sf-toolbarreset {
- position: fixed;
- background-color: #f7f7f7;
+ background-color: #222;
+ box-shadow: 0 -1px 0px rgba(0, 0, 0, 0.2);
+ bottom: 0;
+ color: #EEE;
+ font: 11px Arial, sans-serif;
+ height: 36px;
left: 0;
- right: 0;
margin: 0;
- padding: 0 40px 0 0;
- z-index: 6000000;
- font: 11px Verdana, Arial, sans-serif;
+ padding: 0 36px 0 0;
+ position: fixed;
+ right: 0;
text-align: left;
- color: #2f2f2f;
-
- background-image: -moz-linear-gradient(top, #e4e4e4, #ffffff);
- background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#e4e4e4), to(#ffffff));
- background-image: -o-linear-gradient(top, #e4e4e4, #ffffff);
- background: linear-gradient(top, #e4e4e4, #ffffff);
-
- bottom: 0;
- border-top: 1px solid #bbb;
+ z-index: 6000000;
}
.sf-toolbarreset abbr {
- border-bottom: 1px dotted #000000;
- cursor: help;
-}
-.sf-toolbarreset span,
-.sf-toolbarreset div,
-.sf-toolbarreset td,
-.sf-toolbarreset th {
- font-size: 11px;
+ border: none;
+ cursor: text;
}
.sf-toolbarreset img {
width: auto;
display: inline;
}
+.sf-toolbarreset svg,
+.sf-toolbarreset img {
+ max-height: 24px;
+}
.sf-toolbarreset table {
border-collapse: collapse;
border-spacing: 0;
@@ -70,42 +57,74 @@
table-layout: auto;
}
.sf-toolbarreset .hide-button {
+ background: #444;
+ cursor: pointer;
display: block;
position: absolute;
top: 0;
right: 0;
- width: 40px;
- height: 40px;
+ width: 36px;
+ height: 30px;
cursor: pointer;
- background-image: url('data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAA8AAAAPCAMAAAAMCGV4AAAAllBMVEXDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PDw8PExMTPz8/Q0NDR0dHT09Pb29vc3Nzf39/h4eHi4uLj4+P6+vr7+/v8/Pz9/f3///+Nh2QuAAAAIXRSTlMABgwPGBswMzk8QktRV4SKjZOWmaKlq7TAxszb3urt+fy1vNEpAAAAiklEQVQIHUXBBxKCQBREwRFzDqjoGh+C2YV//8u5Sll2S0E/dof1tKdKM6GyqCto7PjZRJIS/mbSELgXOSd/BzpKIH1ZefVWpDDTHsi8mZVnwImPi5ndCLbaAZk3M58Bay0h9VbeSvMpjDUAHj4jL55AW1rxN5fU2PLjIgVRzNdxVFOlGzvnJi0Fb1XNGBHA9uQOAAAAAElFTkSuQmCC');
- background-repeat: no-repeat;
- background-position: 13px 11px;
+ padding-top: 6px;
+ text-align: center;
+}
+.sf-toolbarreset .hide-button svg {
+ max-height: 24px;
+ max-width: 24px;
}
.sf-toolbar-block {
- white-space: nowrap;
- color: #2f2f2f;
+ cursor: default;
display: block;
- min-height: 28px;
- border-bottom: 1px solid #e4e4e4;
- border-right: 1px solid #e4e4e4;
- padding: 0;
float: left;
- cursor: default;
+ margin-right: 0px;
+ white-space: nowrap;
+}
+.sf-toolbar-block a:hover {
+ text-decoration: none;
+}
+.sf-toolbar-block-config-symfony,
+.sf-toolbar-block-config-php {
+ float: right;
+ margin-left: 0;
+ margin-right: 0;
+}
+.sf-toolbar-block-time {
+ margin-right: 0;
+}
+.sf-toolbar-block-ajax {
+ display: none;
}
.sf-toolbar-block span {
display: inline-block;
}
+.sf-toolbar-block .sf-toolbar-value {
+ color: #F5F5F5;
+ font-size: 13px;
+ line-height: 36px;
+ padding: 0;
+}
+.sf-toolbar-block .sf-toolbar-label {
+ color: #AAA;
+ font-size: 12px;
+}
+.sf-toolbar-block-config-php .sf-toolbar-label,
+.sf-toolbar-block-config-symfony .sf-toolbar-label {
+ font-size: 11px;
+}
+.sf-toolbar-block-twig img {
+ opacity: .8;
+}
.sf-toolbar-block .sf-toolbar-info-piece {
- line-height: 19px;
- margin-bottom: 5px;
+ line-height: 1.4;
+ margin-bottom: 8px;
}
.sf-toolbar-block .sf-toolbar-info-piece .sf-toolbar-status {
padding: 0px 5px;
- border-radius: 5px;
margin-bottom: 0px;
vertical-align: top;
}
@@ -114,16 +133,26 @@
margin-bottom: 0;
}
-.sf-toolbar-block .sf-toolbar-info-piece a,
-.sf-toolbar-block .sf-toolbar-info-piece abbr {
- color: #2f2f2f;
+.sf-toolbar-block .sf-toolbar-info-piece a {
+ color: #75D1EA;
+ text-decoration: underline;
+}
+.sf-toolbar-block .sf-toolbar-info-piece a:hover {
+ text-decoration: none;
}
.sf-toolbar-block .sf-toolbar-info-piece b {
+ color: #AAA;
display: inline-block;
+ font-size: 11px;
min-width: 110px;
vertical-align: top;
}
+.sf-toolbar-block .sf-toolbar-info-piece span,
+.sf-toolbar-block .sf-toolbar-info-piece abbr {
+ color: #F5F5F5;
+ font-size: 12px;
+}
.sf-toolbar-block .sf-toolbar-info-with-next-pointer:after {
content: ' :: ';
@@ -133,20 +162,16 @@
.sf-toolbar-block .sf-toolbar-info-with-delimiter {
border-right: 1px solid #999;
padding-right: 5px;
+ margin-right: 5px;
}
.sf-toolbar-block .sf-toolbar-info {
+ background-color: #444;
+ bottom: 36px;
+ color: #F5F5F5;
display: none;
- position: absolute;
- background-color: #fff;
- border: 1px solid #bbb;
padding: 9px 0;
- margin-left: -1px;
-
- bottom: 38px;
- border-bottom-width: 0;
- border-bottom: 1px solid #bbb;
- border-radius: 4px 4px 0 0;
+ position: absolute;
}
.sf-toolbar-block .sf-toolbar-info:empty {
@@ -165,43 +190,67 @@
min-height: 13px;
}
-.sf-toolbar-block .sf-toolbar-status abbr {
- color: #fff;
- border-bottom: 1px dotted black;
-}
-
.sf-toolbar-block .sf-toolbar-status-green {
background-color: #759e1a;
}
-
.sf-toolbar-block .sf-toolbar-status-red {
- background-color: #a33;
+ background-color: rgba(200,0,0, 0.8);
}
-
.sf-toolbar-block .sf-toolbar-status-yellow {
background-color: #ffcc00;
color: #000;
}
-
.sf-toolbar-block .sf-toolbar-status-black {
background-color: #000;
}
+.sf-toolbar-block.sf-toolbar-status-green {
+ background-color: #759e1a;
+ color: #FFF;
+}
+.sf-toolbar-block.sf-toolbar-status-red {
+ background-color: rgba(200,0,0, 0.8);
+ color: #FFF;
+}
+.sf-toolbar-block.sf-toolbar-status-red svg > g > path {
+ fill: #FFF;
+}
+.sf-toolbar-block.sf-toolbar-status-yellow {
+ background-color: rgba(255,158,43, 0.8);
+ color: #FFF;
+}
+.sf-toolbar-block-request .sf-toolbar-status {
+ border-radius: 0 !important;
+ color: #FFF;
+ font-size: 14px;
+ margin-right: 4px;
+ padding: 10px;
+}
+
+.sf-toolbar-status-green .sf-toolbar-label,
+.sf-toolbar-status-yellow .sf-toolbar-label,
+.sf-toolbar-status-red .sf-toolbar-label {
+ color: #FFF;
+}
+
.sf-toolbar-block .sf-toolbar-icon {
display: block;
+ padding: 0 10px;
+}
+.sf-toolbar-block-request .sf-toolbar-icon {
+ padding-left: 0;
}
+/*
.sf-toolbar-block .sf-toolbar-icon > a,
.sf-toolbar-block .sf-toolbar-icon > span {
- display: block;
- font-weight: normal;
text-decoration: none;
margin: 0;
padding: 5px 8px;
min-width: 20px;
text-align: center;
vertical-align: middle;
-}
+}*/
.sf-toolbar-block .sf-toolbar-icon > a,
.sf-toolbar-block .sf-toolbar-icon > a:link
@@ -216,11 +265,12 @@
.sf-toolbar-block .sf-toolbar-icon img, .sf-toolbar-block .sf-toolbar-icon svg {
border-width: 0;
vertical-align: middle;
+ position: relative;
+ top: -1px;
}
.sf-toolbar-block .sf-toolbar-icon img + span, .sf-toolbar-block .sf-toolbar-icon svg + span {
- margin-left: 5px;
- margin-top: 2px;
+ margin-left: 4px;
}
.sf-toolbar-block .sf-toolbar-icon .sf-toolbar-status {
@@ -230,8 +280,6 @@
}
.sf-toolbar-block .sf-toolbar-info-method {
- border-bottom: 1px dashed #ccc;
- cursor: help;
}
.sf-toolbar-block .sf-toolbar-info-method[onclick=""] {
@@ -260,22 +308,13 @@
display: none;
}
-.sf-toolbarreset:hover {
- box-shadow: rgba(0, 0, 0, 0.3) 0 0 50px;
-}
-
.sf-toolbar-block:hover {
- box-shadow: rgba(0, 0, 0, 0.35) 0 0 5px;
- border-right: none;
- margin-right: 1px;
position: relative;
}
.sf-toolbar-block:hover .sf-toolbar-icon {
- background-color: #fff;
- border-top: 1px dotted #DDD;
+ background-color: #444;
position: relative;
- margin-top: -1px;
z-index: 10002;
}
@@ -286,7 +325,7 @@
z-index: 10001;
box-sizing: border-box;
padding: 9px;
- line-height: 19px;
+ line-height: 1.5;
max-width: 480px;
max-height: 480px;
@@ -433,11 +472,3 @@
display: none;
}
}
-
-/***** Media query print: Do not print the Toolbar. *****/
-@media print {
- .sf-toolbar {
- display: none;
- visibility: hidden;
- }
-}
diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar.html.twig b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar.html.twig
index dbe3d0cdbf7b8..dc769c9cad8c1 100644
--- a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar.html.twig
+++ b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar.html.twig
@@ -15,7 +15,7 @@
Sfjs.setPreference('toolbar/displayState', 'block');
">
-
+
{% endif %}
@@ -43,7 +43,7 @@
document.getElementById('sfMiniToolbar-{{ token }}').style.display = 'block';
Sfjs.setPreference('toolbar/displayState', 'none');
">
-
+ {{ include('@WebProfiler/Icon/close.svg.twig') }}
{% endif %}
diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar_item.html.twig b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar_item.html.twig
index ab4e07f93ec73..18292e8f1a207 100644
--- a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar_item.html.twig
+++ b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar_item.html.twig
@@ -1,5 +1,5 @@
-
{{ text|default('') }}
{% if link %}{% endif %}
From 27353463084f65e2ddec9504d39fdb8ff9d05204 Mon Sep 17 00:00:00 2001
From: Javier Eguiluz
Date: Wed, 8 Jul 2015 10:38:08 +0200
Subject: [PATCH 0095/3475] Fixed a minor markup error that broke the toolbar
---
.../Resources/views/Profiler/toolbar.css.twig | 3 +++
.../Resources/views/Profiler/toolbar_item.html.twig | 2 +-
2 files changed, 4 insertions(+), 1 deletion(-)
diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar.css.twig b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar.css.twig
index 883165795e20e..cfce041ac3ccd 100644
--- a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar.css.twig
+++ b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar.css.twig
@@ -89,6 +89,9 @@
margin-left: 0;
margin-right: 0;
}
+.sf-toolbar-block-config svg {
+ padding-right: 4px;
+}
.sf-toolbar-block-time {
margin-right: 0;
}
diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar_item.html.twig b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar_item.html.twig
index 18292e8f1a207..6a8fa473e4b98 100644
--- a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar_item.html.twig
+++ b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar_item.html.twig
@@ -1,5 +1,5 @@
-{% if collector.logs %}
+ {% if collector.logs %}
#
diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/memory.html.twig b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/memory.html.twig
index 5dd22697475e5..702b4df3658fe 100644
--- a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/memory.html.twig
+++ b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/memory.html.twig
@@ -3,7 +3,7 @@
{% block toolbar %}
{% set icon %}
{% set status_color = (collector.memory / 1024 / 1024) > 50 ? 'yellow' : '' %}
- {{ include('@WebProfiler/Icon/memory.svg.twig') }}
+ {{ include('@WebProfiler/Icon/memory.svg') }}
{{ '%.1f'|format(collector.memory / 1024 / 1024) }}
MB
{% endset %}
diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/time.html.twig b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/time.html.twig
index 7d341a09d32fd..39f8f62abd3a1 100644
--- a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/time.html.twig
+++ b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/time.html.twig
@@ -21,7 +21,7 @@
{% set status_color = collector.events|length and collector.duration > 1000 ? 'yellow' : '' %}
{% set icon %}
- {{ include('@WebProfiler/Icon/time.svg.twig') }}
+ {{ include('@WebProfiler/Icon/time.svg') }}
{{ total_time }}
ms
{% endset %}
diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/translation.html.twig b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/translation.html.twig
index 7eefbde73c860..3d75c46768969 100644
--- a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/translation.html.twig
+++ b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/translation.html.twig
@@ -5,7 +5,7 @@
{% block toolbar %}
{% if collector.messages|length %}
{% set icon %}
- {{ include('@WebProfiler/Icon/translation.svg.twig') }}
+ {{ include('@WebProfiler/Icon/translation.svg') }}
{% set status_color = collector.countMissings ? 'red' : collector.countFallbacks ? 'yellow' : '' %}
{% set error_count = collector.countMissings + collector.countFallbacks %}
{{ error_count ?: collector.countdefines }}
@@ -15,20 +15,20 @@
Missing messages
- {{ collector.countMissings|default(0) }}
+ {{ collector.countMissings }}
Fallback messages
- {{ collector.countFallbacks|default(0) }}
+ {{ collector.countFallbacks }}
Defined messages
- {{ collector.countdefines|default(0) }}
+ {{ collector.countdefines }}
{% endset %}
diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/twig.html.twig b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/twig.html.twig
index 4f758a1d12c14..95713b93db249 100644
--- a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/twig.html.twig
+++ b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/twig.html.twig
@@ -3,7 +3,7 @@
{% block toolbar %}
{% set time = collector.templatecount ? '%0.0f'|format(collector.time) : 'n/a' %}
{% set icon %}
- {{ include('@WebProfiler/Icon/twig.html.twig') }}
+ {{ include('@WebProfiler/Icon/twig.svg') }}
{{ time }}
ms
{% endset %}
diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Icon/ajax.svg.twig b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Icon/ajax.svg
similarity index 100%
rename from src/Symfony/Bundle/WebProfilerBundle/Resources/views/Icon/ajax.svg.twig
rename to src/Symfony/Bundle/WebProfilerBundle/Resources/views/Icon/ajax.svg
diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Icon/close.svg.twig b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Icon/close.svg
similarity index 100%
rename from src/Symfony/Bundle/WebProfilerBundle/Resources/views/Icon/close.svg.twig
rename to src/Symfony/Bundle/WebProfilerBundle/Resources/views/Icon/close.svg
diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Icon/form.svg.twig b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Icon/form.svg
similarity index 100%
rename from src/Symfony/Bundle/WebProfilerBundle/Resources/views/Icon/form.svg.twig
rename to src/Symfony/Bundle/WebProfilerBundle/Resources/views/Icon/form.svg
diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Icon/logger.svg.twig b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Icon/logger.svg
similarity index 100%
rename from src/Symfony/Bundle/WebProfilerBundle/Resources/views/Icon/logger.svg.twig
rename to src/Symfony/Bundle/WebProfilerBundle/Resources/views/Icon/logger.svg
diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Icon/memory.svg.twig b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Icon/memory.svg
similarity index 100%
rename from src/Symfony/Bundle/WebProfilerBundle/Resources/views/Icon/memory.svg.twig
rename to src/Symfony/Bundle/WebProfilerBundle/Resources/views/Icon/memory.svg
diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Icon/symfony.svg.twig b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Icon/symfony.svg
similarity index 100%
rename from src/Symfony/Bundle/WebProfilerBundle/Resources/views/Icon/symfony.svg.twig
rename to src/Symfony/Bundle/WebProfilerBundle/Resources/views/Icon/symfony.svg
diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Icon/time.svg.twig b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Icon/time.svg
similarity index 100%
rename from src/Symfony/Bundle/WebProfilerBundle/Resources/views/Icon/time.svg.twig
rename to src/Symfony/Bundle/WebProfilerBundle/Resources/views/Icon/time.svg
diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Icon/translation.svg.twig b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Icon/translation.svg
similarity index 100%
rename from src/Symfony/Bundle/WebProfilerBundle/Resources/views/Icon/translation.svg.twig
rename to src/Symfony/Bundle/WebProfilerBundle/Resources/views/Icon/translation.svg
diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Icon/twig.html.twig b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Icon/twig.svg
similarity index 100%
rename from src/Symfony/Bundle/WebProfilerBundle/Resources/views/Icon/twig.html.twig
rename to src/Symfony/Bundle/WebProfilerBundle/Resources/views/Icon/twig.svg
diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/base_js.html.twig b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/base_js.html.twig
index 6c8826dabe72e..2b1eeff3c00e9 100644
--- a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/base_js.html.twig
+++ b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/base_js.html.twig
@@ -86,6 +86,7 @@
return;
}
+ var ajaxToolbarPanel = document.querySelector('.sf-toolbar-block-ajax');
var tbodies = document.querySelectorAll('.sf-toolbar-ajax-request-list');
var state = 'ok';
if (tbodies.length) {
@@ -169,7 +170,6 @@
infoSpan.textContent = text;
}
} else {
- var ajaxToolbarPanel = document.querySelector('.sf-toolbar-block-ajax');
ajaxToolbarPanel.style.display = 'none';
}
}
@@ -179,7 +179,6 @@
var className = 'sf-toolbar-ajax-requests sf-toolbar-value';
requestCounter[0].className = className;
- var ajaxToolbarPanel = document.querySelector('.sf-toolbar-block-ajax');
if (state == 'error') {
Sfjs.addClass(ajaxToolbarPanel, 'sf-toolbar-status-red');
} else {
diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar.css.twig b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar.css.twig
index 1cd7fd541b0cd..5b2e4f66667a0 100644
--- a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar.css.twig
+++ b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar.css.twig
@@ -85,10 +85,6 @@
color: #AAA;
font-size: 12px;
}
-/* TODO: remove it when Twig uses SVG icons */
-.sf-toolbar-block-twig img {
- opacity: .8;
-}
.sf-toolbar-block .sf-toolbar-info {
border-collapse: collapse;
@@ -316,11 +312,6 @@
50% { background: #444; }
100% { background: #222; }
}
-@-o-keyframes sf-blink {
- 0% { background: #222; }
- 50% { background: #444; }
- 100% { background: #222; }
-}
@keyframes sf-blink {
0% { background: #222; }
50% { background: #444; }
diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar.html.twig b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar.html.twig
index e141a0df11251..e4fea4b00b1a0 100644
--- a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar.html.twig
+++ b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/toolbar.html.twig
@@ -15,7 +15,7 @@
Sfjs.setPreference('toolbar/displayState', 'block');
">
- {{ include('@WebProfiler/Icon/symfony.svg.twig') }}
+ {{ include('@WebProfiler/Icon/symfony.svg') }}
-
- {% if collector.dumpsCount %}
-
- {% for dump in collector.getDumps('html') %}
-
- in
+ {% for dump in collector.getDumps('html') %}
+
+
In
{% if dump.line %}
{% set link = dump.file|file_link(dump.line) %}
{% if link %}
@@ -85,19 +57,22 @@
{% else %}
{{ dump.name }}
{% endif %}
- line {{ dump.line }}:
- ▶
-
- {% if dump.fileExcerpt %}{{ dump.fileExcerpt|raw }}{% else %}{{ dump.file|file_excerpt(dump.line) }}{% endif %}
-
+ line {{ dump.line }}
- {{ dump.data|raw }}
-
- {% endfor %}
-
+ Show code
+
+
+
+
+ {{ dump.fileExcerpt ? dump.fileExcerpt|raw : dump.file|file_excerpt(dump.line) }}
+
+
+
+ {{ dump.data|raw }}
+
{% else %}
-
- No dumped variable
-
- {% endif %}
+
+
No content was dumped.
+
+ {% endfor %}
{% endblock %}
diff --git a/src/Symfony/Bundle/DebugBundle/Resources/views/Profiler/icon.svg b/src/Symfony/Bundle/DebugBundle/Resources/views/Profiler/icon.svg
new file mode 100644
index 0000000000000..2f7e708c8b3d4
--- /dev/null
+++ b/src/Symfony/Bundle/DebugBundle/Resources/views/Profiler/icon.svg
@@ -0,0 +1,4 @@
+
+
+
+
diff --git a/src/Symfony/Bundle/SecurityBundle/Resources/views/Collector/icon.svg b/src/Symfony/Bundle/SecurityBundle/Resources/views/Collector/icon.svg
new file mode 100644
index 0000000000000..02033fdc7f5e9
--- /dev/null
+++ b/src/Symfony/Bundle/SecurityBundle/Resources/views/Collector/icon.svg
@@ -0,0 +1,3 @@
+
+
+
diff --git a/src/Symfony/Bundle/SecurityBundle/Resources/views/Collector/security.html.twig b/src/Symfony/Bundle/SecurityBundle/Resources/views/Collector/security.html.twig
index 6c5b85356de1a..5d36088c4341d 100644
--- a/src/Symfony/Bundle/SecurityBundle/Resources/views/Collector/security.html.twig
+++ b/src/Symfony/Bundle/SecurityBundle/Resources/views/Collector/security.html.twig
@@ -1,5 +1,7 @@
{% extends '@WebProfiler/Profiler/layout.html.twig' %}
+{% block page_title 'Security' %}
+
{% block toolbar %}
{% if collector.tokenClass %}
{% set is_authenticated = collector.enabled and collector.authenticated %}
@@ -9,9 +11,7 @@
{% endif %}
{% set icon %}
-
-
-
+ {{ include('@Security/Collector/icon.svg') }}
{{ collector.user|default('n/a') }}
{% endset %}
@@ -21,10 +21,12 @@
Logged in as
{{ collector.user }}
+
Authenticated
{{ is_authenticated ? 'Yes' : 'No' }}
+
{% if collector.tokenClass != null %}
Token class
@@ -46,54 +48,69 @@
{% endblock %}
{% block menu %}
-
-
- Security
-
+
+ {{ include('@Security/Collector/icon.svg') }}
+ Security
+
{% endblock %}
{% block panel %}
-
Security
+
Security Token
+
{% if collector.tokenClass %}
+
+
+ {{ collector.user == 'anon.' ? 'Anonymous' : collector.user }}
+ Username
+
+
+
+ {{ include('@WebProfiler/Icon/' ~ (collector.authenticated ? 'yes' : 'no') ~ '.svg') }}
+ Authenticated
+
+
+
-
- Username
- {{ collector.user }}
-
-
- Authenticated?
-
- {% if collector.authenticated %}
- yes
- {% else %}
- no {% if not collector.roles|length %}(probably because the user has no roles) {% endif %}
- {% endif %}
-
-
-
- Roles
- {{ collector.roles|yaml_encode }}
-
- {% if collector.supportsRoleHierarchy %}
-
- Inherited Roles
- {{ collector.inheritedRoles|yaml_encode }}
-
- {% endif %}
- {% if collector.tokenClass != null %}
-
- Token class
- {{ collector.tokenClass }}
-
- {% endif %}
+
+
+ Property
+ Value
+
+
+
+
+ Roles
+
+ {{ collector.roles is empty ? 'none' : collector.roles|yaml_encode }}
+
+ {% if not collector.authenticated and collector.roles is empty %}
+ User is not authenticated probably because they have no roles.
+ {% endif %}
+
+
+
+ {% if collector.supportsRoleHierarchy %}
+
+ Inherited Roles
+ {{ collector.inheritedRoles is empty ? 'none' : collector.inheritedRoles|yaml_encode }}
+
+ {% endif %}
+
+ {% if collector.tokenClass %}
+
+ Token class
+ {{ collector.tokenClass }}
+
+ {% endif %}
+
{% elseif collector.enabled %}
-
- No token
-
+
+
There is no security token.
+
{% else %}
-
- The security component is disabled
-
+
+
The security component is disabled.
+
{% endif %}
{% endblock %}
diff --git a/src/Symfony/Bundle/WebProfilerBundle/Controller/ProfilerController.php b/src/Symfony/Bundle/WebProfilerBundle/Controller/ProfilerController.php
index 261d0afcb9082..21b02190c970b 100644
--- a/src/Symfony/Bundle/WebProfilerBundle/Controller/ProfilerController.php
+++ b/src/Symfony/Bundle/WebProfilerBundle/Controller/ProfilerController.php
@@ -112,6 +112,7 @@ public function panelAction(Request $request, $token)
'request' => $request,
'templates' => $this->getTemplateManager()->getTemplates($profile),
'is_ajax' => $request->isXmlHttpRequest(),
+ 'profiler_markup_version' => 2, // 1 = original profiler, 2 = Symfony 2.8+ profiler
)), 200, array('Content-Type' => 'text/html'));
}
diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/config.html.twig b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/config.html.twig
index 7379beaae8621..669f654b72fd9 100644
--- a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/config.html.twig
+++ b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/config.html.twig
@@ -19,21 +19,22 @@
{% endif %}
{% set icon %}
- {% if collector.symfonyState is defined %}
+ {% if collector.applicationname %}
+
{{ collector.applicationname }}
+
{{ collector.applicationversion }}
+ {% elseif collector.symfonyState is defined %}
{{ include('@WebProfiler/Icon/symfony.svg') }}
{{ collector.symfonyversion }}
- {% elseif collector.applicationname %}
-
{{ collector.applicationname }}
-
{{ collector.applicationversion }}
{% endif %}
{% endset %}
{% set text %}
{% if collector.applicationname %}
- {{ collector.applicationname }} {{ collector.applicationversion }}
+ {{ collector.applicationname }}
+ {{ collector.applicationversion }}
{% endif %}
@@ -88,118 +89,149 @@
{{ collector.sapiName }}
+
{% if collector.symfonyversion is defined %}
{% endif %}
{% endset %}
- {{ include('@WebProfiler/Profiler/toolbar_item.html.twig', { link: false, status: block_status }) }}
+ {{ include('@WebProfiler/Profiler/toolbar_item.html.twig', { link: true, name: 'config', status: block_status }) }}
{% endblock %}
{% block menu %}
-
-
- Config
-
+
+ {{ include('@WebProfiler/Icon/config.svg') }}
+ Configuration
+
{% endblock %}
{% block panel %}
- Project Configuration
-
-
- Key
- Value
-
-
- {% if collector.applicationname %}
- Application
- {{ collector.applicationname }} {{ collector.applicationversion }} (on Symfony {{ collector.symfonyversion }})
- {% else %}
- Symfony version
- {{ collector.symfonyversion }}
+ {% if collector.applicationname %}
+ {# this application is not the Symfony framework #}
+ Project Configuration
+
+
+
+ {{ collector.applicationname }}
+ Application name
+
+
+
+ {{ collector.applicationversion }}
+ Application version
+
+
+
+
+ Based on Symfony {{ collector.symfonyversion }}
+
+ {% else %}
+ Symfony Configuration
+
+
+
+ {{ collector.symfonyversion }}
+ Symfony version
+
+
+ {% if 'n/a' != collector.appname %}
+
+ {{ collector.appname }}
+ Application name
+
{% endif %}
-
- {% if 'n/a' != collector.appname %}
-
- Application name
- {{ collector.appname }}
-
- {% endif %}
- {% if 'n/a' != collector.env %}
-
- Environment
- {{ collector.env }}
-
- {% endif %}
- {% if 'n/a' != collector.debug %}
-
- Debug
- {{ collector.debug ? 'enabled' : 'disabled' }}
-
- {% endif %}
-
-
- PHP configuration
-
-
- Key
- Value
-
-
- PHP version
- {{ collector.phpversion }}
-
-
- Xdebug
- {{ collector.hasxdebug ? 'enabled' : 'disabled' }}
-
-
- PHP acceleration
- {{ collector.hasaccelerator ? 'enabled' : 'disabled' }}
-
-
- XCache
- {{ collector.hasxcache ? 'enabled' : 'disabled' }}
-
-
- APC
- {{ collector.hasapc ? 'enabled' : 'disabled' }}
-
-
- Zend OPcache
- {{ collector.haszendopcache ? 'enabled' : 'disabled' }}
-
-
- EAccelerator
- {{ collector.haseaccelerator ? 'enabled' : 'disabled' }}
-
-
- Full PHP configuration
- phpinfo
-
-
+
+ {% if 'n/a' != collector.env %}
+
+ {{ collector.env }}
+ Environment
+
+ {% endif %}
+
+ {% if 'n/a' != collector.debug %}
+
+ {{ collector.debug ? 'enabled' : 'disabled' }}
+ Debug
+
+ {% endif %}
+
+ {% endif %}
+
+ PHP Configuration
+
+
+
+ {{ collector.phpversion }}
+ PHP version
+
+
+
+ {{ include('@WebProfiler/Icon/' ~ (collector.hasaccelerator ? 'yes' : 'no') ~ '.svg') }}
+ PHP acceleration
+
+
+
+ {{ include('@WebProfiler/Icon/' ~ (collector.hasxdebug ? 'yes' : 'no') ~ '.svg') }}
+ Xdebug
+
+
+
+
+
+ {{ include('@WebProfiler/Icon/' ~ (collector.haszendopcache ? 'yes' : 'no') ~ '.svg') }}
+ OPcache
+
+
+
+ {{ include('@WebProfiler/Icon/' ~ (collector.hasapc ? 'yes' : 'no') ~ '.svg') }}
+ APC
+
+
+
+ {{ include('@WebProfiler/Icon/' ~ (collector.hasxcache ? 'yes' : 'no') ~ '.svg') }}
+ XCache
+
+
+
+ {{ include('@WebProfiler/Icon/' ~ (collector.haseaccelerator ? 'yes' : 'no') ~ '.svg') }}
+ EAccelerator
+
+
+
+
+ View full PHP configuration
+
{% if collector.bundles %}
- Active bundles
+ Enabled Bundles ({{ collector.bundles|length }})
-
- Name
- Path
-
- {% set bundles = collector.bundles %}
- {% for name in bundles|keys|sort %}
-
- {{ name }}
- {{ bundles[name] }}
-
- {% endfor %}
+
+
+ Name
+ Path
+
+
+
+ {% for name in collector.bundles|keys|sort %}
+
+ {{ name }}
+ {{ collector.bundles[name] }}
+
+ {% endfor %}
+
{% endif %}
{% endblock %}
diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/events.html.twig b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/events.html.twig
index 879e537f13ce0..24a1e3fff99a8 100644
--- a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/events.html.twig
+++ b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/events.html.twig
@@ -1,79 +1,117 @@
{% extends '@WebProfiler/Profiler/layout.html.twig' %}
-{% from _self import display_listener %}
+{% import _self as helper %}
{% block menu %}
-
+ {{ include('@WebProfiler/Icon/event.svg') }}
Events
{% endblock %}
{% block panel %}
- {% if collector.calledlisteners|length %}
- {{ block('panelContent') }}
+ Event Dispatcher
+
+ {% if collector.calledlisteners is empty %}
+
+
No events have been recorded. Check that debugging is enabled in the kernel.
+
{% else %}
- Events
-
- No events have been recorded. Are you sure that debugging is enabled in the kernel?
-
+
+
+
Called Listeners {{ collector.calledlisteners|length }}
+
+
+ {{ helper.render_table(collector.calledlisteners) }}
+
+
+
+
+
Not Called Listeners {{ collector.notcalledlisteners|length }}
+
+ {% if collector.notcalledlisteners is empty %}
+
+
+ There are no uncalled listeners .
+
+
+ All listeners were called for this request or an error occurred
+ when trying to collect uncalled listeners (in which case check the
+ logs to get more information).
+
+
+ {% else %}
+ {{ helper.render_table(collector.notcalledlisteners) }}
+ {% endif %}
+
+
+
{% endif %}
{% endblock %}
-{% block panelContent %}
- Called Listeners
-
+{% macro render_table(listeners) %}
-
- Event name
- Listener
-
- {% for listener in collector.calledlisteners %}
+
- {{ listener.event }}
- {{ display_listener(listener) }}
+ Priority
+ Listener
- {% endfor %}
-
+
+
+ {% set previous_event = (listeners|first).event %}
+ {% for listener in listeners %}
+ {% if loop.first or listener.event != previous_event %}
+ {% if not loop.first %}
+
+ {% endif %}
+
+
+
+ {{ listener.event }}
+
- Not Called Listeners
+ {% set previous_event = listener.event %}
+ {% endif %}
- {% if collector.notcalledlisteners %}
-
- Event name
- Listener
-
- {% set listeners = collector.notcalledlisteners %}
- {% for listener in listeners|keys|sort %}
-
- {{ listeners[listener].event }}
- {{ display_listener(listeners[listener]) }}
-
- {% endfor %}
-
- {% else %}
-
- No uncalled listeners .
-
-
+
{{ listener.priority|default('-') }}
+
+ {% if listener.type == 'Closure' %}
- All listeners were called for this request or an error occurred
- when trying to collect uncalled listeners (in which case check the
- logs to get more information).
+ Closure
+ (there is no class or file information)
-
- {% endif %}
-{% endblock %}
+ {% elseif listener.type == 'Function' %}
-{% macro display_listener(listener) %}
- {% if listener.type == "Closure" %}
- Closure
- {% elseif listener.type == "Function" %}
- {% set link = listener.file|file_link(listener.line) %}
- {% if link %}{{ listener.function }} {% else %}{{ listener.function }}{% endif %}
- {% elseif listener.type == "Method" %}
- {% set link = listener.file|file_link(listener.line) %}
- {{ listener.class|abbr_class }}::{% if link %}{{ listener.method }} {% else %}{{ listener.method }}{% endif %}
- {% endif %}
+ {% set link = listener.file|file_link(listener.line) %}
+ {% if link %}
+ {{ listener.function }}()
+ ({{ listener.file }})
+ {% else %}
+ {{ listener.function }}()
+ {{ listener.file }} (line {{ listener.line }})
+ {% endif %}
+
+ {% elseif listener.type == "Method" %}
+
+ {% set link = listener.file|file_link(listener.line) %}
+ {% set class_namespace = listener.class|split('\\', -1)|join('\\') %}
+
+ {% if link %}
+ {{ listener.class|abbr_class|striptags }} ::{{ listener.method }}()
+ ({{ listener.class }})
+ {% else %}
+ {{ class_namespace }}\ {{ listener.class|abbr_class|striptags }} ::{{ listener.method }}()
+ {{ listener.file }} (line {{ listener.line }})
+ {% endif %}
+
+ {% endif %}
+
+
+
+ {% if loop.last %}
+
+ {% endif %}
+ {% endfor %}
+
{% endmacro %}
diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/exception.css.twig b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/exception.css.twig
index 1224081bd600a..8d5eaf7e1ac46 100644
--- a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/exception.css.twig
+++ b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/exception.css.twig
@@ -1,55 +1,82 @@
.sf-reset .traces {
- padding-bottom: 14px;
+ padding: 0 0 1em 1.5em;
+}
+.sf-reset .traces a {
+ font-size: 14px;
+}
+.sf-reset .traces abbr {
+ border-bottom-color: #AAA;
+ padding-bottom: 2px;
}
.sf-reset .traces li {
- font-size: 12px;
- color: #868686;
- padding: 5px 4px;
+ ccolor: #222;
+ font-size: 14px;
+ padding: 5px 0;
list-style-type: decimal;
- margin-left: 20px;
+ margin: 0 0 0 1em;
white-space: break-word;
}
+.sf-reset .traces li.selected {
+ background: rgba(255, 255, 153, 0.5);
+}
+
+.sf-reset .traces ol li {
+ font-size: 12px;
+ color: #777;
+}
.sf-reset #logs .traces li.error {
- font-style: normal;
color: #AA3333;
- background: #f9ecec;
}
.sf-reset #logs .traces li.warning {
- font-style: normal;
- background: #ffcc00;
-}
-/* fix for Opera not liking empty */
-.sf-reset .traces li:after {
- content: "\00A0";
+ background: #FFCC00;
}
.sf-reset .trace {
- border: 1px solid #D3D3D3;
+ border: 1px solid #DDD;
+ background: #FFF;
padding: 10px;
overflow: auto;
- margin: 10px 0 20px;
+ margin: 1em 0;
+}
+.sf-reset .trace code,
+#traces-text pre {
+ font-size: 13px;
}
.sf-reset .block-exception {
- border-radius: 16px;
- margin-bottom: 20px;
- background-color: #f6f6f6;
- border: 1px solid #dfdfdf;
- padding: 30px 28px;
+ margin-bottom: 2em;
+ background-color: #FFF;
+ border: 1px solid #EEE;
+ padding: 28px;
word-wrap: break-word;
overflow: hidden;
}
+.sf-reset .block-exception h1 {
+ font-size: 21px;
+ font-weight: normal;
+ margin: 0 0 12px;
+}
+.sf-reset .block-exception .linked {
+ margin-top: 1em;
+}
+
+.sf-reset .block {
+ margin-bottom: 2em;
+}
+.sf-reset .block h2 {
+ font-size: 16px;
+}
.sf-reset .block-exception div {
- color: #313131;
- font-size: 10px;
+ font-size: 14px;
}
.sf-reset .block-exception-detected .illustration-exception,
.sf-reset .block-exception-detected .text-exception {
float: left;
}
.sf-reset .block-exception-detected .illustration-exception {
- width: 152px;
+ width: 110px;
}
.sf-reset .block-exception-detected .text-exception {
- width: 670px;
+ width: 650px;
+ margin-left: 20px;
padding: 30px 44px 24px 46px;
position: relative;
}
@@ -65,40 +92,6 @@
bottom: 0;
right: 50px;
}
-.sf-reset .block-exception p {
- font-family: Arial, Helvetica, sans-serif;
-}
-.sf-reset .block-exception p a,
-.sf-reset .block-exception p a:hover {
- color: #565656;
-}
-.sf-reset .logs h2 {
- float: left;
- width: 654px;
-}
-.sf-reset .error-count {
- float: right;
- width: 170px;
- text-align: right;
-}
-.sf-reset .error-count span {
- display: inline-block;
- background-color: #aacd4e;
- border-radius: 6px;
- padding: 4px;
- color: white;
- margin-right: 2px;
- font-size: 11px;
- font-weight: bold;
-}
.sf-reset .toggle {
vertical-align: middle;
}
-.sf-reset .linked ul,
-.sf-reset .linked li {
- display: inline;
-}
-.sf-reset #output-content {
- color: #000;
- font-size: 12px;
-}
diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/exception.html.twig b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/exception.html.twig
index 5175f6610769c..94dfbb6acac0a 100644
--- a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/exception.html.twig
+++ b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/exception.html.twig
@@ -3,34 +3,34 @@
{% block head %}
{% if collector.hasexception %}
{% endif %}
{{ parent() }}
{% endblock %}
{% block menu %}
-
-
- Exception
-
+
+ {{ include('@WebProfiler/Icon/exception.svg') }}
+ Exception
{% if collector.hasexception %}
- 1
+
+ 1
+
{% endif %}
-
{% endblock %}
{% block panel %}
- Exception
+ Exceptions
{% if not collector.hasexception %}
-
- No exception was thrown and uncaught during the request.
-
+
+
No exception was thrown and caught during the request.
+
{% else %}
- {{ render(path('_profiler_exception', { 'token': token })) }}
+ {{ render(path('_profiler_exception', { token: token })) }}
{% endif %}
{% endblock %}
diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/form.html.twig b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/form.html.twig
index d7b286647044e..f119f5eb80e07 100644
--- a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/form.html.twig
+++ b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/form.html.twig
@@ -8,11 +8,7 @@
{% set icon %}
{{ include('@WebProfiler/Icon/form.svg') }}
- {% if collector.data.nb_errors %}
- {{ collector.data.nb_errors }}
- {% else %}
- {{ collector.data.forms|length }}
- {% endif %}
+ {{ collector.data.nb_errors ?: collector.data.forms|length }}
{% endset %}
@@ -32,188 +28,184 @@
{% endblock %}
{% block menu %}
-
-
+
+ {{ include('@WebProfiler/Icon/form.svg') }}
Forms
- {% if collector.data.forms|length %}
- {{ collector.data.forms|length }}
+ {% if collector.data.nb_errors > 0 %}
+
+ {{ collector.data.nb_errors }}
+
{% endif %}
{% endblock %}
-{% block panel %}
-
+{% endblock %}
- {% if collector.data.forms|length %}
-
-
-
Forms
+{% block panel %}
+
Forms
-
- {% for formName, formData in collector.data.forms %}
- {{ form_tree_entry(formName, formData, true) }}
- {% endfor %}
-
-
+ {% if collector.data.forms|length %}
+
+
{% for formName, formData in collector.data.forms %}
{{ form_tree_details(formName, formData, collector.data.forms_by_hash) }}
{% endfor %}
{% else %}
-
No forms were submitted for this request.
+
+
No forms were submitted for this request.
+
{% endif %}
-{% endblock %}
-
-{% macro state(translation) %}
- {% if translation.state == constant('Symfony\\Component\\Translation\\DataCollectorTranslator::MESSAGE_EQUALS_FALLBACK') %}
- same as fallback
- {% elseif translation.state == constant('Symfony\\Component\\Translation\\DataCollectorTranslator::MESSAGE_MISSING') %}
- missing
- {% endif %}
{% endmacro %}
diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/twig.html.twig b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/twig.html.twig
index 95713b93db249..c3c8a5d5f6764 100644
--- a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/twig.html.twig
+++ b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/twig.html.twig
@@ -31,58 +31,71 @@
{% endblock %}
{% block menu %}
-
-
- Twig
-
- {{ collector.templatecount }}
- {{ '%0.0f ms'|format(collector.time) }}
+
+ {{ include('@WebProfiler/Icon/twig.svg') }}
+ Twig
-
{% endblock %}
{% block panel %}
- {% if collector.templatecount %}
- Twig Stats
+ {% if collector.templatecount == 0 %}
+ Twig
-
-
- Total Render Timeincluding sub-requests rendering time
- {{ '%0.0f ms'|format(collector.time) }}
-
-
- Template Calls
- {{ collector.templatecount }}
-
-
- Block Calls
- {{ collector.blockcount }}
-
-
- Macro Calls
- {{ collector.macrocount }}
-
-
+
+
No Twig templates were rendered for this request.
+
+ {% else %}
+ Twig Metrics
+
+
+
+ {{ '%0.0f'|format(collector.time) }} ms
+ Render time
+
+
+
+ {{ collector.templatecount }}
+ Template calls
+
+
+
+ {{ collector.blockcount }}
+ Block calls
+
+
+
+ {{ collector.macrocount }}
+ Macro calls
+
+
+
+
+ Render time includes sub-requests rendering time (if any).
+
Rendered Templates
-
- Template Name
- Render Count
-
+
+
+ Template Name
+ Render Count
+
+
+
{% for template, count in collector.templates %}
- {{ template }}
- {{ count }}
+ {{ template }}
+ {{ count }}
{% endfor %}
+
Rendering Call Graph
- {{ collector.htmlcallgraph }}
- {% else %}
- No Twig templates were rendered for this request.
+
+ {{ collector.htmlcallgraph }}
+
{% endif %}
{% endblock %}
diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Icon/config.svg b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Icon/config.svg
new file mode 100644
index 0000000000000..9bafe3830175f
--- /dev/null
+++ b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Icon/config.svg
@@ -0,0 +1,3 @@
+
+
+
diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Icon/event.svg b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Icon/event.svg
new file mode 100644
index 0000000000000..7d15a66f01033
--- /dev/null
+++ b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Icon/event.svg
@@ -0,0 +1,11 @@
+
+
+
diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Icon/exception.svg b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Icon/exception.svg
new file mode 100644
index 0000000000000..98e4eb1ebd52a
--- /dev/null
+++ b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Icon/exception.svg
@@ -0,0 +1,15 @@
+
+
+
diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Icon/no.svg b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Icon/no.svg
new file mode 100644
index 0000000000000..02eb4e9c6abbb
--- /dev/null
+++ b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Icon/no.svg
@@ -0,0 +1,5 @@
+
+
+
diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Icon/request.svg b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Icon/request.svg
new file mode 100644
index 0000000000000..d74a72850dc04
--- /dev/null
+++ b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Icon/request.svg
@@ -0,0 +1,16 @@
+
+
+
+
diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Icon/router.svg b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Icon/router.svg
new file mode 100644
index 0000000000000..061a0a19465a0
--- /dev/null
+++ b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Icon/router.svg
@@ -0,0 +1,6 @@
+
+
+
diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Icon/search.svg b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Icon/search.svg
new file mode 100644
index 0000000000000..b5f0a2c85be48
--- /dev/null
+++ b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Icon/search.svg
@@ -0,0 +1,7 @@
+
+
+
diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Icon/yes.svg b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Icon/yes.svg
new file mode 100644
index 0000000000000..0f129bffc21b0
--- /dev/null
+++ b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Icon/yes.svg
@@ -0,0 +1,5 @@
+
+
+
diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/admin.html.twig b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/admin.html.twig
index a47b254a7716c..431861cad6049 100644
--- a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/admin.html.twig
+++ b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/admin.html.twig
@@ -1,10 +1,7 @@
{% if token is not empty %}
-
-
-
- Admin
-
+
{% endif %}
diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/bag.html.twig b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/bag.html.twig
index b7a774db532da..bfcef9440329b 100644
--- a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/bag.html.twig
+++ b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/bag.html.twig
@@ -1,15 +1,19 @@
-
+
- Key
- Value
+ {{ labels is defined ? labels[0] : 'Key' }}
+ {{ labels is defined ? labels[1] : 'Value' }}
{% for key in bag.keys|sort %}
{{ key }}
- {{ profiler_dump(bag.get(key)) }}
+ {{ profiler_dump(bag.get(key)) }}
+
+ {% else %}
+
+ (no data)
{% endfor %}
diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/base.html.twig b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/base.html.twig
index 3567708a72604..0edffcc40a1fb 100644
--- a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/base.html.twig
+++ b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/base.html.twig
@@ -3,19 +3,14 @@
- {% block title 'Profiler' %}
-
-
+ Symfony Profiler
+
+
{% block head %}
{% endblock %}
-
{% block body '' %}
diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/base_js.html.twig b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/base_js.html.twig
index 2b1eeff3c00e9..e2ca2c6fd927f 100644
--- a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/base_js.html.twig
+++ b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/base_js.html.twig
@@ -1,7 +1,25 @@
diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/body.css.twig b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/body.css.twig
deleted file mode 100644
index fa4d076917434..0000000000000
--- a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/body.css.twig
+++ /dev/null
@@ -1,137 +0,0 @@
-/*
-Copyright (c) 2010, Yahoo! Inc. All rights reserved.
-Code licensed under the BSD License:
-http://developer.yahoo.com/yui/license.html
-version: 3.1.2
-build: 56
-*/
-.sf-reset div,.sf-reset dl,.sf-reset dt,.sf-reset dd,.sf-reset ul,.sf-reset ol,.sf-reset li,.sf-reset h1,.sf-reset h2,.sf-reset h3,.sf-reset h4,.sf-reset h5,.sf-reset h6,.sf-reset pre,.sf-reset code,.sf-reset form,.sf-reset fieldset,.sf-reset legend,.sf-reset input,.sf-reset textarea,.sf-reset p,.sf-reset blockquote,.sf-reset th,.sf-reset td{margin:0;padding:0;}.sf-reset table{border-collapse:collapse;border-spacing:0;}.sf-reset fieldset,.sf-reset img{border:0;}.sf-reset address,.sf-reset caption,.sf-reset cite,.sf-reset code,.sf-reset dfn,.sf-reset em,.sf-reset strong,.sf-reset th,.sf-reset var{font-style:normal;font-weight:normal;}.sf-reset li{list-style:none;}.sf-reset caption,.sf-reset th{text-align:left;}.sf-reset h1,.sf-reset h2,.sf-reset h3,.sf-reset h4,.sf-reset h5,.sf-reset h6{font-size:100%;font-weight:normal;}.sf-reset q:before,.sf-reset q:after{content:'';}.sf-reset abbr,.sf-reset acronym{border:0;font-variant:normal;}.sf-reset sup{vertical-align:text-top;}.sf-reset sub{vertical-align:text-bottom;}.sf-reset input,.sf-reset textarea,.sf-reset select{font-family:inherit;font-size:inherit;font-weight:inherit;}.sf-reset input,.sf-reset textarea,.sf-reset select{font-size:100%;}.sf-reset legend{color:#000;}
-.sf-reset abbr {
- border-bottom: 1px dotted #000;
- cursor: help;
-}
-.sf-reset p {
- font-size: 14px;
- line-height: 20px;
- padding-bottom: 20px;
-}
-.sf-reset strong {
- color: #313131;
- font-weight: bold;
-}
-.sf-reset a {
- color: #6c6159;
-}
-.sf-reset a img {
- border: none;
-}
-.sf-reset a:hover {
- text-decoration: underline;
-}
-.sf-reset em {
- font-style: italic;
-}
-.sf-reset h2,
-.sf-reset h3 {
- font-weight: bold;
-}
-.sf-reset h1 {
- font-family: Georgia, "Times New Roman", Times, serif;
- font-size: 20px;
- color: #313131;
- word-break: break-all;
-}
-.sf-reset li {
- padding-bottom: 10px;
-}
-.sf-reset .block {
- -moz-border-radius: 16px;
- -webkit-border-radius: 16px;
- border-radius: 16px;
- margin-bottom: 20px;
- background-color: #FFFFFF;
- border: 1px solid #dfdfdf;
- padding: 40px 50px;
-}
-.sf-reset h2 {
- font-size: 16px;
- font-family: Arial, Helvetica, sans-serif;
-}
-.sf-reset li a {
- background: none;
- color: #868686;
- text-decoration: none;
-}
-.sf-reset li a:hover {
- background: none;
- color: #313131;
- text-decoration: underline;
-}
-.sf-reset ol {
- padding: 10px 0;
-}
-.sf-reset ol li {
- list-style: decimal;
- margin-left: 20px;
- padding: 2px;
- padding-bottom: 20px;
-}
-.sf-reset ol ol li {
- list-style-position: inside;
- margin-left: 0;
- white-space: nowrap;
- font-size: 12px;
- padding-bottom: 0;
-}
-.sf-reset li .selected {
- background-color: #ffd;
-}
-.sf-button {
- display: -moz-inline-box;
- display: inline-block;
- text-align: center;
- vertical-align: middle;
- border: 0;
- background: transparent none;
- text-transform: uppercase;
- cursor: pointer;
- font: bold 11px Arial, Helvetica, sans-serif;
-}
-.sf-button span {
- text-decoration: none;
- display: block;
- height: 28px;
- float: left;
-}
-.sf-button .border-l {
- text-decoration: none;
- display: block;
- height: 28px;
- float: left;
- padding: 0 0 0 7px;
- background: transparent url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAcAAAAcCAYAAACtQ6WLAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAQtJREFUeNpiPHnyJAMakARiByDWYEGT8ADiYGVlZStubm5xlv///4MEQYoKZGRkQkRERLRYWVl5wYJQyXBZWdkwCQkJUxAHKgaWlAHSLqKiosb//v1DsYMFKGCvoqJiDmQzwXTAJYECulxcXNLoumCSoszMzDzoumDGghQwYZUECWIzkrAkSIIGOmlkLI10AiX//P379x8jIyMTNmPf/v79+ysLCwsvuiQoNi5//fr1Kch4dAyS3P/gwYMTQBP+wxwHw0xA4gkQ73v9+vUZdJ2w1Lf82bNn4iCHCQoKasHsZw4ODgbRIL8c+/Lly5M3b978Y2dn5wC6npkFLXnsAOKLjx49AmUHLYAAAwBoQubG016R5wAAAABJRU5ErkJggg==) no-repeat top left;
-}
-.sf-button .border-r {
- padding: 0 7px 0 0;
- background: transparent url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAcAAAAcCAYAAACtQ6WLAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAR1JREFUeNpiPHnyZCMDA8MNID5gZmb2nAEJMH7//v3N169fX969e/cYkL8WqGAHXPLv37//QYzfv39/fvPmzbUnT56sAXInmJub/2H5/x8sx8DCwsIrISFhDmQyPX78+CmQXs70798/BmQsKipqBNTgdvz4cWkmkE5kDATMioqKZkCFdiwg1eiAi4tLGqhQF24nMmBmZuYEigth1QkEbEBxTlySYPvJkwSJ00AnjYylgU6gxB8g/oFVEphkvgLF32KNMmCCewYUv4qhEyj47+HDhyeBzIMYOoEp8CxQw56wsLAncJ1//vz5/P79+2svX74EJc2V4BT58+fPd8CE/QKYHMGJOiIiAp6oWW7evDkNSF8DZYfIyEiU7AAQYACJ2vxVdJW4eQAAAABJRU5ErkJggg==) right top no-repeat;
-}
-.sf-button .btn-bg {
- padding: 0px 14px;
- color: #636363;
- line-height: 28px;
- background: transparent url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAAcCAYAAACgXdXMAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAClJREFUeNpiPnny5EKGf//+/Wf6//8/A4QAcrGzKCZwGc9sa2urBBBgAIbDUoYVp9lmAAAAAElFTkSuQmCC) repeat-x top left;
-}
-.sf-button:hover .border-l,
-.sf-button-selected .border-l {
- background: transparent url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAcAAAAcCAYAAACtQ6WLAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAR9JREFUeNpi/P//PwMyOHfunDqQSgNiexZkibNnzxYBqZa3HOs5v7PcYQBLnjlzhg1IbfzIdsTjA/t+ht9Mr8GKwZL//v3r+sB+0OMN+zqIEf8gFMvJkyd1gXTOa9YNDP//otrPAtSV/Jp9HfPff78Z0AEL0LUeXxivMfxD0wXTqfjj/2ugkf+wSrL9/YtpJEyS4S8WI5Ek/+GR/POPFjr//cenE6/kP9q4Fo/kr39/mdj+M/zFkGQCSj5i+ccPjLJ/GBgkuYOHQR1sNDpmAkb2LBmWwL///zKCIxwZM0VHR18G6p4uxeLLAA4tJMwEshiou1iMxXaHLGswA+t/YbhORuQUv2DBAnCifvxzI+enP3dQJUFg/vz5sOzgBBBgAPxX9j0YnH4JAAAAAElFTkSuQmCC) no-repeat top left;
-}
-.sf-button:hover .border-r,
-.sf-button-selected .border-r {
- background: transparent url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAcAAAAcCAYAAACtQ6WLAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAT5JREFUeNpiPHv27BkGBoaDQDzLyMjoJgMSYHrM3WX8hn1d0f///88DFRYhSzIuv2X5H8Rg/SfKIPDTkYH/l80OINffxMTkF9O/f/8ZQPgnwyuGl+wrGd6x7vf49+9fO9jYf3+Bkkj4NesmBqAV+SdPntQC6vzHgIz//gOawbqOGchOxtAJwp8Zr4F0e7D8/fuPAR38/P8eZIo0yz8skv8YvoIk+YE6/zNgAyD7sRqLkPzzjxY6/+HS+R+fTkZ8djLh08lCUCcuSWawJGbwMTGwg7zyBatX2Bj5QZKPsBrLzaICktzN8g/NWEYGZgYZjoC/wMiei5FMpFh8QPSU6Ojoy3Cd7EwiDBJsDgxiLNY7gLrKQGIsHAxSDHxAO2TZ/b8D+TVxcXF9MCtYtLiKLgDpfUDVsxITE1GyA0CAAQA2E/N8VuHyAAAAAABJRU5ErkJggg==) right top no-repeat;
-}
-.sf-button:hover .btn-bg,
-.sf-button-selected .btn-bg {
- color: #FFFFFF;
- text-shadow:0 1px 1px #6b9311;
- background: transparent url(data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAAcCAIAAAAvP0KbAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAEFJREFUeNpiPnv2LNMdvlymf///M/37B8R/QfQ/MP33L4j+B6Qh7L9//sHpf2h8MA1V+w/KRjYLaDaLCU8vQIABAFO3TxZriO4yAAAAAElFTkSuQmCC) repeat-x top left;
-}
diff --git a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/header.html.twig b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/header.html.twig
index acc76300b59dd..d04cf37e6c7b1 100644
--- a/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/header.html.twig
+++ b/src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/header.html.twig
@@ -1,25 +1,14 @@
-