aboutsummaryrefslogtreecommitdiffhomepage
path: root/vendor/symfony/form
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/symfony/form')
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/.gitignore4
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/AbstractExtension.php195
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/AbstractRendererEngine.php206
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/AbstractType.php56
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/AbstractTypeExtension.php48
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Button.php436
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/ButtonBuilder.php864
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/ButtonTypeInterface.php21
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/CHANGELOG.md238
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/CallbackTransformer.php70
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/ClickableInterface.php27
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/DataMapperInterface.php38
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/DataTransformerInterface.php77
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Exception/AlreadyBoundException.php22
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Exception/AlreadySubmittedException.php22
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Exception/BadMethodCallException.php21
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Exception/ErrorMappingException.php16
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Exception/ExceptionInterface.php21
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Exception/InvalidArgumentException.php21
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Exception/InvalidConfigurationException.php16
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Exception/LogicException.php21
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Exception/OutOfBoundsException.php21
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Exception/RuntimeException.php21
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Exception/StringCastException.php16
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Exception/TransformationFailedException.php21
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Exception/UnexpectedTypeException.php20
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Extension/Core/ChoiceList/ChoiceList.php510
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Extension/Core/ChoiceList/ChoiceListInterface.php149
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Extension/Core/ChoiceList/LazyChoiceList.php149
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Extension/Core/ChoiceList/ObjectChoiceList.php184
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Extension/Core/ChoiceList/SimpleChoiceList.php164
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Extension/Core/CoreExtension.php59
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Extension/Core/DataMapper/PropertyPathMapper.php92
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Extension/Core/DataTransformer/ArrayToPartsTransformer.php86
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Extension/Core/DataTransformer/BaseDateTimeTransformer.php52
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Extension/Core/DataTransformer/BooleanToStringTransformer.php85
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Extension/Core/DataTransformer/ChoiceToBooleanArrayTransformer.php118
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Extension/Core/DataTransformer/ChoiceToValueTransformer.php62
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Extension/Core/DataTransformer/ChoicesToBooleanArrayTransformer.php117
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Extension/Core/DataTransformer/ChoicesToValuesTransformer.php83
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Extension/Core/DataTransformer/DataTransformerChain.php86
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToArrayTransformer.php184
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToLocalizedStringTransformer.php169
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToRfc3339Transformer.php82
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToStringTransformer.php231
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToTimestampTransformer.php89
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Extension/Core/DataTransformer/IntegerToLocalizedStringTransformer.php53
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Extension/Core/DataTransformer/MoneyToLocalizedStringTransformer.php90
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Extension/Core/DataTransformer/NumberToLocalizedStringTransformer.php184
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Extension/Core/DataTransformer/PercentToLocalizedStringTransformer.php149
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Extension/Core/DataTransformer/ValueToDuplicatesTransformer.php91
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Extension/Core/EventListener/FixCheckboxInputListener.php62
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Extension/Core/EventListener/FixRadioInputListener.php66
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Extension/Core/EventListener/FixUrlProtocolListener.php56
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Extension/Core/EventListener/MergeCollectionListener.php137
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Extension/Core/EventListener/ResizeFormListener.php173
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Extension/Core/EventListener/TrimListener.php55
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Extension/Core/Type/BaseType.php121
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Extension/Core/Type/BirthdayType.php44
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Extension/Core/Type/ButtonType.php38
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Extension/Core/Type/CheckboxType.php67
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Extension/Core/Type/ChoiceType.php274
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Extension/Core/Type/CollectionType.php103
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Extension/Core/Type/CountryType.php45
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Extension/Core/Type/CurrencyType.php45
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Extension/Core/Type/DateTimeType.php281
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Extension/Core/Type/DateType.php309
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Extension/Core/Type/EmailType.php33
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Extension/Core/Type/FileType.php61
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Extension/Core/Type/FormType.php214
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Extension/Core/Type/HiddenType.php40
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Extension/Core/Type/IntegerType.php68
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Extension/Core/Type/LanguageType.php45
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Extension/Core/Type/LocaleType.php46
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Extension/Core/Type/MoneyType.php111
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Extension/Core/Type/NumberType.php66
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Extension/Core/Type/PasswordType.php57
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Extension/Core/Type/PercentType.php55
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Extension/Core/Type/RadioType.php33
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Extension/Core/Type/RepeatedType.php67
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Extension/Core/Type/ResetType.php39
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Extension/Core/Type/SearchType.php33
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Extension/Core/Type/SubmitType.php46
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Extension/Core/Type/TextType.php36
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Extension/Core/Type/TextareaType.php43
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Extension/Core/Type/TimeType.php225
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Extension/Core/Type/TimezoneType.php86
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Extension/Core/Type/UrlType.php54
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Extension/Core/View/ChoiceView.php55
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Extension/Csrf/CsrfExtension.php64
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Extension/Csrf/CsrfProvider/CsrfProviderInterface.php49
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Extension/Csrf/CsrfProvider/DefaultCsrfProvider.php78
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Extension/Csrf/CsrfProvider/SessionCsrfProvider.php57
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Extension/Csrf/EventListener/CsrfValidationListener.php115
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Extension/Csrf/Type/FormTypeCsrfExtension.php129
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Extension/DependencyInjection/DependencyInjectionExtension.php101
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Extension/HttpFoundation/EventListener/BindRequestListener.php91
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Extension/HttpFoundation/HttpFoundationExtension.php29
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Extension/HttpFoundation/HttpFoundationRequestHandler.php79
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Extension/HttpFoundation/Type/FormTypeHttpFoundationExtension.php56
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Extension/Templating/TemplatingExtension.php33
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Extension/Templating/TemplatingRendererEngine.php125
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Extension/Validator/Constraints/Form.php33
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Extension/Validator/Constraints/FormValidator.php236
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Extension/Validator/EventListener/ValidationListener.php68
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Extension/Validator/Type/BaseValidatorExtension.php56
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Extension/Validator/Type/FormTypeValidatorExtension.php84
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Extension/Validator/Type/RepeatedTypeValidatorExtension.php45
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Extension/Validator/Type/SubmitTypeValidatorExtension.php28
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Extension/Validator/Util/ServerParams.php64
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Extension/Validator/ValidatorExtension.php57
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Extension/Validator/ValidatorTypeGuesser.php286
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Extension/Validator/ViolationMapper/MappingRule.php106
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Extension/Validator/ViolationMapper/RelativePath.php45
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Extension/Validator/ViolationMapper/ViolationMapper.php299
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Extension/Validator/ViolationMapper/ViolationMapperInterface.php33
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Extension/Validator/ViolationMapper/ViolationPath.php250
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Extension/Validator/ViolationMapper/ViolationPathIterator.php30
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Form.php1046
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/FormBuilder.php275
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/FormBuilderInterface.php87
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/FormConfigBuilder.php919
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/FormConfigBuilderInterface.php287
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/FormConfigInterface.php243
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/FormError.php105
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/FormEvent.php65
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/FormEvents.php49
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/FormExtensionInterface.php63
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/FormFactory.php156
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/FormFactoryBuilder.php162
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/FormFactoryBuilderInterface.php108
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/FormFactoryInterface.php109
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/FormInterface.php288
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/FormRegistry.php180
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/FormRegistryInterface.php57
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/FormRenderer.php304
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/FormRendererEngineInterface.php150
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/FormRendererInterface.php103
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/FormTypeExtensionInterface.php75
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/FormTypeGuesserChain.php104
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/FormTypeGuesserInterface.php64
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/FormTypeInterface.php95
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/FormView.php159
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Forms.php185
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Guess/Guess.php113
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Guess/TypeGuess.php70
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Guess/ValueGuess.php50
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/LICENSE19
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/NativeRequestHandler.php194
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/PreloadedExtension.php97
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/README.md26
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/RequestHandlerInterface.php28
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/ResolvedFormType.php284
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/ResolvedFormTypeFactory.php26
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/ResolvedFormTypeFactoryInterface.php38
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/ResolvedFormTypeInterface.php106
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Resources/config/validation.xml13
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.ar.xlf19
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.bg.xlf19
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.ca.xlf19
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.cs.xlf19
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.da.xlf19
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.de.xlf19
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.el.xlf19
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.en.xlf19
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.es.xlf19
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.et.xlf19
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.eu.xlf19
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.fa.xlf19
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.fi.xlf19
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.fr.xlf19
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.gl.xlf19
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.he.xlf19
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.hr.xlf19
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.hu.xlf19
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.hy.xlf19
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.id.xlf19
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.it.xlf19
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.ja.xlf19
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.lb.xlf19
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.lt.xlf19
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.lv.xlf19
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.mn.xlf19
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.nb.xlf19
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.nl.xlf19
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.pl.xlf19
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.pt.xlf19
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.pt_BR.xlf19
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.ro.xlf19
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.ru.xlf19
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.sk.xlf19
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.sl.xlf19
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.sr_Cyrl.xlf19
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.sr_Latn.xlf19
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.sv.xlf19
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.ua.xlf19
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.zh_CN.xlf19
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/ReversedTransformer.php55
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/SubmitButton.php52
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/SubmitButtonBuilder.php30
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/SubmitButtonTypeInterface.php21
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Test/DeprecationErrorHandler.php42
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Test/FormBuilderInterface.php16
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Test/FormIntegrationTestCase.php41
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Test/FormInterface.php16
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Test/FormPerformanceTestCase.php70
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Test/TypeTestCase.php41
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Tests/AbstractDivLayoutTest.php732
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Tests/AbstractExtensionTest.php43
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Tests/AbstractFormTest.php147
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Tests/AbstractLayoutTest.php1876
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Tests/AbstractRequestHandlerTest.php280
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Tests/AbstractTableLayoutTest.php509
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Tests/CompoundFormPerformanceTest.php48
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Tests/CompoundFormTest.php759
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/ChoiceList/ChoiceListTest.php200
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/ChoiceList/LazyChoiceListTest.php116
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/ChoiceList/ObjectChoiceListTest.php212
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/ChoiceList/SimpleChoiceListTest.php188
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/DataMapper/PropertyPathMapperTest.php319
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/ArrayToPartsTransformerTest.php149
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/BooleanToStringTransformerTest.php60
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/ChoiceToValueTransformerTest.php76
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/ChoicesToValuesTransformerTest.php76
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DataTransformerChainTest.php53
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeTestCase.php20
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToArrayTransformerTest.php512
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToLocalizedStringTransformerTest.php275
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToRfc3339TransformerTest.php132
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToStringTransformerTest.php181
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToTimestampTransformerTest.php104
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/IntegerToLocalizedStringTransformerTest.php115
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/MoneyToLocalizedStringTransformerTest.php74
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/NumberToLocalizedStringTransformerTest.php393
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/PercentToLocalizedStringTransformerTest.php114
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/ValueToDuplicatesTransformerTest.php120
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/EventListener/FixRadioInputListenerTest.php106
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/EventListener/FixUrlProtocolListenerTest.php61
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/EventListener/Fixtures/randomhashbin35 -> 0 bytes
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/EventListener/MergeCollectionListenerArrayObjectTest.php27
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/EventListener/MergeCollectionListenerArrayTest.php27
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/EventListener/MergeCollectionListenerCustomArrayObjectTest.php28
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/EventListener/MergeCollectionListenerTest.php259
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/EventListener/ResizeFormListenerTest.php255
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/EventListener/TrimListenerTest.php79
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/Type/BaseTypeTest.php135
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/Type/ButtonTypeTest.php28
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/Type/CheckboxTypeTest.php162
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/Type/ChoiceTypePerformanceTest.php38
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/Type/ChoiceTypeTest.php949
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/Type/CollectionTypeTest.php200
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/Type/CountryTypeTest.php52
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/Type/CurrencyTypeTest.php37
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/Type/DateTimeTypeTest.php477
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/Type/DateTypeTest.php781
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/Type/FileTypeTest.php83
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/Type/FormTypeTest.php578
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/Type/IntegerTypeTest.php34
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/Type/LanguageTypeTest.php47
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/Type/LocaleTypeTest.php36
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/Type/MoneyTypeTest.php59
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/Type/NumberTypeTest.php63
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/Type/PasswordTypeTest.php51
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/Type/RepeatedTypeTest.php149
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/Type/SubmitTypeTest.php54
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/Type/TimeTypeTest.php649
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/Type/TimezoneTypeTest.php30
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/Type/TypeTestCase.php21
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/Type/UrlTypeTest.php61
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Csrf/CsrfProvider/DefaultCsrfProviderTest.php81
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Csrf/CsrfProvider/SessionCsrfProviderTest.php75
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Csrf/EventListener/CsrfValidationListenerTest.php78
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Csrf/Type/FormTypeCsrfExtensionTest.php301
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Tests/Extension/HttpFoundation/EventListener/BindRequestListenerTest.php286
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Tests/Extension/HttpFoundation/HttpFoundationRequestHandlerTest.php54
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Validator/Constraints/FormValidatorTest.php748
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Validator/EventListener/ValidationListenerTest.php145
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Validator/Type/FormTypeValidatorExtensionTest.php85
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Validator/Type/TypeTestCase.php49
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Validator/Util/ServerParamsTest.php46
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Validator/ViolationMapper/ViolationMapperTest.php1481
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Validator/ViolationMapper/ViolationPathTest.php245
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Tests/Fixtures/AlternatingRowType.php27
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Tests/Fixtures/Author.php71
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Tests/Fixtures/AuthorType.php30
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Tests/Fixtures/CustomArrayObject.php70
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Tests/Fixtures/FixedDataTransformer.php45
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Tests/Fixtures/FixedFilterListener.php66
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Tests/Fixtures/FooSubType.php32
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Tests/Fixtures/FooSubTypeWithParentInstance.php32
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Tests/Fixtures/FooType.php32
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Tests/Fixtures/FooTypeBarExtension.php35
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Tests/Fixtures/FooTypeBazExtension.php28
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Tests/Fixtures/TestExtension.php72
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Tests/Fixtures/foo0
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Tests/FormBuilderTest.php232
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Tests/FormConfigTest.php148
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Tests/FormFactoryBuilderTest.php59
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Tests/FormFactoryTest.php506
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Tests/FormIntegrationTestCase.php21
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Tests/FormPerformanceTestCase.php21
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Tests/FormRegistryTest.php243
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Tests/FormRendererTest.php27
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Tests/Guess/GuessTest.php36
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Tests/NativeRequestHandlerTest.php219
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Tests/ResolvedFormTypeTest.php280
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Tests/SimpleFormTest.php1045
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Util/FormUtil.php42
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Util/InheritDataAwareIterator.php35
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/Util/VirtualFormAwareIterator.php50
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/composer.json43
-rw-r--r--vendor/symfony/form/Symfony/Component/Form/phpunit.xml.dist29
312 files changed, 0 insertions, 40367 deletions
diff --git a/vendor/symfony/form/Symfony/Component/Form/.gitignore b/vendor/symfony/form/Symfony/Component/Form/.gitignore
deleted file mode 100644
index 44de97a3..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/.gitignore
+++ /dev/null
@@ -1,4 +0,0 @@
1vendor/
2composer.lock
3phpunit.xml
4
diff --git a/vendor/symfony/form/Symfony/Component/Form/AbstractExtension.php b/vendor/symfony/form/Symfony/Component/Form/AbstractExtension.php
deleted file mode 100644
index 4db77b9b..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/AbstractExtension.php
+++ /dev/null
@@ -1,195 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form;
13
14use Symfony\Component\Form\Exception\InvalidArgumentException;
15use Symfony\Component\Form\Exception\UnexpectedTypeException;
16
17/**
18 * @author Bernhard Schussek <bschussek@gmail.com>
19 */
20abstract class AbstractExtension implements FormExtensionInterface
21{
22 /**
23 * The types provided by this extension
24 * @var FormTypeInterface[] An array of FormTypeInterface
25 */
26 private $types;
27
28 /**
29 * The type extensions provided by this extension
30 * @var FormTypeExtensionInterface[] An array of FormTypeExtensionInterface
31 */
32 private $typeExtensions;
33
34 /**
35 * The type guesser provided by this extension
36 * @var FormTypeGuesserInterface
37 */
38 private $typeGuesser;
39
40 /**
41 * Whether the type guesser has been loaded
42 * @var Boolean
43 */
44 private $typeGuesserLoaded = false;
45
46 /**
47 * {@inheritdoc}
48 */
49 public function getType($name)
50 {
51 if (null === $this->types) {
52 $this->initTypes();
53 }
54
55 if (!isset($this->types[$name])) {
56 throw new InvalidArgumentException(sprintf('The type "%s" can not be loaded by this extension', $name));
57 }
58
59 return $this->types[$name];
60 }
61
62 /**
63 * {@inheritdoc}
64 */
65 public function hasType($name)
66 {
67 if (null === $this->types) {
68 $this->initTypes();
69 }
70
71 return isset($this->types[$name]);
72 }
73
74 /**
75 * {@inheritdoc}
76 */
77 public function getTypeExtensions($name)
78 {
79 if (null === $this->typeExtensions) {
80 $this->initTypeExtensions();
81 }
82
83 return isset($this->typeExtensions[$name])
84 ? $this->typeExtensions[$name]
85 : array();
86 }
87
88 /**
89 * {@inheritdoc}
90 */
91 public function hasTypeExtensions($name)
92 {
93 if (null === $this->typeExtensions) {
94 $this->initTypeExtensions();
95 }
96
97 return isset($this->typeExtensions[$name]) && count($this->typeExtensions[$name]) > 0;
98 }
99
100 /**
101 * {@inheritdoc}
102 */
103 public function getTypeGuesser()
104 {
105 if (!$this->typeGuesserLoaded) {
106 $this->initTypeGuesser();
107 }
108
109 return $this->typeGuesser;
110 }
111
112 /**
113 * Registers the types.
114 *
115 * @return FormTypeInterface[] An array of FormTypeInterface instances
116 */
117 protected function loadTypes()
118 {
119 return array();
120 }
121
122 /**
123 * Registers the type extensions.
124 *
125 * @return FormTypeExtensionInterface[] An array of FormTypeExtensionInterface instances
126 */
127 protected function loadTypeExtensions()
128 {
129 return array();
130 }
131
132 /**
133 * Registers the type guesser.
134 *
135 * @return FormTypeGuesserInterface|null A type guesser
136 */
137 protected function loadTypeGuesser()
138 {
139 return null;
140 }
141
142 /**
143 * Initializes the types.
144 *
145 * @throws UnexpectedTypeException if any registered type is not an instance of FormTypeInterface
146 */
147 private function initTypes()
148 {
149 $this->types = array();
150
151 foreach ($this->loadTypes() as $type) {
152 if (!$type instanceof FormTypeInterface) {
153 throw new UnexpectedTypeException($type, 'Symfony\Component\Form\FormTypeInterface');
154 }
155
156 $this->types[$type->getName()] = $type;
157 }
158 }
159
160 /**
161 * Initializes the type extensions.
162 *
163 * @throws UnexpectedTypeException if any registered type extension is not
164 * an instance of FormTypeExtensionInterface
165 */
166 private function initTypeExtensions()
167 {
168 $this->typeExtensions = array();
169
170 foreach ($this->loadTypeExtensions() as $extension) {
171 if (!$extension instanceof FormTypeExtensionInterface) {
172 throw new UnexpectedTypeException($extension, 'Symfony\Component\Form\FormTypeExtensionInterface');
173 }
174
175 $type = $extension->getExtendedType();
176
177 $this->typeExtensions[$type][] = $extension;
178 }
179 }
180
181 /**
182 * Initializes the type guesser.
183 *
184 * @throws UnexpectedTypeException if the type guesser is not an instance of FormTypeGuesserInterface
185 */
186 private function initTypeGuesser()
187 {
188 $this->typeGuesserLoaded = true;
189
190 $this->typeGuesser = $this->loadTypeGuesser();
191 if (null !== $this->typeGuesser && !$this->typeGuesser instanceof FormTypeGuesserInterface) {
192 throw new UnexpectedTypeException($this->typeGuesser, 'Symfony\Component\Form\FormTypeGuesserInterface');
193 }
194 }
195}
diff --git a/vendor/symfony/form/Symfony/Component/Form/AbstractRendererEngine.php b/vendor/symfony/form/Symfony/Component/Form/AbstractRendererEngine.php
deleted file mode 100644
index 347be10d..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/AbstractRendererEngine.php
+++ /dev/null
@@ -1,206 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form;
13
14/**
15 * Default implementation of {@link FormRendererEngineInterface}.
16 *
17 * @author Bernhard Schussek <bschussek@gmail.com>
18 */
19abstract class AbstractRendererEngine implements FormRendererEngineInterface
20{
21 /**
22 * The variable in {@link FormView} used as cache key.
23 */
24 const CACHE_KEY_VAR = 'cache_key';
25
26 /**
27 * @var array
28 */
29 protected $defaultThemes;
30
31 /**
32 * @var array
33 */
34 protected $themes = array();
35
36 /**
37 * @var array
38 */
39 protected $resources = array();
40
41 /**
42 * @var array
43 */
44 private $resourceHierarchyLevels = array();
45
46 /**
47 * Creates a new renderer engine.
48 *
49 * @param array $defaultThemes The default themes. The type of these
50 * themes is open to the implementation.
51 */
52 public function __construct(array $defaultThemes = array())
53 {
54 $this->defaultThemes = $defaultThemes;
55 }
56
57 /**
58 * {@inheritdoc}
59 */
60 public function setTheme(FormView $view, $themes)
61 {
62 $cacheKey = $view->vars[self::CACHE_KEY_VAR];
63
64 // Do not cast, as casting turns objects into arrays of properties
65 $this->themes[$cacheKey] = is_array($themes) ? $themes : array($themes);
66
67 // Unset instead of resetting to an empty array, in order to allow
68 // implementations (like TwigRendererEngine) to check whether $cacheKey
69 // is set at all.
70 unset($this->resources[$cacheKey]);
71 unset($this->resourceHierarchyLevels[$cacheKey]);
72 }
73
74 /**
75 * {@inheritdoc}
76 */
77 public function getResourceForBlockName(FormView $view, $blockName)
78 {
79 $cacheKey = $view->vars[self::CACHE_KEY_VAR];
80
81 if (!isset($this->resources[$cacheKey][$blockName])) {
82 $this->loadResourceForBlockName($cacheKey, $view, $blockName);
83 }
84
85 return $this->resources[$cacheKey][$blockName];
86 }
87
88 /**
89 * {@inheritdoc}
90 */
91 public function getResourceForBlockNameHierarchy(FormView $view, array $blockNameHierarchy, $hierarchyLevel)
92 {
93 $cacheKey = $view->vars[self::CACHE_KEY_VAR];
94 $blockName = $blockNameHierarchy[$hierarchyLevel];
95
96 if (!isset($this->resources[$cacheKey][$blockName])) {
97 $this->loadResourceForBlockNameHierarchy($cacheKey, $view, $blockNameHierarchy, $hierarchyLevel);
98 }
99
100 return $this->resources[$cacheKey][$blockName];
101 }
102
103 /**
104 * {@inheritdoc}
105 */
106 public function getResourceHierarchyLevel(FormView $view, array $blockNameHierarchy, $hierarchyLevel)
107 {
108 $cacheKey = $view->vars[self::CACHE_KEY_VAR];
109 $blockName = $blockNameHierarchy[$hierarchyLevel];
110
111 if (!isset($this->resources[$cacheKey][$blockName])) {
112 $this->loadResourceForBlockNameHierarchy($cacheKey, $view, $blockNameHierarchy, $hierarchyLevel);
113 }
114
115 // If $block was previously rendered loaded with loadTemplateForBlock(), the template
116 // is cached but the hierarchy level is not. In this case, we know that the block
117 // exists at this very hierarchy level, so we can just set it.
118 if (!isset($this->resourceHierarchyLevels[$cacheKey][$blockName])) {
119 $this->resourceHierarchyLevels[$cacheKey][$blockName] = $hierarchyLevel;
120 }
121
122 return $this->resourceHierarchyLevels[$cacheKey][$blockName];
123 }
124
125 /**
126 * Loads the cache with the resource for a given block name.
127 *
128 * @see getResourceForBlock()
129 *
130 * @param string $cacheKey The cache key of the form view.
131 * @param FormView $view The form view for finding the applying themes.
132 * @param string $blockName The name of the block to load.
133 *
134 * @return Boolean True if the resource could be loaded, false otherwise.
135 */
136 abstract protected function loadResourceForBlockName($cacheKey, FormView $view, $blockName);
137
138 /**
139 * Loads the cache with the resource for a specific level of a block hierarchy.
140 *
141 * @see getResourceForBlockHierarchy()
142 *
143 * @param string $cacheKey The cache key used for storing the
144 * resource.
145 * @param FormView $view The form view for finding the applying
146 * themes.
147 * @param array $blockNameHierarchy The block hierarchy, with the most
148 * specific block name at the end.
149 * @param integer $hierarchyLevel The level in the block hierarchy that
150 * should be loaded.
151 *
152 * @return Boolean True if the resource could be loaded, false otherwise.
153 */
154 private function loadResourceForBlockNameHierarchy($cacheKey, FormView $view, array $blockNameHierarchy, $hierarchyLevel)
155 {
156 $blockName = $blockNameHierarchy[$hierarchyLevel];
157
158 // Try to find a template for that block
159 if ($this->loadResourceForBlockName($cacheKey, $view, $blockName)) {
160 // If loadTemplateForBlock() returns true, it was able to populate the
161 // cache. The only missing thing is to set the hierarchy level at which
162 // the template was found.
163 $this->resourceHierarchyLevels[$cacheKey][$blockName] = $hierarchyLevel;
164
165 return true;
166 }
167
168 if ($hierarchyLevel > 0) {
169 $parentLevel = $hierarchyLevel - 1;
170 $parentBlockName = $blockNameHierarchy[$parentLevel];
171
172 // The next two if statements contain slightly duplicated code. This is by intention
173 // and tries to avoid execution of unnecessary checks in order to increase performance.
174
175 if (isset($this->resources[$cacheKey][$parentBlockName])) {
176 // It may happen that the parent block is already loaded, but its level is not.
177 // In this case, the parent block must have been loaded by loadResourceForBlock(),
178 // which does not check the hierarchy of the block. Subsequently the block must have
179 // been found directly on the parent level.
180 if (!isset($this->resourceHierarchyLevels[$cacheKey][$parentBlockName])) {
181 $this->resourceHierarchyLevels[$cacheKey][$parentBlockName] = $parentLevel;
182 }
183
184 // Cache the shortcuts for further accesses
185 $this->resources[$cacheKey][$blockName] = $this->resources[$cacheKey][$parentBlockName];
186 $this->resourceHierarchyLevels[$cacheKey][$blockName] = $this->resourceHierarchyLevels[$cacheKey][$parentBlockName];
187
188 return true;
189 }
190
191 if ($this->loadResourceForBlockNameHierarchy($cacheKey, $view, $blockNameHierarchy, $parentLevel)) {
192 // Cache the shortcuts for further accesses
193 $this->resources[$cacheKey][$blockName] = $this->resources[$cacheKey][$parentBlockName];
194 $this->resourceHierarchyLevels[$cacheKey][$blockName] = $this->resourceHierarchyLevels[$cacheKey][$parentBlockName];
195
196 return true;
197 }
198 }
199
200 // Cache the result for further accesses
201 $this->resources[$cacheKey][$blockName] = false;
202 $this->resourceHierarchyLevels[$cacheKey][$blockName] = false;
203
204 return false;
205 }
206}
diff --git a/vendor/symfony/form/Symfony/Component/Form/AbstractType.php b/vendor/symfony/form/Symfony/Component/Form/AbstractType.php
deleted file mode 100644
index 6f7f5da6..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/AbstractType.php
+++ /dev/null
@@ -1,56 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form;
13
14use Symfony\Component\OptionsResolver\OptionsResolverInterface;
15
16/**
17 * @author Bernhard Schussek <bschussek@gmail.com>
18 */
19abstract class AbstractType implements FormTypeInterface
20{
21 /**
22 * {@inheritdoc}
23 */
24 public function buildForm(FormBuilderInterface $builder, array $options)
25 {
26 }
27
28 /**
29 * {@inheritdoc}
30 */
31 public function buildView(FormView $view, FormInterface $form, array $options)
32 {
33 }
34
35 /**
36 * {@inheritdoc}
37 */
38 public function finishView(FormView $view, FormInterface $form, array $options)
39 {
40 }
41
42 /**
43 * {@inheritdoc}
44 */
45 public function setDefaultOptions(OptionsResolverInterface $resolver)
46 {
47 }
48
49 /**
50 * {@inheritdoc}
51 */
52 public function getParent()
53 {
54 return 'form';
55 }
56}
diff --git a/vendor/symfony/form/Symfony/Component/Form/AbstractTypeExtension.php b/vendor/symfony/form/Symfony/Component/Form/AbstractTypeExtension.php
deleted file mode 100644
index 351c8009..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/AbstractTypeExtension.php
+++ /dev/null
@@ -1,48 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form;
13
14use Symfony\Component\OptionsResolver\OptionsResolverInterface;
15
16/**
17 * @author Bernhard Schussek <bschussek@gmail.com>
18 */
19abstract class AbstractTypeExtension implements FormTypeExtensionInterface
20{
21 /**
22 * {@inheritdoc}
23 */
24 public function buildForm(FormBuilderInterface $builder, array $options)
25 {
26 }
27
28 /**
29 * {@inheritdoc}
30 */
31 public function buildView(FormView $view, FormInterface $form, array $options)
32 {
33 }
34
35 /**
36 * {@inheritdoc}
37 */
38 public function finishView(FormView $view, FormInterface $form, array $options)
39 {
40 }
41
42 /**
43 * {@inheritdoc}
44 */
45 public function setDefaultOptions(OptionsResolverInterface $resolver)
46 {
47 }
48}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Button.php b/vendor/symfony/form/Symfony/Component/Form/Button.php
deleted file mode 100644
index 6e12ba16..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Button.php
+++ /dev/null
@@ -1,436 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form;
13
14use Symfony\Component\Form\Exception\AlreadySubmittedException;
15use Symfony\Component\Form\Exception\BadMethodCallException;
16
17/**
18 * A form button.
19 *
20 * @author Bernhard Schussek <bschussek@gmail.com>
21 */
22class Button implements \IteratorAggregate, FormInterface
23{
24 /**
25 * @var FormInterface
26 */
27 private $parent;
28
29 /**
30 * @var FormConfigInterface
31 */
32 private $config;
33
34 /**
35 * @var Boolean
36 */
37 private $submitted = false;
38
39 /**
40 * Creates a new button from a form configuration.
41 *
42 * @param FormConfigInterface $config The button's configuration.
43 */
44 public function __construct(FormConfigInterface $config)
45 {
46 $this->config = $config;
47 }
48
49 /**
50 * Unsupported method.
51 *
52 * @param mixed $offset
53 *
54 * @return Boolean Always returns false.
55 */
56 public function offsetExists($offset)
57 {
58 return false;
59 }
60
61 /**
62 * Unsupported method.
63 *
64 * This method should not be invoked.
65 *
66 * @param mixed $offset
67 *
68 * @throws BadMethodCallException
69 */
70 public function offsetGet($offset)
71 {
72 throw new BadMethodCallException('Buttons cannot have children.');
73 }
74
75 /**
76 * Unsupported method.
77 *
78 * This method should not be invoked.
79 *
80 * @param mixed $offset
81 * @param mixed $value
82 *
83 * @throws BadMethodCallException
84 */
85 public function offsetSet($offset, $value)
86 {
87 throw new BadMethodCallException('Buttons cannot have children.');
88 }
89
90 /**
91 * Unsupported method.
92 *
93 * This method should not be invoked.
94 *
95 * @param mixed $offset
96 *
97 * @throws BadMethodCallException
98 */
99 public function offsetUnset($offset)
100 {
101 throw new BadMethodCallException('Buttons cannot have children.');
102 }
103
104 /**
105 * {@inheritdoc}
106 */
107 public function setParent(FormInterface $parent = null)
108 {
109 $this->parent = $parent;
110 }
111
112 /**
113 * {@inheritdoc}
114 */
115 public function getParent()
116 {
117 return $this->parent;
118 }
119
120 /**
121 * Unsupported method.
122 *
123 * This method should not be invoked.
124 *
125 * @param int|string|FormInterface $child
126 * @param null $type
127 * @param array $options
128 *
129 * @throws BadMethodCallException
130 */
131 public function add($child, $type = null, array $options = array())
132 {
133 throw new BadMethodCallException('Buttons cannot have children.');
134 }
135
136 /**
137 * Unsupported method.
138 *
139 * This method should not be invoked.
140 *
141 * @param string $name
142 *
143 * @throws BadMethodCallException
144 */
145 public function get($name)
146 {
147 throw new BadMethodCallException('Buttons cannot have children.');
148 }
149
150 /**
151 * Unsupported method.
152 *
153 * @param string $name
154 *
155 * @return Boolean Always returns false.
156 */
157 public function has($name)
158 {
159 return false;
160 }
161
162 /**
163 * Unsupported method.
164 *
165 * This method should not be invoked.
166 *
167 * @param string $name
168 *
169 * @throws BadMethodCallException
170 */
171 public function remove($name)
172 {
173 throw new BadMethodCallException('Buttons cannot have children.');
174 }
175
176 /**
177 * {@inheritdoc}
178 */
179 public function all()
180 {
181 return array();
182 }
183
184 /**
185 * {@inheritdoc}
186 */
187 public function getErrors()
188 {
189 return array();
190 }
191
192 /**
193 * Unsupported method.
194 *
195 * This method should not be invoked.
196 *
197 * @param string $modelData
198 *
199 * @throws BadMethodCallException
200 */
201 public function setData($modelData)
202 {
203 throw new BadMethodCallException('Buttons cannot have data.');
204 }
205
206 /**
207 * Unsupported method.
208 *
209 * @return null Always returns null.
210 */
211 public function getData()
212 {
213 return null;
214 }
215
216 /**
217 * Unsupported method.
218 *
219 * @return null Always returns null.
220 */
221 public function getNormData()
222 {
223 return null;
224 }
225
226 /**
227 * Unsupported method.
228 *
229 * @return null Always returns null.
230 */
231 public function getViewData()
232 {
233 return null;
234 }
235
236 /**
237 * Unsupported method.
238 *
239 * @return array Always returns an empty array.
240 */
241 public function getExtraData()
242 {
243 return array();
244 }
245
246 /**
247 * Returns the button's configuration.
248 *
249 * @return FormConfigInterface The configuration.
250 */
251 public function getConfig()
252 {
253 return $this->config;
254 }
255
256 /**
257 * Returns whether the button is submitted.
258 *
259 * @return Boolean true if the button was submitted.
260 */
261 public function isSubmitted()
262 {
263 return $this->submitted;
264 }
265
266 /**
267 * Returns the name by which the button is identified in forms.
268 *
269 * @return string The name of the button.
270 */
271 public function getName()
272 {
273 return $this->config->getName();
274 }
275
276 /**
277 * Unsupported method.
278 *
279 * @return null Always returns null.
280 */
281 public function getPropertyPath()
282 {
283 return null;
284 }
285
286 /**
287 * Unsupported method.
288 *
289 * @param FormError $error
290 *
291 * @throws BadMethodCallException
292 */
293 public function addError(FormError $error)
294 {
295 throw new BadMethodCallException('Buttons cannot have errors.');
296 }
297
298 /**
299 * Unsupported method.
300 *
301 * @return Boolean Always returns true.
302 */
303 public function isValid()
304 {
305 return true;
306 }
307
308 /**
309 * Unsupported method.
310 *
311 * @return Boolean Always returns false.
312 */
313 public function isRequired()
314 {
315 return false;
316 }
317
318 /**
319 * {@inheritdoc}
320 */
321 public function isDisabled()
322 {
323 return $this->config->getDisabled();
324 }
325
326 /**
327 * Unsupported method.
328 *
329 * @return Boolean Always returns true.
330 */
331 public function isEmpty()
332 {
333 return true;
334 }
335
336 /**
337 * Unsupported method.
338 *
339 * @return Boolean Always returns true.
340 */
341 public function isSynchronized()
342 {
343 return true;
344 }
345
346 /**
347 * Unsupported method.
348 *
349 * @throws BadMethodCallException
350 */
351 public function initialize()
352 {
353 throw new BadMethodCallException('Buttons cannot be initialized. Call initialize() on the root form instead.');
354 }
355
356 /**
357 * Unsupported method.
358 *
359 * @param mixed $request
360 *
361 * @throws BadMethodCallException
362 */
363 public function handleRequest($request = null)
364 {
365 throw new BadMethodCallException('Buttons cannot handle requests. Call handleRequest() on the root form instead.');
366 }
367
368 /**
369 * Submits data to the button.
370 *
371 * @param null|string $submittedData The data.
372 * @param Boolean $clearMissing Not used.
373 *
374 * @return Button The button instance
375 *
376 * @throws Exception\AlreadySubmittedException If the button has already been submitted.
377 */
378 public function submit($submittedData, $clearMissing = true)
379 {
380 if ($this->submitted) {
381 throw new AlreadySubmittedException('A form can only be submitted once');
382 }
383
384 $this->submitted = true;
385
386 return $this;
387 }
388
389 /**
390 * {@inheritdoc}
391 */
392 public function getRoot()
393 {
394 return $this->parent ? $this->parent->getRoot() : $this;
395 }
396
397 /**
398 * {@inheritdoc}
399 */
400 public function isRoot()
401 {
402 return null === $this->parent;
403 }
404
405 /**
406 * {@inheritdoc}
407 */
408 public function createView(FormView $parent = null)
409 {
410 if (null === $parent && $this->parent) {
411 $parent = $this->parent->createView();
412 }
413
414 return $this->config->getType()->createView($this, $parent);
415 }
416
417 /**
418 * Unsupported method.
419 *
420 * @return integer Always returns 0.
421 */
422 public function count()
423 {
424 return 0;
425 }
426
427 /**
428 * Unsupported method.
429 *
430 * @return \EmptyIterator Always returns an empty iterator.
431 */
432 public function getIterator()
433 {
434 return new \EmptyIterator();
435 }
436}
diff --git a/vendor/symfony/form/Symfony/Component/Form/ButtonBuilder.php b/vendor/symfony/form/Symfony/Component/Form/ButtonBuilder.php
deleted file mode 100644
index 3addedbd..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/ButtonBuilder.php
+++ /dev/null
@@ -1,864 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form;
13
14use Symfony\Component\EventDispatcher\EventSubscriberInterface;
15use Symfony\Component\Form\Exception\InvalidArgumentException;
16use Symfony\Component\Form\Exception\BadMethodCallException;
17
18/**
19 * A builder for {@link Button} instances.
20 *
21 * @author Bernhard Schussek <bschussek@gmail.com>
22 */
23class ButtonBuilder implements \IteratorAggregate, FormBuilderInterface
24{
25 /**
26 * @var Boolean
27 */
28 protected $locked = false;
29
30 /**
31 * @var Boolean
32 */
33 private $disabled;
34
35 /**
36 * @var ResolvedFormTypeInterface
37 */
38 private $type;
39
40 /**
41 * @var string
42 */
43 private $name;
44
45 /**
46 * @var array
47 */
48 private $attributes = array();
49
50 /**
51 * @var array
52 */
53 private $options;
54
55 /**
56 * Creates a new button builder.
57 *
58 * @param string $name The name of the button.
59 * @param array $options The button's options.
60 *
61 * @throws InvalidArgumentException If the name is empty.
62 */
63 public function __construct($name, array $options)
64 {
65 if (empty($name) && 0 != $name) {
66 throw new InvalidArgumentException('Buttons cannot have empty names.');
67 }
68
69 $this->name = (string) $name;
70 $this->options = $options;
71 }
72
73 /**
74 * Unsupported method.
75 *
76 * This method should not be invoked.
77 *
78 * @param string|integer|FormBuilderInterface $child
79 * @param string|FormTypeInterface $type
80 * @param array $options
81 *
82 * @throws BadMethodCallException
83 */
84 public function add($child, $type = null, array $options = array())
85 {
86 throw new BadMethodCallException('Buttons cannot have children.');
87 }
88
89 /**
90 * Unsupported method.
91 *
92 * This method should not be invoked.
93 *
94 * @param string $name
95 * @param string|FormTypeInterface $type
96 * @param array $options
97 *
98 * @throws BadMethodCallException
99 */
100 public function create($name, $type = null, array $options = array())
101 {
102 throw new BadMethodCallException('Buttons cannot have children.');
103 }
104
105 /**
106 * Unsupported method.
107 *
108 * This method should not be invoked.
109 *
110 * @param string $name
111 *
112 * @throws BadMethodCallException
113 */
114 public function get($name)
115 {
116 throw new BadMethodCallException('Buttons cannot have children.');
117 }
118
119 /**
120 * Unsupported method.
121 *
122 * This method should not be invoked.
123 *
124 * @param string $name
125 *
126 * @throws BadMethodCallException
127 */
128 public function remove($name)
129 {
130 throw new BadMethodCallException('Buttons cannot have children.');
131 }
132
133 /**
134 * Unsupported method.
135 *
136 * @param string $name
137 *
138 * @return Boolean Always returns false.
139 */
140 public function has($name)
141 {
142 return false;
143 }
144
145 /**
146 * Returns the children.
147 *
148 * @return array Always returns an empty array.
149 */
150 public function all()
151 {
152 return array();
153 }
154
155 /**
156 * Creates the button.
157 *
158 * @return Button The button
159 */
160 public function getForm()
161 {
162 return new Button($this->getFormConfig());
163 }
164
165 /**
166 * Unsupported method.
167 *
168 * This method should not be invoked.
169 *
170 * @param string $eventName
171 * @param callable $listener
172 * @param integer $priority
173 *
174 * @throws BadMethodCallException
175 */
176 public function addEventListener($eventName, $listener, $priority = 0)
177 {
178 throw new BadMethodCallException('Buttons do not support event listeners.');
179 }
180
181 /**
182 * Unsupported method.
183 *
184 * This method should not be invoked.
185 *
186 * @param EventSubscriberInterface $subscriber
187 *
188 * @throws BadMethodCallException
189 */
190 public function addEventSubscriber(EventSubscriberInterface $subscriber)
191 {
192 throw new BadMethodCallException('Buttons do not support event subscribers.');
193 }
194
195 /**
196 * Unsupported method.
197 *
198 * This method should not be invoked.
199 *
200 * @param DataTransformerInterface $viewTransformer
201 * @param Boolean $forcePrepend
202 *
203 * @throws BadMethodCallException
204 */
205 public function addViewTransformer(DataTransformerInterface $viewTransformer, $forcePrepend = false)
206 {
207 throw new BadMethodCallException('Buttons do not support data transformers.');
208 }
209
210 /**
211 * Unsupported method.
212 *
213 * This method should not be invoked.
214 *
215 * @throws BadMethodCallException
216 */
217 public function resetViewTransformers()
218 {
219 throw new BadMethodCallException('Buttons do not support data transformers.');
220 }
221
222 /**
223 * Unsupported method.
224 *
225 * This method should not be invoked.
226 *
227 * @param DataTransformerInterface $modelTransformer
228 * @param Boolean $forceAppend
229 *
230 * @throws BadMethodCallException
231 */
232 public function addModelTransformer(DataTransformerInterface $modelTransformer, $forceAppend = false)
233 {
234 throw new BadMethodCallException('Buttons do not support data transformers.');
235 }
236
237 /**
238 * Unsupported method.
239 *
240 * This method should not be invoked.
241 *
242 * @throws BadMethodCallException
243 */
244 public function resetModelTransformers()
245 {
246 throw new BadMethodCallException('Buttons do not support data transformers.');
247 }
248
249 /**
250 * {@inheritdoc}
251 */
252 public function setAttribute($name, $value)
253 {
254 $this->attributes[$name] = $value;
255 }
256
257 /**
258 * {@inheritdoc}
259 */
260 public function setAttributes(array $attributes)
261 {
262 $this->attributes = $attributes;
263 }
264
265 /**
266 * Unsupported method.
267 *
268 * This method should not be invoked.
269 *
270 * @param DataMapperInterface $dataMapper
271 *
272 * @throws BadMethodCallException
273 */
274 public function setDataMapper(DataMapperInterface $dataMapper = null)
275 {
276 throw new BadMethodCallException('Buttons do not support data mappers.');
277 }
278
279 /**
280 * Set whether the button is disabled.
281 *
282 * @param Boolean $disabled Whether the button is disabled
283 *
284 * @return ButtonBuilder The button builder.
285 */
286 public function setDisabled($disabled)
287 {
288 $this->disabled = $disabled;
289 }
290
291 /**
292 * Unsupported method.
293 *
294 * This method should not be invoked.
295 *
296 * @param mixed $emptyData
297 *
298 * @throws BadMethodCallException
299 */
300 public function setEmptyData($emptyData)
301 {
302 throw new BadMethodCallException('Buttons do not support empty data.');
303 }
304
305 /**
306 * Unsupported method.
307 *
308 * This method should not be invoked.
309 *
310 * @param Boolean $errorBubbling
311 *
312 * @throws BadMethodCallException
313 */
314 public function setErrorBubbling($errorBubbling)
315 {
316 throw new BadMethodCallException('Buttons do not support error bubbling.');
317 }
318
319 /**
320 * Unsupported method.
321 *
322 * This method should not be invoked.
323 *
324 * @param Boolean $required
325 *
326 * @throws BadMethodCallException
327 */
328 public function setRequired($required)
329 {
330 throw new BadMethodCallException('Buttons cannot be required.');
331 }
332
333 /**
334 * Unsupported method.
335 *
336 * This method should not be invoked.
337 *
338 * @param null $propertyPath
339 *
340 * @throws BadMethodCallException
341 */
342 public function setPropertyPath($propertyPath)
343 {
344 throw new BadMethodCallException('Buttons do not support property paths.');
345 }
346
347 /**
348 * Unsupported method.
349 *
350 * This method should not be invoked.
351 *
352 * @param Boolean $mapped
353 *
354 * @throws BadMethodCallException
355 */
356 public function setMapped($mapped)
357 {
358 throw new BadMethodCallException('Buttons do not support data mapping.');
359 }
360
361 /**
362 * Unsupported method.
363 *
364 * This method should not be invoked.
365 *
366 * @param Boolean $byReference
367 *
368 * @throws BadMethodCallException
369 */
370 public function setByReference($byReference)
371 {
372 throw new BadMethodCallException('Buttons do not support data mapping.');
373 }
374
375 /**
376 * Unsupported method.
377 *
378 * This method should not be invoked.
379 *
380 * @param Boolean $virtual
381 *
382 * @throws BadMethodCallException
383 */
384 public function setVirtual($virtual)
385 {
386 throw new BadMethodCallException('Buttons cannot be virtual.');
387 }
388
389 /**
390 * Unsupported method.
391 *
392 * This method should not be invoked.
393 *
394 * @param Boolean $compound
395 *
396 * @throws BadMethodCallException
397 */
398 public function setCompound($compound)
399 {
400 throw new BadMethodCallException('Buttons cannot be compound.');
401 }
402
403 /**
404 * Sets the type of the button.
405 *
406 * @param ResolvedFormTypeInterface $type The type of the button.
407 *
408 * @return ButtonBuilder The button builder.
409 */
410 public function setType(ResolvedFormTypeInterface $type)
411 {
412 $this->type = $type;
413 }
414
415 /**
416 * Unsupported method.
417 *
418 * This method should not be invoked.
419 *
420 * @param array $data
421 *
422 * @throws BadMethodCallException
423 */
424 public function setData($data)
425 {
426 throw new BadMethodCallException('Buttons do not support data.');
427 }
428
429 /**
430 * Unsupported method.
431 *
432 * This method should not be invoked.
433 *
434 * @param Boolean $locked
435 *
436 * @throws BadMethodCallException
437 */
438 public function setDataLocked($locked)
439 {
440 throw new BadMethodCallException('Buttons do not support data locking.');
441 }
442
443 /**
444 * Unsupported method.
445 *
446 * This method should not be invoked.
447 *
448 * @param FormFactoryInterface $formFactory
449 *
450 * @return void
451 *
452 * @throws BadMethodCallException
453 */
454 public function setFormFactory(FormFactoryInterface $formFactory)
455 {
456 throw new BadMethodCallException('Buttons do not support form factories.');
457 }
458
459 /**
460 * Unsupported method.
461 *
462 * @param string $action
463 *
464 * @throws BadMethodCallException
465 */
466 public function setAction($action)
467 {
468 throw new BadMethodCallException('Buttons do not support actions.');
469 }
470
471 /**
472 * Unsupported method.
473 *
474 * @param string $method
475 *
476 * @throws BadMethodCallException
477 */
478 public function setMethod($method)
479 {
480 throw new BadMethodCallException('Buttons do not support methods.');
481 }
482
483 /**
484 * Unsupported method.
485 *
486 * @param RequestHandlerInterface $requestHandler
487 *
488 * @throws BadMethodCallException
489 */
490 public function setRequestHandler(RequestHandlerInterface $requestHandler)
491 {
492 throw new BadMethodCallException('Buttons do not support form processors.');
493 }
494
495 /**
496 * Unsupported method.
497 *
498 * @param Boolean $initialize
499 *
500 * @throws BadMethodCallException
501 */
502 public function setAutoInitialize($initialize)
503 {
504 if (true === $initialize) {
505 throw new BadMethodCallException('Buttons do not support automatic initialization.');
506 }
507
508 return $this;
509 }
510
511 /**
512 * Unsupported method.
513 *
514 * @param Boolean $inheritData
515 *
516 * @throws BadMethodCallException
517 */
518 public function setInheritData($inheritData)
519 {
520 throw new BadMethodCallException('Buttons do not support data inheritance.');
521 }
522
523 /**
524 * Builds and returns the button configuration.
525 *
526 * @return FormConfigInterface
527 */
528 public function getFormConfig()
529 {
530 // This method should be idempotent, so clone the builder
531 $config = clone $this;
532 $config->locked = true;
533
534 return $config;
535 }
536
537 /**
538 * Unsupported method.
539 *
540 * @return null Always returns null.
541 */
542 public function getEventDispatcher()
543 {
544 return null;
545 }
546
547 /**
548 * {@inheritdoc}
549 */
550 public function getName()
551 {
552 return $this->name;
553 }
554
555 /**
556 * Unsupported method.
557 *
558 * @return null Always returns null.
559 */
560 public function getPropertyPath()
561 {
562 return null;
563 }
564
565 /**
566 * Unsupported method.
567 *
568 * @return Boolean Always returns false.
569 */
570 public function getMapped()
571 {
572 return false;
573 }
574
575 /**
576 * Unsupported method.
577 *
578 * @return Boolean Always returns false.
579 */
580 public function getByReference()
581 {
582 return false;
583 }
584
585 /**
586 * Unsupported method.
587 *
588 * @return Boolean Always returns false.
589 */
590 public function getVirtual()
591 {
592 return false;
593 }
594
595 /**
596 * Unsupported method.
597 *
598 * @return Boolean Always returns false.
599 */
600 public function getCompound()
601 {
602 return false;
603 }
604
605 /**
606 * Returns the form type used to construct the button.
607 *
608 * @return ResolvedFormTypeInterface The button's type.
609 */
610 public function getType()
611 {
612 return $this->type;
613 }
614
615 /**
616 * Unsupported method.
617 *
618 * @return array Always returns an empty array.
619 */
620 public function getViewTransformers()
621 {
622 return array();
623 }
624
625 /**
626 * Unsupported method.
627 *
628 * @return array Always returns an empty array.
629 */
630 public function getModelTransformers()
631 {
632 return array();
633 }
634
635 /**
636 * Unsupported method.
637 *
638 * @return null Always returns null.
639 */
640 public function getDataMapper()
641 {
642 return null;
643 }
644
645 /**
646 * Unsupported method.
647 *
648 * @return Boolean Always returns false.
649 */
650 public function getRequired()
651 {
652 return false;
653 }
654
655 /**
656 * Returns whether the button is disabled.
657 *
658 * @return Boolean Whether the button is disabled.
659 */
660 public function getDisabled()
661 {
662 return $this->disabled;
663 }
664
665 /**
666 * Unsupported method.
667 *
668 * @return Boolean Always returns false.
669 */
670 public function getErrorBubbling()
671 {
672 return false;
673 }
674
675 /**
676 * Unsupported method.
677 *
678 * @return null Always returns null.
679 */
680 public function getEmptyData()
681 {
682 return null;
683 }
684
685 /**
686 * Returns additional attributes of the button.
687 *
688 * @return array An array of key-value combinations.
689 */
690 public function getAttributes()
691 {
692 return $this->attributes;
693 }
694
695 /**
696 * Returns whether the attribute with the given name exists.
697 *
698 * @param string $name The attribute name.
699 *
700 * @return Boolean Whether the attribute exists.
701 */
702 public function hasAttribute($name)
703 {
704 return array_key_exists($name, $this->attributes);
705 }
706
707 /**
708 * Returns the value of the given attribute.
709 *
710 * @param string $name The attribute name.
711 * @param mixed $default The value returned if the attribute does not exist.
712 *
713 * @return mixed The attribute value.
714 */
715 public function getAttribute($name, $default = null)
716 {
717 return array_key_exists($name, $this->attributes) ? $this->attributes[$name] : $default;
718 }
719
720 /**
721 * Unsupported method.
722 *
723 * @return null Always returns null.
724 */
725 public function getData()
726 {
727 return null;
728 }
729
730 /**
731 * Unsupported method.
732 *
733 * @return null Always returns null.
734 */
735 public function getDataClass()
736 {
737 return null;
738 }
739
740 /**
741 * Unsupported method.
742 *
743 * @return Boolean Always returns false.
744 */
745 public function getDataLocked()
746 {
747 return false;
748 }
749
750 /**
751 * Unsupported method.
752 *
753 * @return null Always returns null.
754 */
755 public function getFormFactory()
756 {
757 return null;
758 }
759
760 /**
761 * Unsupported method.
762 *
763 * @return null Always returns null.
764 */
765 public function getAction()
766 {
767 return null;
768 }
769
770 /**
771 * Unsupported method.
772 *
773 * @return null Always returns null.
774 */
775 public function getMethod()
776 {
777 return null;
778 }
779
780 /**
781 * Unsupported method.
782 *
783 * @return null Always returns null.
784 */
785 public function getRequestHandler()
786 {
787 return null;
788 }
789
790 /**
791 * Unsupported method.
792 *
793 * @return Boolean Always returns false.
794 */
795 public function getAutoInitialize()
796 {
797 return false;
798 }
799
800 /**
801 * Unsupported method.
802 *
803 * @return Boolean Always returns false.
804 */
805 public function getInheritData()
806 {
807 return false;
808 }
809
810 /**
811 * Returns all options passed during the construction of the button.
812 *
813 * @return array The passed options.
814 */
815 public function getOptions()
816 {
817 return $this->options;
818 }
819
820 /**
821 * Returns whether a specific option exists.
822 *
823 * @param string $name The option name,
824 *
825 * @return Boolean Whether the option exists.
826 */
827 public function hasOption($name)
828 {
829 return array_key_exists($name, $this->options);
830 }
831
832 /**
833 * Returns the value of a specific option.
834 *
835 * @param string $name The option name.
836 * @param mixed $default The value returned if the option does not exist.
837 *
838 * @return mixed The option value.
839 */
840 public function getOption($name, $default = null)
841 {
842 return array_key_exists($name, $this->options) ? $this->options[$name] : $default;
843 }
844
845 /**
846 * Unsupported method.
847 *
848 * @return integer Always returns 0.
849 */
850 public function count()
851 {
852 return 0;
853 }
854
855 /**
856 * Unsupported method.
857 *
858 * @return \EmptyIterator Always returns an empty iterator.
859 */
860 public function getIterator()
861 {
862 return new \EmptyIterator();
863 }
864}
diff --git a/vendor/symfony/form/Symfony/Component/Form/ButtonTypeInterface.php b/vendor/symfony/form/Symfony/Component/Form/ButtonTypeInterface.php
deleted file mode 100644
index dd5117c4..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/ButtonTypeInterface.php
+++ /dev/null
@@ -1,21 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form;
13
14/**
15 * A type that should be converted into a {@link Button} instance.
16 *
17 * @author Bernhard Schussek <bschussek@gmail.com>
18 */
19interface ButtonTypeInterface extends FormTypeInterface
20{
21}
diff --git a/vendor/symfony/form/Symfony/Component/Form/CHANGELOG.md b/vendor/symfony/form/Symfony/Component/Form/CHANGELOG.md
deleted file mode 100644
index a696c7be..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/CHANGELOG.md
+++ /dev/null
@@ -1,238 +0,0 @@
1CHANGELOG
2=========
3
4
52.3.0
6------
7
8 * deprecated FormPerformanceTestCase and FormIntegrationTestCase in the Symfony\Component\Form\Tests namespace and moved them to the Symfony\Component\Form\Test namespace
9 * deprecated TypeTestCase in the Symfony\Component\Form\Tests\Extension\Core\Type namespace and moved it to the Symfony\Component\Form\Test namespace
10 * changed FormRenderer::humanize() to humanize also camel cased field name
11 * added RequestHandlerInterface and FormInterface::handleRequest()
12 * deprecated passing a Request instance to FormInterface::bind()
13 * added options "method" and "action" to FormType
14 * deprecated option "virtual" in favor "inherit_data"
15 * deprecated VirtualFormAwareIterator in favor of InheritDataAwareIterator
16 * [BC BREAK] removed the "array" type hint from DataMapperInterface
17 * improved forms inheriting their parent data to actually return that data from getData(), getNormData() and getViewData()
18 * added component-level exceptions for various SPL exceptions
19 changed all uses of the deprecated Exception class to use more specialized exceptions instead
20 removed NotInitializedException, NotValidException, TypeDefinitionException, TypeLoaderException, CreationException
21 * added events PRE_SUBMIT, SUBMIT and POST_SUBMIT
22 * deprecated events PRE_BIND, BIND and POST_BIND
23 * [BC BREAK] renamed bind() and isBound() in FormInterface to submit() and isSubmitted()
24 * added methods submit() and isSubmitted() to Form
25 * deprecated bind() and isBound() in Form
26 * deprecated AlreadyBoundException in favor of AlreadySubmittedException
27 * added support for PATCH requests
28 * [BC BREAK] added initialize() to FormInterface
29 * [BC BREAK] added getAutoInitialize() to FormConfigInterface
30 * [BC BREAK] added setAutoInitialize() to FormConfigBuilderInterface
31 * [BC BREAK] initialization for Form instances added to a form tree must be manually disabled
32 * PRE_SET_DATA is now guaranteed to be called after children were added by the form builder,
33 unless FormInterface::setData() is called manually
34 * fixed CSRF error message to be translated
35 * custom CSRF error messages can now be set through the "csrf_message" option
36 * fixed: expanded single-choice fields now show a radio button for the empty value
37
382.2.0
39-----
40
41 * TrimListener now removes unicode whitespaces
42 * deprecated getParent(), setParent() and hasParent() in FormBuilderInterface
43 * FormInterface::add() now accepts a FormInterface instance OR a field's name, type and options
44 * removed special characters between the choice or text fields of DateType unless
45 the option "format" is set to a custom value
46 * deprecated FormException and introduced ExceptionInterface instead
47 * [BC BREAK] FormException is now an interface
48 * protected FormBuilder methods from being called when it is turned into a FormConfigInterface with getFormConfig()
49 * [BC BREAK] inserted argument `$message` in the constructor of `FormError`
50 * the PropertyPath class and related classes were moved to a dedicated
51 PropertyAccess component. During the move, InvalidPropertyException was
52 renamed to NoSuchPropertyException. FormUtil was split: FormUtil::singularify()
53 can now be found in Symfony\Component\PropertyAccess\StringUtil. The methods
54 getValue() and setValue() from PropertyPath were extracted into a new class
55 PropertyAccessor.
56 * added an optional PropertyAccessorInterface parameter to FormType,
57 ObjectChoiceList and PropertyPathMapper
58 * [BC BREAK] PropertyPathMapper and FormType now have a constructor
59 * [BC BREAK] setting the option "validation_groups" to ``false`` now disables validation
60 instead of assuming group "Default"
61
622.1.0
63-----
64
65 * [BC BREAK] ``read_only`` field attribute now renders as ``readonly="readonly"``, use ``disabled`` instead
66 * [BC BREAK] child forms now aren't validated anymore by default
67 * made validation of form children configurable (new option: cascade_validation)
68 * added support for validation groups as callbacks
69 * made the translation catalogue configurable via the "translation_domain" option
70 * added Form::getErrorsAsString() to help debugging forms
71 * allowed setting different options for RepeatedType fields (like the label)
72 * added support for empty form name at root level, this enables rendering forms
73 without form name prefix in field names
74 * [BC BREAK] form and field names must start with a letter, digit or underscore
75 and only contain letters, digits, underscores, hyphens and colons
76 * [BC BREAK] changed default name of the prototype in the "collection" type
77 from "$$name$$" to "\__name\__". No dollars are appended/prepended to custom
78 names anymore.
79 * [BC BREAK] improved ChoiceListInterface
80 * [BC BREAK] added SimpleChoiceList and LazyChoiceList as replacement of
81 ArrayChoiceList
82 * added ChoiceList and ObjectChoiceList to use objects as choices
83 * [BC BREAK] removed EntitiesToArrayTransformer and EntityToIdTransformer.
84 The former has been replaced by CollectionToArrayTransformer in combination
85 with EntityChoiceList, the latter is not required in the core anymore.
86 * [BC BREAK] renamed
87 * ArrayToBooleanChoicesTransformer to ChoicesToBooleanArrayTransformer
88 * ScalarToBooleanChoicesTransformer to ChoiceToBooleanArrayTransformer
89 * ArrayToChoicesTransformer to ChoicesToValuesTransformer
90 * ScalarToChoiceTransformer to ChoiceToValueTransformer
91 to be consistent with the naming in ChoiceListInterface.
92 They were merged into ChoiceList and have no public equivalent anymore.
93 * choice fields now throw a FormException if neither the "choices" nor the
94 "choice_list" option is set
95 * the radio type is now a child of the checkbox type
96 * the collection, choice (with multiple selection) and entity (with multiple
97 selection) types now make use of addXxx() and removeXxx() methods in your
98 model if you set "by_reference" to false. For a custom, non-recognized
99 singular form, set the "property_path" option like this: "plural|singular"
100 * forms now don't create an empty object anymore if they are completely
101 empty and not required. The empty value for such forms is null.
102 * added constant Guess::VERY_HIGH_CONFIDENCE
103 * [BC BREAK] The methods `add`, `remove`, `setParent`, `bind` and `setData`
104 in class Form now throw an exception if the form is already bound
105 * fields of constrained classes without a NotBlank or NotNull constraint are
106 set to not required now, as stated in the docs
107 * fixed TimeType and DateTimeType to not display seconds when "widget" is
108 "single_text" unless "with_seconds" is set to true
109 * checkboxes of in an expanded multiple-choice field don't include the choice
110 in their name anymore. Their names terminate with "[]" now.
111 * deprecated FormValidatorInterface and substituted its implementations
112 by event subscribers
113 * simplified CSRF protection and removed the csrf type
114 * deprecated FieldType and merged it into FormType
115 * added new option "compound" that lets you switch between field and form behavior
116 * [BC BREAK] renamed theme blocks
117 * "field_*" to "form_*"
118 * "field_widget" to "form_widget_simple"
119 * "widget_choice_options" to "choice_widget_options"
120 * "generic_label" to "form_label"
121 * added theme blocks "form_widget_compound", "choice_widget_expanded" and
122 "choice_widget_collapsed" to make theming more modular
123 * ValidatorTypeGuesser now guesses "collection" for array type constraint
124 * added method `guessPattern` to FormTypeGuesserInterface to guess which pattern to use in the HTML5 attribute "pattern"
125 * deprecated method `guessMinLength` in favor of `guessPattern`
126 * labels don't display field attributes anymore. Label attributes can be
127 passed in the "label_attr" option/variable
128 * added option "mapped" which should be used instead of setting "property_path" to false
129 * [BC BREAK] "data_class" now *must* be set if a form maps to an object and should be left empty otherwise
130 * improved error mapping on forms
131 * dot (".") rules are now allowed to map errors assigned to a form to
132 one of its children
133 * errors are not mapped to unsynchronized forms anymore
134 * [BC BREAK] changed Form constructor to accept a single `FormConfigInterface` object
135 * [BC BREAK] changed argument order in the FormBuilder constructor
136 * added Form method `getViewData`
137 * deprecated Form methods
138 * `getTypes`
139 * `getErrorBubbling`
140 * `getNormTransformers`
141 * `getClientTransformers`
142 * `getAttribute`
143 * `hasAttribute`
144 * `getClientData`
145 * added FormBuilder methods
146 * `getTypes`
147 * `addViewTransformer`
148 * `getViewTransformers`
149 * `resetViewTransformers`
150 * `addModelTransformer`
151 * `getModelTransformers`
152 * `resetModelTransformers`
153 * deprecated FormBuilder methods
154 * `prependClientTransformer`
155 * `appendClientTransformer`
156 * `getClientTransformers`
157 * `resetClientTransformers`
158 * `prependNormTransformer`
159 * `appendNormTransformer`
160 * `getNormTransformers`
161 * `resetNormTransformers`
162 * deprecated the option "validation_constraint" in favor of the new
163 option "constraints"
164 * removed superfluous methods from DataMapperInterface
165 * `mapFormToData`
166 * `mapDataToForm`
167 * added `setDefaultOptions` to FormTypeInterface and FormTypeExtensionInterface
168 which accepts an OptionsResolverInterface instance
169 * deprecated the methods `getDefaultOptions` and `getAllowedOptionValues`
170 in FormTypeInterface and FormTypeExtensionInterface
171 * options passed during construction can now be accessed from FormConfigInterface
172 * added FormBuilderInterface and FormConfigEditorInterface
173 * [BC BREAK] the method `buildForm` in FormTypeInterface and FormTypeExtensionInterface
174 now receives a FormBuilderInterface instead of a FormBuilder instance
175 * [BC BREAK] the method `buildViewBottomUp` was renamed to `finishView` in
176 FormTypeInterface and FormTypeExtensionInterface
177 * [BC BREAK] the options array is now passed as last argument of the
178 methods
179 * `buildView`
180 * `finishView`
181 in FormTypeInterface and FormTypeExtensionInterface
182 * [BC BREAK] no options are passed to `getParent` of FormTypeInterface anymore
183 * deprecated DataEvent and FilterDataEvent in favor of the new FormEvent which is
184 now passed to all events thrown by the component
185 * FormEvents::BIND now replaces FormEvents::BIND_NORM_DATA
186 * FormEvents::PRE_SET_DATA now replaces FormEvents::SET_DATA
187 * FormEvents::PRE_BIND now replaces FormEvents::BIND_CLIENT_DATA
188 * deprecated FormEvents::SET_DATA, FormEvents::BIND_CLIENT_DATA and
189 FormEvents::BIND_NORM_DATA
190 * [BC BREAK] reversed the order of the first two arguments to `createNamed`
191 and `createNamedBuilder` in `FormFactoryInterface`
192 * deprecated `getChildren` in Form and FormBuilder in favor of `all`
193 * deprecated `hasChildren` in Form and FormBuilder in favor of `count`
194 * FormBuilder now implements \IteratorAggregate
195 * [BC BREAK] compound forms now always need a data mapper
196 * FormBuilder now maintains the order when explicitly adding form builders as children
197 * ChoiceType now doesn't add the empty value anymore if the choices already contain an empty element
198 * DateType, TimeType and DateTimeType now show empty values again if not required
199 * [BC BREAK] fixed rendering of errors for DateType, BirthdayType and similar ones
200 * [BC BREAK] fixed: form constraints are only validated if they belong to the validated group
201 * deprecated `bindRequest` in `Form` and replaced it by a listener to FormEvents::PRE_BIND
202 * fixed: the "data" option supersedes default values from the model
203 * changed DateType to refer to the "format" option for calculating the year and day choices instead
204 of padding them automatically
205 * [BC BREAK] DateType defaults to the format "yyyy-MM-dd" now if the widget is
206 "single_text", in order to support the HTML 5 date field out of the box
207 * added the option "format" to DateTimeType
208 * [BC BREAK] DateTimeType now outputs RFC 3339 dates by default, as generated and
209 consumed by HTML5 browsers, if the widget is "single_text"
210 * deprecated the options "data_timezone" and "user_timezone" in DateType, DateTimeType and TimeType
211 and renamed them to "model_timezone" and "view_timezone"
212 * fixed: TransformationFailedExceptions thrown in the model transformer are now caught by the form
213 * added FormRegistryInterface, ResolvedFormTypeInterface and ResolvedFormTypeFactoryInterface
214 * deprecated FormFactory methods
215 * `addType`
216 * `hasType`
217 * `getType`
218 * [BC BREAK] FormFactory now expects a FormRegistryInterface and a ResolvedFormTypeFactoryInterface as constructor argument
219 * [BC BREAK] The method `createBuilder` in FormTypeInterface is not supported anymore for performance reasons
220 * [BC BREAK] Removed `setTypes` from FormBuilder
221 * deprecated AbstractType methods
222 * `getExtensions`
223 * `setExtensions`
224 * ChoiceType now caches its created choice lists to improve performance
225 * [BC BREAK] Rows of a collection field cannot be themed individually anymore. All rows in the collection
226 field now have the same block names, which contains "entry" where it previously contained the row index.
227 * [BC BREAK] When registering a type through the DI extension, the tag alias has to match the actual type name.
228 * added FormRendererInterface, FormRendererEngineInterface and implementations of these interfaces
229 * [BC BREAK] removed the following methods from FormUtil:
230 * `toArrayKey`
231 * `toArrayKeys`
232 * `isChoiceGroup`
233 * `isChoiceSelected`
234 * [BC BREAK] renamed method `renderBlock` in FormHelper to `block` and changed its signature
235 * made FormView properties public and deprecated their accessor methods
236 * made the normalized data of a form accessible in the template through the variable "form.vars.data"
237 * made the original data of a choice accessible in the template through the property "choice.data"
238 * added convenience class Forms and FormFactoryBuilderInterface
diff --git a/vendor/symfony/form/Symfony/Component/Form/CallbackTransformer.php b/vendor/symfony/form/Symfony/Component/Form/CallbackTransformer.php
deleted file mode 100644
index 1dfe8900..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/CallbackTransformer.php
+++ /dev/null
@@ -1,70 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form;
13
14class CallbackTransformer implements DataTransformerInterface
15{
16 /**
17 * The callback used for forward transform
18 * @var \Closure
19 */
20 private $transform;
21
22 /**
23 * The callback used for reverse transform
24 * @var \Closure
25 */
26 private $reverseTransform;
27
28 /**
29 * Constructor.
30 *
31 * @param \Closure $transform The forward transform callback
32 * @param \Closure $reverseTransform The reverse transform callback
33 */
34 public function __construct(\Closure $transform, \Closure $reverseTransform)
35 {
36 $this->transform = $transform;
37 $this->reverseTransform = $reverseTransform;
38 }
39
40 /**
41 * Transforms a value from the original representation to a transformed representation.
42 *
43 * @param mixed $data The value in the original representation
44 *
45 * @return mixed The value in the transformed representation
46 *
47 * @throws UnexpectedTypeException when the argument is not a string
48 * @throws TransformationFailedException when the transformation fails
49 */
50 public function transform($data)
51 {
52 return call_user_func($this->transform, $data);
53 }
54
55 /**
56 * Transforms a value from the transformed representation to its original
57 * representation.
58 *
59 * @param mixed $data The value in the transformed representation
60 *
61 * @return mixed The value in the original representation
62 *
63 * @throws UnexpectedTypeException when the argument is not of the expected type
64 * @throws TransformationFailedException when the transformation fails
65 */
66 public function reverseTransform($data)
67 {
68 return call_user_func($this->reverseTransform, $data);
69 }
70}
diff --git a/vendor/symfony/form/Symfony/Component/Form/ClickableInterface.php b/vendor/symfony/form/Symfony/Component/Form/ClickableInterface.php
deleted file mode 100644
index 893f02df..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/ClickableInterface.php
+++ /dev/null
@@ -1,27 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form;
13
14/**
15 * A clickable form element.
16 *
17 * @author Bernhard Schussek <bschussek@gmail.com>
18 */
19interface ClickableInterface
20{
21 /**
22 * Returns whether this element was clicked.
23 *
24 * @return Boolean Whether this element was clicked.
25 */
26 public function isClicked();
27}
diff --git a/vendor/symfony/form/Symfony/Component/Form/DataMapperInterface.php b/vendor/symfony/form/Symfony/Component/Form/DataMapperInterface.php
deleted file mode 100644
index 6e031682..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/DataMapperInterface.php
+++ /dev/null
@@ -1,38 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form;
13
14/**
15 * @author Bernhard Schussek <bschussek@gmail.com>
16 */
17interface DataMapperInterface
18{
19 /**
20 * Maps properties of some data to a list of forms.
21 *
22 * @param mixed $data Structured data.
23 * @param FormInterface[] $forms A list of {@link FormInterface} instances.
24 *
25 * @throws Exception\UnexpectedTypeException if the type of the data parameter is not supported.
26 */
27 public function mapDataToForms($data, $forms);
28
29 /**
30 * Maps the data of a list of forms into the properties of some data.
31 *
32 * @param FormInterface[] $forms A list of {@link FormInterface} instances.
33 * @param mixed $data Structured data.
34 *
35 * @throws Exception\UnexpectedTypeException if the type of the data parameter is not supported.
36 */
37 public function mapFormsToData($forms, &$data);
38}
diff --git a/vendor/symfony/form/Symfony/Component/Form/DataTransformerInterface.php b/vendor/symfony/form/Symfony/Component/Form/DataTransformerInterface.php
deleted file mode 100644
index 6567da25..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/DataTransformerInterface.php
+++ /dev/null
@@ -1,77 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form;
13
14use Symfony\Component\Form\Exception\TransformationFailedException;
15
16/**
17 * Transforms a value between different representations.
18 *
19 * @author Bernhard Schussek <bschussek@gmail.com>
20 */
21interface DataTransformerInterface
22{
23 /**
24 * Transforms a value from the original representation to a transformed representation.
25 *
26 * This method is called on two occasions inside a form field:
27 *
28 * 1. When the form field is initialized with the data attached from the datasource (object or array).
29 * 2. When data from a request is submitted using {@link Form::submit()} to transform the new input data
30 * back into the renderable format. For example if you have a date field and submit '2009-10-10'
31 * you might accept this value because its easily parsed, but the transformer still writes back
32 * "2009/10/10" onto the form field (for further displaying or other purposes).
33 *
34 * This method must be able to deal with empty values. Usually this will
35 * be NULL, but depending on your implementation other empty values are
36 * possible as well (such as empty strings). The reasoning behind this is
37 * that value transformers must be chainable. If the transform() method
38 * of the first value transformer outputs NULL, the second value transformer
39 * must be able to process that value.
40 *
41 * By convention, transform() should return an empty string if NULL is
42 * passed.
43 *
44 * @param mixed $value The value in the original representation
45 *
46 * @return mixed The value in the transformed representation
47 *
48 * @throws TransformationFailedException When the transformation fails.
49 */
50 public function transform($value);
51
52 /**
53 * Transforms a value from the transformed representation to its original
54 * representation.
55 *
56 * This method is called when {@link Form::submit()} is called to transform the requests tainted data
57 * into an acceptable format for your data processing/model layer.
58 *
59 * This method must be able to deal with empty values. Usually this will
60 * be an empty string, but depending on your implementation other empty
61 * values are possible as well (such as empty strings). The reasoning behind
62 * this is that value transformers must be chainable. If the
63 * reverseTransform() method of the first value transformer outputs an
64 * empty string, the second value transformer must be able to process that
65 * value.
66 *
67 * By convention, reverseTransform() should return NULL if an empty string
68 * is passed.
69 *
70 * @param mixed $value The value in the transformed representation
71 *
72 * @return mixed The value in the original representation
73 *
74 * @throws TransformationFailedException When the transformation fails.
75 */
76 public function reverseTransform($value);
77}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Exception/AlreadyBoundException.php b/vendor/symfony/form/Symfony/Component/Form/Exception/AlreadyBoundException.php
deleted file mode 100644
index 7ef0ca02..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Exception/AlreadyBoundException.php
+++ /dev/null
@@ -1,22 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Exception;
13
14/**
15 * Alias of {@link AlreadySubmittedException}.
16 *
17 * @deprecated Deprecated since version 2.3, to be removed in 3.0. Use
18 * {@link AlreadySubmittedException} instead.
19 */
20class AlreadyBoundException extends LogicException
21{
22}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Exception/AlreadySubmittedException.php b/vendor/symfony/form/Symfony/Component/Form/Exception/AlreadySubmittedException.php
deleted file mode 100644
index 7be21249..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Exception/AlreadySubmittedException.php
+++ /dev/null
@@ -1,22 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Exception;
13
14/**
15 * Thrown when an operation is called that is not acceptable after submitting
16 * a form.
17 *
18 * @author Bernhard Schussek <bschussek@gmail.com>
19 */
20class AlreadySubmittedException extends AlreadyBoundException
21{
22}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Exception/BadMethodCallException.php b/vendor/symfony/form/Symfony/Component/Form/Exception/BadMethodCallException.php
deleted file mode 100644
index 27649dd0..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Exception/BadMethodCallException.php
+++ /dev/null
@@ -1,21 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Exception;
13
14/**
15 * Base BadMethodCallException for the Form component.
16 *
17 * @author Bernhard Schussek <bschussek@gmail.com>
18 */
19class BadMethodCallException extends \BadMethodCallException implements ExceptionInterface
20{
21}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Exception/ErrorMappingException.php b/vendor/symfony/form/Symfony/Component/Form/Exception/ErrorMappingException.php
deleted file mode 100644
index a6968492..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Exception/ErrorMappingException.php
+++ /dev/null
@@ -1,16 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Exception;
13
14class ErrorMappingException extends RuntimeException
15{
16}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Exception/ExceptionInterface.php b/vendor/symfony/form/Symfony/Component/Form/Exception/ExceptionInterface.php
deleted file mode 100644
index d455932e..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Exception/ExceptionInterface.php
+++ /dev/null
@@ -1,21 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Exception;
13
14/**
15 * Base ExceptionInterface for the Form component.
16 *
17 * @author Bernhard Schussek <bschussek@gmail.com>
18 */
19interface ExceptionInterface
20{
21}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Exception/InvalidArgumentException.php b/vendor/symfony/form/Symfony/Component/Form/Exception/InvalidArgumentException.php
deleted file mode 100644
index a270e0ce..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Exception/InvalidArgumentException.php
+++ /dev/null
@@ -1,21 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Exception;
13
14/**
15 * Base InvalidArgumentException for the Form component.
16 *
17 * @author Bernhard Schussek <bschussek@gmail.com>
18 */
19class InvalidArgumentException extends \InvalidArgumentException implements ExceptionInterface
20{
21}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Exception/InvalidConfigurationException.php b/vendor/symfony/form/Symfony/Component/Form/Exception/InvalidConfigurationException.php
deleted file mode 100644
index daa0c42f..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Exception/InvalidConfigurationException.php
+++ /dev/null
@@ -1,16 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Exception;
13
14class InvalidConfigurationException extends InvalidArgumentException
15{
16}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Exception/LogicException.php b/vendor/symfony/form/Symfony/Component/Form/Exception/LogicException.php
deleted file mode 100644
index 84878021..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Exception/LogicException.php
+++ /dev/null
@@ -1,21 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Exception;
13
14/**
15 * Base LogicException for Form component.
16 *
17 * @author Alexander Kotynia <aleksander.kot@gmail.com>
18 */
19class LogicException extends \LogicException implements ExceptionInterface
20{
21}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Exception/OutOfBoundsException.php b/vendor/symfony/form/Symfony/Component/Form/Exception/OutOfBoundsException.php
deleted file mode 100644
index 44d31166..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Exception/OutOfBoundsException.php
+++ /dev/null
@@ -1,21 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Exception;
13
14/**
15 * Base OutOfBoundsException for Form component.
16 *
17 * @author Alexander Kotynia <aleksander.kot@gmail.com>
18 */
19class OutOfBoundsException extends \OutOfBoundsException implements ExceptionInterface
20{
21}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Exception/RuntimeException.php b/vendor/symfony/form/Symfony/Component/Form/Exception/RuntimeException.php
deleted file mode 100644
index 0af48a4a..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Exception/RuntimeException.php
+++ /dev/null
@@ -1,21 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Exception;
13
14/**
15 * Base RuntimeException for the Form component.
16 *
17 * @author Bernhard Schussek <bschussek@gmail.com>
18 */
19class RuntimeException extends \RuntimeException implements ExceptionInterface
20{
21}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Exception/StringCastException.php b/vendor/symfony/form/Symfony/Component/Form/Exception/StringCastException.php
deleted file mode 100644
index f9b51d60..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Exception/StringCastException.php
+++ /dev/null
@@ -1,16 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Exception;
13
14class StringCastException extends RuntimeException
15{
16}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Exception/TransformationFailedException.php b/vendor/symfony/form/Symfony/Component/Form/Exception/TransformationFailedException.php
deleted file mode 100644
index d32896e6..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Exception/TransformationFailedException.php
+++ /dev/null
@@ -1,21 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Exception;
13
14/**
15 * Indicates a value transformation error.
16 *
17 * @author Bernhard Schussek <bschussek@gmail.com>
18 */
19class TransformationFailedException extends RuntimeException
20{
21}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Exception/UnexpectedTypeException.php b/vendor/symfony/form/Symfony/Component/Form/Exception/UnexpectedTypeException.php
deleted file mode 100644
index 474e244b..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Exception/UnexpectedTypeException.php
+++ /dev/null
@@ -1,20 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Exception;
13
14class UnexpectedTypeException extends InvalidArgumentException
15{
16 public function __construct($value, $expectedType)
17 {
18 parent::__construct(sprintf('Expected argument of type "%s", "%s" given', $expectedType, is_object($value) ? get_class($value) : gettype($value)));
19 }
20}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Extension/Core/ChoiceList/ChoiceList.php b/vendor/symfony/form/Symfony/Component/Form/Extension/Core/ChoiceList/ChoiceList.php
deleted file mode 100644
index f9d381cd..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Extension/Core/ChoiceList/ChoiceList.php
+++ /dev/null
@@ -1,510 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Extension\Core\ChoiceList;
13
14use Symfony\Component\Form\FormConfigBuilder;
15use Symfony\Component\Form\Exception\UnexpectedTypeException;
16use Symfony\Component\Form\Exception\InvalidConfigurationException;
17use Symfony\Component\Form\Exception\InvalidArgumentException;
18use Symfony\Component\Form\Extension\Core\View\ChoiceView;
19
20/**
21 * A choice list for choices of arbitrary data types.
22 *
23 * Choices and labels are passed in two arrays. The indices of the choices
24 * and the labels should match. Choices may also be given as hierarchy of
25 * unlimited depth by creating nested arrays. The title of the sub-hierarchy
26 * can be stored in the array key pointing to the nested array. The topmost
27 * level of the hierarchy may also be a \Traversable.
28 *
29 * <code>
30 * $choices = array(true, false);
31 * $labels = array('Agree', 'Disagree');
32 * $choiceList = new ChoiceList($choices, $labels);
33 * </code>
34 *
35 * @author Bernhard Schussek <bschussek@gmail.com>
36 */
37class ChoiceList implements ChoiceListInterface
38{
39 /**
40 * The choices with their indices as keys.
41 *
42 * @var array
43 */
44 private $choices = array();
45
46 /**
47 * The choice values with the indices of the matching choices as keys.
48 *
49 * @var array
50 */
51 private $values = array();
52
53 /**
54 * The preferred view objects as hierarchy containing also the choice groups
55 * with the indices of the matching choices as bottom-level keys.
56 *
57 * @var array
58 */
59 private $preferredViews = array();
60
61 /**
62 * The non-preferred view objects as hierarchy containing also the choice
63 * groups with the indices of the matching choices as bottom-level keys.
64 *
65 * @var array
66 */
67 private $remainingViews = array();
68
69 /**
70 * Creates a new choice list.
71 *
72 * @param array|\Traversable $choices The array of choices. Choices may also be given
73 * as hierarchy of unlimited depth. Hierarchies are
74 * created by creating nested arrays. The title of
75 * the sub-hierarchy can be stored in the array
76 * key pointing to the nested array. The topmost
77 * level of the hierarchy may also be a \Traversable.
78 * @param array $labels The array of labels. The structure of this array
79 * should match the structure of $choices.
80 * @param array $preferredChoices A flat array of choices that should be
81 * presented to the user with priority.
82 *
83 * @throws UnexpectedTypeException If the choices are not an array or \Traversable.
84 */
85 public function __construct($choices, array $labels, array $preferredChoices = array())
86 {
87 if (!is_array($choices) && !$choices instanceof \Traversable) {
88 throw new UnexpectedTypeException($choices, 'array or \Traversable');
89 }
90
91 $this->initialize($choices, $labels, $preferredChoices);
92 }
93
94 /**
95 * Initializes the list with choices.
96 *
97 * Safe to be called multiple times. The list is cleared on every call.
98 *
99 * @param array|\Traversable $choices The choices to write into the list.
100 * @param array $labels The labels belonging to the choices.
101 * @param array $preferredChoices The choices to display with priority.
102 */
103 protected function initialize($choices, array $labels, array $preferredChoices)
104 {
105 $this->choices = array();
106 $this->values = array();
107 $this->preferredViews = array();
108 $this->remainingViews = array();
109
110 $this->addChoices(
111 $this->preferredViews,
112 $this->remainingViews,
113 $choices,
114 $labels,
115 $preferredChoices
116 );
117 }
118
119 /**
120 * {@inheritdoc}
121 */
122 public function getChoices()
123 {
124 return $this->choices;
125 }
126
127 /**
128 * {@inheritdoc}
129 */
130 public function getValues()
131 {
132 return $this->values;
133 }
134
135 /**
136 * {@inheritdoc}
137 */
138 public function getPreferredViews()
139 {
140 return $this->preferredViews;
141 }
142
143 /**
144 * {@inheritdoc}
145 */
146 public function getRemainingViews()
147 {
148 return $this->remainingViews;
149 }
150
151 /**
152 * {@inheritdoc}
153 */
154 public function getChoicesForValues(array $values)
155 {
156 $values = $this->fixValues($values);
157 $choices = array();
158
159 foreach ($values as $j => $givenValue) {
160 foreach ($this->values as $i => $value) {
161 if ($value === $givenValue) {
162 $choices[] = $this->choices[$i];
163 unset($values[$j]);
164
165 if (0 === count($values)) {
166 break 2;
167 }
168 }
169 }
170 }
171
172 return $choices;
173 }
174
175 /**
176 * {@inheritdoc}
177 */
178 public function getValuesForChoices(array $choices)
179 {
180 $choices = $this->fixChoices($choices);
181 $values = array();
182
183 foreach ($this->choices as $i => $choice) {
184 foreach ($choices as $j => $givenChoice) {
185 if ($choice === $givenChoice) {
186 $values[] = $this->values[$i];
187 unset($choices[$j]);
188
189 if (0 === count($choices)) {
190 break 2;
191 }
192 }
193 }
194 }
195
196 return $values;
197 }
198
199 /**
200 * {@inheritdoc}
201 */
202 public function getIndicesForChoices(array $choices)
203 {
204 $choices = $this->fixChoices($choices);
205 $indices = array();
206
207 foreach ($this->choices as $i => $choice) {
208 foreach ($choices as $j => $givenChoice) {
209 if ($choice === $givenChoice) {
210 $indices[] = $i;
211 unset($choices[$j]);
212
213 if (0 === count($choices)) {
214 break 2;
215 }
216 }
217 }
218 }
219
220 return $indices;
221 }
222
223 /**
224 * {@inheritdoc}
225 */
226 public function getIndicesForValues(array $values)
227 {
228 $values = $this->fixValues($values);
229 $indices = array();
230
231 foreach ($this->values as $i => $value) {
232 foreach ($values as $j => $givenValue) {
233 if ($value === $givenValue) {
234 $indices[] = $i;
235 unset($values[$j]);
236
237 if (0 === count($values)) {
238 break 2;
239 }
240 }
241 }
242 }
243
244 return $indices;
245 }
246
247 /**
248 * Recursively adds the given choices to the list.
249 *
250 * @param array $bucketForPreferred The bucket where to store the preferred
251 * view objects.
252 * @param array $bucketForRemaining The bucket where to store the
253 * non-preferred view objects.
254 * @param array|\Traversable $choices The list of choices.
255 * @param array $labels The labels corresponding to the choices.
256 * @param array $preferredChoices The preferred choices.
257 *
258 * @throws InvalidArgumentException If the structures of the choices and labels array do not match.
259 * @throws InvalidConfigurationException If no valid value or index could be created for a choice.
260 */
261 protected function addChoices(array &$bucketForPreferred, array &$bucketForRemaining, $choices, array $labels, array $preferredChoices)
262 {
263 // Add choices to the nested buckets
264 foreach ($choices as $group => $choice) {
265 if (!array_key_exists($group, $labels)) {
266 throw new InvalidArgumentException('The structures of the choices and labels array do not match.');
267 }
268
269 if (is_array($choice)) {
270 // Don't do the work if the array is empty
271 if (count($choice) > 0) {
272 $this->addChoiceGroup(
273 $group,
274 $bucketForPreferred,
275 $bucketForRemaining,
276 $choice,
277 $labels[$group],
278 $preferredChoices
279 );
280 }
281 } else {
282 $this->addChoice(
283 $bucketForPreferred,
284 $bucketForRemaining,
285 $choice,
286 $labels[$group],
287 $preferredChoices
288 );
289 }
290 }
291 }
292
293 /**
294 * Recursively adds a choice group.
295 *
296 * @param string $group The name of the group.
297 * @param array $bucketForPreferred The bucket where to store the preferred
298 * view objects.
299 * @param array $bucketForRemaining The bucket where to store the
300 * non-preferred view objects.
301 * @param array $choices The list of choices in the group.
302 * @param array $labels The labels corresponding to the choices in the group.
303 * @param array $preferredChoices The preferred choices.
304 *
305 * @throws InvalidConfigurationException If no valid value or index could be created for a choice.
306 */
307 protected function addChoiceGroup($group, array &$bucketForPreferred, array &$bucketForRemaining, array $choices, array $labels, array $preferredChoices)
308 {
309 // If this is a choice group, create a new level in the choice
310 // key hierarchy
311 $bucketForPreferred[$group] = array();
312 $bucketForRemaining[$group] = array();
313
314 $this->addChoices(
315 $bucketForPreferred[$group],
316 $bucketForRemaining[$group],
317 $choices,
318 $labels,
319 $preferredChoices
320 );
321
322 // Remove child levels if empty
323 if (empty($bucketForPreferred[$group])) {
324 unset($bucketForPreferred[$group]);
325 }
326 if (empty($bucketForRemaining[$group])) {
327 unset($bucketForRemaining[$group]);
328 }
329 }
330
331 /**
332 * Adds a new choice.
333 *
334 * @param array $bucketForPreferred The bucket where to store the preferred
335 * view objects.
336 * @param array $bucketForRemaining The bucket where to store the
337 * non-preferred view objects.
338 * @param mixed $choice The choice to add.
339 * @param string $label The label for the choice.
340 * @param array $preferredChoices The preferred choices.
341 *
342 * @throws InvalidConfigurationException If no valid value or index could be created.
343 */
344 protected function addChoice(array &$bucketForPreferred, array &$bucketForRemaining, $choice, $label, array $preferredChoices)
345 {
346 $index = $this->createIndex($choice);
347
348 if ('' === $index || null === $index || !FormConfigBuilder::isValidName((string) $index)) {
349 throw new InvalidConfigurationException(sprintf('The index "%s" created by the choice list is invalid. It should be a valid, non-empty Form name.', $index));
350 }
351
352 $value = $this->createValue($choice);
353
354 if (!is_string($value)) {
355 throw new InvalidConfigurationException(sprintf('The value created by the choice list is of type "%s", but should be a string.', gettype($value)));
356 }
357
358 $view = new ChoiceView($choice, $value, $label);
359
360 $this->choices[$index] = $this->fixChoice($choice);
361 $this->values[$index] = $value;
362
363 if ($this->isPreferred($choice, $preferredChoices)) {
364 $bucketForPreferred[$index] = $view;
365 } else {
366 $bucketForRemaining[$index] = $view;
367 }
368 }
369
370 /**
371 * Returns whether the given choice should be preferred judging by the
372 * given array of preferred choices.
373 *
374 * Extension point to optimize performance by changing the structure of the
375 * $preferredChoices array.
376 *
377 * @param mixed $choice The choice to test.
378 * @param array $preferredChoices An array of preferred choices.
379 *
380 * @return Boolean Whether the choice is preferred.
381 */
382 protected function isPreferred($choice, array $preferredChoices)
383 {
384 return false !== array_search($choice, $preferredChoices, true);
385 }
386
387 /**
388 * Creates a new unique index for this choice.
389 *
390 * Extension point to change the indexing strategy.
391 *
392 * @param mixed $choice The choice to create an index for
393 *
394 * @return integer|string A unique index containing only ASCII letters,
395 * digits and underscores.
396 */
397 protected function createIndex($choice)
398 {
399 return count($this->choices);
400 }
401
402 /**
403 * Creates a new unique value for this choice.
404 *
405 * By default, an integer is generated since it cannot be guaranteed that
406 * all values in the list are convertible to (unique) strings. Subclasses
407 * can override this behaviour if they can guarantee this property.
408 *
409 * @param mixed $choice The choice to create a value for
410 *
411 * @return string A unique string.
412 */
413 protected function createValue($choice)
414 {
415 return (string) count($this->values);
416 }
417
418 /**
419 * Fixes the data type of the given choice value to avoid comparison
420 * problems.
421 *
422 * @param mixed $value The choice value.
423 *
424 * @return string The value as string.
425 */
426 protected function fixValue($value)
427 {
428 return (string) $value;
429 }
430
431 /**
432 * Fixes the data types of the given choice values to avoid comparison
433 * problems.
434 *
435 * @param array $values The choice values.
436 *
437 * @return array The values as strings.
438 */
439 protected function fixValues(array $values)
440 {
441 foreach ($values as $i => $value) {
442 $values[$i] = $this->fixValue($value);
443 }
444
445 return $values;
446 }
447
448 /**
449 * Fixes the data type of the given choice index to avoid comparison
450 * problems.
451 *
452 * @param mixed $index The choice index.
453 *
454 * @return integer|string The index as PHP array key.
455 */
456 protected function fixIndex($index)
457 {
458 if (is_bool($index) || (string) (int) $index === (string) $index) {
459 return (int) $index;
460 }
461
462 return (string) $index;
463 }
464
465 /**
466 * Fixes the data types of the given choice indices to avoid comparison
467 * problems.
468 *
469 * @param array $indices The choice indices.
470 *
471 * @return array The indices as strings.
472 */
473 protected function fixIndices(array $indices)
474 {
475 foreach ($indices as $i => $index) {
476 $indices[$i] = $this->fixIndex($index);
477 }
478
479 return $indices;
480 }
481
482 /**
483 * Fixes the data type of the given choice to avoid comparison problems.
484 *
485 * Extension point. In this implementation, choices are guaranteed to
486 * always maintain their type and thus can be typesafely compared.
487 *
488 * @param mixed $choice The choice.
489 *
490 * @return mixed The fixed choice.
491 */
492 protected function fixChoice($choice)
493 {
494 return $choice;
495 }
496
497 /**
498 * Fixes the data type of the given choices to avoid comparison problems.
499 *
500 * @param array $choices The choices.
501 *
502 * @return array The fixed choices.
503 *
504 * @see fixChoice
505 */
506 protected function fixChoices(array $choices)
507 {
508 return $choices;
509 }
510}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Extension/Core/ChoiceList/ChoiceListInterface.php b/vendor/symfony/form/Symfony/Component/Form/Extension/Core/ChoiceList/ChoiceListInterface.php
deleted file mode 100644
index 099ace82..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Extension/Core/ChoiceList/ChoiceListInterface.php
+++ /dev/null
@@ -1,149 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Extension\Core\ChoiceList;
13
14/**
15 * Contains choices that can be selected in a form field.
16 *
17 * Each choice has three different properties:
18 *
19 * - Choice: The choice that should be returned to the application by the
20 * choice field. Can be any scalar value or an object, but no
21 * array.
22 * - Label: A text representing the choice that is displayed to the user.
23 * - Value: A uniquely identifying value that can contain arbitrary
24 * characters, but no arrays or objects. This value is displayed
25 * in the HTML "value" attribute.
26 *
27 * @author Bernhard Schussek <bschussek@gmail.com>
28 */
29interface ChoiceListInterface
30{
31 /**
32 * Returns the list of choices
33 *
34 * @return array The choices with their indices as keys
35 */
36 public function getChoices();
37
38 /**
39 * Returns the values for the choices
40 *
41 * @return array The values with the corresponding choice indices as keys
42 */
43 public function getValues();
44
45 /**
46 * Returns the choice views of the preferred choices as nested array with
47 * the choice groups as top-level keys.
48 *
49 * Example:
50 *
51 * <source>
52 * array(
53 * 'Group 1' => array(
54 * 10 => ChoiceView object,
55 * 20 => ChoiceView object,
56 * ),
57 * 'Group 2' => array(
58 * 30 => ChoiceView object,
59 * ),
60 * )
61 * </source>
62 *
63 * @return array A nested array containing the views with the corresponding
64 * choice indices as keys on the lowest levels and the choice
65 * group names in the keys of the higher levels
66 */
67 public function getPreferredViews();
68
69 /**
70 * Returns the choice views of the choices that are not preferred as nested
71 * array with the choice groups as top-level keys.
72 *
73 * Example:
74 *
75 * <source>
76 * array(
77 * 'Group 1' => array(
78 * 10 => ChoiceView object,
79 * 20 => ChoiceView object,
80 * ),
81 * 'Group 2' => array(
82 * 30 => ChoiceView object,
83 * ),
84 * )
85 * </source>
86 *
87 * @return array A nested array containing the views with the corresponding
88 * choice indices as keys on the lowest levels and the choice
89 * group names in the keys of the higher levels
90 *
91 * @see getPreferredValues
92 */
93 public function getRemainingViews();
94
95 /**
96 * Returns the choices corresponding to the given values.
97 *
98 * The choices can have any data type.
99 *
100 * @param array $values An array of choice values. Not existing values in
101 * this array are ignored
102 *
103 * @return array An array of choices with ascending, 0-based numeric keys
104 */
105 public function getChoicesForValues(array $values);
106
107 /**
108 * Returns the values corresponding to the given choices.
109 *
110 * The values must be strings.
111 *
112 * @param array $choices An array of choices. Not existing choices in this
113 * array are ignored
114 *
115 * @return array An array of choice values with ascending, 0-based numeric
116 * keys
117 */
118 public function getValuesForChoices(array $choices);
119
120 /**
121 * Returns the indices corresponding to the given choices.
122 *
123 * The indices must be positive integers or strings accepted by
124 * {@link FormConfigBuilder::validateName()}.
125 *
126 * The index "placeholder" is internally reserved.
127 *
128 * @param array $choices An array of choices. Not existing choices in this
129 * array are ignored
130 *
131 * @return array An array of indices with ascending, 0-based numeric keys
132 */
133 public function getIndicesForChoices(array $choices);
134
135 /**
136 * Returns the indices corresponding to the given values.
137 *
138 * The indices must be positive integers or strings accepted by
139 * {@link FormConfigBuilder::validateName()}.
140 *
141 * The index "placeholder" is internally reserved.
142 *
143 * @param array $values An array of choice values. Not existing values in
144 * this array are ignored
145 *
146 * @return array An array of indices with ascending, 0-based numeric keys
147 */
148 public function getIndicesForValues(array $values);
149}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Extension/Core/ChoiceList/LazyChoiceList.php b/vendor/symfony/form/Symfony/Component/Form/Extension/Core/ChoiceList/LazyChoiceList.php
deleted file mode 100644
index 996f900c..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Extension/Core/ChoiceList/LazyChoiceList.php
+++ /dev/null
@@ -1,149 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Extension\Core\ChoiceList;
13
14use Symfony\Component\Form\Exception\InvalidArgumentException;
15
16/**
17 * A choice list that is loaded lazily
18 *
19 * This list loads itself as soon as any of the getters is accessed for the
20 * first time. You should implement loadChoiceList() in your child classes,
21 * which should return a ChoiceListInterface instance.
22 *
23 * @author Bernhard Schussek <bschussek@gmail.com>
24 */
25abstract class LazyChoiceList implements ChoiceListInterface
26{
27 /**
28 * The loaded choice list
29 *
30 * @var ChoiceListInterface
31 */
32 private $choiceList;
33
34 /**
35 * {@inheritdoc}
36 */
37 public function getChoices()
38 {
39 if (!$this->choiceList) {
40 $this->load();
41 }
42
43 return $this->choiceList->getChoices();
44 }
45
46 /**
47 * {@inheritdoc}
48 */
49 public function getValues()
50 {
51 if (!$this->choiceList) {
52 $this->load();
53 }
54
55 return $this->choiceList->getValues();
56 }
57
58 /**
59 * {@inheritdoc}
60 */
61 public function getPreferredViews()
62 {
63 if (!$this->choiceList) {
64 $this->load();
65 }
66
67 return $this->choiceList->getPreferredViews();
68 }
69
70 /**
71 * {@inheritdoc}
72 */
73 public function getRemainingViews()
74 {
75 if (!$this->choiceList) {
76 $this->load();
77 }
78
79 return $this->choiceList->getRemainingViews();
80 }
81
82 /**
83 * {@inheritdoc}
84 */
85 public function getChoicesForValues(array $values)
86 {
87 if (!$this->choiceList) {
88 $this->load();
89 }
90
91 return $this->choiceList->getChoicesForValues($values);
92 }
93
94 /**
95 * {@inheritdoc}
96 */
97 public function getValuesForChoices(array $choices)
98 {
99 if (!$this->choiceList) {
100 $this->load();
101 }
102
103 return $this->choiceList->getValuesForChoices($choices);
104 }
105
106 /**
107 * {@inheritdoc}
108 */
109 public function getIndicesForChoices(array $choices)
110 {
111 if (!$this->choiceList) {
112 $this->load();
113 }
114
115 return $this->choiceList->getIndicesForChoices($choices);
116 }
117
118 /**
119 * {@inheritdoc}
120 */
121 public function getIndicesForValues(array $values)
122 {
123 if (!$this->choiceList) {
124 $this->load();
125 }
126
127 return $this->choiceList->getIndicesForValues($values);
128 }
129
130 /**
131 * Loads the choice list
132 *
133 * Should be implemented by child classes.
134 *
135 * @return ChoiceListInterface The loaded choice list
136 */
137 abstract protected function loadChoiceList();
138
139 private function load()
140 {
141 $choiceList = $this->loadChoiceList();
142
143 if (!$choiceList instanceof ChoiceListInterface) {
144 throw new InvalidArgumentException(sprintf('loadChoiceList() should return a ChoiceListInterface instance. Got %s', gettype($choiceList)));
145 }
146
147 $this->choiceList = $choiceList;
148 }
149}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Extension/Core/ChoiceList/ObjectChoiceList.php b/vendor/symfony/form/Symfony/Component/Form/Extension/Core/ChoiceList/ObjectChoiceList.php
deleted file mode 100644
index 0a153883..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Extension/Core/ChoiceList/ObjectChoiceList.php
+++ /dev/null
@@ -1,184 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5*
6* (c) Fabien Potencier <fabien@symfony.com>
7*
8* For the full copyright and license information, please view the LICENSE
9* file that was distributed with this source code.
10*/
11
12namespace Symfony\Component\Form\Extension\Core\ChoiceList;
13
14use Symfony\Component\Form\Exception\StringCastException;
15use Symfony\Component\Form\Exception\InvalidArgumentException;
16use Symfony\Component\PropertyAccess\PropertyPath;
17use Symfony\Component\PropertyAccess\Exception\NoSuchPropertyException;
18use Symfony\Component\PropertyAccess\PropertyAccess;
19use Symfony\Component\PropertyAccess\PropertyAccessorInterface;
20
21/**
22 * A choice list for object choices.
23 *
24 * Supports generation of choice labels, choice groups and choice values
25 * by calling getters of the object (or associated objects).
26 *
27 * <code>
28 * $choices = array($user1, $user2);
29 *
30 * // call getName() to determine the choice labels
31 * $choiceList = new ObjectChoiceList($choices, 'name');
32 * </code>
33 *
34 * @author Bernhard Schussek <bschussek@gmail.com>
35 */
36class ObjectChoiceList extends ChoiceList
37{
38 /**
39 * @var PropertyAccessorInterface
40 */
41 private $propertyAccessor;
42
43 /**
44 * The property path used to obtain the choice label.
45 *
46 * @var PropertyPath
47 */
48 private $labelPath;
49
50 /**
51 * The property path used for object grouping.
52 *
53 * @var PropertyPath
54 */
55 private $groupPath;
56
57 /**
58 * The property path used to obtain the choice value.
59 *
60 * @var PropertyPath
61 */
62 private $valuePath;
63
64 /**
65 * Creates a new object choice list.
66 *
67 * @param array|\Traversable $choices The array of choices. Choices may also be given
68 * as hierarchy of unlimited depth by creating nested
69 * arrays. The title of the sub-hierarchy can be
70 * stored in the array key pointing to the nested
71 * array. The topmost level of the hierarchy may also
72 * be a \Traversable.
73 * @param string $labelPath A property path pointing to the property used
74 * for the choice labels. The value is obtained
75 * by calling the getter on the object. If the
76 * path is NULL, the object's __toString() method
77 * is used instead.
78 * @param array $preferredChoices A flat array of choices that should be
79 * presented to the user with priority.
80 * @param string $groupPath A property path pointing to the property used
81 * to group the choices. Only allowed if
82 * the choices are given as flat array.
83 * @param string $valuePath A property path pointing to the property used
84 * for the choice values. If not given, integers
85 * are generated instead.
86 * @param PropertyAccessorInterface $propertyAccessor The reflection graph for reading property paths.
87 */
88 public function __construct($choices, $labelPath = null, array $preferredChoices = array(), $groupPath = null, $valuePath = null, PropertyAccessorInterface $propertyAccessor = null)
89 {
90 $this->propertyAccessor = $propertyAccessor ?: PropertyAccess::getPropertyAccessor();
91 $this->labelPath = null !== $labelPath ? new PropertyPath($labelPath) : null;
92 $this->groupPath = null !== $groupPath ? new PropertyPath($groupPath) : null;
93 $this->valuePath = null !== $valuePath ? new PropertyPath($valuePath) : null;
94
95 parent::__construct($choices, array(), $preferredChoices);
96 }
97
98 /**
99 * Initializes the list with choices.
100 *
101 * Safe to be called multiple times. The list is cleared on every call.
102 *
103 * @param array|\Traversable $choices The choices to write into the list.
104 * @param array $labels Ignored.
105 * @param array $preferredChoices The choices to display with priority.
106 *
107 * @throws InvalidArgumentException When passing a hierarchy of choices and using
108 * the "groupPath" option at the same time.
109 */
110 protected function initialize($choices, array $labels, array $preferredChoices)
111 {
112 if (null !== $this->groupPath) {
113 $groupedChoices = array();
114
115 foreach ($choices as $i => $choice) {
116 if (is_array($choice)) {
117 throw new InvalidArgumentException('You should pass a plain object array (without groups) when using the "groupPath" option.');
118 }
119
120 try {
121 $group = $this->propertyAccessor->getValue($choice, $this->groupPath);
122 } catch (NoSuchPropertyException $e) {
123 // Don't group items whose group property does not exist
124 // see https://github.com/symfony/symfony/commit/d9b7abb7c7a0f28e0ce970afc5e305dce5dccddf
125 $group = null;
126 }
127
128 if (null === $group) {
129 $groupedChoices[$i] = $choice;
130 } else {
131 if (!isset($groupedChoices[$group])) {
132 $groupedChoices[$group] = array();
133 }
134
135 $groupedChoices[$group][$i] = $choice;
136 }
137 }
138
139 $choices = $groupedChoices;
140 }
141
142 $labels = array();
143
144 $this->extractLabels($choices, $labels);
145
146 parent::initialize($choices, $labels, $preferredChoices);
147 }
148
149 /**
150 * Creates a new unique value for this choice.
151 *
152 * If a property path for the value was given at object creation,
153 * the getter behind that path is now called to obtain a new value.
154 * Otherwise a new integer is generated.
155 *
156 * @param mixed $choice The choice to create a value for
157 *
158 * @return integer|string A unique value without character limitations.
159 */
160 protected function createValue($choice)
161 {
162 if ($this->valuePath) {
163 return (string) $this->propertyAccessor->getValue($choice, $this->valuePath);
164 }
165
166 return parent::createValue($choice);
167 }
168
169 private function extractLabels($choices, array &$labels)
170 {
171 foreach ($choices as $i => $choice) {
172 if (is_array($choice)) {
173 $labels[$i] = array();
174 $this->extractLabels($choice, $labels[$i]);
175 } elseif ($this->labelPath) {
176 $labels[$i] = $this->propertyAccessor->getValue($choice, $this->labelPath);
177 } elseif (method_exists($choice, '__toString')) {
178 $labels[$i] = (string) $choice;
179 } else {
180 throw new StringCastException(sprintf('A "__toString()" method was not found on the objects of type "%s" passed to the choice field. To read a custom getter instead, set the argument $labelPath to the desired property path.', get_class($choice)));
181 }
182 }
183 }
184}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Extension/Core/ChoiceList/SimpleChoiceList.php b/vendor/symfony/form/Symfony/Component/Form/Extension/Core/ChoiceList/SimpleChoiceList.php
deleted file mode 100644
index 914dbe5f..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Extension/Core/ChoiceList/SimpleChoiceList.php
+++ /dev/null
@@ -1,164 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Extension\Core\ChoiceList;
13
14/**
15 * A choice list for choices of type string or integer.
16 *
17 * Choices and their associated labels can be passed in a single array. Since
18 * choices are passed as array keys, only strings or integer choices are
19 * allowed. Choices may also be given as hierarchy of unlimited depth by
20 * creating nested arrays. The title of the sub-hierarchy can be stored in the
21 * array key pointing to the nested array.
22 *
23 * <code>
24 * $choiceList = new SimpleChoiceList(array(
25 * 'creditcard' => 'Credit card payment',
26 * 'cash' => 'Cash payment',
27 * ));
28 * </code>
29 *
30 * @author Bernhard Schussek <bschussek@gmail.com>
31 */
32class SimpleChoiceList extends ChoiceList
33{
34 /**
35 * Creates a new simple choice list.
36 *
37 * @param array $choices The array of choices with the choices as keys and
38 * the labels as values. Choices may also be given
39 * as hierarchy of unlimited depth by creating nested
40 * arrays. The title of the sub-hierarchy is stored
41 * in the array key pointing to the nested array.
42 * @param array $preferredChoices A flat array of choices that should be
43 * presented to the user with priority.
44 */
45 public function __construct(array $choices, array $preferredChoices = array())
46 {
47 // Flip preferred choices to speed up lookup
48 parent::__construct($choices, $choices, array_flip($preferredChoices));
49 }
50
51 /**
52 * {@inheritdoc}
53 */
54 public function getChoicesForValues(array $values)
55 {
56 $values = $this->fixValues($values);
57
58 // The values are identical to the choices, so we can just return them
59 // to improve performance a little bit
60 return $this->fixChoices(array_intersect($values, $this->getValues()));
61 }
62
63 /**
64 * {@inheritdoc}
65 */
66 public function getValuesForChoices(array $choices)
67 {
68 $choices = $this->fixChoices($choices);
69
70 // The choices are identical to the values, so we can just return them
71 // to improve performance a little bit
72 return $this->fixValues(array_intersect($choices, $this->getValues()));
73 }
74
75 /**
76 * Recursively adds the given choices to the list.
77 *
78 * Takes care of splitting the single $choices array passed in the
79 * constructor into choices and labels.
80 *
81 * @param array $bucketForPreferred The bucket where to store the preferred
82 * view objects.
83 * @param array $bucketForRemaining The bucket where to store the
84 * non-preferred view objects.
85 * @param array|\Traversable $choices The list of choices.
86 * @param array $labels Ignored.
87 * @param array $preferredChoices The preferred choices.
88 */
89 protected function addChoices(array &$bucketForPreferred, array &$bucketForRemaining, $choices, array $labels, array $preferredChoices)
90 {
91 // Add choices to the nested buckets
92 foreach ($choices as $choice => $label) {
93 if (is_array($label)) {
94 // Don't do the work if the array is empty
95 if (count($label) > 0) {
96 $this->addChoiceGroup(
97 $choice,
98 $bucketForPreferred,
99 $bucketForRemaining,
100 $label,
101 $label,
102 $preferredChoices
103 );
104 }
105 } else {
106 $this->addChoice(
107 $bucketForPreferred,
108 $bucketForRemaining,
109 $choice,
110 $label,
111 $preferredChoices
112 );
113 }
114 }
115 }
116
117 /**
118 * Returns whether the given choice should be preferred judging by the
119 * given array of preferred choices.
120 *
121 * Optimized for performance by treating the preferred choices as array
122 * where choices are stored in the keys.
123 *
124 * @param mixed $choice The choice to test.
125 * @param array $preferredChoices An array of preferred choices.
126 *
127 * @return Boolean Whether the choice is preferred.
128 */
129 protected function isPreferred($choice, array $preferredChoices)
130 {
131 // Optimize performance over the default implementation
132 return isset($preferredChoices[$choice]);
133 }
134
135 /**
136 * Converts the choice to a valid PHP array key.
137 *
138 * @param mixed $choice The choice.
139 *
140 * @return string|integer A valid PHP array key.
141 */
142 protected function fixChoice($choice)
143 {
144 return $this->fixIndex($choice);
145 }
146
147 /**
148 * {@inheritdoc}
149 */
150 protected function fixChoices(array $choices)
151 {
152 return $this->fixIndices($choices);
153 }
154
155 /**
156 * {@inheritdoc}
157 */
158 protected function createValue($choice)
159 {
160 // Choices are guaranteed to be unique and scalar, so we can simply
161 // convert them to strings
162 return (string) $choice;
163 }
164}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Extension/Core/CoreExtension.php b/vendor/symfony/form/Symfony/Component/Form/Extension/Core/CoreExtension.php
deleted file mode 100644
index bbcac4ba..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Extension/Core/CoreExtension.php
+++ /dev/null
@@ -1,59 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Extension\Core;
13
14use Symfony\Component\Form\AbstractExtension;
15use Symfony\Component\PropertyAccess\PropertyAccess;
16
17/**
18 * Represents the main form extension, which loads the core functionality.
19 *
20 * @author Bernhard Schussek <bschussek@gmail.com>
21 */
22class CoreExtension extends AbstractExtension
23{
24 protected function loadTypes()
25 {
26 return array(
27 new Type\FormType(PropertyAccess::getPropertyAccessor()),
28 new Type\BirthdayType(),
29 new Type\CheckboxType(),
30 new Type\ChoiceType(),
31 new Type\CollectionType(),
32 new Type\CountryType(),
33 new Type\DateType(),
34 new Type\DateTimeType(),
35 new Type\EmailType(),
36 new Type\HiddenType(),
37 new Type\IntegerType(),
38 new Type\LanguageType(),
39 new Type\LocaleType(),
40 new Type\MoneyType(),
41 new Type\NumberType(),
42 new Type\PasswordType(),
43 new Type\PercentType(),
44 new Type\RadioType(),
45 new Type\RepeatedType(),
46 new Type\SearchType(),
47 new Type\TextareaType(),
48 new Type\TextType(),
49 new Type\TimeType(),
50 new Type\TimezoneType(),
51 new Type\UrlType(),
52 new Type\FileType(),
53 new Type\ButtonType(),
54 new Type\SubmitType(),
55 new Type\ResetType(),
56 new Type\CurrencyType(),
57 );
58 }
59}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Extension/Core/DataMapper/PropertyPathMapper.php b/vendor/symfony/form/Symfony/Component/Form/Extension/Core/DataMapper/PropertyPathMapper.php
deleted file mode 100644
index d8bd9c71..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Extension/Core/DataMapper/PropertyPathMapper.php
+++ /dev/null
@@ -1,92 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Extension\Core\DataMapper;
13
14use Symfony\Component\Form\DataMapperInterface;
15use Symfony\Component\Form\Exception\UnexpectedTypeException;
16use Symfony\Component\PropertyAccess\PropertyAccess;
17use Symfony\Component\PropertyAccess\PropertyAccessorInterface;
18
19/**
20 * A data mapper using property paths to read/write data.
21 *
22 * @author Bernhard Schussek <bschussek@gmail.com>
23 */
24class PropertyPathMapper implements DataMapperInterface
25{
26 /**
27 * @var PropertyAccessorInterface
28 */
29 private $propertyAccessor;
30
31 /**
32 * Creates a new property path mapper.
33 *
34 * @param PropertyAccessorInterface $propertyAccessor
35 */
36 public function __construct(PropertyAccessorInterface $propertyAccessor = null)
37 {
38 $this->propertyAccessor = $propertyAccessor ?: PropertyAccess::getPropertyAccessor();
39 }
40
41 /**
42 * {@inheritdoc}
43 */
44 public function mapDataToForms($data, $forms)
45 {
46 if (null === $data || array() === $data) {
47 return;
48 }
49
50 if (!is_array($data) && !is_object($data)) {
51 throw new UnexpectedTypeException($data, 'object, array or empty');
52 }
53
54 foreach ($forms as $form) {
55 $propertyPath = $form->getPropertyPath();
56 $config = $form->getConfig();
57
58 if (null !== $propertyPath && $config->getMapped()) {
59 $form->setData($this->propertyAccessor->getValue($data, $propertyPath));
60 }
61 }
62 }
63
64 /**
65 * {@inheritdoc}
66 */
67 public function mapFormsToData($forms, &$data)
68 {
69 if (null === $data) {
70 return;
71 }
72
73 if (!is_array($data) && !is_object($data)) {
74 throw new UnexpectedTypeException($data, 'object, array or empty');
75 }
76
77 foreach ($forms as $form) {
78 $propertyPath = $form->getPropertyPath();
79 $config = $form->getConfig();
80
81 // Write-back is disabled if the form is not synchronized (transformation failed)
82 // and if the form is disabled (modification not allowed)
83 if (null !== $propertyPath && $config->getMapped() && $form->isSynchronized() && !$form->isDisabled()) {
84 // If the data is identical to the value in $data, we are
85 // dealing with a reference
86 if (!is_object($data) || !$config->getByReference() || $form->getData() !== $this->propertyAccessor->getValue($data, $propertyPath)) {
87 $this->propertyAccessor->setValue($data, $propertyPath, $form->getData());
88 }
89 }
90 }
91 }
92}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Extension/Core/DataTransformer/ArrayToPartsTransformer.php b/vendor/symfony/form/Symfony/Component/Form/Extension/Core/DataTransformer/ArrayToPartsTransformer.php
deleted file mode 100644
index fc080f25..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Extension/Core/DataTransformer/ArrayToPartsTransformer.php
+++ /dev/null
@@ -1,86 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Extension\Core\DataTransformer;
13
14use Symfony\Component\Form\DataTransformerInterface;
15use Symfony\Component\Form\Exception\TransformationFailedException;
16
17/**
18 * @author Bernhard Schussek <bschussek@gmail.com>
19 */
20class ArrayToPartsTransformer implements DataTransformerInterface
21{
22 private $partMapping;
23
24 public function __construct(array $partMapping)
25 {
26 $this->partMapping = $partMapping;
27 }
28
29 public function transform($array)
30 {
31 if (null === $array) {
32 $array = array();
33 }
34
35 if (!is_array($array) ) {
36 throw new TransformationFailedException('Expected an array.');
37 }
38
39 $result = array();
40
41 foreach ($this->partMapping as $partKey => $originalKeys) {
42 if (empty($array)) {
43 $result[$partKey] = null;
44 } else {
45 $result[$partKey] = array_intersect_key($array, array_flip($originalKeys));
46 }
47 }
48
49 return $result;
50 }
51
52 public function reverseTransform($array)
53 {
54 if (!is_array($array) ) {
55 throw new TransformationFailedException('Expected an array.');
56 }
57
58 $result = array();
59 $emptyKeys = array();
60
61 foreach ($this->partMapping as $partKey => $originalKeys) {
62 if (!empty($array[$partKey])) {
63 foreach ($originalKeys as $originalKey) {
64 if (isset($array[$partKey][$originalKey])) {
65 $result[$originalKey] = $array[$partKey][$originalKey];
66 }
67 }
68 } else {
69 $emptyKeys[] = $partKey;
70 }
71 }
72
73 if (count($emptyKeys) > 0) {
74 if (count($emptyKeys) === count($this->partMapping)) {
75 // All parts empty
76 return null;
77 }
78
79 throw new TransformationFailedException(
80 sprintf('The keys "%s" should not be empty', implode('", "', $emptyKeys)
81 ));
82 }
83
84 return $result;
85 }
86}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Extension/Core/DataTransformer/BaseDateTimeTransformer.php b/vendor/symfony/form/Symfony/Component/Form/Extension/Core/DataTransformer/BaseDateTimeTransformer.php
deleted file mode 100644
index e4e8932e..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Extension/Core/DataTransformer/BaseDateTimeTransformer.php
+++ /dev/null
@@ -1,52 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Extension\Core\DataTransformer;
13
14use Symfony\Component\Form\DataTransformerInterface;
15use Symfony\Component\Form\Exception\UnexpectedTypeException;
16
17abstract class BaseDateTimeTransformer implements DataTransformerInterface
18{
19 protected static $formats = array(
20 \IntlDateFormatter::NONE,
21 \IntlDateFormatter::FULL,
22 \IntlDateFormatter::LONG,
23 \IntlDateFormatter::MEDIUM,
24 \IntlDateFormatter::SHORT,
25 );
26
27 protected $inputTimezone;
28
29 protected $outputTimezone;
30
31 /**
32 * Constructor.
33 *
34 * @param string $inputTimezone The name of the input timezone
35 * @param string $outputTimezone The name of the output timezone
36 *
37 * @throws UnexpectedTypeException if a timezone is not a string
38 */
39 public function __construct($inputTimezone = null, $outputTimezone = null)
40 {
41 if (!is_string($inputTimezone) && null !== $inputTimezone) {
42 throw new UnexpectedTypeException($inputTimezone, 'string');
43 }
44
45 if (!is_string($outputTimezone) && null !== $outputTimezone) {
46 throw new UnexpectedTypeException($outputTimezone, 'string');
47 }
48
49 $this->inputTimezone = $inputTimezone ?: date_default_timezone_get();
50 $this->outputTimezone = $outputTimezone ?: date_default_timezone_get();
51 }
52}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Extension/Core/DataTransformer/BooleanToStringTransformer.php b/vendor/symfony/form/Symfony/Component/Form/Extension/Core/DataTransformer/BooleanToStringTransformer.php
deleted file mode 100644
index 95e7332d..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Extension/Core/DataTransformer/BooleanToStringTransformer.php
+++ /dev/null
@@ -1,85 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Extension\Core\DataTransformer;
13
14use Symfony\Component\Form\DataTransformerInterface;
15use Symfony\Component\Form\Exception\TransformationFailedException;
16
17/**
18 * Transforms between a Boolean and a string.
19 *
20 * @author Bernhard Schussek <bschussek@gmail.com>
21 * @author Florian Eckerstorfer <florian@eckerstorfer.org>
22 */
23class BooleanToStringTransformer implements DataTransformerInterface
24{
25 /**
26 * The value emitted upon transform if the input is true
27 * @var string
28 */
29 private $trueValue;
30
31 /**
32 * Sets the value emitted upon transform if the input is true.
33 *
34 * @param string $trueValue
35 */
36 public function __construct($trueValue)
37 {
38 $this->trueValue = $trueValue;
39 }
40
41 /**
42 * Transforms a Boolean into a string.
43 *
44 * @param Boolean $value Boolean value.
45 *
46 * @return string String value.
47 *
48 * @throws TransformationFailedException If the given value is not a Boolean.
49 */
50 public function transform($value)
51 {
52 if (null === $value) {
53 return null;
54 }
55
56 if (!is_bool($value)) {
57 throw new TransformationFailedException('Expected a Boolean.');
58 }
59
60 return true === $value ? $this->trueValue : null;
61 }
62
63 /**
64 * Transforms a string into a Boolean.
65 *
66 * @param string $value String value.
67 *
68 * @return Boolean Boolean value.
69 *
70 * @throws TransformationFailedException If the given value is not a string.
71 */
72 public function reverseTransform($value)
73 {
74 if (null === $value) {
75 return false;
76 }
77
78 if (!is_string($value)) {
79 throw new TransformationFailedException('Expected a string.');
80 }
81
82 return true;
83 }
84
85}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Extension/Core/DataTransformer/ChoiceToBooleanArrayTransformer.php b/vendor/symfony/form/Symfony/Component/Form/Extension/Core/DataTransformer/ChoiceToBooleanArrayTransformer.php
deleted file mode 100644
index 79b3f7ac..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Extension/Core/DataTransformer/ChoiceToBooleanArrayTransformer.php
+++ /dev/null
@@ -1,118 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Extension\Core\DataTransformer;
13
14use Symfony\Component\Form\Extension\Core\ChoiceList\ChoiceListInterface;
15use Symfony\Component\Form\DataTransformerInterface;
16use Symfony\Component\Form\Exception\TransformationFailedException;
17
18/**
19 * @author Bernhard Schussek <bschussek@gmail.com>
20 */
21class ChoiceToBooleanArrayTransformer implements DataTransformerInterface
22{
23 private $choiceList;
24
25 private $placeholderPresent;
26
27 /**
28 * Constructor.
29 *
30 * @param ChoiceListInterface $choiceList
31 * @param Boolean $placeholderPresent
32 */
33 public function __construct(ChoiceListInterface $choiceList, $placeholderPresent)
34 {
35 $this->choiceList = $choiceList;
36 $this->placeholderPresent = $placeholderPresent;
37 }
38
39 /**
40 * Transforms a single choice to a format appropriate for the nested
41 * checkboxes/radio buttons.
42 *
43 * The result is an array with the options as keys and true/false as values,
44 * depending on whether a given option is selected. If this field is rendered
45 * as select tag, the value is not modified.
46 *
47 * @param mixed $choice An array if "multiple" is set to true, a scalar
48 * value otherwise.
49 *
50 * @return mixed An array
51 *
52 * @throws TransformationFailedException If the given value is not scalar or
53 * if the choices can not be retrieved.
54 */
55 public function transform($choice)
56 {
57 try {
58 $values = $this->choiceList->getValues();
59 } catch (\Exception $e) {
60 throw new TransformationFailedException('Can not get the choice list', $e->getCode(), $e);
61 }
62
63 $index = current($this->choiceList->getIndicesForChoices(array($choice)));
64
65 foreach ($values as $i => $value) {
66 $values[$i] = $i === $index;
67 }
68
69 if ($this->placeholderPresent) {
70 $values['placeholder'] = false === $index;
71 }
72
73 return $values;
74 }
75
76 /**
77 * Transforms a checkbox/radio button array to a single choice.
78 *
79 * The input value is an array with the choices as keys and true/false as
80 * values, depending on whether a given choice is selected. The output
81 * is the selected choice.
82 *
83 * @param array $values An array of values
84 *
85 * @return mixed A scalar value
86 *
87 * @throws TransformationFailedException If the given value is not an array,
88 * if the recuperation of the choices
89 * fails or if some choice can't be
90 * found.
91 */
92 public function reverseTransform($values)
93 {
94 if (!is_array($values)) {
95 throw new TransformationFailedException('Expected an array.');
96 }
97
98 try {
99 $choices = $this->choiceList->getChoices();
100 } catch (\Exception $e) {
101 throw new TransformationFailedException('Can not get the choice list', $e->getCode(), $e);
102 }
103
104 foreach ($values as $i => $selected) {
105 if ($selected) {
106 if (isset($choices[$i])) {
107 return $choices[$i] === '' ? null : $choices[$i];
108 } elseif ($this->placeholderPresent && 'placeholder' === $i) {
109 return null;
110 } else {
111 throw new TransformationFailedException(sprintf('The choice "%s" does not exist', $i));
112 }
113 }
114 }
115
116 return null;
117 }
118}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Extension/Core/DataTransformer/ChoiceToValueTransformer.php b/vendor/symfony/form/Symfony/Component/Form/Extension/Core/DataTransformer/ChoiceToValueTransformer.php
deleted file mode 100644
index 5a818558..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Extension/Core/DataTransformer/ChoiceToValueTransformer.php
+++ /dev/null
@@ -1,62 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Extension\Core\DataTransformer;
13
14use Symfony\Component\Form\DataTransformerInterface;
15use Symfony\Component\Form\Exception\TransformationFailedException;
16use Symfony\Component\Form\Extension\Core\ChoiceList\ChoiceListInterface;
17
18/**
19 * @author Bernhard Schussek <bschussek@gmail.com>
20 */
21class ChoiceToValueTransformer implements DataTransformerInterface
22{
23 private $choiceList;
24
25 /**
26 * Constructor.
27 *
28 * @param ChoiceListInterface $choiceList
29 */
30 public function __construct(ChoiceListInterface $choiceList)
31 {
32 $this->choiceList = $choiceList;
33 }
34
35 public function transform($choice)
36 {
37 return (string) current($this->choiceList->getValuesForChoices(array($choice)));
38 }
39
40 public function reverseTransform($value)
41 {
42 if (null !== $value && !is_scalar($value)) {
43 throw new TransformationFailedException('Expected a scalar.');
44 }
45
46 // These are now valid ChoiceList values, so we can return null
47 // right away
48 if ('' === $value || null === $value) {
49 return null;
50 }
51
52 $choices = $this->choiceList->getChoicesForValues(array($value));
53
54 if (1 !== count($choices)) {
55 throw new TransformationFailedException(sprintf('The choice "%s" does not exist or is not unique', $value));
56 }
57
58 $choice = current($choices);
59
60 return '' === $choice ? null : $choice;
61 }
62}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Extension/Core/DataTransformer/ChoicesToBooleanArrayTransformer.php b/vendor/symfony/form/Symfony/Component/Form/Extension/Core/DataTransformer/ChoicesToBooleanArrayTransformer.php
deleted file mode 100644
index a13c0d4d..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Extension/Core/DataTransformer/ChoicesToBooleanArrayTransformer.php
+++ /dev/null
@@ -1,117 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Extension\Core\DataTransformer;
13
14use Symfony\Component\Form\Extension\Core\ChoiceList\ChoiceListInterface;
15use Symfony\Component\Form\DataTransformerInterface;
16use Symfony\Component\Form\Exception\TransformationFailedException;
17
18/**
19 * @author Bernhard Schussek <bschussek@gmail.com>
20 */
21class ChoicesToBooleanArrayTransformer implements DataTransformerInterface
22{
23 private $choiceList;
24
25 public function __construct(ChoiceListInterface $choiceList)
26 {
27 $this->choiceList = $choiceList;
28 }
29
30 /**
31 * Transforms an array of choices to a format appropriate for the nested
32 * checkboxes/radio buttons.
33 *
34 * The result is an array with the options as keys and true/false as values,
35 * depending on whether a given option is selected. If this field is rendered
36 * as select tag, the value is not modified.
37 *
38 * @param mixed $array An array
39 *
40 * @return mixed An array
41 *
42 * @throws TransformationFailedException If the given value is not an array
43 * or if the choices can not be retrieved.
44 */
45 public function transform($array)
46 {
47 if (null === $array) {
48 return array();
49 }
50
51 if (!is_array($array)) {
52 throw new TransformationFailedException('Expected an array.');
53 }
54
55 try {
56 $values = $this->choiceList->getValues();
57 } catch (\Exception $e) {
58 throw new TransformationFailedException('Can not get the choice list', $e->getCode(), $e);
59 }
60
61 $indexMap = array_flip($this->choiceList->getIndicesForChoices($array));
62
63 foreach ($values as $i => $value) {
64 $values[$i] = isset($indexMap[$i]);
65 }
66
67 return $values;
68 }
69
70 /**
71 * Transforms a checkbox/radio button array to an array of choices.
72 *
73 * The input value is an array with the choices as keys and true/false as
74 * values, depending on whether a given choice is selected. The output
75 * is an array with the selected choices.
76 *
77 * @param mixed $values An array
78 *
79 * @return mixed An array
80 *
81 * @throws TransformationFailedException If the given value is not an array,
82 * if the recuperation of the choices
83 * fails or if some choice can't be
84 * found.
85 */
86 public function reverseTransform($values)
87 {
88 if (!is_array($values)) {
89 throw new TransformationFailedException('Expected an array.');
90 }
91
92 try {
93 $choices = $this->choiceList->getChoices();
94 } catch (\Exception $e) {
95 throw new TransformationFailedException('Can not get the choice list', $e->getCode(), $e);
96 }
97
98 $result = array();
99 $unknown = array();
100
101 foreach ($values as $i => $selected) {
102 if ($selected) {
103 if (isset($choices[$i])) {
104 $result[] = $choices[$i];
105 } else {
106 $unknown[] = $i;
107 }
108 }
109 }
110
111 if (count($unknown) > 0) {
112 throw new TransformationFailedException(sprintf('The choices "%s" were not found', implode('", "', $unknown)));
113 }
114
115 return $result;
116 }
117}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Extension/Core/DataTransformer/ChoicesToValuesTransformer.php b/vendor/symfony/form/Symfony/Component/Form/Extension/Core/DataTransformer/ChoicesToValuesTransformer.php
deleted file mode 100644
index 4492865e..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Extension/Core/DataTransformer/ChoicesToValuesTransformer.php
+++ /dev/null
@@ -1,83 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Extension\Core\DataTransformer;
13
14use Symfony\Component\Form\Exception\TransformationFailedException;
15
16use Symfony\Component\Form\DataTransformerInterface;
17use Symfony\Component\Form\Extension\Core\ChoiceList\ChoiceListInterface;
18
19/**
20 * @author Bernhard Schussek <bschussek@gmail.com>
21 */
22class ChoicesToValuesTransformer implements DataTransformerInterface
23{
24 private $choiceList;
25
26 /**
27 * Constructor.
28 *
29 * @param ChoiceListInterface $choiceList
30 */
31 public function __construct(ChoiceListInterface $choiceList)
32 {
33 $this->choiceList = $choiceList;
34 }
35
36 /**
37 * @param array $array
38 *
39 * @return array
40 *
41 * @throws TransformationFailedException If the given value is not an array.
42 */
43 public function transform($array)
44 {
45 if (null === $array) {
46 return array();
47 }
48
49 if (!is_array($array)) {
50 throw new TransformationFailedException('Expected an array.');
51 }
52
53 return $this->choiceList->getValuesForChoices($array);
54 }
55
56 /**
57 * @param array $array
58 *
59 * @return array
60 *
61 * @throws TransformationFailedException If the given value is not an array
62 * or if no matching choice could be
63 * found for some given value.
64 */
65 public function reverseTransform($array)
66 {
67 if (null === $array) {
68 return array();
69 }
70
71 if (!is_array($array)) {
72 throw new TransformationFailedException('Expected an array.');
73 }
74
75 $choices = $this->choiceList->getChoicesForValues($array);
76
77 if (count($choices) !== count($array)) {
78 throw new TransformationFailedException('Could not find all matching choices for the given values');
79 }
80
81 return $choices;
82 }
83}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Extension/Core/DataTransformer/DataTransformerChain.php b/vendor/symfony/form/Symfony/Component/Form/Extension/Core/DataTransformer/DataTransformerChain.php
deleted file mode 100644
index 9cc185e1..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Extension/Core/DataTransformer/DataTransformerChain.php
+++ /dev/null
@@ -1,86 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Extension\Core\DataTransformer;
13
14use Symfony\Component\Form\DataTransformerInterface;
15use Symfony\Component\Form\Exception\TransformationFailedException;
16
17/**
18 * Passes a value through multiple value transformers
19 *
20 * @author Bernhard Schussek <bschussek@gmail.com>
21 */
22class DataTransformerChain implements DataTransformerInterface
23{
24 /**
25 * The value transformers
26 * @var DataTransformerInterface[]
27 */
28 protected $transformers;
29
30 /**
31 * Uses the given value transformers to transform values
32 *
33 * @param array $transformers
34 */
35 public function __construct(array $transformers)
36 {
37 $this->transformers = $transformers;
38 }
39
40 /**
41 * Passes the value through the transform() method of all nested transformers
42 *
43 * The transformers receive the value in the same order as they were passed
44 * to the constructor. Each transformer receives the result of the previous
45 * transformer as input. The output of the last transformer is returned
46 * by this method.
47 *
48 * @param mixed $value The original value
49 *
50 * @return mixed The transformed value
51 *
52 * @throws TransformationFailedException
53 */
54 public function transform($value)
55 {
56 foreach ($this->transformers as $transformer) {
57 $value = $transformer->transform($value);
58 }
59
60 return $value;
61 }
62
63 /**
64 * Passes the value through the reverseTransform() method of all nested
65 * transformers
66 *
67 * The transformers receive the value in the reverse order as they were passed
68 * to the constructor. Each transformer receives the result of the previous
69 * transformer as input. The output of the last transformer is returned
70 * by this method.
71 *
72 * @param mixed $value The transformed value
73 *
74 * @return mixed The reverse-transformed value
75 *
76 * @throws TransformationFailedException
77 */
78 public function reverseTransform($value)
79 {
80 for ($i = count($this->transformers) - 1; $i >= 0; --$i) {
81 $value = $this->transformers[$i]->reverseTransform($value);
82 }
83
84 return $value;
85 }
86}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToArrayTransformer.php b/vendor/symfony/form/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToArrayTransformer.php
deleted file mode 100644
index 34af2820..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToArrayTransformer.php
+++ /dev/null
@@ -1,184 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Extension\Core\DataTransformer;
13
14use Symfony\Component\Form\Exception\TransformationFailedException;
15use Symfony\Component\Form\Exception\UnexpectedTypeException;
16
17/**
18 * Transforms between a normalized time and a localized time string/array.
19 *
20 * @author Bernhard Schussek <bschussek@gmail.com>
21 * @author Florian Eckerstorfer <florian@eckerstorfer.org>
22 */
23class DateTimeToArrayTransformer extends BaseDateTimeTransformer
24{
25 private $pad;
26
27 private $fields;
28
29 /**
30 * Constructor.
31 *
32 * @param string $inputTimezone The input timezone
33 * @param string $outputTimezone The output timezone
34 * @param array $fields The date fields
35 * @param Boolean $pad Whether to use padding
36 *
37 * @throws UnexpectedTypeException if a timezone is not a string
38 */
39 public function __construct($inputTimezone = null, $outputTimezone = null, array $fields = null, $pad = false)
40 {
41 parent::__construct($inputTimezone, $outputTimezone);
42
43 if (null === $fields) {
44 $fields = array('year', 'month', 'day', 'hour', 'minute', 'second');
45 }
46
47 $this->fields = $fields;
48 $this->pad = (Boolean) $pad;
49 }
50
51 /**
52 * Transforms a normalized date into a localized date.
53 *
54 * @param \DateTime $dateTime Normalized date.
55 *
56 * @return array Localized date.
57 *
58 * @throws TransformationFailedException If the given value is not an
59 * instance of \DateTime or if the
60 * output timezone is not supported.
61 */
62 public function transform($dateTime)
63 {
64 if (null === $dateTime) {
65 return array_intersect_key(array(
66 'year' => '',
67 'month' => '',
68 'day' => '',
69 'hour' => '',
70 'minute' => '',
71 'second' => '',
72 ), array_flip($this->fields));
73 }
74
75 if (!$dateTime instanceof \DateTime) {
76 throw new TransformationFailedException('Expected a \DateTime.');
77 }
78
79 $dateTime = clone $dateTime;
80 if ($this->inputTimezone !== $this->outputTimezone) {
81 try {
82 $dateTime->setTimezone(new \DateTimeZone($this->outputTimezone));
83 } catch (\Exception $e) {
84 throw new TransformationFailedException($e->getMessage(), $e->getCode(), $e);
85 }
86 }
87
88 $result = array_intersect_key(array(
89 'year' => $dateTime->format('Y'),
90 'month' => $dateTime->format('m'),
91 'day' => $dateTime->format('d'),
92 'hour' => $dateTime->format('H'),
93 'minute' => $dateTime->format('i'),
94 'second' => $dateTime->format('s'),
95 ), array_flip($this->fields));
96
97 if (!$this->pad) {
98 foreach ($result as &$entry) {
99 // remove leading zeros
100 $entry = (string) (int) $entry;
101 }
102 }
103
104 return $result;
105 }
106
107 /**
108 * Transforms a localized date into a normalized date.
109 *
110 * @param array $value Localized date
111 *
112 * @return \DateTime Normalized date
113 *
114 * @throws TransformationFailedException If the given value is not an array,
115 * if the value could not be transformed
116 * or if the input timezone is not
117 * supported.
118 */
119 public function reverseTransform($value)
120 {
121 if (null === $value) {
122 return null;
123 }
124
125 if (!is_array($value)) {
126 throw new TransformationFailedException('Expected an array.');
127 }
128
129 if ('' === implode('', $value)) {
130 return null;
131 }
132
133 $emptyFields = array();
134
135 foreach ($this->fields as $field) {
136 if (!isset($value[$field])) {
137 $emptyFields[] = $field;
138 }
139 }
140
141 if (count($emptyFields) > 0) {
142 throw new TransformationFailedException(
143 sprintf('The fields "%s" should not be empty', implode('", "', $emptyFields)
144 ));
145 }
146
147 if (isset($value['month']) && !ctype_digit($value['month']) && !is_int($value['month'])) {
148 throw new TransformationFailedException('This month is invalid');
149 }
150
151 if (isset($value['day']) && !ctype_digit($value['day']) && !is_int($value['day'])) {
152 throw new TransformationFailedException('This day is invalid');
153 }
154
155 if (isset($value['year']) && !ctype_digit($value['year']) && !is_int($value['year'])) {
156 throw new TransformationFailedException('This year is invalid');
157 }
158
159 if (!empty($value['month']) && !empty($value['day']) && !empty($value['year']) && false === checkdate($value['month'], $value['day'], $value['year'])) {
160 throw new TransformationFailedException('This is an invalid date');
161 }
162
163 try {
164 $dateTime = new \DateTime(sprintf(
165 '%s-%s-%s %s:%s:%s %s',
166 empty($value['year']) ? '1970' : $value['year'],
167 empty($value['month']) ? '1' : $value['month'],
168 empty($value['day']) ? '1' : $value['day'],
169 empty($value['hour']) ? '0' : $value['hour'],
170 empty($value['minute']) ? '0' : $value['minute'],
171 empty($value['second']) ? '0' : $value['second'],
172 $this->outputTimezone
173 ));
174
175 if ($this->inputTimezone !== $this->outputTimezone) {
176 $dateTime->setTimezone(new \DateTimeZone($this->inputTimezone));
177 }
178 } catch (\Exception $e) {
179 throw new TransformationFailedException($e->getMessage(), $e->getCode(), $e);
180 }
181
182 return $dateTime;
183 }
184}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToLocalizedStringTransformer.php b/vendor/symfony/form/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToLocalizedStringTransformer.php
deleted file mode 100644
index d755e485..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToLocalizedStringTransformer.php
+++ /dev/null
@@ -1,169 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Extension\Core\DataTransformer;
13
14use Symfony\Component\Form\Exception\TransformationFailedException;
15use Symfony\Component\Form\Exception\UnexpectedTypeException;
16
17/**
18 * Transforms between a normalized time and a localized time string
19 *
20 * @author Bernhard Schussek <bschussek@gmail.com>
21 * @author Florian Eckerstorfer <florian@eckerstorfer.org>
22 */
23class DateTimeToLocalizedStringTransformer extends BaseDateTimeTransformer
24{
25 private $dateFormat;
26 private $timeFormat;
27 private $pattern;
28 private $calendar;
29
30 /**
31 * Constructor.
32 *
33 * @see BaseDateTimeTransformer::formats for available format options
34 *
35 * @param string $inputTimezone The name of the input timezone
36 * @param string $outputTimezone The name of the output timezone
37 * @param integer $dateFormat The date format
38 * @param integer $timeFormat The time format
39 * @param integer $calendar One of the \IntlDateFormatter calendar constants
40 * @param string $pattern A pattern to pass to \IntlDateFormatter
41 *
42 * @throws UnexpectedTypeException If a format is not supported or if a timezone is not a string
43 */
44 public function __construct($inputTimezone = null, $outputTimezone = null, $dateFormat = null, $timeFormat = null, $calendar = \IntlDateFormatter::GREGORIAN, $pattern = null)
45 {
46 parent::__construct($inputTimezone, $outputTimezone);
47
48 if (null === $dateFormat) {
49 $dateFormat = \IntlDateFormatter::MEDIUM;
50 }
51
52 if (null === $timeFormat) {
53 $timeFormat = \IntlDateFormatter::SHORT;
54 }
55
56 if (!in_array($dateFormat, self::$formats, true)) {
57 throw new UnexpectedTypeException($dateFormat, implode('", "', self::$formats));
58 }
59
60 if (!in_array($timeFormat, self::$formats, true)) {
61 throw new UnexpectedTypeException($timeFormat, implode('", "', self::$formats));
62 }
63
64 $this->dateFormat = $dateFormat;
65 $this->timeFormat = $timeFormat;
66 $this->calendar = $calendar;
67 $this->pattern = $pattern;
68 }
69
70 /**
71 * Transforms a normalized date into a localized date string/array.
72 *
73 * @param \DateTime $dateTime Normalized date.
74 *
75 * @return string|array Localized date string/array.
76 *
77 * @throws TransformationFailedException If the given value is not an instance
78 * of \DateTime or if the date could not
79 * be transformed.
80 */
81 public function transform($dateTime)
82 {
83 if (null === $dateTime) {
84 return '';
85 }
86
87 if (!$dateTime instanceof \DateTime) {
88 throw new TransformationFailedException('Expected a \DateTime.');
89 }
90
91 // convert time to UTC before passing it to the formatter
92 $dateTime = clone $dateTime;
93 if ('UTC' !== $this->inputTimezone) {
94 $dateTime->setTimezone(new \DateTimeZone('UTC'));
95 }
96
97 $value = $this->getIntlDateFormatter()->format((int) $dateTime->format('U'));
98
99 if (intl_get_error_code() != 0) {
100 throw new TransformationFailedException(intl_get_error_message());
101 }
102
103 return $value;
104 }
105
106 /**
107 * Transforms a localized date string/array into a normalized date.
108 *
109 * @param string|array $value Localized date string/array
110 *
111 * @return \DateTime Normalized date
112 *
113 * @throws TransformationFailedException if the given value is not a string,
114 * if the date could not be parsed or
115 * if the input timezone is not supported
116 */
117 public function reverseTransform($value)
118 {
119 if (!is_string($value)) {
120 throw new TransformationFailedException('Expected a string.');
121 }
122
123 if ('' === $value) {
124 return null;
125 }
126
127 $timestamp = $this->getIntlDateFormatter()->parse($value);
128
129 if (intl_get_error_code() != 0) {
130 throw new TransformationFailedException(intl_get_error_message());
131 }
132
133 try {
134 // read timestamp into DateTime object - the formatter delivers in UTC
135 $dateTime = new \DateTime(sprintf('@%s UTC', $timestamp));
136 } catch (\Exception $e) {
137 throw new TransformationFailedException($e->getMessage(), $e->getCode(), $e);
138 }
139
140 if ('UTC' !== $this->inputTimezone) {
141 try {
142 $dateTime->setTimezone(new \DateTimeZone($this->inputTimezone));
143 } catch (\Exception $e) {
144 throw new TransformationFailedException($e->getMessage(), $e->getCode(), $e);
145 }
146 }
147
148 return $dateTime;
149 }
150
151 /**
152 * Returns a preconfigured IntlDateFormatter instance
153 *
154 * @return \IntlDateFormatter
155 */
156 protected function getIntlDateFormatter()
157 {
158 $dateFormat = $this->dateFormat;
159 $timeFormat = $this->timeFormat;
160 $timezone = $this->outputTimezone;
161 $calendar = $this->calendar;
162 $pattern = $this->pattern;
163
164 $intlDateFormatter = new \IntlDateFormatter(\Locale::getDefault(), $dateFormat, $timeFormat, $timezone, $calendar, $pattern);
165 $intlDateFormatter->setLenient(false);
166
167 return $intlDateFormatter;
168 }
169}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToRfc3339Transformer.php b/vendor/symfony/form/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToRfc3339Transformer.php
deleted file mode 100644
index 0eb07422..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToRfc3339Transformer.php
+++ /dev/null
@@ -1,82 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Extension\Core\DataTransformer;
13
14use Symfony\Component\Form\Exception\TransformationFailedException;
15
16/**
17 * @author Bernhard Schussek <bschussek@gmail.com>
18 */
19class DateTimeToRfc3339Transformer extends BaseDateTimeTransformer
20{
21 /**
22 * {@inheritDoc}
23 */
24 public function transform($dateTime)
25 {
26 if (null === $dateTime) {
27 return '';
28 }
29
30 if (!$dateTime instanceof \DateTime) {
31 throw new TransformationFailedException('Expected a \DateTime.');
32 }
33
34 if ($this->inputTimezone !== $this->outputTimezone) {
35 $dateTime = clone $dateTime;
36 $dateTime->setTimezone(new \DateTimeZone($this->outputTimezone));
37 }
38
39 return preg_replace('/\+00:00$/', 'Z', $dateTime->format('c'));
40 }
41
42 /**
43 * {@inheritDoc}
44 */
45 public function reverseTransform($rfc3339)
46 {
47 if (!is_string($rfc3339)) {
48 throw new TransformationFailedException('Expected a string.');
49 }
50
51 if ('' === $rfc3339) {
52 return null;
53 }
54
55 try {
56 $dateTime = new \DateTime($rfc3339);
57 } catch (\Exception $e) {
58 throw new TransformationFailedException($e->getMessage(), $e->getCode(), $e);
59 }
60
61 if ($this->outputTimezone !== $this->inputTimezone) {
62 try {
63 $dateTime->setTimezone(new \DateTimeZone($this->inputTimezone));
64 } catch (\Exception $e) {
65 throw new TransformationFailedException($e->getMessage(), $e->getCode(), $e);
66 }
67 }
68
69 if (preg_match('/(\d{4})-(\d{2})-(\d{2})/', $rfc3339, $matches)) {
70 if (!checkdate($matches[2], $matches[3], $matches[1])) {
71 throw new TransformationFailedException(sprintf(
72 'The date "%s-%s-%s" is not a valid date.',
73 $matches[1],
74 $matches[2],
75 $matches[3]
76 ));
77 }
78 }
79
80 return $dateTime;
81 }
82}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToStringTransformer.php b/vendor/symfony/form/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToStringTransformer.php
deleted file mode 100644
index 131f45cb..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToStringTransformer.php
+++ /dev/null
@@ -1,231 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Extension\Core\DataTransformer;
13
14use Symfony\Component\Form\Exception\TransformationFailedException;
15use Symfony\Component\Form\Exception\UnexpectedTypeException;
16
17/**
18 * Transforms between a date string and a DateTime object
19 *
20 * @author Bernhard Schussek <bschussek@gmail.com>
21 * @author Florian Eckerstorfer <florian@eckerstorfer.org>
22 */
23class DateTimeToStringTransformer extends BaseDateTimeTransformer
24{
25 /**
26 * Format used for generating strings
27 * @var string
28 */
29 private $generateFormat;
30
31 /**
32 * Format used for parsing strings
33 *
34 * Different than the {@link $generateFormat} because formats for parsing
35 * support additional characters in PHP that are not supported for
36 * generating strings.
37 *
38 * @var string
39 */
40 private $parseFormat;
41
42 /**
43 * Whether to parse by appending a pipe "|" to the parse format.
44 *
45 * This only works as of PHP 5.3.7.
46 *
47 * @var Boolean
48 */
49 private $parseUsingPipe;
50
51 /**
52 * Transforms a \DateTime instance to a string
53 *
54 * @see \DateTime::format() for supported formats
55 *
56 * @param string $inputTimezone The name of the input timezone
57 * @param string $outputTimezone The name of the output timezone
58 * @param string $format The date format
59 * @param Boolean $parseUsingPipe Whether to parse by appending a pipe "|" to the parse format
60 *
61 * @throws UnexpectedTypeException if a timezone is not a string
62 */
63 public function __construct($inputTimezone = null, $outputTimezone = null, $format = 'Y-m-d H:i:s', $parseUsingPipe = null)
64 {
65 parent::__construct($inputTimezone, $outputTimezone);
66
67 $this->generateFormat = $this->parseFormat = $format;
68
69 // The pipe in the parser pattern only works as of PHP 5.3.7
70 // See http://bugs.php.net/54316
71 $this->parseUsingPipe = null === $parseUsingPipe
72 ? version_compare(phpversion(), '5.3.7', '>=')
73 : $parseUsingPipe;
74
75 // See http://php.net/manual/en/datetime.createfromformat.php
76 // The character "|" in the format makes sure that the parts of a date
77 // that are *not* specified in the format are reset to the corresponding
78 // values from 1970-01-01 00:00:00 instead of the current time.
79 // Without "|" and "Y-m-d", "2010-02-03" becomes "2010-02-03 12:32:47",
80 // where the time corresponds to the current server time.
81 // With "|" and "Y-m-d", "2010-02-03" becomes "2010-02-03 00:00:00",
82 // which is at least deterministic and thus used here.
83 if ($this->parseUsingPipe && false === strpos($this->parseFormat, '|')) {
84 $this->parseFormat .= '|';
85 }
86 }
87
88 /**
89 * Transforms a DateTime object into a date string with the configured format
90 * and timezone
91 *
92 * @param \DateTime $value A DateTime object
93 *
94 * @return string A value as produced by PHP's date() function
95 *
96 * @throws TransformationFailedException If the given value is not a \DateTime
97 * instance or if the output timezone
98 * is not supported.
99 */
100 public function transform($value)
101 {
102 if (null === $value) {
103 return '';
104 }
105
106 if (!$value instanceof \DateTime) {
107 throw new TransformationFailedException('Expected a \DateTime.');
108 }
109
110 $value = clone $value;
111 try {
112 $value->setTimezone(new \DateTimeZone($this->outputTimezone));
113 } catch (\Exception $e) {
114 throw new TransformationFailedException($e->getMessage(), $e->getCode(), $e);
115 }
116
117 return $value->format($this->generateFormat);
118 }
119
120 /**
121 * Transforms a date string in the configured timezone into a DateTime object.
122 *
123 * @param string $value A value as produced by PHP's date() function
124 *
125 * @return \DateTime An instance of \DateTime
126 *
127 * @throws TransformationFailedException If the given value is not a string,
128 * if the date could not be parsed or
129 * if the input timezone is not supported.
130 */
131 public function reverseTransform($value)
132 {
133 if (empty($value)) {
134 return null;
135 }
136
137 if (!is_string($value)) {
138 throw new TransformationFailedException('Expected a string.');
139 }
140
141 try {
142 $outputTz = new \DateTimeZone($this->outputTimezone);
143 $dateTime = \DateTime::createFromFormat($this->parseFormat, $value, $outputTz);
144
145 $lastErrors = \DateTime::getLastErrors();
146
147 if (0 < $lastErrors['warning_count'] || 0 < $lastErrors['error_count']) {
148 throw new TransformationFailedException(
149 implode(', ', array_merge(
150 array_values($lastErrors['warnings']),
151 array_values($lastErrors['errors'])
152 ))
153 );
154 }
155
156 // On PHP versions < 5.3.7 we need to emulate the pipe operator
157 // and reset parts not given in the format to their equivalent
158 // of the UNIX base timestamp.
159 if (!$this->parseUsingPipe) {
160 list($year, $month, $day, $hour, $minute, $second) = explode('-', $dateTime->format('Y-m-d-H-i-s'));
161
162 // Check which of the date parts are present in the pattern
163 preg_match(
164 '/(' .
165 '(?P<day>[djDl])|' .
166 '(?P<month>[FMmn])|' .
167 '(?P<year>[Yy])|' .
168 '(?P<hour>[ghGH])|' .
169 '(?P<minute>i)|' .
170 '(?P<second>s)|' .
171 '(?P<dayofyear>z)|' .
172 '(?P<timestamp>U)|' .
173 '[^djDlFMmnYyghGHiszU]' .
174 ')*/',
175 $this->parseFormat,
176 $matches
177 );
178
179 // preg_match() does not guarantee to set all indices, so
180 // set them unless given
181 $matches = array_merge(array(
182 'day' => false,
183 'month' => false,
184 'year' => false,
185 'hour' => false,
186 'minute' => false,
187 'second' => false,
188 'dayofyear' => false,
189 'timestamp' => false,
190 ), $matches);
191
192 // Reset all parts that don't exist in the format to the
193 // corresponding part of the UNIX base timestamp
194 if (!$matches['timestamp']) {
195 if (!$matches['dayofyear']) {
196 if (!$matches['day']) {
197 $day = 1;
198 }
199 if (!$matches['month']) {
200 $month = 1;
201 }
202 }
203 if (!$matches['year']) {
204 $year = 1970;
205 }
206 if (!$matches['hour']) {
207 $hour = 0;
208 }
209 if (!$matches['minute']) {
210 $minute = 0;
211 }
212 if (!$matches['second']) {
213 $second = 0;
214 }
215 $dateTime->setDate($year, $month, $day);
216 $dateTime->setTime($hour, $minute, $second);
217 }
218 }
219
220 if ($this->inputTimezone !== $this->outputTimezone) {
221 $dateTime->setTimeZone(new \DateTimeZone($this->inputTimezone));
222 }
223 } catch (TransformationFailedException $e) {
224 throw $e;
225 } catch (\Exception $e) {
226 throw new TransformationFailedException($e->getMessage(), $e->getCode(), $e);
227 }
228
229 return $dateTime;
230 }
231}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToTimestampTransformer.php b/vendor/symfony/form/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToTimestampTransformer.php
deleted file mode 100644
index d2ca6604..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Extension/Core/DataTransformer/DateTimeToTimestampTransformer.php
+++ /dev/null
@@ -1,89 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Extension\Core\DataTransformer;
13
14use Symfony\Component\Form\Exception\TransformationFailedException;
15
16/**
17 * Transforms between a timestamp and a DateTime object
18 *
19 * @author Bernhard Schussek <bschussek@gmail.com>
20 * @author Florian Eckerstorfer <florian@eckerstorfer.org>
21 */
22class DateTimeToTimestampTransformer extends BaseDateTimeTransformer
23{
24 /**
25 * Transforms a DateTime object into a timestamp in the configured timezone.
26 *
27 * @param \DateTime $value A \DateTime object
28 *
29 * @return integer A timestamp
30 *
31 * @throws TransformationFailedException If the given value is not an instance
32 * of \DateTime or if the output
33 * timezone is not supported.
34 */
35 public function transform($value)
36 {
37 if (null === $value) {
38 return null;
39 }
40
41 if (!$value instanceof \DateTime) {
42 throw new TransformationFailedException('Expected a \DateTime.');
43 }
44
45 $value = clone $value;
46 try {
47 $value->setTimezone(new \DateTimeZone($this->outputTimezone));
48 } catch (\Exception $e) {
49 throw new TransformationFailedException($e->getMessage(), $e->getCode(), $e);
50 }
51
52 return (int) $value->format('U');
53 }
54
55 /**
56 * Transforms a timestamp in the configured timezone into a DateTime object
57 *
58 * @param string $value A timestamp
59 *
60 * @return \DateTime A \DateTime object
61 *
62 * @throws TransformationFailedException If the given value is not a timestamp
63 * or if the given timestamp is invalid.
64 */
65 public function reverseTransform($value)
66 {
67 if (null === $value) {
68 return null;
69 }
70
71 if (!is_numeric($value)) {
72 throw new TransformationFailedException('Expected a numeric.');
73 }
74
75 try {
76 $dateTime = new \DateTime();
77 $dateTime->setTimezone(new \DateTimeZone($this->outputTimezone));
78 $dateTime->setTimestamp($value);
79
80 if ($this->inputTimezone !== $this->outputTimezone) {
81 $dateTime->setTimezone(new \DateTimeZone($this->inputTimezone));
82 }
83 } catch (\Exception $e) {
84 throw new TransformationFailedException($e->getMessage(), $e->getCode(), $e);
85 }
86
87 return $dateTime;
88 }
89}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Extension/Core/DataTransformer/IntegerToLocalizedStringTransformer.php b/vendor/symfony/form/Symfony/Component/Form/Extension/Core/DataTransformer/IntegerToLocalizedStringTransformer.php
deleted file mode 100644
index 6bb48a9a..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Extension/Core/DataTransformer/IntegerToLocalizedStringTransformer.php
+++ /dev/null
@@ -1,53 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Extension\Core\DataTransformer;
13
14use Symfony\Component\Form\Exception\TransformationFailedException;
15
16/**
17 * Transforms between an integer and a localized number with grouping
18 * (each thousand) and comma separators.
19 *
20 * @author Bernhard Schussek <bschussek@gmail.com>
21 */
22class IntegerToLocalizedStringTransformer extends NumberToLocalizedStringTransformer
23{
24 /**
25 * {@inheritDoc}
26 */
27 public function reverseTransform($value)
28 {
29 if (!is_string($value)) {
30 throw new TransformationFailedException('Expected a string.');
31 }
32
33 if ('' === $value) {
34 return null;
35 }
36
37 if ('NaN' === $value) {
38 throw new TransformationFailedException('"NaN" is not a valid integer');
39 }
40
41 $formatter = $this->getNumberFormatter();
42 $value = $formatter->parse(
43 $value,
44 PHP_INT_SIZE == 8 ? $formatter::TYPE_INT64 : $formatter::TYPE_INT32
45 );
46
47 if (intl_is_failure($formatter->getErrorCode())) {
48 throw new TransformationFailedException($formatter->getErrorMessage());
49 }
50
51 return $value;
52 }
53}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Extension/Core/DataTransformer/MoneyToLocalizedStringTransformer.php b/vendor/symfony/form/Symfony/Component/Form/Extension/Core/DataTransformer/MoneyToLocalizedStringTransformer.php
deleted file mode 100644
index 5b8e9d96..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Extension/Core/DataTransformer/MoneyToLocalizedStringTransformer.php
+++ /dev/null
@@ -1,90 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Extension\Core\DataTransformer;
13
14use Symfony\Component\Form\Exception\TransformationFailedException;
15
16/**
17 * Transforms between a normalized format and a localized money string.
18 *
19 * @author Bernhard Schussek <bschussek@gmail.com>
20 * @author Florian Eckerstorfer <florian@eckerstorfer.org>
21 */
22class MoneyToLocalizedStringTransformer extends NumberToLocalizedStringTransformer
23{
24
25 private $divisor;
26
27 public function __construct($precision = null, $grouping = null, $roundingMode = null, $divisor = null)
28 {
29 if (null === $grouping) {
30 $grouping = true;
31 }
32
33 if (null === $precision) {
34 $precision = 2;
35 }
36
37 parent::__construct($precision, $grouping, $roundingMode);
38
39 if (null === $divisor) {
40 $divisor = 1;
41 }
42
43 $this->divisor = $divisor;
44 }
45
46 /**
47 * Transforms a normalized format into a localized money string.
48 *
49 * @param number $value Normalized number
50 *
51 * @return string Localized money string.
52 *
53 * @throws TransformationFailedException If the given value is not numeric or
54 * if the value can not be transformed.
55 */
56 public function transform($value)
57 {
58 if (null !== $value) {
59 if (!is_numeric($value)) {
60 throw new TransformationFailedException('Expected a numeric.');
61 }
62
63 $value /= $this->divisor;
64 }
65
66 return parent::transform($value);
67 }
68
69 /**
70 * Transforms a localized money string into a normalized format.
71 *
72 * @param string $value Localized money string
73 *
74 * @return number Normalized number
75 *
76 * @throws TransformationFailedException If the given value is not a string
77 * or if the value can not be transformed.
78 */
79 public function reverseTransform($value)
80 {
81 $value = parent::reverseTransform($value);
82
83 if (null !== $value) {
84 $value *= $this->divisor;
85 }
86
87 return $value;
88 }
89
90}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Extension/Core/DataTransformer/NumberToLocalizedStringTransformer.php b/vendor/symfony/form/Symfony/Component/Form/Extension/Core/DataTransformer/NumberToLocalizedStringTransformer.php
deleted file mode 100644
index b0c59b3e..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Extension/Core/DataTransformer/NumberToLocalizedStringTransformer.php
+++ /dev/null
@@ -1,184 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Extension\Core\DataTransformer;
13
14use Symfony\Component\Form\DataTransformerInterface;
15use Symfony\Component\Form\Exception\TransformationFailedException;
16
17/**
18 * Transforms between a number type and a localized number with grouping
19 * (each thousand) and comma separators.
20 *
21 * @author Bernhard Schussek <bschussek@gmail.com>
22 * @author Florian Eckerstorfer <florian@eckerstorfer.org>
23 */
24class NumberToLocalizedStringTransformer implements DataTransformerInterface
25{
26 const ROUND_FLOOR = \NumberFormatter::ROUND_FLOOR;
27 const ROUND_DOWN = \NumberFormatter::ROUND_DOWN;
28 const ROUND_HALFDOWN = \NumberFormatter::ROUND_HALFDOWN;
29 const ROUND_HALFEVEN = \NumberFormatter::ROUND_HALFEVEN;
30 const ROUND_HALFUP = \NumberFormatter::ROUND_HALFUP;
31 const ROUND_UP = \NumberFormatter::ROUND_UP;
32 const ROUND_CEILING = \NumberFormatter::ROUND_CEILING;
33
34 protected $precision;
35
36 protected $grouping;
37
38 protected $roundingMode;
39
40 public function __construct($precision = null, $grouping = null, $roundingMode = null)
41 {
42 if (null === $grouping) {
43 $grouping = false;
44 }
45
46 if (null === $roundingMode) {
47 $roundingMode = self::ROUND_HALFUP;
48 }
49
50 $this->precision = $precision;
51 $this->grouping = $grouping;
52 $this->roundingMode = $roundingMode;
53 }
54
55 /**
56 * Transforms a number type into localized number.
57 *
58 * @param integer|float $value Number value.
59 *
60 * @return string Localized value.
61 *
62 * @throws TransformationFailedException If the given value is not numeric
63 * or if the value can not be transformed.
64 */
65 public function transform($value)
66 {
67 if (null === $value) {
68 return '';
69 }
70
71 if (!is_numeric($value)) {
72 throw new TransformationFailedException('Expected a numeric.');
73 }
74
75 $formatter = $this->getNumberFormatter();
76 $value = $formatter->format($value);
77
78 if (intl_is_failure($formatter->getErrorCode())) {
79 throw new TransformationFailedException($formatter->getErrorMessage());
80 }
81
82 // Convert fixed spaces to normal ones
83 $value = str_replace("\xc2\xa0", ' ', $value);
84
85 return $value;
86 }
87
88 /**
89 * Transforms a localized number into an integer or float
90 *
91 * @param string $value The localized value
92 *
93 * @return integer|float The numeric value
94 *
95 * @throws TransformationFailedException If the given value is not a string
96 * or if the value can not be transformed.
97 */
98 public function reverseTransform($value)
99 {
100 if (!is_string($value)) {
101 throw new TransformationFailedException('Expected a string.');
102 }
103
104 if ('' === $value) {
105 return null;
106 }
107
108 if ('NaN' === $value) {
109 throw new TransformationFailedException('"NaN" is not a valid number');
110 }
111
112 $position = 0;
113 $formatter = $this->getNumberFormatter();
114 $groupSep = $formatter->getSymbol(\NumberFormatter::GROUPING_SEPARATOR_SYMBOL);
115 $decSep = $formatter->getSymbol(\NumberFormatter::DECIMAL_SEPARATOR_SYMBOL);
116
117 if ('.' !== $decSep && (!$this->grouping || '.' !== $groupSep)) {
118 $value = str_replace('.', $decSep, $value);
119 }
120
121 if (',' !== $decSep && (!$this->grouping || ',' !== $groupSep)) {
122 $value = str_replace(',', $decSep, $value);
123 }
124
125 $result = $formatter->parse($value, \NumberFormatter::TYPE_DOUBLE, $position);
126
127 if (intl_is_failure($formatter->getErrorCode())) {
128 throw new TransformationFailedException($formatter->getErrorMessage());
129 }
130
131 if ($result >= PHP_INT_MAX || $result <= -PHP_INT_MAX) {
132 throw new TransformationFailedException('I don\'t have a clear idea what infinity looks like');
133 }
134
135 if (function_exists('mb_detect_encoding') && false !== $encoding = mb_detect_encoding($value)) {
136 $strlen = function ($string) use ($encoding) {
137 return mb_strlen($string, $encoding);
138 };
139 $substr = function ($string, $offset, $length) use ($encoding) {
140 return mb_substr($string, $offset, $length, $encoding);
141 };
142 } else {
143 $strlen = 'strlen';
144 $substr = 'substr';
145 }
146
147 $length = $strlen($value);
148
149 // After parsing, position holds the index of the character where the
150 // parsing stopped
151 if ($position < $length) {
152 // Check if there are unrecognized characters at the end of the
153 // number (excluding whitespace characters)
154 $remainder = trim($substr($value, $position, $length), " \t\n\r\0\x0b\xc2\xa0");
155
156 if ('' !== $remainder) {
157 throw new TransformationFailedException(
158 sprintf('The number contains unrecognized characters: "%s"', $remainder)
159 );
160 }
161 }
162
163 return $result;
164 }
165
166 /**
167 * Returns a preconfigured \NumberFormatter instance
168 *
169 * @return \NumberFormatter
170 */
171 protected function getNumberFormatter()
172 {
173 $formatter = new \NumberFormatter(\Locale::getDefault(), \NumberFormatter::DECIMAL);
174
175 if (null !== $this->precision) {
176 $formatter->setAttribute(\NumberFormatter::FRACTION_DIGITS, $this->precision);
177 $formatter->setAttribute(\NumberFormatter::ROUNDING_MODE, $this->roundingMode);
178 }
179
180 $formatter->setAttribute(\NumberFormatter::GROUPING_USED, $this->grouping);
181
182 return $formatter;
183 }
184}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Extension/Core/DataTransformer/PercentToLocalizedStringTransformer.php b/vendor/symfony/form/Symfony/Component/Form/Extension/Core/DataTransformer/PercentToLocalizedStringTransformer.php
deleted file mode 100644
index e099d436..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Extension/Core/DataTransformer/PercentToLocalizedStringTransformer.php
+++ /dev/null
@@ -1,149 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Extension\Core\DataTransformer;
13
14use Symfony\Component\Form\DataTransformerInterface;
15use Symfony\Component\Form\Exception\TransformationFailedException;
16use Symfony\Component\Form\Exception\UnexpectedTypeException;
17
18/**
19 * Transforms between a normalized format (integer or float) and a percentage value.
20 *
21 * @author Bernhard Schussek <bschussek@gmail.com>
22 * @author Florian Eckerstorfer <florian@eckerstorfer.org>
23 */
24class PercentToLocalizedStringTransformer implements DataTransformerInterface
25{
26 const FRACTIONAL = 'fractional';
27 const INTEGER = 'integer';
28
29 protected static $types = array(
30 self::FRACTIONAL,
31 self::INTEGER,
32 );
33
34 private $type;
35
36 private $precision;
37
38 /**
39 * Constructor.
40 *
41 * @see self::$types for a list of supported types
42 *
43 * @param integer $precision The precision
44 * @param string $type One of the supported types
45 *
46 * @throws UnexpectedTypeException if the given value of type is unknown
47 */
48 public function __construct($precision = null, $type = null)
49 {
50 if (null === $precision) {
51 $precision = 0;
52 }
53
54 if (null === $type) {
55 $type = self::FRACTIONAL;
56 }
57
58 if (!in_array($type, self::$types, true)) {
59 throw new UnexpectedTypeException($type, implode('", "', self::$types));
60 }
61
62 $this->type = $type;
63 $this->precision = $precision;
64 }
65
66 /**
67 * Transforms between a normalized format (integer or float) into a percentage value.
68 *
69 * @param number $value Normalized value
70 *
71 * @return number Percentage value
72 *
73 * @throws TransformationFailedException If the given value is not numeric or
74 * if the value could not be transformed.
75 */
76 public function transform($value)
77 {
78 if (null === $value) {
79 return '';
80 }
81
82 if (!is_numeric($value)) {
83 throw new TransformationFailedException('Expected a numeric.');
84 }
85
86 if (self::FRACTIONAL == $this->type) {
87 $value *= 100;
88 }
89
90 $formatter = $this->getNumberFormatter();
91 $value = $formatter->format($value);
92
93 if (intl_is_failure($formatter->getErrorCode())) {
94 throw new TransformationFailedException($formatter->getErrorMessage());
95 }
96
97 // replace the UTF-8 non break spaces
98 return $value;
99 }
100
101 /**
102 * Transforms between a percentage value into a normalized format (integer or float).
103 *
104 * @param number $value Percentage value.
105 *
106 * @return number Normalized value.
107 *
108 * @throws TransformationFailedException If the given value is not a string or
109 * if the value could not be transformed.
110 */
111 public function reverseTransform($value)
112 {
113 if (!is_string($value)) {
114 throw new TransformationFailedException('Expected a string.');
115 }
116
117 if ('' === $value) {
118 return null;
119 }
120
121 $formatter = $this->getNumberFormatter();
122 // replace normal spaces so that the formatter can read them
123 $value = $formatter->parse(str_replace(' ', ' ', $value));
124
125 if (intl_is_failure($formatter->getErrorCode())) {
126 throw new TransformationFailedException($formatter->getErrorMessage());
127 }
128
129 if (self::FRACTIONAL == $this->type) {
130 $value /= 100;
131 }
132
133 return $value;
134 }
135
136 /**
137 * Returns a preconfigured \NumberFormatter instance
138 *
139 * @return \NumberFormatter
140 */
141 protected function getNumberFormatter()
142 {
143 $formatter = new \NumberFormatter(\Locale::getDefault(), \NumberFormatter::DECIMAL);
144
145 $formatter->setAttribute(\NumberFormatter::FRACTION_DIGITS, $this->precision);
146
147 return $formatter;
148 }
149}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Extension/Core/DataTransformer/ValueToDuplicatesTransformer.php b/vendor/symfony/form/Symfony/Component/Form/Extension/Core/DataTransformer/ValueToDuplicatesTransformer.php
deleted file mode 100644
index c34a0139..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Extension/Core/DataTransformer/ValueToDuplicatesTransformer.php
+++ /dev/null
@@ -1,91 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Extension\Core\DataTransformer;
13
14use Symfony\Component\Form\DataTransformerInterface;
15use Symfony\Component\Form\Exception\TransformationFailedException;
16
17/**
18 * @author Bernhard Schussek <bschussek@gmail.com>
19 */
20class ValueToDuplicatesTransformer implements DataTransformerInterface
21{
22 private $keys;
23
24 public function __construct(array $keys)
25 {
26 $this->keys = $keys;
27 }
28
29 /**
30 * Duplicates the given value through the array.
31 *
32 * @param mixed $value The value
33 *
34 * @return array The array
35 */
36 public function transform($value)
37 {
38 $result = array();
39
40 foreach ($this->keys as $key) {
41 $result[$key] = $value;
42 }
43
44 return $result;
45 }
46
47 /**
48 * Extracts the duplicated value from an array.
49 *
50 * @param array $array
51 *
52 * @return mixed The value
53 *
54 * @throws TransformationFailedException If the given value is not an array or
55 * if the given array can not be transformed.
56 */
57 public function reverseTransform($array)
58 {
59 if (!is_array($array)) {
60 throw new TransformationFailedException('Expected an array.');
61 }
62
63 $result = current($array);
64 $emptyKeys = array();
65
66 foreach ($this->keys as $key) {
67 if (!empty($array[$key])) {
68 if ($array[$key] !== $result) {
69 throw new TransformationFailedException(
70 'All values in the array should be the same'
71 );
72 }
73 } else {
74 $emptyKeys[] = $key;
75 }
76 }
77
78 if (count($emptyKeys) > 0) {
79 if (count($emptyKeys) == count($this->keys)) {
80 // All keys empty
81 return null;
82 }
83
84 throw new TransformationFailedException(
85 sprintf('The keys "%s" should not be empty', implode('", "', $emptyKeys)
86 ));
87 }
88
89 return $result;
90 }
91}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Extension/Core/EventListener/FixCheckboxInputListener.php b/vendor/symfony/form/Symfony/Component/Form/Extension/Core/EventListener/FixCheckboxInputListener.php
deleted file mode 100644
index 1f62e060..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Extension/Core/EventListener/FixCheckboxInputListener.php
+++ /dev/null
@@ -1,62 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Extension\Core\EventListener;
13
14use Symfony\Component\Form\FormEvents;
15use Symfony\Component\Form\FormEvent;
16use Symfony\Component\EventDispatcher\EventSubscriberInterface;
17use Symfony\Component\Form\Extension\Core\ChoiceList\ChoiceListInterface;
18
19/**
20 * Takes care of converting the input from a list of checkboxes to a correctly
21 * indexed array.
22 *
23 * @author Bernhard Schussek <bschussek@gmail.com>
24 */
25class FixCheckboxInputListener implements EventSubscriberInterface
26{
27 private $choiceList;
28
29 /**
30 * Constructor.
31 *
32 * @param ChoiceListInterface $choiceList
33 */
34 public function __construct(ChoiceListInterface $choiceList)
35 {
36 $this->choiceList = $choiceList;
37 }
38
39 public function preSubmit(FormEvent $event)
40 {
41 $values = (array) $event->getData();
42 $indices = $this->choiceList->getIndicesForValues($values);
43
44 $event->setData(count($indices) > 0 ? array_combine($indices, $values) : array());
45 }
46
47 /**
48 * Alias of {@link preSubmit()}.
49 *
50 * @deprecated Deprecated since version 2.3, to be removed in 3.0. Use
51 * {@link preSubmit()} instead.
52 */
53 public function preBind(FormEvent $event)
54 {
55 $this->preSubmit($event);
56 }
57
58 public static function getSubscribedEvents()
59 {
60 return array(FormEvents::PRE_SUBMIT => 'preSubmit');
61 }
62}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Extension/Core/EventListener/FixRadioInputListener.php b/vendor/symfony/form/Symfony/Component/Form/Extension/Core/EventListener/FixRadioInputListener.php
deleted file mode 100644
index bf03792f..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Extension/Core/EventListener/FixRadioInputListener.php
+++ /dev/null
@@ -1,66 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Extension\Core\EventListener;
13
14use Symfony\Component\Form\FormEvents;
15use Symfony\Component\Form\FormEvent;
16use Symfony\Component\EventDispatcher\EventSubscriberInterface;
17use Symfony\Component\Form\Extension\Core\ChoiceList\ChoiceListInterface;
18
19/**
20 * Takes care of converting the input from a single radio button
21 * to an array.
22 *
23 * @author Bernhard Schussek <bschussek@gmail.com>
24 */
25class FixRadioInputListener implements EventSubscriberInterface
26{
27 private $choiceList;
28
29 private $placeholderPresent;
30
31 /**
32 * Constructor.
33 *
34 * @param ChoiceListInterface $choiceList
35 * @param Boolean $placeholderPresent
36 */
37 public function __construct(ChoiceListInterface $choiceList, $placeholderPresent)
38 {
39 $this->choiceList = $choiceList;
40 $this->placeholderPresent = $placeholderPresent;
41 }
42
43 public function preSubmit(FormEvent $event)
44 {
45 $value = $event->getData();
46 $index = current($this->choiceList->getIndicesForValues(array($value)));
47
48 $event->setData(false !== $index ? array($index => $value) : ($this->placeholderPresent ? array('placeholder' => '') : array())) ;
49 }
50
51 /**
52 * Alias of {@link preSubmit()}.
53 *
54 * @deprecated Deprecated since version 2.3, to be removed in 3.0. Use
55 * {@link preSubmit()} instead.
56 */
57 public function preBind(FormEvent $event)
58 {
59 $this->preSubmit($event);
60 }
61
62 public static function getSubscribedEvents()
63 {
64 return array(FormEvents::PRE_SUBMIT => 'preSubmit');
65 }
66}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Extension/Core/EventListener/FixUrlProtocolListener.php b/vendor/symfony/form/Symfony/Component/Form/Extension/Core/EventListener/FixUrlProtocolListener.php
deleted file mode 100644
index e25dacf2..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Extension/Core/EventListener/FixUrlProtocolListener.php
+++ /dev/null
@@ -1,56 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Extension\Core\EventListener;
13
14use Symfony\Component\Form\FormEvents;
15use Symfony\Component\Form\FormEvent;
16use Symfony\Component\EventDispatcher\EventSubscriberInterface;
17
18/**
19 * Adds a protocol to a URL if it doesn't already have one.
20 *
21 * @author Bernhard Schussek <bschussek@gmail.com>
22 */
23class FixUrlProtocolListener implements EventSubscriberInterface
24{
25 private $defaultProtocol;
26
27 public function __construct($defaultProtocol = 'http')
28 {
29 $this->defaultProtocol = $defaultProtocol;
30 }
31
32 public function onSubmit(FormEvent $event)
33 {
34 $data = $event->getData();
35
36 if ($this->defaultProtocol && $data && !preg_match('~^\w+://~', $data)) {
37 $event->setData($this->defaultProtocol.'://'.$data);
38 }
39 }
40
41 /**
42 * Alias of {@link onSubmit()}.
43 *
44 * @deprecated Deprecated since version 2.3, to be removed in 3.0. Use
45 * {@link onSubmit()} instead.
46 */
47 public function onBind(FormEvent $event)
48 {
49 $this->onSubmit($event);
50 }
51
52 public static function getSubscribedEvents()
53 {
54 return array(FormEvents::SUBMIT => 'onSubmit');
55 }
56}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Extension/Core/EventListener/MergeCollectionListener.php b/vendor/symfony/form/Symfony/Component/Form/Extension/Core/EventListener/MergeCollectionListener.php
deleted file mode 100644
index 4d0bdfaa..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Extension/Core/EventListener/MergeCollectionListener.php
+++ /dev/null
@@ -1,137 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Extension\Core\EventListener;
13
14use Symfony\Component\EventDispatcher\EventSubscriberInterface;
15use Symfony\Component\Form\FormEvents;
16use Symfony\Component\Form\FormEvent;
17use Symfony\Component\Form\Exception\UnexpectedTypeException;
18
19/**
20 * @author Bernhard Schussek <bschussek@gmail.com>
21 */
22class MergeCollectionListener implements EventSubscriberInterface
23{
24 /**
25 * Whether elements may be added to the collection
26 * @var Boolean
27 */
28 private $allowAdd;
29
30 /**
31 * Whether elements may be removed from the collection
32 * @var Boolean
33 */
34 private $allowDelete;
35
36 /**
37 * Creates a new listener.
38 *
39 * @param Boolean $allowAdd Whether values might be added to the
40 * collection.
41 * @param Boolean $allowDelete Whether values might be removed from the
42 * collection.
43 */
44 public function __construct($allowAdd = false, $allowDelete = false)
45 {
46 $this->allowAdd = $allowAdd;
47 $this->allowDelete = $allowDelete;
48 }
49
50 public static function getSubscribedEvents()
51 {
52 return array(
53 FormEvents::SUBMIT => 'onSubmit',
54 );
55 }
56
57 public function onSubmit(FormEvent $event)
58 {
59 $dataToMergeInto = $event->getForm()->getNormData();
60 $data = $event->getData();
61
62 if (null === $data) {
63 $data = array();
64 }
65
66 if (!is_array($data) && !($data instanceof \Traversable && $data instanceof \ArrayAccess)) {
67 throw new UnexpectedTypeException($data, 'array or (\Traversable and \ArrayAccess)');
68 }
69
70 if (null !== $dataToMergeInto && !is_array($dataToMergeInto) && !($dataToMergeInto instanceof \Traversable && $dataToMergeInto instanceof \ArrayAccess)) {
71 throw new UnexpectedTypeException($dataToMergeInto, 'array or (\Traversable and \ArrayAccess)');
72 }
73
74 // If we are not allowed to change anything, return immediately
75 if ((!$this->allowAdd && !$this->allowDelete) || $data === $dataToMergeInto) {
76 $event->setData($dataToMergeInto);
77
78 return;
79 }
80
81 if (!$dataToMergeInto) {
82 // No original data was set. Set it if allowed
83 if ($this->allowAdd) {
84 $dataToMergeInto = $data;
85 }
86 } else {
87 // Calculate delta
88 $itemsToAdd = is_object($data) ? clone $data : $data;
89 $itemsToDelete = array();
90
91 foreach ($dataToMergeInto as $beforeKey => $beforeItem) {
92 foreach ($data as $afterKey => $afterItem) {
93 if ($afterItem === $beforeItem) {
94 // Item found, next original item
95 unset($itemsToAdd[$afterKey]);
96 continue 2;
97 }
98 }
99
100 // Item not found, remember for deletion
101 $itemsToDelete[] = $beforeKey;
102 }
103
104 // Remove deleted items before adding to free keys that are to be
105 // replaced
106 if ($this->allowDelete) {
107 foreach ($itemsToDelete as $key) {
108 unset($dataToMergeInto[$key]);
109 }
110 }
111
112 // Add remaining items
113 if ($this->allowAdd) {
114 foreach ($itemsToAdd as $key => $item) {
115 if (!isset($dataToMergeInto[$key])) {
116 $dataToMergeInto[$key] = $item;
117 } else {
118 $dataToMergeInto[] = $item;
119 }
120 }
121 }
122 }
123
124 $event->setData($dataToMergeInto);
125 }
126
127 /**
128 * Alias of {@link onSubmit()}.
129 *
130 * @deprecated Deprecated since version 2.3, to be removed in 3.0. Use
131 * {@link onSubmit()} instead.
132 */
133 public function onBind(FormEvent $event)
134 {
135 $this->onSubmit($event);
136 }
137}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Extension/Core/EventListener/ResizeFormListener.php b/vendor/symfony/form/Symfony/Component/Form/Extension/Core/EventListener/ResizeFormListener.php
deleted file mode 100644
index f1c39db2..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Extension/Core/EventListener/ResizeFormListener.php
+++ /dev/null
@@ -1,173 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Extension\Core\EventListener;
13
14use Symfony\Component\Form\FormEvents;
15use Symfony\Component\Form\FormEvent;
16use Symfony\Component\Form\Exception\UnexpectedTypeException;
17use Symfony\Component\EventDispatcher\EventSubscriberInterface;
18
19/**
20 * Resize a collection form element based on the data sent from the client.
21 *
22 * @author Bernhard Schussek <bschussek@gmail.com>
23 */
24class ResizeFormListener implements EventSubscriberInterface
25{
26 /**
27 * @var string
28 */
29 protected $type;
30
31 /**
32 * @var array
33 */
34 protected $options;
35
36 /**
37 * Whether children could be added to the group
38 * @var Boolean
39 */
40 protected $allowAdd;
41
42 /**
43 * Whether children could be removed from the group
44 * @var Boolean
45 */
46 protected $allowDelete;
47
48 public function __construct($type, array $options = array(), $allowAdd = false, $allowDelete = false)
49 {
50 $this->type = $type;
51 $this->allowAdd = $allowAdd;
52 $this->allowDelete = $allowDelete;
53 $this->options = $options;
54 }
55
56 public static function getSubscribedEvents()
57 {
58 return array(
59 FormEvents::PRE_SET_DATA => 'preSetData',
60 FormEvents::PRE_SUBMIT => 'preSubmit',
61 // (MergeCollectionListener, MergeDoctrineCollectionListener)
62 FormEvents::SUBMIT => array('onSubmit', 50),
63 );
64 }
65
66 public function preSetData(FormEvent $event)
67 {
68 $form = $event->getForm();
69 $data = $event->getData();
70
71 if (null === $data) {
72 $data = array();
73 }
74
75 if (!is_array($data) && !($data instanceof \Traversable && $data instanceof \ArrayAccess)) {
76 throw new UnexpectedTypeException($data, 'array or (\Traversable and \ArrayAccess)');
77 }
78
79 // First remove all rows
80 foreach ($form as $name => $child) {
81 $form->remove($name);
82 }
83
84 // Then add all rows again in the correct order
85 foreach ($data as $name => $value) {
86 $form->add($name, $this->type, array_replace(array(
87 'property_path' => '['.$name.']',
88 ), $this->options));
89 }
90 }
91
92 public function preSubmit(FormEvent $event)
93 {
94 $form = $event->getForm();
95 $data = $event->getData();
96
97 if (null === $data || '' === $data) {
98 $data = array();
99 }
100
101 if (!is_array($data) && !($data instanceof \Traversable && $data instanceof \ArrayAccess)) {
102 throw new UnexpectedTypeException($data, 'array or (\Traversable and \ArrayAccess)');
103 }
104
105 // Remove all empty rows
106 if ($this->allowDelete) {
107 foreach ($form as $name => $child) {
108 if (!isset($data[$name])) {
109 $form->remove($name);
110 }
111 }
112 }
113
114 // Add all additional rows
115 if ($this->allowAdd) {
116 foreach ($data as $name => $value) {
117 if (!$form->has($name)) {
118 $form->add($name, $this->type, array_replace(array(
119 'property_path' => '['.$name.']',
120 ), $this->options));
121 }
122 }
123 }
124 }
125
126 public function onSubmit(FormEvent $event)
127 {
128 $form = $event->getForm();
129 $data = $event->getData();
130
131 if (null === $data) {
132 $data = array();
133 }
134
135 if (!is_array($data) && !($data instanceof \Traversable && $data instanceof \ArrayAccess)) {
136 throw new UnexpectedTypeException($data, 'array or (\Traversable and \ArrayAccess)');
137 }
138
139 // The data mapper only adds, but does not remove items, so do this
140 // here
141 if ($this->allowDelete) {
142 foreach ($data as $name => $child) {
143 if (!$form->has($name)) {
144 unset($data[$name]);
145 }
146 }
147 }
148
149 $event->setData($data);
150 }
151
152 /**
153 * Alias of {@link preSubmit()}.
154 *
155 * @deprecated Deprecated since version 2.3, to be removed in 3.0. Use
156 * {@link preSubmit()} instead.
157 */
158 public function preBind(FormEvent $event)
159 {
160 $this->preSubmit($event);
161 }
162
163 /**
164 * Alias of {@link onSubmit()}.
165 *
166 * @deprecated Deprecated since version 2.3, to be removed in 3.0. Use
167 * {@link onSubmit()} instead.
168 */
169 public function onBind(FormEvent $event)
170 {
171 $this->onSubmit($event);
172 }
173}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Extension/Core/EventListener/TrimListener.php b/vendor/symfony/form/Symfony/Component/Form/Extension/Core/EventListener/TrimListener.php
deleted file mode 100644
index cbe6e0ab..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Extension/Core/EventListener/TrimListener.php
+++ /dev/null
@@ -1,55 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Extension\Core\EventListener;
13
14use Symfony\Component\Form\FormEvents;
15use Symfony\Component\Form\FormEvent;
16use Symfony\Component\EventDispatcher\EventSubscriberInterface;
17
18/**
19 * Trims string data
20 *
21 * @author Bernhard Schussek <bschussek@gmail.com>
22 */
23class TrimListener implements EventSubscriberInterface
24{
25 public function preSubmit(FormEvent $event)
26 {
27 $data = $event->getData();
28
29 if (!is_string($data)) {
30 return;
31 }
32
33 if (null !== $result = @preg_replace('/^[\pZ\p{Cc}]+|[\pZ\p{Cc}]+$/u', '', $data)) {
34 $event->setData($result);
35 } else {
36 $event->setData(trim($data));
37 }
38 }
39
40 /**
41 * Alias of {@link preSubmit()}.
42 *
43 * @deprecated Deprecated since version 2.3, to be removed in 3.0. Use
44 * {@link preSubmit()} instead.
45 */
46 public function preBind(FormEvent $event)
47 {
48 $this->preSubmit($event);
49 }
50
51 public static function getSubscribedEvents()
52 {
53 return array(FormEvents::PRE_SUBMIT => 'preSubmit');
54 }
55}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Extension/Core/Type/BaseType.php b/vendor/symfony/form/Symfony/Component/Form/Extension/Core/Type/BaseType.php
deleted file mode 100644
index 79333a67..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Extension/Core/Type/BaseType.php
+++ /dev/null
@@ -1,121 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Extension\Core\Type;
13
14use Symfony\Component\Form\AbstractType;
15use Symfony\Component\Form\FormBuilderInterface;
16use Symfony\Component\Form\FormInterface;
17use Symfony\Component\Form\FormView;
18use Symfony\Component\OptionsResolver\OptionsResolverInterface;
19
20/**
21 * Encapsulates common logic of {@link FormType} and {@link ButtonType}.
22 *
23 * This type does not appear in the form's type inheritance chain and as such
24 * cannot be extended (via {@link FormTypeExtension}s) nor themed.
25 *
26 * @author Bernhard Schussek <bschussek@gmail.com>
27 */
28abstract class BaseType extends AbstractType
29{
30 /**
31 * {@inheritdoc}
32 */
33 public function buildForm(FormBuilderInterface $builder, array $options)
34 {
35 $builder->setDisabled($options['disabled']);
36 }
37
38 /**
39 * {@inheritdoc}
40 */
41 public function buildView(FormView $view, FormInterface $form, array $options)
42 {
43 $name = $form->getName();
44 $blockName = $options['block_name'] ?: $form->getName();
45 $translationDomain = $options['translation_domain'];
46
47 if ($view->parent) {
48 if ('' !== ($parentFullName = $view->parent->vars['full_name'])) {
49 $id = sprintf('%s_%s', $view->parent->vars['id'], $name);
50 $fullName = sprintf('%s[%s]', $parentFullName, $name);
51 $uniqueBlockPrefix = sprintf('%s_%s', $view->parent->vars['unique_block_prefix'], $blockName);
52 } else {
53 $id = $name;
54 $fullName = $name;
55 $uniqueBlockPrefix = '_'.$blockName;
56 }
57
58 if (!$translationDomain) {
59 $translationDomain = $view->parent->vars['translation_domain'];
60 }
61 } else {
62 $id = $name;
63 $fullName = $name;
64 $uniqueBlockPrefix = '_'.$blockName;
65
66 // Strip leading underscores and digits. These are allowed in
67 // form names, but not in HTML4 ID attributes.
68 // http://www.w3.org/TR/html401/struct/global.html#adef-id
69 $id = ltrim($id, '_0123456789');
70 }
71
72 $blockPrefixes = array();
73 for ($type = $form->getConfig()->getType(); null !== $type; $type = $type->getParent()) {
74 array_unshift($blockPrefixes, $type->getName());
75 }
76 $blockPrefixes[] = $uniqueBlockPrefix;
77
78 if (!$translationDomain) {
79 $translationDomain = 'messages';
80 }
81
82 $view->vars = array_replace($view->vars, array(
83 'form' => $view,
84 'id' => $id,
85 'name' => $name,
86 'full_name' => $fullName,
87 'disabled' => $form->isDisabled(),
88 'label' => $options['label'],
89 'multipart' => false,
90 'attr' => $options['attr'],
91 'block_prefixes' => $blockPrefixes,
92 'unique_block_prefix' => $uniqueBlockPrefix,
93 'translation_domain' => $translationDomain,
94 // Using the block name here speeds up performance in collection
95 // forms, where each entry has the same full block name.
96 // Including the type is important too, because if rows of a
97 // collection form have different types (dynamically), they should
98 // be rendered differently.
99 // https://github.com/symfony/symfony/issues/5038
100 'cache_key' => $uniqueBlockPrefix.'_'.$form->getConfig()->getType()->getName(),
101 ));
102 }
103
104 /**
105 * {@inheritdoc}
106 */
107 public function setDefaultOptions(OptionsResolverInterface $resolver)
108 {
109 $resolver->setDefaults(array(
110 'block_name' => null,
111 'disabled' => false,
112 'label' => null,
113 'attr' => array(),
114 'translation_domain' => null,
115 ));
116
117 $resolver->setAllowedTypes(array(
118 'attr' => 'array',
119 ));
120 }
121}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Extension/Core/Type/BirthdayType.php b/vendor/symfony/form/Symfony/Component/Form/Extension/Core/Type/BirthdayType.php
deleted file mode 100644
index 5314c140..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Extension/Core/Type/BirthdayType.php
+++ /dev/null
@@ -1,44 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Extension\Core\Type;
13
14use Symfony\Component\Form\AbstractType;
15use Symfony\Component\OptionsResolver\OptionsResolverInterface;
16
17class BirthdayType extends AbstractType
18{
19 /**
20 * {@inheritdoc}
21 */
22 public function setDefaultOptions(OptionsResolverInterface $resolver)
23 {
24 $resolver->setDefaults(array(
25 'years' => range(date('Y') - 120, date('Y')),
26 ));
27 }
28
29 /**
30 * {@inheritdoc}
31 */
32 public function getParent()
33 {
34 return 'date';
35 }
36
37 /**
38 * {@inheritdoc}
39 */
40 public function getName()
41 {
42 return 'birthday';
43 }
44}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Extension/Core/Type/ButtonType.php b/vendor/symfony/form/Symfony/Component/Form/Extension/Core/Type/ButtonType.php
deleted file mode 100644
index 3569963b..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Extension/Core/Type/ButtonType.php
+++ /dev/null
@@ -1,38 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Extension\Core\Type;
13
14use Symfony\Component\Form\ButtonTypeInterface;
15
16/**
17 * A form button.
18 *
19 * @author Bernhard Schussek <bschussek@gmail.com>
20 */
21class ButtonType extends BaseType implements ButtonTypeInterface
22{
23 /**
24 * {@inheritdoc}
25 */
26 public function getParent()
27 {
28 return null;
29 }
30
31 /**
32 * {@inheritdoc}
33 */
34 public function getName()
35 {
36 return 'button';
37 }
38}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Extension/Core/Type/CheckboxType.php b/vendor/symfony/form/Symfony/Component/Form/Extension/Core/Type/CheckboxType.php
deleted file mode 100644
index 214e581a..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Extension/Core/Type/CheckboxType.php
+++ /dev/null
@@ -1,67 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Extension\Core\Type;
13
14use Symfony\Component\Form\AbstractType;
15use Symfony\Component\Form\FormBuilderInterface;
16use Symfony\Component\Form\FormInterface;
17use Symfony\Component\Form\Extension\Core\DataTransformer\BooleanToStringTransformer;
18use Symfony\Component\Form\FormView;
19use Symfony\Component\OptionsResolver\OptionsResolverInterface;
20
21class CheckboxType extends AbstractType
22{
23 /**
24 * {@inheritdoc}
25 */
26 public function buildForm(FormBuilderInterface $builder, array $options)
27 {
28 $builder
29 ->addViewTransformer(new BooleanToStringTransformer($options['value']))
30 ;
31 }
32
33 /**
34 * {@inheritdoc}
35 */
36 public function buildView(FormView $view, FormInterface $form, array $options)
37 {
38 $view->vars = array_replace($view->vars, array(
39 'value' => $options['value'],
40 'checked' => null !== $form->getViewData(),
41 ));
42 }
43
44 /**
45 * {@inheritdoc}
46 */
47 public function setDefaultOptions(OptionsResolverInterface $resolver)
48 {
49 $emptyData = function (FormInterface $form, $clientData) {
50 return $clientData;
51 };
52
53 $resolver->setDefaults(array(
54 'value' => '1',
55 'empty_data' => $emptyData,
56 'compound' => false,
57 ));
58 }
59
60 /**
61 * {@inheritdoc}
62 */
63 public function getName()
64 {
65 return 'checkbox';
66 }
67}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Extension/Core/Type/ChoiceType.php b/vendor/symfony/form/Symfony/Component/Form/Extension/Core/Type/ChoiceType.php
deleted file mode 100644
index 9a3fdef1..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Extension/Core/Type/ChoiceType.php
+++ /dev/null
@@ -1,274 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Extension\Core\Type;
13
14use Symfony\Component\Form\AbstractType;
15use Symfony\Component\Form\Extension\Core\View\ChoiceView;
16use Symfony\Component\Form\FormBuilderInterface;
17use Symfony\Component\Form\FormInterface;
18use Symfony\Component\Form\FormView;
19use Symfony\Component\Form\Exception\LogicException;
20use Symfony\Component\Form\Extension\Core\ChoiceList\SimpleChoiceList;
21use Symfony\Component\Form\Extension\Core\EventListener\FixRadioInputListener;
22use Symfony\Component\Form\Extension\Core\EventListener\FixCheckboxInputListener;
23use Symfony\Component\Form\Extension\Core\EventListener\MergeCollectionListener;
24use Symfony\Component\Form\Extension\Core\DataTransformer\ChoiceToValueTransformer;
25use Symfony\Component\Form\Extension\Core\DataTransformer\ChoiceToBooleanArrayTransformer;
26use Symfony\Component\Form\Extension\Core\DataTransformer\ChoicesToValuesTransformer;
27use Symfony\Component\Form\Extension\Core\DataTransformer\ChoicesToBooleanArrayTransformer;
28use Symfony\Component\OptionsResolver\Options;
29use Symfony\Component\OptionsResolver\OptionsResolverInterface;
30
31class ChoiceType extends AbstractType
32{
33 /**
34 * Caches created choice lists.
35 * @var array
36 */
37 private $choiceListCache = array();
38
39 /**
40 * {@inheritdoc}
41 */
42 public function buildForm(FormBuilderInterface $builder, array $options)
43 {
44 if (!$options['choice_list'] && !is_array($options['choices']) && !$options['choices'] instanceof \Traversable) {
45 throw new LogicException('Either the option "choices" or "choice_list" must be set.');
46 }
47
48 if ($options['expanded']) {
49 // Initialize all choices before doing the index check below.
50 // This helps in cases where index checks are optimized for non
51 // initialized choice lists. For example, when using an SQL driver,
52 // the index check would read in one SQL query and the initialization
53 // requires another SQL query. When the initialization is done first,
54 // one SQL query is sufficient.
55 $preferredViews = $options['choice_list']->getPreferredViews();
56 $remainingViews = $options['choice_list']->getRemainingViews();
57
58 // Check if the choices already contain the empty value
59 // Only add the empty value option if this is not the case
60 if (null !== $options['empty_value'] && 0 === count($options['choice_list']->getIndicesForValues(array('')))) {
61 $placeholderView = new ChoiceView(null, '', $options['empty_value']);
62
63 // "placeholder" is a reserved index
64 // see also ChoiceListInterface::getIndicesForChoices()
65 $this->addSubForms($builder, array('placeholder' => $placeholderView), $options);
66 }
67
68 $this->addSubForms($builder, $preferredViews, $options);
69 $this->addSubForms($builder, $remainingViews, $options);
70
71 if ($options['multiple']) {
72 $builder->addViewTransformer(new ChoicesToBooleanArrayTransformer($options['choice_list']));
73 $builder->addEventSubscriber(new FixCheckboxInputListener($options['choice_list']), 10);
74 } else {
75 $builder->addViewTransformer(new ChoiceToBooleanArrayTransformer($options['choice_list'], $builder->has('placeholder')));
76 $builder->addEventSubscriber(new FixRadioInputListener($options['choice_list'], $builder->has('placeholder')), 10);
77 }
78 } else {
79 if ($options['multiple']) {
80 $builder->addViewTransformer(new ChoicesToValuesTransformer($options['choice_list']));
81 } else {
82 $builder->addViewTransformer(new ChoiceToValueTransformer($options['choice_list']));
83 }
84 }
85
86 if ($options['multiple'] && $options['by_reference']) {
87 // Make sure the collection created during the client->norm
88 // transformation is merged back into the original collection
89 $builder->addEventSubscriber(new MergeCollectionListener(true, true));
90 }
91 }
92
93 /**
94 * {@inheritdoc}
95 */
96 public function buildView(FormView $view, FormInterface $form, array $options)
97 {
98 $view->vars = array_replace($view->vars, array(
99 'multiple' => $options['multiple'],
100 'expanded' => $options['expanded'],
101 'preferred_choices' => $options['choice_list']->getPreferredViews(),
102 'choices' => $options['choice_list']->getRemainingViews(),
103 'separator' => '-------------------',
104 'empty_value' => null,
105 ));
106
107 // The decision, whether a choice is selected, is potentially done
108 // thousand of times during the rendering of a template. Provide a
109 // closure here that is optimized for the value of the form, to
110 // avoid making the type check inside the closure.
111 if ($options['multiple']) {
112 $view->vars['is_selected'] = function ($choice, array $values) {
113 return false !== array_search($choice, $values, true);
114 };
115 } else {
116 $view->vars['is_selected'] = function ($choice, $value) {
117 return $choice === $value;
118 };
119 }
120
121 // Check if the choices already contain the empty value
122 // Only add the empty value option if this is not the case
123 if (null !== $options['empty_value'] && 0 === count($options['choice_list']->getIndicesForValues(array('')))) {
124 $view->vars['empty_value'] = $options['empty_value'];
125 }
126
127 if ($options['multiple'] && !$options['expanded']) {
128 // Add "[]" to the name in case a select tag with multiple options is
129 // displayed. Otherwise only one of the selected options is sent in the
130 // POST request.
131 $view->vars['full_name'] = $view->vars['full_name'].'[]';
132 }
133 }
134
135 /**
136 * {@inheritdoc}
137 */
138 public function finishView(FormView $view, FormInterface $form, array $options)
139 {
140 if ($options['expanded']) {
141 // Radio buttons should have the same name as the parent
142 $childName = $view->vars['full_name'];
143
144 // Checkboxes should append "[]" to allow multiple selection
145 if ($options['multiple']) {
146 $childName .= '[]';
147 }
148
149 foreach ($view as $childView) {
150 $childView->vars['full_name'] = $childName;
151 }
152 }
153 }
154
155 /**
156 * {@inheritdoc}
157 */
158 public function setDefaultOptions(OptionsResolverInterface $resolver)
159 {
160 $choiceListCache =& $this->choiceListCache;
161
162 $choiceList = function (Options $options) use (&$choiceListCache) {
163 // Harden against NULL values (like in EntityType and ModelType)
164 $choices = null !== $options['choices'] ? $options['choices'] : array();
165
166 // Reuse existing choice lists in order to increase performance
167 $hash = md5(json_encode(array($choices, $options['preferred_choices'])));
168
169 if (!isset($choiceListCache[$hash])) {
170 $choiceListCache[$hash] = new SimpleChoiceList($choices, $options['preferred_choices']);
171 }
172
173 return $choiceListCache[$hash];
174 };
175
176 $emptyData = function (Options $options) {
177 if ($options['multiple'] || $options['expanded']) {
178 return array();
179 }
180
181 return '';
182 };
183
184 $emptyValue = function (Options $options) {
185 return $options['required'] ? null : '';
186 };
187
188 $emptyValueNormalizer = function (Options $options, $emptyValue) {
189 if ($options['multiple']) {
190 // never use an empty value for this case
191 return null;
192 } elseif (false === $emptyValue) {
193 // an empty value should be added but the user decided otherwise
194 return null;
195 } elseif ($options['expanded'] && '' === $emptyValue) {
196 // never use an empty label for radio buttons
197 return 'None';
198 }
199
200 // empty value has been set explicitly
201 return $emptyValue;
202 };
203
204 $compound = function (Options $options) {
205 return $options['expanded'];
206 };
207
208 $resolver->setDefaults(array(
209 'multiple' => false,
210 'expanded' => false,
211 'choice_list' => $choiceList,
212 'choices' => array(),
213 'preferred_choices' => array(),
214 'empty_data' => $emptyData,
215 'empty_value' => $emptyValue,
216 'error_bubbling' => false,
217 'compound' => $compound,
218 // The view data is always a string, even if the "data" option
219 // is manually set to an object.
220 // See https://github.com/symfony/symfony/pull/5582
221 'data_class' => null,
222 ));
223
224 $resolver->setNormalizers(array(
225 'empty_value' => $emptyValueNormalizer,
226 ));
227
228 $resolver->setAllowedTypes(array(
229 'choice_list' => array('null', 'Symfony\Component\Form\Extension\Core\ChoiceList\ChoiceListInterface'),
230 ));
231 }
232
233 /**
234 * {@inheritdoc}
235 */
236 public function getName()
237 {
238 return 'choice';
239 }
240
241 /**
242 * Adds the sub fields for an expanded choice field.
243 *
244 * @param FormBuilderInterface $builder The form builder.
245 * @param array $choiceViews The choice view objects.
246 * @param array $options The build options.
247 */
248 private function addSubForms(FormBuilderInterface $builder, array $choiceViews, array $options)
249 {
250 foreach ($choiceViews as $i => $choiceView) {
251 if (is_array($choiceView)) {
252 // Flatten groups
253 $this->addSubForms($builder, $choiceView, $options);
254 } else {
255 $choiceOpts = array(
256 'value' => $choiceView->value,
257 'label' => $choiceView->label,
258 'translation_domain' => $options['translation_domain'],
259 );
260
261 if ($options['multiple']) {
262 $choiceType = 'checkbox';
263 // The user can check 0 or more checkboxes. If required
264 // is true, he is required to check all of them.
265 $choiceOpts['required'] = false;
266 } else {
267 $choiceType = 'radio';
268 }
269
270 $builder->add($i, $choiceType, $choiceOpts);
271 }
272 }
273 }
274}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Extension/Core/Type/CollectionType.php b/vendor/symfony/form/Symfony/Component/Form/Extension/Core/Type/CollectionType.php
deleted file mode 100644
index 0cb3af1b..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Extension/Core/Type/CollectionType.php
+++ /dev/null
@@ -1,103 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Extension\Core\Type;
13
14use Symfony\Component\Form\AbstractType;
15use Symfony\Component\Form\FormBuilderInterface;
16use Symfony\Component\Form\FormView;
17use Symfony\Component\Form\FormInterface;
18use Symfony\Component\Form\Extension\Core\EventListener\ResizeFormListener;
19use Symfony\Component\OptionsResolver\Options;
20use Symfony\Component\OptionsResolver\OptionsResolverInterface;
21
22class CollectionType extends AbstractType
23{
24 /**
25 * {@inheritdoc}
26 */
27 public function buildForm(FormBuilderInterface $builder, array $options)
28 {
29 if ($options['allow_add'] && $options['prototype']) {
30 $prototype = $builder->create($options['prototype_name'], $options['type'], array_replace(array(
31 'label' => $options['prototype_name'].'label__',
32 ), $options['options']));
33 $builder->setAttribute('prototype', $prototype->getForm());
34 }
35
36 $resizeListener = new ResizeFormListener(
37 $options['type'],
38 $options['options'],
39 $options['allow_add'],
40 $options['allow_delete']
41 );
42
43 $builder->addEventSubscriber($resizeListener);
44 }
45
46 /**
47 * {@inheritdoc}
48 */
49 public function buildView(FormView $view, FormInterface $form, array $options)
50 {
51 $view->vars = array_replace($view->vars, array(
52 'allow_add' => $options['allow_add'],
53 'allow_delete' => $options['allow_delete'],
54 ));
55
56 if ($form->getConfig()->hasAttribute('prototype')) {
57 $view->vars['prototype'] = $form->getConfig()->getAttribute('prototype')->createView($view);
58 }
59 }
60
61 /**
62 * {@inheritdoc}
63 */
64 public function finishView(FormView $view, FormInterface $form, array $options)
65 {
66 if ($form->getConfig()->hasAttribute('prototype') && $view->vars['prototype']->vars['multipart']) {
67 $view->vars['multipart'] = true;
68 }
69 }
70
71 /**
72 * {@inheritdoc}
73 */
74 public function setDefaultOptions(OptionsResolverInterface $resolver)
75 {
76 $optionsNormalizer = function (Options $options, $value) {
77 $value['block_name'] = 'entry';
78
79 return $value;
80 };
81
82 $resolver->setDefaults(array(
83 'allow_add' => false,
84 'allow_delete' => false,
85 'prototype' => true,
86 'prototype_name' => '__name__',
87 'type' => 'text',
88 'options' => array(),
89 ));
90
91 $resolver->setNormalizers(array(
92 'options' => $optionsNormalizer,
93 ));
94 }
95
96 /**
97 * {@inheritdoc}
98 */
99 public function getName()
100 {
101 return 'collection';
102 }
103}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Extension/Core/Type/CountryType.php b/vendor/symfony/form/Symfony/Component/Form/Extension/Core/Type/CountryType.php
deleted file mode 100644
index 3482ba66..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Extension/Core/Type/CountryType.php
+++ /dev/null
@@ -1,45 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Extension\Core\Type;
13
14use Symfony\Component\Form\AbstractType;
15use Symfony\Component\Intl\Intl;
16use Symfony\Component\OptionsResolver\OptionsResolverInterface;
17
18class CountryType extends AbstractType
19{
20 /**
21 * {@inheritdoc}
22 */
23 public function setDefaultOptions(OptionsResolverInterface $resolver)
24 {
25 $resolver->setDefaults(array(
26 'choices' => Intl::getRegionBundle()->getCountryNames(),
27 ));
28 }
29
30 /**
31 * {@inheritdoc}
32 */
33 public function getParent()
34 {
35 return 'choice';
36 }
37
38 /**
39 * {@inheritdoc}
40 */
41 public function getName()
42 {
43 return 'country';
44 }
45}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Extension/Core/Type/CurrencyType.php b/vendor/symfony/form/Symfony/Component/Form/Extension/Core/Type/CurrencyType.php
deleted file mode 100644
index 3a925e3a..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Extension/Core/Type/CurrencyType.php
+++ /dev/null
@@ -1,45 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Extension\Core\Type;
13
14use Symfony\Component\Form\AbstractType;
15use Symfony\Component\Intl\Intl;
16use Symfony\Component\OptionsResolver\OptionsResolverInterface;
17
18class CurrencyType extends AbstractType
19{
20 /**
21 * {@inheritdoc}
22 */
23 public function setDefaultOptions(OptionsResolverInterface $resolver)
24 {
25 $resolver->setDefaults(array(
26 'choices' => Intl::getCurrencyBundle()->getCurrencyNames(),
27 ));
28 }
29
30 /**
31 * {@inheritdoc}
32 */
33 public function getParent()
34 {
35 return 'choice';
36 }
37
38 /**
39 * {@inheritdoc}
40 */
41 public function getName()
42 {
43 return 'currency';
44 }
45}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Extension/Core/Type/DateTimeType.php b/vendor/symfony/form/Symfony/Component/Form/Extension/Core/Type/DateTimeType.php
deleted file mode 100644
index a612b6fc..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Extension/Core/Type/DateTimeType.php
+++ /dev/null
@@ -1,281 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Extension\Core\Type;
13
14use Symfony\Component\Form\AbstractType;
15use Symfony\Component\OptionsResolver\Exception\InvalidOptionsException;
16use Symfony\Component\Form\FormInterface;
17use Symfony\Component\Form\FormBuilderInterface;
18use Symfony\Component\Form\FormView;
19use Symfony\Component\Form\ReversedTransformer;
20use Symfony\Component\Form\Extension\Core\DataTransformer\DataTransformerChain;
21use Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeToArrayTransformer;
22use Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeToStringTransformer;
23use Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeToLocalizedStringTransformer;
24use Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeToTimestampTransformer;
25use Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeToRfc3339Transformer;
26use Symfony\Component\Form\Extension\Core\DataTransformer\ArrayToPartsTransformer;
27use Symfony\Component\OptionsResolver\Options;
28use Symfony\Component\OptionsResolver\OptionsResolverInterface;
29
30class DateTimeType extends AbstractType
31{
32 const DEFAULT_DATE_FORMAT = \IntlDateFormatter::MEDIUM;
33
34 const DEFAULT_TIME_FORMAT = \IntlDateFormatter::MEDIUM;
35
36 /**
37 * This is not quite the HTML5 format yet, because ICU lacks the
38 * capability of parsing and generating RFC 3339 dates, which
39 * are like the below pattern but with a timezone suffix. The
40 * timezone suffix is
41 *
42 * * "Z" for UTC
43 * * "(-|+)HH:mm" for other timezones (note the colon!)
44 *
45 * For more information see:
46 *
47 * http://userguide.icu-project.org/formatparse/datetime#TOC-Date-Time-Format-Syntax
48 * http://www.w3.org/TR/html-markup/input.datetime.html
49 * http://tools.ietf.org/html/rfc3339
50 *
51 * An ICU ticket was created:
52 * http://icu-project.org/trac/ticket/9421
53 *
54 * It was supposedly fixed, but is not available in all PHP installations
55 * yet. To temporarily circumvent this issue, DateTimeToRfc3339Transformer
56 * is used when the format matches this constant.
57 */
58 const HTML5_FORMAT = "yyyy-MM-dd'T'HH:mm:ssZZZZZ";
59
60 private static $acceptedFormats = array(
61 \IntlDateFormatter::FULL,
62 \IntlDateFormatter::LONG,
63 \IntlDateFormatter::MEDIUM,
64 \IntlDateFormatter::SHORT,
65 );
66
67 /**
68 * {@inheritdoc}
69 */
70 public function buildForm(FormBuilderInterface $builder, array $options)
71 {
72 $parts = array('year', 'month', 'day', 'hour');
73 $dateParts = array('year', 'month', 'day');
74 $timeParts = array('hour');
75
76 if ($options['with_minutes']) {
77 $parts[] = 'minute';
78 $timeParts[] = 'minute';
79 }
80
81 if ($options['with_seconds']) {
82 $parts[] = 'second';
83 $timeParts[] = 'second';
84 }
85
86 $dateFormat = is_int($options['date_format']) ? $options['date_format'] : self::DEFAULT_DATE_FORMAT;
87 $timeFormat = self::DEFAULT_TIME_FORMAT;
88 $calendar = \IntlDateFormatter::GREGORIAN;
89 $pattern = is_string($options['format']) ? $options['format'] : null;
90
91 if (!in_array($dateFormat, self::$acceptedFormats, true)) {
92 throw new InvalidOptionsException('The "date_format" option must be one of the IntlDateFormatter constants (FULL, LONG, MEDIUM, SHORT) or a string representing a custom format.');
93 }
94
95 if ('single_text' === $options['widget']) {
96 if (self::HTML5_FORMAT === $pattern) {
97 $builder->addViewTransformer(new DateTimeToRfc3339Transformer(
98 $options['model_timezone'],
99 $options['view_timezone']
100 ));
101 } else {
102 $builder->addViewTransformer(new DateTimeToLocalizedStringTransformer(
103 $options['model_timezone'],
104 $options['view_timezone'],
105 $dateFormat,
106 $timeFormat,
107 $calendar,
108 $pattern
109 ));
110 }
111 } else {
112 // Only pass a subset of the options to children
113 $dateOptions = array_intersect_key($options, array_flip(array(
114 'years',
115 'months',
116 'days',
117 'empty_value',
118 'required',
119 'translation_domain',
120 )));
121
122 $timeOptions = array_intersect_key($options, array_flip(array(
123 'hours',
124 'minutes',
125 'seconds',
126 'with_minutes',
127 'with_seconds',
128 'empty_value',
129 'required',
130 'translation_domain',
131 )));
132
133 if (null !== $options['date_widget']) {
134 $dateOptions['widget'] = $options['date_widget'];
135 }
136
137 if (null !== $options['time_widget']) {
138 $timeOptions['widget'] = $options['time_widget'];
139 }
140
141 if (null !== $options['date_format']) {
142 $dateOptions['format'] = $options['date_format'];
143 }
144
145 $dateOptions['input'] = $timeOptions['input'] = 'array';
146 $dateOptions['error_bubbling'] = $timeOptions['error_bubbling'] = true;
147
148 $builder
149 ->addViewTransformer(new DataTransformerChain(array(
150 new DateTimeToArrayTransformer($options['model_timezone'], $options['view_timezone'], $parts),
151 new ArrayToPartsTransformer(array(
152 'date' => $dateParts,
153 'time' => $timeParts,
154 )),
155 )))
156 ->add('date', 'date', $dateOptions)
157 ->add('time', 'time', $timeOptions)
158 ;
159 }
160
161 if ('string' === $options['input']) {
162 $builder->addModelTransformer(new ReversedTransformer(
163 new DateTimeToStringTransformer($options['model_timezone'], $options['model_timezone'])
164 ));
165 } elseif ('timestamp' === $options['input']) {
166 $builder->addModelTransformer(new ReversedTransformer(
167 new DateTimeToTimestampTransformer($options['model_timezone'], $options['model_timezone'])
168 ));
169 } elseif ('array' === $options['input']) {
170 $builder->addModelTransformer(new ReversedTransformer(
171 new DateTimeToArrayTransformer($options['model_timezone'], $options['model_timezone'], $parts)
172 ));
173 }
174 }
175
176 /**
177 * {@inheritdoc}
178 */
179 public function buildView(FormView $view, FormInterface $form, array $options)
180 {
181 $view->vars['widget'] = $options['widget'];
182
183 // Change the input to a HTML5 date input if
184 // * the widget is set to "single_text"
185 // * the format matches the one expected by HTML5
186 if ('single_text' === $options['widget'] && self::HTML5_FORMAT === $options['format']) {
187 $view->vars['type'] = 'datetime';
188 }
189 }
190
191 /**
192 * {@inheritdoc}
193 */
194 public function setDefaultOptions(OptionsResolverInterface $resolver)
195 {
196 $compound = function (Options $options) {
197 return $options['widget'] !== 'single_text';
198 };
199
200 // Defaults to the value of "widget"
201 $dateWidget = function (Options $options) {
202 return $options['widget'];
203 };
204
205 // Defaults to the value of "widget"
206 $timeWidget = function (Options $options) {
207 return $options['widget'];
208 };
209
210 $resolver->setDefaults(array(
211 'input' => 'datetime',
212 'model_timezone' => null,
213 'view_timezone' => null,
214 'format' => self::HTML5_FORMAT,
215 'date_format' => null,
216 'widget' => null,
217 'date_widget' => $dateWidget,
218 'time_widget' => $timeWidget,
219 'with_minutes' => true,
220 'with_seconds' => false,
221 // Don't modify \DateTime classes by reference, we treat
222 // them like immutable value objects
223 'by_reference' => false,
224 'error_bubbling' => false,
225 // If initialized with a \DateTime object, FormType initializes
226 // this option to "\DateTime". Since the internal, normalized
227 // representation is not \DateTime, but an array, we need to unset
228 // this option.
229 'data_class' => null,
230 'compound' => $compound,
231 ));
232
233 // Don't add some defaults in order to preserve the defaults
234 // set in DateType and TimeType
235 $resolver->setOptional(array(
236 'empty_value',
237 'years',
238 'months',
239 'days',
240 'hours',
241 'minutes',
242 'seconds',
243 ));
244
245 $resolver->setAllowedValues(array(
246 'input' => array(
247 'datetime',
248 'string',
249 'timestamp',
250 'array',
251 ),
252 'date_widget' => array(
253 null, // inherit default from DateType
254 'single_text',
255 'text',
256 'choice',
257 ),
258 'time_widget' => array(
259 null, // inherit default from TimeType
260 'single_text',
261 'text',
262 'choice',
263 ),
264 // This option will overwrite "date_widget" and "time_widget" options
265 'widget' => array(
266 null, // default, don't overwrite options
267 'single_text',
268 'text',
269 'choice',
270 ),
271 ));
272 }
273
274 /**
275 * {@inheritdoc}
276 */
277 public function getName()
278 {
279 return 'datetime';
280 }
281}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Extension/Core/Type/DateType.php b/vendor/symfony/form/Symfony/Component/Form/Extension/Core/Type/DateType.php
deleted file mode 100644
index 93d3502e..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Extension/Core/Type/DateType.php
+++ /dev/null
@@ -1,309 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Extension\Core\Type;
13
14use Symfony\Component\Form\AbstractType;
15use Symfony\Component\Form\FormInterface;
16use Symfony\Component\Form\FormBuilderInterface;
17use Symfony\Component\Form\FormView;
18use Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeToLocalizedStringTransformer;
19use Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeToArrayTransformer;
20use Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeToStringTransformer;
21use Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeToTimestampTransformer;
22use Symfony\Component\Form\ReversedTransformer;
23use Symfony\Component\OptionsResolver\Options;
24use Symfony\Component\OptionsResolver\OptionsResolverInterface;
25use Symfony\Component\OptionsResolver\Exception\InvalidOptionsException;
26
27class DateType extends AbstractType
28{
29 const DEFAULT_FORMAT = \IntlDateFormatter::MEDIUM;
30
31 const HTML5_FORMAT = 'yyyy-MM-dd';
32
33 private static $acceptedFormats = array(
34 \IntlDateFormatter::FULL,
35 \IntlDateFormatter::LONG,
36 \IntlDateFormatter::MEDIUM,
37 \IntlDateFormatter::SHORT,
38 );
39
40 /**
41 * {@inheritdoc}
42 */
43 public function buildForm(FormBuilderInterface $builder, array $options)
44 {
45 $dateFormat = is_int($options['format']) ? $options['format'] : self::DEFAULT_FORMAT;
46 $timeFormat = \IntlDateFormatter::NONE;
47 $calendar = \IntlDateFormatter::GREGORIAN;
48 $pattern = is_string($options['format']) ? $options['format'] : null;
49
50 if (!in_array($dateFormat, self::$acceptedFormats, true)) {
51 throw new InvalidOptionsException('The "format" option must be one of the IntlDateFormatter constants (FULL, LONG, MEDIUM, SHORT) or a string representing a custom format.');
52 }
53
54 if (null !== $pattern && (false === strpos($pattern, 'y') || false === strpos($pattern, 'M') || false === strpos($pattern, 'd'))) {
55 throw new InvalidOptionsException(sprintf('The "format" option should contain the letters "y", "M" and "d". Its current value is "%s".', $pattern));
56 }
57
58 if ('single_text' === $options['widget']) {
59 $builder->addViewTransformer(new DateTimeToLocalizedStringTransformer(
60 $options['model_timezone'],
61 $options['view_timezone'],
62 $dateFormat,
63 $timeFormat,
64 $calendar,
65 $pattern
66 ));
67 } else {
68 $yearOptions = $monthOptions = $dayOptions = array(
69 'error_bubbling' => true,
70 );
71
72 $formatter = new \IntlDateFormatter(
73 \Locale::getDefault(),
74 $dateFormat,
75 $timeFormat,
76 'UTC',
77 $calendar,
78 $pattern
79 );
80 $formatter->setLenient(false);
81
82 if ('choice' === $options['widget']) {
83 // Only pass a subset of the options to children
84 $yearOptions['choices'] = $this->formatTimestamps($formatter, '/y+/', $this->listYears($options['years']));
85 $yearOptions['empty_value'] = $options['empty_value']['year'];
86 $monthOptions['choices'] = $this->formatTimestamps($formatter, '/[M|L]+/', $this->listMonths($options['months']));
87 $monthOptions['empty_value'] = $options['empty_value']['month'];
88 $dayOptions['choices'] = $this->formatTimestamps($formatter, '/d+/', $this->listDays($options['days']));
89 $dayOptions['empty_value'] = $options['empty_value']['day'];
90 }
91
92 // Append generic carry-along options
93 foreach (array('required', 'translation_domain') as $passOpt) {
94 $yearOptions[$passOpt] = $monthOptions[$passOpt] = $dayOptions[$passOpt] = $options[$passOpt];
95 }
96
97 $builder
98 ->add('year', $options['widget'], $yearOptions)
99 ->add('month', $options['widget'], $monthOptions)
100 ->add('day', $options['widget'], $dayOptions)
101 ->addViewTransformer(new DateTimeToArrayTransformer(
102 $options['model_timezone'], $options['view_timezone'], array('year', 'month', 'day')
103 ))
104 ->setAttribute('formatter', $formatter)
105 ;
106 }
107
108 if ('string' === $options['input']) {
109 $builder->addModelTransformer(new ReversedTransformer(
110 new DateTimeToStringTransformer($options['model_timezone'], $options['model_timezone'], 'Y-m-d')
111 ));
112 } elseif ('timestamp' === $options['input']) {
113 $builder->addModelTransformer(new ReversedTransformer(
114 new DateTimeToTimestampTransformer($options['model_timezone'], $options['model_timezone'])
115 ));
116 } elseif ('array' === $options['input']) {
117 $builder->addModelTransformer(new ReversedTransformer(
118 new DateTimeToArrayTransformer($options['model_timezone'], $options['model_timezone'], array('year', 'month', 'day'))
119 ));
120 }
121 }
122
123 /**
124 * {@inheritdoc}
125 */
126 public function finishView(FormView $view, FormInterface $form, array $options)
127 {
128 $view->vars['widget'] = $options['widget'];
129
130 // Change the input to a HTML5 date input if
131 // * the widget is set to "single_text"
132 // * the format matches the one expected by HTML5
133 if ('single_text' === $options['widget'] && self::HTML5_FORMAT === $options['format']) {
134 $view->vars['type'] = 'date';
135 }
136
137 if ($form->getConfig()->hasAttribute('formatter')) {
138 $pattern = $form->getConfig()->getAttribute('formatter')->getPattern();
139
140 // remove special characters unless the format was explicitly specified
141 if (!is_string($options['format'])) {
142 $pattern = preg_replace('/[^yMd]+/', '', $pattern);
143 }
144
145 // set right order with respect to locale (e.g.: de_DE=dd.MM.yy; en_US=M/d/yy)
146 // lookup various formats at http://userguide.icu-project.org/formatparse/datetime
147 if (preg_match('/^([yMd]+)[^yMd]*([yMd]+)[^yMd]*([yMd]+)$/', $pattern)) {
148 $pattern = preg_replace(array('/y+/', '/M+/', '/d+/'), array('{{ year }}', '{{ month }}', '{{ day }}'), $pattern);
149 } else {
150 // default fallback
151 $pattern = '{{ year }}{{ month }}{{ day }}';
152 }
153
154 $view->vars['date_pattern'] = $pattern;
155 }
156 }
157
158 /**
159 * {@inheritdoc}
160 */
161 public function setDefaultOptions(OptionsResolverInterface $resolver)
162 {
163 $compound = function (Options $options) {
164 return $options['widget'] !== 'single_text';
165 };
166
167 $emptyValue = $emptyValueDefault = function (Options $options) {
168 return $options['required'] ? null : '';
169 };
170
171 $emptyValueNormalizer = function (Options $options, $emptyValue) use ($emptyValueDefault) {
172 if (is_array($emptyValue)) {
173 $default = $emptyValueDefault($options);
174
175 return array_merge(
176 array('year' => $default, 'month' => $default, 'day' => $default),
177 $emptyValue
178 );
179 }
180
181 return array(
182 'year' => $emptyValue,
183 'month' => $emptyValue,
184 'day' => $emptyValue
185 );
186 };
187
188 $format = function (Options $options) {
189 return $options['widget'] === 'single_text' ? DateType::HTML5_FORMAT : DateType::DEFAULT_FORMAT;
190 };
191
192 $resolver->setDefaults(array(
193 'years' => range(date('Y') - 5, date('Y') + 5),
194 'months' => range(1, 12),
195 'days' => range(1, 31),
196 'widget' => 'choice',
197 'input' => 'datetime',
198 'format' => $format,
199 'model_timezone' => null,
200 'view_timezone' => null,
201 'empty_value' => $emptyValue,
202 // Don't modify \DateTime classes by reference, we treat
203 // them like immutable value objects
204 'by_reference' => false,
205 'error_bubbling' => false,
206 // If initialized with a \DateTime object, FormType initializes
207 // this option to "\DateTime". Since the internal, normalized
208 // representation is not \DateTime, but an array, we need to unset
209 // this option.
210 'data_class' => null,
211 'compound' => $compound,
212 ));
213
214 $resolver->setNormalizers(array(
215 'empty_value' => $emptyValueNormalizer,
216 ));
217
218 $resolver->setAllowedValues(array(
219 'input' => array(
220 'datetime',
221 'string',
222 'timestamp',
223 'array',
224 ),
225 'widget' => array(
226 'single_text',
227 'text',
228 'choice',
229 ),
230 ));
231
232 $resolver->setAllowedTypes(array(
233 'format' => array('int', 'string'),
234 ));
235 }
236
237 /**
238 * {@inheritdoc}
239 */
240 public function getName()
241 {
242 return 'date';
243 }
244
245 private function formatTimestamps(\IntlDateFormatter $formatter, $regex, array $timestamps)
246 {
247 $pattern = $formatter->getPattern();
248 $timezone = $formatter->getTimezoneId();
249
250 if (version_compare(\PHP_VERSION, '5.5.0-dev', '>=')) {
251 $formatter->setTimeZone(\DateTimeZone::UTC);
252 } else {
253 $formatter->setTimeZoneId(\DateTimeZone::UTC);
254 }
255
256 if (preg_match($regex, $pattern, $matches)) {
257 $formatter->setPattern($matches[0]);
258
259 foreach ($timestamps as $key => $timestamp) {
260 $timestamps[$key] = $formatter->format($timestamp);
261 }
262
263 // I'd like to clone the formatter above, but then we get a
264 // segmentation fault, so let's restore the old state instead
265 $formatter->setPattern($pattern);
266 }
267
268 if (version_compare(\PHP_VERSION, '5.5.0-dev', '>=')) {
269 $formatter->setTimeZone($timezone);
270 } else {
271 $formatter->setTimeZoneId($timezone);
272 }
273
274 return $timestamps;
275 }
276
277 private function listYears(array $years)
278 {
279 $result = array();
280
281 foreach ($years as $year) {
282 $result[$year] = gmmktime(0, 0, 0, 6, 15, $year);
283 }
284
285 return $result;
286 }
287
288 private function listMonths(array $months)
289 {
290 $result = array();
291
292 foreach ($months as $month) {
293 $result[$month] = gmmktime(0, 0, 0, $month, 15);
294 }
295
296 return $result;
297 }
298
299 private function listDays(array $days)
300 {
301 $result = array();
302
303 foreach ($days as $day) {
304 $result[$day] = gmmktime(0, 0, 0, 5, $day);
305 }
306
307 return $result;
308 }
309}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Extension/Core/Type/EmailType.php b/vendor/symfony/form/Symfony/Component/Form/Extension/Core/Type/EmailType.php
deleted file mode 100644
index 26652ef6..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Extension/Core/Type/EmailType.php
+++ /dev/null
@@ -1,33 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Extension\Core\Type;
13
14use Symfony\Component\Form\AbstractType;
15
16class EmailType extends AbstractType
17{
18 /**
19 * {@inheritdoc}
20 */
21 public function getParent()
22 {
23 return 'text';
24 }
25
26 /**
27 * {@inheritdoc}
28 */
29 public function getName()
30 {
31 return 'email';
32 }
33}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Extension/Core/Type/FileType.php b/vendor/symfony/form/Symfony/Component/Form/Extension/Core/Type/FileType.php
deleted file mode 100644
index 2c09da6f..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Extension/Core/Type/FileType.php
+++ /dev/null
@@ -1,61 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Extension\Core\Type;
13
14use Symfony\Component\Form\AbstractType;
15use Symfony\Component\Form\FormInterface;
16use Symfony\Component\Form\FormView;
17use Symfony\Component\OptionsResolver\OptionsResolverInterface;
18
19class FileType extends AbstractType
20{
21 /**
22 * {@inheritdoc}
23 */
24 public function buildView(FormView $view, FormInterface $form, array $options)
25 {
26 $view->vars = array_replace($view->vars, array(
27 'type' => 'file',
28 'value' => '',
29 ));
30 }
31
32 /**
33 * {@inheritdoc}
34 */
35 public function finishView(FormView $view, FormInterface $form, array $options)
36 {
37 $view
38 ->vars['multipart'] = true
39 ;
40 }
41
42 /**
43 * {@inheritdoc}
44 */
45 public function setDefaultOptions(OptionsResolverInterface $resolver)
46 {
47 $resolver->setDefaults(array(
48 'compound' => false,
49 'data_class' => 'Symfony\Component\HttpFoundation\File\File',
50 'empty_data' => null,
51 ));
52 }
53
54 /**
55 * {@inheritdoc}
56 */
57 public function getName()
58 {
59 return 'file';
60 }
61}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Extension/Core/Type/FormType.php b/vendor/symfony/form/Symfony/Component/Form/Extension/Core/Type/FormType.php
deleted file mode 100644
index 0c39d3eb..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Extension/Core/Type/FormType.php
+++ /dev/null
@@ -1,214 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Extension\Core\Type;
13
14use Symfony\Component\Form\FormBuilderInterface;
15use Symfony\Component\Form\FormInterface;
16use Symfony\Component\Form\FormView;
17use Symfony\Component\Form\Extension\Core\EventListener\TrimListener;
18use Symfony\Component\Form\Extension\Core\DataMapper\PropertyPathMapper;
19use Symfony\Component\Form\Exception\LogicException;
20use Symfony\Component\OptionsResolver\Options;
21use Symfony\Component\OptionsResolver\OptionsResolverInterface;
22use Symfony\Component\PropertyAccess\PropertyAccess;
23use Symfony\Component\PropertyAccess\PropertyAccessorInterface;
24
25class FormType extends BaseType
26{
27 /**
28 * @var PropertyAccessorInterface
29 */
30 private $propertyAccessor;
31
32 public function __construct(PropertyAccessorInterface $propertyAccessor = null)
33 {
34 $this->propertyAccessor = $propertyAccessor ?: PropertyAccess::getPropertyAccessor();
35 }
36
37 /**
38 * {@inheritdoc}
39 */
40 public function buildForm(FormBuilderInterface $builder, array $options)
41 {
42 parent::buildForm($builder, $options);
43
44 $builder
45 ->setRequired($options['required'])
46 ->setErrorBubbling($options['error_bubbling'])
47 ->setEmptyData($options['empty_data'])
48 ->setPropertyPath($options['property_path'])
49 ->setMapped($options['mapped'])
50 ->setByReference($options['by_reference'])
51 ->setInheritData($options['inherit_data'])
52 ->setCompound($options['compound'])
53 ->setData(isset($options['data']) ? $options['data'] : null)
54 ->setDataLocked(isset($options['data']))
55 ->setDataMapper($options['compound'] ? new PropertyPathMapper($this->propertyAccessor) : null)
56 ->setMethod($options['method'])
57 ->setAction($options['action'])
58 ->setAutoInitialize($options['auto_initialize'])
59 ;
60
61 if ($options['trim']) {
62 $builder->addEventSubscriber(new TrimListener());
63 }
64 }
65
66 /**
67 * {@inheritdoc}
68 */
69 public function buildView(FormView $view, FormInterface $form, array $options)
70 {
71 parent::buildView($view, $form, $options);
72
73 $name = $form->getName();
74 $readOnly = $options['read_only'];
75
76 if ($view->parent) {
77 if ('' === $name) {
78 throw new LogicException('Form node with empty name can be used only as root form node.');
79 }
80
81 // Complex fields are read-only if they themselves or their parents are.
82 if (!$readOnly) {
83 $readOnly = $view->parent->vars['read_only'];
84 }
85 }
86
87 $view->vars = array_replace($view->vars, array(
88 'read_only' => $readOnly,
89 'errors' => $form->getErrors(),
90 'valid' => $form->isSubmitted() ? $form->isValid() : true,
91 'value' => $form->getViewData(),
92 'data' => $form->getNormData(),
93 'required' => $form->isRequired(),
94 'max_length' => $options['max_length'],
95 'pattern' => $options['pattern'],
96 'size' => null,
97 'label_attr' => $options['label_attr'],
98 'compound' => $form->getConfig()->getCompound(),
99 'method' => $form->getConfig()->getMethod(),
100 'action' => $form->getConfig()->getAction(),
101 ));
102 }
103
104 /**
105 * {@inheritdoc}
106 */
107 public function finishView(FormView $view, FormInterface $form, array $options)
108 {
109 $multipart = false;
110
111 foreach ($view->children as $child) {
112 if ($child->vars['multipart']) {
113 $multipart = true;
114 break;
115 }
116 }
117
118 $view->vars['multipart'] = $multipart;
119 }
120
121 /**
122 * {@inheritdoc}
123 */
124 public function setDefaultOptions(OptionsResolverInterface $resolver)
125 {
126 parent::setDefaultOptions($resolver);
127
128 // Derive "data_class" option from passed "data" object
129 $dataClass = function (Options $options) {
130 return isset($options['data']) && is_object($options['data']) ? get_class($options['data']) : null;
131 };
132
133 // Derive "empty_data" closure from "data_class" option
134 $emptyData = function (Options $options) {
135 $class = $options['data_class'];
136
137 if (null !== $class) {
138 return function (FormInterface $form) use ($class) {
139 return $form->isEmpty() && !$form->isRequired() ? null : new $class();
140 };
141 }
142
143 return function (FormInterface $form) {
144 return $form->getConfig()->getCompound() ? array() : '';
145 };
146 };
147
148 // For any form that is not represented by a single HTML control,
149 // errors should bubble up by default
150 $errorBubbling = function (Options $options) {
151 return $options['compound'];
152 };
153
154 // BC with old "virtual" option
155 $inheritData = function (Options $options) {
156 if (null !== $options['virtual']) {
157 // Uncomment this as soon as the deprecation note should be shown
158 // trigger_error('The form option "virtual" is deprecated since version 2.3 and will be removed in 3.0. Use "inherit_data" instead.', E_USER_DEPRECATED);
159 return $options['virtual'];
160 }
161
162 return false;
163 };
164
165 // If data is given, the form is locked to that data
166 // (independent of its value)
167 $resolver->setOptional(array(
168 'data',
169 ));
170
171 $resolver->setDefaults(array(
172 'data_class' => $dataClass,
173 'empty_data' => $emptyData,
174 'trim' => true,
175 'required' => true,
176 'read_only' => false,
177 'max_length' => null,
178 'pattern' => null,
179 'property_path' => null,
180 'mapped' => true,
181 'by_reference' => true,
182 'error_bubbling' => $errorBubbling,
183 'label_attr' => array(),
184 'virtual' => null,
185 'inherit_data' => $inheritData,
186 'compound' => true,
187 'method' => 'POST',
188 // According to RFC 2396 (http://www.ietf.org/rfc/rfc2396.txt)
189 // section 4.2., empty URIs are considered same-document references
190 'action' => '',
191 'auto_initialize' => true,
192 ));
193
194 $resolver->setAllowedTypes(array(
195 'label_attr' => 'array',
196 ));
197 }
198
199 /**
200 * {@inheritdoc}
201 */
202 public function getParent()
203 {
204 return null;
205 }
206
207 /**
208 * {@inheritdoc}
209 */
210 public function getName()
211 {
212 return 'form';
213 }
214}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Extension/Core/Type/HiddenType.php b/vendor/symfony/form/Symfony/Component/Form/Extension/Core/Type/HiddenType.php
deleted file mode 100644
index bd4fa898..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Extension/Core/Type/HiddenType.php
+++ /dev/null
@@ -1,40 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Extension\Core\Type;
13
14use Symfony\Component\Form\AbstractType;
15use Symfony\Component\OptionsResolver\OptionsResolverInterface;
16
17class HiddenType extends AbstractType
18{
19 /**
20 * {@inheritdoc}
21 */
22 public function setDefaultOptions(OptionsResolverInterface $resolver)
23 {
24 $resolver->setDefaults(array(
25 // hidden fields cannot have a required attribute
26 'required' => false,
27 // Pass errors to the parent
28 'error_bubbling' => true,
29 'compound' => false,
30 ));
31 }
32
33 /**
34 * {@inheritdoc}
35 */
36 public function getName()
37 {
38 return 'hidden';
39 }
40}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Extension/Core/Type/IntegerType.php b/vendor/symfony/form/Symfony/Component/Form/Extension/Core/Type/IntegerType.php
deleted file mode 100644
index b224cac5..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Extension/Core/Type/IntegerType.php
+++ /dev/null
@@ -1,68 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Extension\Core\Type;
13
14use Symfony\Component\Form\AbstractType;
15use Symfony\Component\Form\FormBuilderInterface;
16use Symfony\Component\Form\Extension\Core\DataTransformer\IntegerToLocalizedStringTransformer;
17use Symfony\Component\OptionsResolver\OptionsResolverInterface;
18
19class IntegerType extends AbstractType
20{
21 /**
22 * {@inheritdoc}
23 */
24 public function buildForm(FormBuilderInterface $builder, array $options)
25 {
26 $builder->addViewTransformer(
27 new IntegerToLocalizedStringTransformer(
28 $options['precision'],
29 $options['grouping'],
30 $options['rounding_mode']
31 ));
32 }
33
34 /**
35 * {@inheritdoc}
36 */
37 public function setDefaultOptions(OptionsResolverInterface $resolver)
38 {
39 $resolver->setDefaults(array(
40 // default precision is locale specific (usually around 3)
41 'precision' => null,
42 'grouping' => false,
43 // Integer cast rounds towards 0, so do the same when displaying fractions
44 'rounding_mode' => \NumberFormatter::ROUND_DOWN,
45 'compound' => false,
46 ));
47
48 $resolver->setAllowedValues(array(
49 'rounding_mode' => array(
50 \NumberFormatter::ROUND_FLOOR,
51 \NumberFormatter::ROUND_DOWN,
52 \NumberFormatter::ROUND_HALFDOWN,
53 \NumberFormatter::ROUND_HALFEVEN,
54 \NumberFormatter::ROUND_HALFUP,
55 \NumberFormatter::ROUND_UP,
56 \NumberFormatter::ROUND_CEILING,
57 ),
58 ));
59 }
60
61 /**
62 * {@inheritdoc}
63 */
64 public function getName()
65 {
66 return 'integer';
67 }
68}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Extension/Core/Type/LanguageType.php b/vendor/symfony/form/Symfony/Component/Form/Extension/Core/Type/LanguageType.php
deleted file mode 100644
index 37b2bf33..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Extension/Core/Type/LanguageType.php
+++ /dev/null
@@ -1,45 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Extension\Core\Type;
13
14use Symfony\Component\Form\AbstractType;
15use Symfony\Component\Intl\Intl;
16use Symfony\Component\OptionsResolver\OptionsResolverInterface;
17
18class LanguageType extends AbstractType
19{
20 /**
21 * {@inheritdoc}
22 */
23 public function setDefaultOptions(OptionsResolverInterface $resolver)
24 {
25 $resolver->setDefaults(array(
26 'choices' => Intl::getLanguageBundle()->getLanguageNames(),
27 ));
28 }
29
30 /**
31 * {@inheritdoc}
32 */
33 public function getParent()
34 {
35 return 'choice';
36 }
37
38 /**
39 * {@inheritdoc}
40 */
41 public function getName()
42 {
43 return 'language';
44 }
45}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Extension/Core/Type/LocaleType.php b/vendor/symfony/form/Symfony/Component/Form/Extension/Core/Type/LocaleType.php
deleted file mode 100644
index c68c561a..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Extension/Core/Type/LocaleType.php
+++ /dev/null
@@ -1,46 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Extension\Core\Type;
13
14use Symfony\Component\Form\AbstractType;
15use Symfony\Component\Intl\Intl;
16use Symfony\Component\Locale\Locale;
17use Symfony\Component\OptionsResolver\OptionsResolverInterface;
18
19class LocaleType extends AbstractType
20{
21 /**
22 * {@inheritdoc}
23 */
24 public function setDefaultOptions(OptionsResolverInterface $resolver)
25 {
26 $resolver->setDefaults(array(
27 'choices' => Intl::getLocaleBundle()->getLocaleNames(),
28 ));
29 }
30
31 /**
32 * {@inheritdoc}
33 */
34 public function getParent()
35 {
36 return 'choice';
37 }
38
39 /**
40 * {@inheritdoc}
41 */
42 public function getName()
43 {
44 return 'locale';
45 }
46}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Extension/Core/Type/MoneyType.php b/vendor/symfony/form/Symfony/Component/Form/Extension/Core/Type/MoneyType.php
deleted file mode 100644
index 9e36f9ce..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Extension/Core/Type/MoneyType.php
+++ /dev/null
@@ -1,111 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Extension\Core\Type;
13
14use Symfony\Component\Form\AbstractType;
15use Symfony\Component\Form\FormInterface;
16use Symfony\Component\Form\FormBuilderInterface;
17use Symfony\Component\Form\Extension\Core\DataTransformer\MoneyToLocalizedStringTransformer;
18use Symfony\Component\Form\FormView;
19use Symfony\Component\OptionsResolver\OptionsResolverInterface;
20
21class MoneyType extends AbstractType
22{
23 protected static $patterns = array();
24
25 /**
26 * {@inheritdoc}
27 */
28 public function buildForm(FormBuilderInterface $builder, array $options)
29 {
30 $builder
31 ->addViewTransformer(new MoneyToLocalizedStringTransformer(
32 $options['precision'],
33 $options['grouping'],
34 null,
35 $options['divisor']
36 ))
37 ;
38 }
39
40 /**
41 * {@inheritdoc}
42 */
43 public function buildView(FormView $view, FormInterface $form, array $options)
44 {
45 $view->vars['money_pattern'] = self::getPattern($options['currency']);
46 }
47
48 /**
49 * {@inheritdoc}
50 */
51 public function setDefaultOptions(OptionsResolverInterface $resolver)
52 {
53 $resolver->setDefaults(array(
54 'precision' => 2,
55 'grouping' => false,
56 'divisor' => 1,
57 'currency' => 'EUR',
58 'compound' => false,
59 ));
60 }
61
62 /**
63 * {@inheritdoc}
64 */
65 public function getName()
66 {
67 return 'money';
68 }
69
70 /**
71 * Returns the pattern for this locale
72 *
73 * The pattern contains the placeholder "{{ widget }}" where the HTML tag should
74 * be inserted
75 */
76 protected static function getPattern($currency)
77 {
78 if (!$currency) {
79 return '{{ widget }}';
80 }
81
82 $locale = \Locale::getDefault();
83
84 if (!isset(self::$patterns[$locale])) {
85 self::$patterns[$locale] = array();
86 }
87
88 if (!isset(self::$patterns[$locale][$currency])) {
89 $format = new \NumberFormatter($locale, \NumberFormatter::CURRENCY);
90 $pattern = $format->formatCurrency('123', $currency);
91
92 // the spacings between currency symbol and number are ignored, because
93 // a single space leads to better readability in combination with input
94 // fields
95
96 // the regex also considers non-break spaces (0xC2 or 0xA0 in UTF-8)
97
98 preg_match('/^([^\s\xc2\xa0]*)[\s\xc2\xa0]*123(?:[,.]0+)?[\s\xc2\xa0]*([^\s\xc2\xa0]*)$/u', $pattern, $matches);
99
100 if (!empty($matches[1])) {
101 self::$patterns[$locale][$currency] = $matches[1].' {{ widget }}';
102 } elseif (!empty($matches[2])) {
103 self::$patterns[$locale][$currency] = '{{ widget }} '.$matches[2];
104 } else {
105 self::$patterns[$locale][$currency] = '{{ widget }}';
106 }
107 }
108
109 return self::$patterns[$locale][$currency];
110 }
111}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Extension/Core/Type/NumberType.php b/vendor/symfony/form/Symfony/Component/Form/Extension/Core/Type/NumberType.php
deleted file mode 100644
index beb3c89a..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Extension/Core/Type/NumberType.php
+++ /dev/null
@@ -1,66 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Extension\Core\Type;
13
14use Symfony\Component\Form\AbstractType;
15use Symfony\Component\Form\FormBuilderInterface;
16use Symfony\Component\Form\Extension\Core\DataTransformer\NumberToLocalizedStringTransformer;
17use Symfony\Component\OptionsResolver\OptionsResolverInterface;
18
19class NumberType extends AbstractType
20{
21 /**
22 * {@inheritdoc}
23 */
24 public function buildForm(FormBuilderInterface $builder, array $options)
25 {
26 $builder->addViewTransformer(new NumberToLocalizedStringTransformer(
27 $options['precision'],
28 $options['grouping'],
29 $options['rounding_mode']
30 ));
31 }
32
33 /**
34 * {@inheritdoc}
35 */
36 public function setDefaultOptions(OptionsResolverInterface $resolver)
37 {
38 $resolver->setDefaults(array(
39 // default precision is locale specific (usually around 3)
40 'precision' => null,
41 'grouping' => false,
42 'rounding_mode' => \NumberFormatter::ROUND_HALFUP,
43 'compound' => false,
44 ));
45
46 $resolver->setAllowedValues(array(
47 'rounding_mode' => array(
48 \NumberFormatter::ROUND_FLOOR,
49 \NumberFormatter::ROUND_DOWN,
50 \NumberFormatter::ROUND_HALFDOWN,
51 \NumberFormatter::ROUND_HALFEVEN,
52 \NumberFormatter::ROUND_HALFUP,
53 \NumberFormatter::ROUND_UP,
54 \NumberFormatter::ROUND_CEILING,
55 ),
56 ));
57 }
58
59 /**
60 * {@inheritdoc}
61 */
62 public function getName()
63 {
64 return 'number';
65 }
66}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Extension/Core/Type/PasswordType.php b/vendor/symfony/form/Symfony/Component/Form/Extension/Core/Type/PasswordType.php
deleted file mode 100644
index 5a5b1635..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Extension/Core/Type/PasswordType.php
+++ /dev/null
@@ -1,57 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Extension\Core\Type;
13
14use Symfony\Component\Form\AbstractType;
15use Symfony\Component\Form\FormInterface;
16use Symfony\Component\Form\FormView;
17use Symfony\Component\OptionsResolver\OptionsResolverInterface;
18
19class PasswordType extends AbstractType
20{
21 /**
22 * {@inheritdoc}
23 */
24 public function buildView(FormView $view, FormInterface $form, array $options)
25 {
26 if ($options['always_empty'] || !$form->isSubmitted()) {
27 $view->vars['value'] = '';
28 }
29 }
30
31 /**
32 * {@inheritdoc}
33 */
34 public function setDefaultOptions(OptionsResolverInterface $resolver)
35 {
36 $resolver->setDefaults(array(
37 'always_empty' => true,
38 'trim' => false,
39 ));
40 }
41
42 /**
43 * {@inheritdoc}
44 */
45 public function getParent()
46 {
47 return 'text';
48 }
49
50 /**
51 * {@inheritdoc}
52 */
53 public function getName()
54 {
55 return 'password';
56 }
57}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Extension/Core/Type/PercentType.php b/vendor/symfony/form/Symfony/Component/Form/Extension/Core/Type/PercentType.php
deleted file mode 100644
index b1df9436..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Extension/Core/Type/PercentType.php
+++ /dev/null
@@ -1,55 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Extension\Core\Type;
13
14use Symfony\Component\Form\AbstractType;
15use Symfony\Component\Form\FormBuilderInterface;
16use Symfony\Component\Form\Extension\Core\DataTransformer\PercentToLocalizedStringTransformer;
17use Symfony\Component\OptionsResolver\OptionsResolverInterface;
18
19class PercentType extends AbstractType
20{
21 /**
22 * {@inheritdoc}
23 */
24 public function buildForm(FormBuilderInterface $builder, array $options)
25 {
26 $builder->addViewTransformer(new PercentToLocalizedStringTransformer($options['precision'], $options['type']));
27 }
28
29 /**
30 * {@inheritdoc}
31 */
32 public function setDefaultOptions(OptionsResolverInterface $resolver)
33 {
34 $resolver->setDefaults(array(
35 'precision' => 0,
36 'type' => 'fractional',
37 'compound' => false,
38 ));
39
40 $resolver->setAllowedValues(array(
41 'type' => array(
42 'fractional',
43 'integer',
44 ),
45 ));
46 }
47
48 /**
49 * {@inheritdoc}
50 */
51 public function getName()
52 {
53 return 'percent';
54 }
55}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Extension/Core/Type/RadioType.php b/vendor/symfony/form/Symfony/Component/Form/Extension/Core/Type/RadioType.php
deleted file mode 100644
index dfa7c7d5..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Extension/Core/Type/RadioType.php
+++ /dev/null
@@ -1,33 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Extension\Core\Type;
13
14use Symfony\Component\Form\AbstractType;
15
16class RadioType extends AbstractType
17{
18 /**
19 * {@inheritdoc}
20 */
21 public function getParent()
22 {
23 return 'checkbox';
24 }
25
26 /**
27 * {@inheritdoc}
28 */
29 public function getName()
30 {
31 return 'radio';
32 }
33}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Extension/Core/Type/RepeatedType.php b/vendor/symfony/form/Symfony/Component/Form/Extension/Core/Type/RepeatedType.php
deleted file mode 100644
index 9a3cd146..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Extension/Core/Type/RepeatedType.php
+++ /dev/null
@@ -1,67 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Extension\Core\Type;
13
14use Symfony\Component\Form\AbstractType;
15use Symfony\Component\Form\FormBuilderInterface;
16use Symfony\Component\Form\Extension\Core\DataTransformer\ValueToDuplicatesTransformer;
17use Symfony\Component\OptionsResolver\OptionsResolverInterface;
18
19class RepeatedType extends AbstractType
20{
21 /**
22 * {@inheritdoc}
23 */
24 public function buildForm(FormBuilderInterface $builder, array $options)
25 {
26 // Overwrite required option for child fields
27 $options['first_options']['required'] = $options['required'];
28 $options['second_options']['required'] = $options['required'];
29
30 if (!isset($options['options']['error_bubbling'])) {
31 $options['options']['error_bubbling'] = $options['error_bubbling'];
32 }
33
34 $builder
35 ->addViewTransformer(new ValueToDuplicatesTransformer(array(
36 $options['first_name'],
37 $options['second_name'],
38 )))
39 ->add($options['first_name'], $options['type'], array_merge($options['options'], $options['first_options']))
40 ->add($options['second_name'], $options['type'], array_merge($options['options'], $options['second_options']))
41 ;
42 }
43
44 /**
45 * {@inheritdoc}
46 */
47 public function setDefaultOptions(OptionsResolverInterface $resolver)
48 {
49 $resolver->setDefaults(array(
50 'type' => 'text',
51 'options' => array(),
52 'first_options' => array(),
53 'second_options' => array(),
54 'first_name' => 'first',
55 'second_name' => 'second',
56 'error_bubbling' => false,
57 ));
58 }
59
60 /**
61 * {@inheritdoc}
62 */
63 public function getName()
64 {
65 return 'repeated';
66 }
67}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Extension/Core/Type/ResetType.php b/vendor/symfony/form/Symfony/Component/Form/Extension/Core/Type/ResetType.php
deleted file mode 100644
index cf55f7c5..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Extension/Core/Type/ResetType.php
+++ /dev/null
@@ -1,39 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Extension\Core\Type;
13
14use Symfony\Component\Form\AbstractType;
15use Symfony\Component\Form\ButtonTypeInterface;
16
17/**
18 * A reset button.
19 *
20 * @author Bernhard Schussek <bschussek@gmail.com>
21 */
22class ResetType extends AbstractType implements ButtonTypeInterface
23{
24 /**
25 * {@inheritdoc}
26 */
27 public function getParent()
28 {
29 return 'button';
30 }
31
32 /**
33 * {@inheritdoc}
34 */
35 public function getName()
36 {
37 return 'reset';
38 }
39}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Extension/Core/Type/SearchType.php b/vendor/symfony/form/Symfony/Component/Form/Extension/Core/Type/SearchType.php
deleted file mode 100644
index bf82972d..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Extension/Core/Type/SearchType.php
+++ /dev/null
@@ -1,33 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Extension\Core\Type;
13
14use Symfony\Component\Form\AbstractType;
15
16class SearchType extends AbstractType
17{
18 /**
19 * {@inheritdoc}
20 */
21 public function getParent()
22 {
23 return 'text';
24 }
25
26 /**
27 * {@inheritdoc}
28 */
29 public function getName()
30 {
31 return 'search';
32 }
33}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Extension/Core/Type/SubmitType.php b/vendor/symfony/form/Symfony/Component/Form/Extension/Core/Type/SubmitType.php
deleted file mode 100644
index 6d160b96..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Extension/Core/Type/SubmitType.php
+++ /dev/null
@@ -1,46 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Extension\Core\Type;
13
14use Symfony\Component\Form\AbstractType;
15use Symfony\Component\Form\FormInterface;
16use Symfony\Component\Form\FormView;
17use Symfony\Component\Form\SubmitButtonTypeInterface;
18
19/**
20 * A submit button.
21 *
22 * @author Bernhard Schussek <bschussek@gmail.com>
23 */
24class SubmitType extends AbstractType implements SubmitButtonTypeInterface
25{
26 public function buildView(FormView $view, FormInterface $form, array $options)
27 {
28 $view->vars['clicked'] = $form->isClicked();
29 }
30
31 /**
32 * {@inheritdoc}
33 */
34 public function getParent()
35 {
36 return 'button';
37 }
38
39 /**
40 * {@inheritdoc}
41 */
42 public function getName()
43 {
44 return 'submit';
45 }
46}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Extension/Core/Type/TextType.php b/vendor/symfony/form/Symfony/Component/Form/Extension/Core/Type/TextType.php
deleted file mode 100644
index 11503261..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Extension/Core/Type/TextType.php
+++ /dev/null
@@ -1,36 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Extension\Core\Type;
13
14use Symfony\Component\Form\AbstractType;
15use Symfony\Component\OptionsResolver\OptionsResolverInterface;
16
17class TextType extends AbstractType
18{
19 /**
20 * {@inheritdoc}
21 */
22 public function setDefaultOptions(OptionsResolverInterface $resolver)
23 {
24 $resolver->setDefaults(array(
25 'compound' => false,
26 ));
27 }
28
29 /**
30 * {@inheritdoc}
31 */
32 public function getName()
33 {
34 return 'text';
35 }
36}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Extension/Core/Type/TextareaType.php b/vendor/symfony/form/Symfony/Component/Form/Extension/Core/Type/TextareaType.php
deleted file mode 100644
index 0e749b15..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Extension/Core/Type/TextareaType.php
+++ /dev/null
@@ -1,43 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Extension\Core\Type;
13
14use Symfony\Component\Form\AbstractType;
15use Symfony\Component\Form\FormView;
16use Symfony\Component\Form\FormInterface;
17
18class TextareaType extends AbstractType
19{
20 /**
21 * {@inheritdoc}
22 */
23 public function buildView(FormView $view, FormInterface $form, array $options)
24 {
25 $view->vars['pattern'] = null;
26 }
27
28 /**
29 * {@inheritdoc}
30 */
31 public function getParent()
32 {
33 return 'text';
34 }
35
36 /**
37 * {@inheritdoc}
38 */
39 public function getName()
40 {
41 return 'textarea';
42 }
43}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Extension/Core/Type/TimeType.php b/vendor/symfony/form/Symfony/Component/Form/Extension/Core/Type/TimeType.php
deleted file mode 100644
index d7a2a9ef..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Extension/Core/Type/TimeType.php
+++ /dev/null
@@ -1,225 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Extension\Core\Type;
13
14use Symfony\Component\Form\AbstractType;
15use Symfony\Component\Form\FormInterface;
16use Symfony\Component\Form\FormBuilderInterface;
17use Symfony\Component\Form\ReversedTransformer;
18use Symfony\Component\Form\Exception\InvalidConfigurationException;
19use Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeToStringTransformer;
20use Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeToTimestampTransformer;
21use Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeToArrayTransformer;
22use Symfony\Component\Form\FormView;
23use Symfony\Component\OptionsResolver\Options;
24use Symfony\Component\OptionsResolver\OptionsResolverInterface;
25
26class TimeType extends AbstractType
27{
28 /**
29 * {@inheritdoc}
30 */
31 public function buildForm(FormBuilderInterface $builder, array $options)
32 {
33 $parts = array('hour');
34 $format = 'H';
35
36 if ($options['with_seconds'] && !$options['with_minutes']) {
37 throw new InvalidConfigurationException('You can not disable minutes if you have enabled seconds.');
38 }
39
40 if ($options['with_minutes']) {
41 $format .= ':i';
42 $parts[] = 'minute';
43 }
44
45 if ($options['with_seconds']) {
46 $format .= ':s';
47 $parts[] = 'second';
48 }
49
50 if ('single_text' === $options['widget']) {
51 $builder->addViewTransformer(new DateTimeToStringTransformer($options['model_timezone'], $options['view_timezone'], $format));
52 } else {
53 $hourOptions = $minuteOptions = $secondOptions = array(
54 'error_bubbling' => true,
55 );
56
57 if ('choice' === $options['widget']) {
58 $hours = $minutes = array();
59
60 foreach ($options['hours'] as $hour) {
61 $hours[$hour] = str_pad($hour, 2, '0', STR_PAD_LEFT);
62 }
63
64 // Only pass a subset of the options to children
65 $hourOptions['choices'] = $hours;
66 $hourOptions['empty_value'] = $options['empty_value']['hour'];
67
68 if ($options['with_minutes']) {
69 foreach ($options['minutes'] as $minute) {
70 $minutes[$minute] = str_pad($minute, 2, '0', STR_PAD_LEFT);
71 }
72
73 $minuteOptions['choices'] = $minutes;
74 $minuteOptions['empty_value'] = $options['empty_value']['minute'];
75 }
76
77 if ($options['with_seconds']) {
78 $seconds = array();
79
80 foreach ($options['seconds'] as $second) {
81 $seconds[$second] = str_pad($second, 2, '0', STR_PAD_LEFT);
82 }
83
84 $secondOptions['choices'] = $seconds;
85 $secondOptions['empty_value'] = $options['empty_value']['second'];
86 }
87
88 // Append generic carry-along options
89 foreach (array('required', 'translation_domain') as $passOpt) {
90 $hourOptions[$passOpt] = $options[$passOpt];
91
92 if ($options['with_minutes']) {
93 $minuteOptions[$passOpt] = $options[$passOpt];
94 }
95
96 if ($options['with_seconds']) {
97 $secondOptions[$passOpt] = $options[$passOpt];
98 }
99 }
100 }
101
102 $builder->add('hour', $options['widget'], $hourOptions);
103
104 if ($options['with_minutes']) {
105 $builder->add('minute', $options['widget'], $minuteOptions);
106 }
107
108 if ($options['with_seconds']) {
109 $builder->add('second', $options['widget'], $secondOptions);
110 }
111
112 $builder->addViewTransformer(new DateTimeToArrayTransformer($options['model_timezone'], $options['view_timezone'], $parts, 'text' === $options['widget']));
113 }
114
115 if ('string' === $options['input']) {
116 $builder->addModelTransformer(new ReversedTransformer(
117 new DateTimeToStringTransformer($options['model_timezone'], $options['model_timezone'], 'H:i:s')
118 ));
119 } elseif ('timestamp' === $options['input']) {
120 $builder->addModelTransformer(new ReversedTransformer(
121 new DateTimeToTimestampTransformer($options['model_timezone'], $options['model_timezone'])
122 ));
123 } elseif ('array' === $options['input']) {
124 $builder->addModelTransformer(new ReversedTransformer(
125 new DateTimeToArrayTransformer($options['model_timezone'], $options['model_timezone'], $parts)
126 ));
127 }
128 }
129
130 /**
131 * {@inheritdoc}
132 */
133 public function buildView(FormView $view, FormInterface $form, array $options)
134 {
135 $view->vars = array_replace($view->vars, array(
136 'widget' => $options['widget'],
137 'with_minutes' => $options['with_minutes'],
138 'with_seconds' => $options['with_seconds'],
139 ));
140
141 if ('single_text' === $options['widget']) {
142 $view->vars['type'] = 'time';
143 }
144 }
145
146 /**
147 * {@inheritdoc}
148 */
149 public function setDefaultOptions(OptionsResolverInterface $resolver)
150 {
151 $compound = function (Options $options) {
152 return $options['widget'] !== 'single_text';
153 };
154
155 $emptyValue = $emptyValueDefault = function (Options $options) {
156 return $options['required'] ? null : '';
157 };
158
159 $emptyValueNormalizer = function (Options $options, $emptyValue) use ($emptyValueDefault) {
160 if (is_array($emptyValue)) {
161 $default = $emptyValueDefault($options);
162
163 return array_merge(
164 array('hour' => $default, 'minute' => $default, 'second' => $default),
165 $emptyValue
166 );
167 }
168
169 return array(
170 'hour' => $emptyValue,
171 'minute' => $emptyValue,
172 'second' => $emptyValue
173 );
174 };
175
176 $resolver->setDefaults(array(
177 'hours' => range(0, 23),
178 'minutes' => range(0, 59),
179 'seconds' => range(0, 59),
180 'widget' => 'choice',
181 'input' => 'datetime',
182 'with_minutes' => true,
183 'with_seconds' => false,
184 'model_timezone' => null,
185 'view_timezone' => null,
186 'empty_value' => $emptyValue,
187 // Don't modify \DateTime classes by reference, we treat
188 // them like immutable value objects
189 'by_reference' => false,
190 'error_bubbling' => false,
191 // If initialized with a \DateTime object, FormType initializes
192 // this option to "\DateTime". Since the internal, normalized
193 // representation is not \DateTime, but an array, we need to unset
194 // this option.
195 'data_class' => null,
196 'compound' => $compound,
197 ));
198
199 $resolver->setNormalizers(array(
200 'empty_value' => $emptyValueNormalizer,
201 ));
202
203 $resolver->setAllowedValues(array(
204 'input' => array(
205 'datetime',
206 'string',
207 'timestamp',
208 'array',
209 ),
210 'widget' => array(
211 'single_text',
212 'text',
213 'choice',
214 ),
215 ));
216 }
217
218 /**
219 * {@inheritdoc}
220 */
221 public function getName()
222 {
223 return 'time';
224 }
225}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Extension/Core/Type/TimezoneType.php b/vendor/symfony/form/Symfony/Component/Form/Extension/Core/Type/TimezoneType.php
deleted file mode 100644
index cd4a2ad3..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Extension/Core/Type/TimezoneType.php
+++ /dev/null
@@ -1,86 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Extension\Core\Type;
13
14use Symfony\Component\Form\AbstractType;
15use Symfony\Component\OptionsResolver\OptionsResolverInterface;
16
17class TimezoneType extends AbstractType
18{
19 /**
20 * Stores the available timezone choices
21 * @var array
22 */
23 private static $timezones;
24
25 /**
26 * {@inheritdoc}
27 */
28 public function setDefaultOptions(OptionsResolverInterface $resolver)
29 {
30 $resolver->setDefaults(array(
31 'choices' => self::getTimezones(),
32 ));
33 }
34
35 /**
36 * {@inheritdoc}
37 */
38 public function getParent()
39 {
40 return 'choice';
41 }
42
43 /**
44 * {@inheritdoc}
45 */
46 public function getName()
47 {
48 return 'timezone';
49 }
50
51 /**
52 * Returns the timezone choices.
53 *
54 * The choices are generated from the ICU function
55 * \DateTimeZone::listIdentifiers(). They are cached during a single request,
56 * so multiple timezone fields on the same page don't lead to unnecessary
57 * overhead.
58 *
59 * @return array The timezone choices
60 */
61 public static function getTimezones()
62 {
63 if (null === static::$timezones) {
64 static::$timezones = array();
65
66 foreach (\DateTimeZone::listIdentifiers() as $timezone) {
67 $parts = explode('/', $timezone);
68
69 if (count($parts) > 2) {
70 $region = $parts[0];
71 $name = $parts[1].' - '.$parts[2];
72 } elseif (count($parts) > 1) {
73 $region = $parts[0];
74 $name = $parts[1];
75 } else {
76 $region = 'Other';
77 $name = $parts[0];
78 }
79
80 static::$timezones[$region][$timezone] = str_replace('_', ' ', $name);
81 }
82 }
83
84 return static::$timezones;
85 }
86}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Extension/Core/Type/UrlType.php b/vendor/symfony/form/Symfony/Component/Form/Extension/Core/Type/UrlType.php
deleted file mode 100644
index 27749b1a..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Extension/Core/Type/UrlType.php
+++ /dev/null
@@ -1,54 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Extension\Core\Type;
13
14use Symfony\Component\Form\AbstractType;
15use Symfony\Component\Form\FormBuilderInterface;
16use Symfony\Component\Form\Extension\Core\EventListener\FixUrlProtocolListener;
17use Symfony\Component\OptionsResolver\OptionsResolverInterface;
18
19class UrlType extends AbstractType
20{
21 /**
22 * {@inheritdoc}
23 */
24 public function buildForm(FormBuilderInterface $builder, array $options)
25 {
26 $builder->addEventSubscriber(new FixUrlProtocolListener($options['default_protocol']));
27 }
28
29 /**
30 * {@inheritdoc}
31 */
32 public function setDefaultOptions(OptionsResolverInterface $resolver)
33 {
34 $resolver->setDefaults(array(
35 'default_protocol' => 'http',
36 ));
37 }
38
39 /**
40 * {@inheritdoc}
41 */
42 public function getParent()
43 {
44 return 'text';
45 }
46
47 /**
48 * {@inheritdoc}
49 */
50 public function getName()
51 {
52 return 'url';
53 }
54}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Extension/Core/View/ChoiceView.php b/vendor/symfony/form/Symfony/Component/Form/Extension/Core/View/ChoiceView.php
deleted file mode 100644
index 97cdd214..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Extension/Core/View/ChoiceView.php
+++ /dev/null
@@ -1,55 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Extension\Core\View;
13
14/**
15 * Represents a choice in templates.
16 *
17 * @author Bernhard Schussek <bschussek@gmail.com>
18 */
19class ChoiceView
20{
21 /**
22 * The original choice value.
23 *
24 * @var mixed
25 */
26 public $data;
27
28 /**
29 * The view representation of the choice.
30 *
31 * @var string
32 */
33 public $value;
34
35 /**
36 * The label displayed to humans.
37 *
38 * @var string
39 */
40 public $label;
41
42 /**
43 * Creates a new ChoiceView.
44 *
45 * @param mixed $data The original choice.
46 * @param string $value The view representation of the choice.
47 * @param string $label The label displayed to humans.
48 */
49 public function __construct($data, $value, $label)
50 {
51 $this->data = $data;
52 $this->value = $value;
53 $this->label = $label;
54 }
55}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Extension/Csrf/CsrfExtension.php b/vendor/symfony/form/Symfony/Component/Form/Extension/Csrf/CsrfExtension.php
deleted file mode 100644
index f9d9e40a..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Extension/Csrf/CsrfExtension.php
+++ /dev/null
@@ -1,64 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Extension\Csrf;
13
14use Symfony\Component\Form\Extension\Csrf\Type;
15use Symfony\Component\Form\Extension\Csrf\CsrfProvider\CsrfProviderInterface;
16use Symfony\Component\Form\AbstractExtension;
17use Symfony\Component\Translation\TranslatorInterface;
18
19/**
20 * This extension protects forms by using a CSRF token.
21 *
22 * @author Bernhard Schussek <bschussek@gmail.com>
23 */
24class CsrfExtension extends AbstractExtension
25{
26 /**
27 * @var CsrfProviderInterface
28 */
29 private $csrfProvider;
30
31 /**
32 * @var TranslatorInterface
33 */
34 private $translator;
35
36 /**
37 * @var null|string
38 */
39 private $translationDomain;
40
41 /**
42 * Constructor.
43 *
44 * @param CsrfProviderInterface $csrfProvider The CSRF provider
45 * @param TranslatorInterface $translator The translator for translating error messages.
46 * @param null|string $translationDomain The translation domain for translating.
47 */
48 public function __construct(CsrfProviderInterface $csrfProvider, TranslatorInterface $translator = null, $translationDomain = null)
49 {
50 $this->csrfProvider = $csrfProvider;
51 $this->translator = $translator;
52 $this->translationDomain = $translationDomain;
53 }
54
55 /**
56 * {@inheritDoc}
57 */
58 protected function loadTypeExtensions()
59 {
60 return array(
61 new Type\FormTypeCsrfExtension($this->csrfProvider, true, '_token', $this->translator, $this->translationDomain),
62 );
63 }
64}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Extension/Csrf/CsrfProvider/CsrfProviderInterface.php b/vendor/symfony/form/Symfony/Component/Form/Extension/Csrf/CsrfProvider/CsrfProviderInterface.php
deleted file mode 100644
index 7143b130..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Extension/Csrf/CsrfProvider/CsrfProviderInterface.php
+++ /dev/null
@@ -1,49 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Extension\Csrf\CsrfProvider;
13
14/**
15 * Marks classes able to provide CSRF protection
16 *
17 * You can generate a CSRF token by using the method generateCsrfToken(). To
18 * this method you should pass a value that is unique to the page that should
19 * be secured against CSRF attacks. This value doesn't necessarily have to be
20 * secret. Implementations of this interface are responsible for adding more
21 * secret information.
22 *
23 * If you want to secure a form submission against CSRF attacks, you could
24 * supply an "intention" string. This way you make sure that the form can only
25 * be submitted to pages that are designed to handle the form, that is, that use
26 * the same intention string to validate the CSRF token with isCsrfTokenValid().
27 *
28 * @author Bernhard Schussek <bschussek@gmail.com>
29 */
30interface CsrfProviderInterface
31{
32 /**
33 * Generates a CSRF token for a page of your application.
34 *
35 * @param string $intention Some value that identifies the action intention
36 * (i.e. "authenticate"). Doesn't have to be a secret value.
37 */
38 public function generateCsrfToken($intention);
39
40 /**
41 * Validates a CSRF token.
42 *
43 * @param string $intention The intention used when generating the CSRF token
44 * @param string $token The token supplied by the browser
45 *
46 * @return Boolean Whether the token supplied by the browser is correct
47 */
48 public function isCsrfTokenValid($intention, $token);
49}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Extension/Csrf/CsrfProvider/DefaultCsrfProvider.php b/vendor/symfony/form/Symfony/Component/Form/Extension/Csrf/CsrfProvider/DefaultCsrfProvider.php
deleted file mode 100644
index 5354886c..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Extension/Csrf/CsrfProvider/DefaultCsrfProvider.php
+++ /dev/null
@@ -1,78 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Extension\Csrf\CsrfProvider;
13
14/**
15 * Default implementation of CsrfProviderInterface.
16 *
17 * This provider uses the session ID returned by session_id() as well as a
18 * user-defined secret value to secure the CSRF token.
19 *
20 * @author Bernhard Schussek <bschussek@gmail.com>
21 */
22class DefaultCsrfProvider implements CsrfProviderInterface
23{
24 /**
25 * A secret value used for generating the CSRF token
26 * @var string
27 */
28 protected $secret;
29
30 /**
31 * Initializes the provider with a secret value
32 *
33 * A recommended value for the secret is a generated value with at least
34 * 32 characters and mixed letters, digits and special characters.
35 *
36 * @param string $secret A secret value included in the CSRF token
37 */
38 public function __construct($secret)
39 {
40 $this->secret = $secret;
41 }
42
43 /**
44 * {@inheritDoc}
45 */
46 public function generateCsrfToken($intention)
47 {
48 return sha1($this->secret.$intention.$this->getSessionId());
49 }
50
51 /**
52 * {@inheritDoc}
53 */
54 public function isCsrfTokenValid($intention, $token)
55 {
56 return $token === $this->generateCsrfToken($intention);
57 }
58
59 /**
60 * Returns the ID of the user session.
61 *
62 * Automatically starts the session if necessary.
63 *
64 * @return string The session ID
65 */
66 protected function getSessionId()
67 {
68 if (version_compare(PHP_VERSION, '5.4', '>=')) {
69 if (PHP_SESSION_NONE === session_status()) {
70 session_start();
71 }
72 } elseif (!session_id()) {
73 session_start();
74 }
75
76 return session_id();
77 }
78}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Extension/Csrf/CsrfProvider/SessionCsrfProvider.php b/vendor/symfony/form/Symfony/Component/Form/Extension/Csrf/CsrfProvider/SessionCsrfProvider.php
deleted file mode 100644
index ea1fa585..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Extension/Csrf/CsrfProvider/SessionCsrfProvider.php
+++ /dev/null
@@ -1,57 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Extension\Csrf\CsrfProvider;
13
14use Symfony\Component\HttpFoundation\Session\Session;
15
16/**
17 * This provider uses a Symfony2 Session object to retrieve the user's
18 * session ID.
19 *
20 * @see DefaultCsrfProvider
21 *
22 * @author Bernhard Schussek <bschussek@gmail.com>
23 */
24class SessionCsrfProvider extends DefaultCsrfProvider
25{
26 /**
27 * The user session from which the session ID is returned
28 * @var Session
29 */
30 protected $session;
31
32 /**
33 * Initializes the provider with a Session object and a secret value.
34 *
35 * A recommended value for the secret is a generated value with at least
36 * 32 characters and mixed letters, digits and special characters.
37 *
38 * @param Session $session The user session
39 * @param string $secret A secret value included in the CSRF token
40 */
41 public function __construct(Session $session, $secret)
42 {
43 parent::__construct($secret);
44
45 $this->session = $session;
46 }
47
48 /**
49 * {@inheritdoc}
50 */
51 protected function getSessionId()
52 {
53 $this->session->start();
54
55 return $this->session->getId();
56 }
57}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Extension/Csrf/EventListener/CsrfValidationListener.php b/vendor/symfony/form/Symfony/Component/Form/Extension/Csrf/EventListener/CsrfValidationListener.php
deleted file mode 100644
index 547e9d75..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Extension/Csrf/EventListener/CsrfValidationListener.php
+++ /dev/null
@@ -1,115 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Extension\Csrf\EventListener;
13
14use Symfony\Component\EventDispatcher\EventSubscriberInterface;
15use Symfony\Component\Form\FormEvents;
16use Symfony\Component\Form\FormError;
17use Symfony\Component\Form\FormEvent;
18use Symfony\Component\Form\Extension\Csrf\CsrfProvider\CsrfProviderInterface;
19use Symfony\Component\Translation\TranslatorInterface;
20
21/**
22 * @author Bernhard Schussek <bschussek@gmail.com>
23 */
24class CsrfValidationListener implements EventSubscriberInterface
25{
26 /**
27 * The name of the CSRF field
28 * @var string
29 */
30 private $fieldName;
31
32 /**
33 * The provider for generating and validating CSRF tokens
34 * @var CsrfProviderInterface
35 */
36 private $csrfProvider;
37
38 /**
39 * A text mentioning the intention of the CSRF token
40 *
41 * Validation of the token will only succeed if it was generated in the
42 * same session and with the same intention.
43 *
44 * @var string
45 */
46 private $intention;
47
48 /**
49 * The message displayed in case of an error.
50 * @var string
51 */
52 private $errorMessage;
53
54 /**
55 * @var TranslatorInterface
56 */
57 private $translator;
58
59 /**
60 * @var null|string
61 */
62 private $translationDomain;
63
64 public static function getSubscribedEvents()
65 {
66 return array(
67 FormEvents::PRE_SUBMIT => 'preSubmit',
68 );
69 }
70
71 public function __construct($fieldName, CsrfProviderInterface $csrfProvider, $intention, $errorMessage, TranslatorInterface $translator = null, $translationDomain = null)
72 {
73 $this->fieldName = $fieldName;
74 $this->csrfProvider = $csrfProvider;
75 $this->intention = $intention;
76 $this->errorMessage = $errorMessage;
77 $this->translator = $translator;
78 $this->translationDomain = $translationDomain;
79 }
80
81 public function preSubmit(FormEvent $event)
82 {
83 $form = $event->getForm();
84 $data = $event->getData();
85
86 if ($form->isRoot() && $form->getConfig()->getOption('compound')) {
87 if (!isset($data[$this->fieldName]) || !$this->csrfProvider->isCsrfTokenValid($this->intention, $data[$this->fieldName])) {
88 $errorMessage = $this->errorMessage;
89
90 if (null !== $this->translator) {
91 $errorMessage = $this->translator->trans($errorMessage, array(), $this->translationDomain);
92 }
93
94 $form->addError(new FormError($errorMessage));
95 }
96
97 if (is_array($data)) {
98 unset($data[$this->fieldName]);
99 }
100 }
101
102 $event->setData($data);
103 }
104
105 /**
106 * Alias of {@link preSubmit()}.
107 *
108 * @deprecated Deprecated since version 2.3, to be removed in 3.0. Use
109 * {@link preSubmit()} instead.
110 */
111 public function preBind(FormEvent $event)
112 {
113 $this->preSubmit($event);
114 }
115}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Extension/Csrf/Type/FormTypeCsrfExtension.php b/vendor/symfony/form/Symfony/Component/Form/Extension/Csrf/Type/FormTypeCsrfExtension.php
deleted file mode 100644
index 336cf047..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Extension/Csrf/Type/FormTypeCsrfExtension.php
+++ /dev/null
@@ -1,129 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Extension\Csrf\Type;
13
14use Symfony\Component\Form\AbstractTypeExtension;
15use Symfony\Component\Form\Extension\Csrf\CsrfProvider\CsrfProviderInterface;
16use Symfony\Component\Form\Extension\Csrf\EventListener\CsrfValidationListener;
17use Symfony\Component\Form\FormBuilderInterface;
18use Symfony\Component\Form\FormView;
19use Symfony\Component\Form\FormInterface;
20use Symfony\Component\OptionsResolver\OptionsResolverInterface;
21use Symfony\Component\Translation\TranslatorInterface;
22
23/**
24 * @author Bernhard Schussek <bschussek@gmail.com>
25 */
26class FormTypeCsrfExtension extends AbstractTypeExtension
27{
28 /**
29 * @var CsrfProviderInterface
30 */
31 private $defaultCsrfProvider;
32
33 /**
34 * @var Boolean
35 */
36 private $defaultEnabled;
37
38 /**
39 * @var string
40 */
41 private $defaultFieldName;
42
43 /**
44 * @var TranslatorInterface
45 */
46 private $translator;
47
48 /**
49 * @var null|string
50 */
51 private $translationDomain;
52
53 public function __construct(CsrfProviderInterface $defaultCsrfProvider, $defaultEnabled = true, $defaultFieldName = '_token', TranslatorInterface $translator = null, $translationDomain = null)
54 {
55 $this->defaultCsrfProvider = $defaultCsrfProvider;
56 $this->defaultEnabled = $defaultEnabled;
57 $this->defaultFieldName = $defaultFieldName;
58 $this->translator = $translator;
59 $this->translationDomain = $translationDomain;
60 }
61
62 /**
63 * Adds a CSRF field to the form when the CSRF protection is enabled.
64 *
65 * @param FormBuilderInterface $builder The form builder
66 * @param array $options The options
67 */
68 public function buildForm(FormBuilderInterface $builder, array $options)
69 {
70 if (!$options['csrf_protection']) {
71 return;
72 }
73
74 $builder
75 ->setAttribute('csrf_factory', $builder->getFormFactory())
76 ->addEventSubscriber(new CsrfValidationListener(
77 $options['csrf_field_name'],
78 $options['csrf_provider'],
79 $options['intention'],
80 $options['csrf_message'],
81 $this->translator,
82 $this->translationDomain
83 ))
84 ;
85 }
86
87 /**
88 * Adds a CSRF field to the root form view.
89 *
90 * @param FormView $view The form view
91 * @param FormInterface $form The form
92 * @param array $options The options
93 */
94 public function finishView(FormView $view, FormInterface $form, array $options)
95 {
96 if ($options['csrf_protection'] && !$view->parent && $options['compound']) {
97 $factory = $form->getConfig()->getAttribute('csrf_factory');
98 $data = $options['csrf_provider']->generateCsrfToken($options['intention']);
99
100 $csrfForm = $factory->createNamed($options['csrf_field_name'], 'hidden', $data, array(
101 'mapped' => false,
102 ));
103
104 $view->children[$options['csrf_field_name']] = $csrfForm->createView($view);
105 }
106 }
107
108 /**
109 * {@inheritDoc}
110 */
111 public function setDefaultOptions(OptionsResolverInterface $resolver)
112 {
113 $resolver->setDefaults(array(
114 'csrf_protection' => $this->defaultEnabled,
115 'csrf_field_name' => $this->defaultFieldName,
116 'csrf_provider' => $this->defaultCsrfProvider,
117 'csrf_message' => 'The CSRF token is invalid. Please try to resubmit the form.',
118 'intention' => 'unknown',
119 ));
120 }
121
122 /**
123 * {@inheritDoc}
124 */
125 public function getExtendedType()
126 {
127 return 'form';
128 }
129}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Extension/DependencyInjection/DependencyInjectionExtension.php b/vendor/symfony/form/Symfony/Component/Form/Extension/DependencyInjection/DependencyInjectionExtension.php
deleted file mode 100644
index 6637ac8c..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Extension/DependencyInjection/DependencyInjectionExtension.php
+++ /dev/null
@@ -1,101 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Extension\DependencyInjection;
13
14use Symfony\Component\Form\FormExtensionInterface;
15use Symfony\Component\Form\FormTypeGuesserChain;
16use Symfony\Component\Form\Exception\InvalidArgumentException;
17use Symfony\Component\DependencyInjection\ContainerInterface;
18
19class DependencyInjectionExtension implements FormExtensionInterface
20{
21 private $container;
22
23 private $typeServiceIds;
24
25 private $guesserServiceIds;
26
27 private $guesser;
28
29 private $guesserLoaded = false;
30
31 public function __construct(ContainerInterface $container,
32 array $typeServiceIds, array $typeExtensionServiceIds,
33 array $guesserServiceIds)
34 {
35 $this->container = $container;
36 $this->typeServiceIds = $typeServiceIds;
37 $this->typeExtensionServiceIds = $typeExtensionServiceIds;
38 $this->guesserServiceIds = $guesserServiceIds;
39 }
40
41 public function getType($name)
42 {
43 if (!isset($this->typeServiceIds[$name])) {
44 throw new InvalidArgumentException(sprintf('The field type "%s" is not registered with the service container.', $name));
45 }
46
47 $type = $this->container->get($this->typeServiceIds[$name]);
48
49 if ($type->getName() !== $name) {
50 throw new InvalidArgumentException(
51 sprintf('The type name specified for the service "%s" does not match the actual name. Expected "%s", given "%s"',
52 $this->typeServiceIds[$name],
53 $name,
54 $type->getName()
55 ));
56 }
57
58 return $type;
59 }
60
61 public function hasType($name)
62 {
63 return isset($this->typeServiceIds[$name]);
64 }
65
66 public function getTypeExtensions($name)
67 {
68 $extensions = array();
69
70 if (isset($this->typeExtensionServiceIds[$name])) {
71 foreach ($this->typeExtensionServiceIds[$name] as $serviceId) {
72 $extensions[] = $this->container->get($serviceId);
73 }
74 }
75
76 return $extensions;
77 }
78
79 public function hasTypeExtensions($name)
80 {
81 return isset($this->typeExtensionServiceIds[$name]);
82 }
83
84 public function getTypeGuesser()
85 {
86 if (!$this->guesserLoaded) {
87 $this->guesserLoaded = true;
88 $guessers = array();
89
90 foreach ($this->guesserServiceIds as $serviceId) {
91 $guessers[] = $this->container->get($serviceId);
92 }
93
94 if (count($guessers) > 0) {
95 $this->guesser = new FormTypeGuesserChain($guessers);
96 }
97 }
98
99 return $this->guesser;
100 }
101}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Extension/HttpFoundation/EventListener/BindRequestListener.php b/vendor/symfony/form/Symfony/Component/Form/Extension/HttpFoundation/EventListener/BindRequestListener.php
deleted file mode 100644
index 6205b98d..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Extension/HttpFoundation/EventListener/BindRequestListener.php
+++ /dev/null
@@ -1,91 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Extension\HttpFoundation\EventListener;
13
14use Symfony\Component\Form\FormEvents;
15use Symfony\Component\Form\FormEvent;
16use Symfony\Component\Form\Exception\LogicException;
17use Symfony\Component\EventDispatcher\EventSubscriberInterface;
18use Symfony\Component\HttpFoundation\Request;
19
20/**
21 * @author Bernhard Schussek <bschussek@gmail.com>
22 *
23 * @deprecated Deprecated since version 2.3, to be removed in 3.0. Pass the
24 * Request instance to {@link Form::process()} instead.
25 */
26class BindRequestListener implements EventSubscriberInterface
27{
28 public static function getSubscribedEvents()
29 {
30 // High priority in order to supersede other listeners
31 return array(FormEvents::PRE_BIND => array('preBind', 128));
32 }
33
34 public function preBind(FormEvent $event)
35 {
36 $form = $event->getForm();
37
38 /* @var Request $request */
39 $request = $event->getData();
40
41 // Only proceed if we actually deal with a Request
42 if (!$request instanceof Request) {
43 return;
44 }
45
46 // Uncomment this as soon as the deprecation note should be shown
47 // trigger_error('Passing a Request instance to Form::submit() is deprecated since version 2.3 and will be disabled in 3.0. Call Form::process($request) instead.', E_USER_DEPRECATED);
48
49 $name = $form->getConfig()->getName();
50 $default = $form->getConfig()->getCompound() ? array() : null;
51
52 // Store the bound data in case of a post request
53 switch ($request->getMethod()) {
54 case 'POST':
55 case 'PUT':
56 case 'DELETE':
57 case 'PATCH':
58 if ('' === $name) {
59 // Form bound without name
60 $params = $request->request->all();
61 $files = $request->files->all();
62 } else {
63 $params = $request->request->get($name, $default);
64 $files = $request->files->get($name, $default);
65 }
66
67 if (is_array($params) && is_array($files)) {
68 $data = array_replace_recursive($params, $files);
69 } else {
70 $data = $params ?: $files;
71 }
72
73 break;
74
75 case 'GET':
76 $data = '' === $name
77 ? $request->query->all()
78 : $request->query->get($name, $default);
79
80 break;
81
82 default:
83 throw new LogicException(sprintf(
84 'The request method "%s" is not supported',
85 $request->getMethod()
86 ));
87 }
88
89 $event->setData($data);
90 }
91}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Extension/HttpFoundation/HttpFoundationExtension.php b/vendor/symfony/form/Symfony/Component/Form/Extension/HttpFoundation/HttpFoundationExtension.php
deleted file mode 100644
index 08bd89c9..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Extension/HttpFoundation/HttpFoundationExtension.php
+++ /dev/null
@@ -1,29 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Extension\HttpFoundation;
13
14use Symfony\Component\Form\AbstractExtension;
15
16/**
17 * Integrates the HttpFoundation component with the Form library.
18 *
19 * @author Bernhard Schussek <bschussek@gmail.com>
20 */
21class HttpFoundationExtension extends AbstractExtension
22{
23 protected function loadTypeExtensions()
24 {
25 return array(
26 new Type\FormTypeHttpFoundationExtension(),
27 );
28 }
29}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Extension/HttpFoundation/HttpFoundationRequestHandler.php b/vendor/symfony/form/Symfony/Component/Form/Extension/HttpFoundation/HttpFoundationRequestHandler.php
deleted file mode 100644
index cc485156..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Extension/HttpFoundation/HttpFoundationRequestHandler.php
+++ /dev/null
@@ -1,79 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Extension\HttpFoundation;
13
14use Symfony\Component\Form\Exception\UnexpectedTypeException;
15use Symfony\Component\Form\FormInterface;
16use Symfony\Component\Form\RequestHandlerInterface;
17use Symfony\Component\HttpFoundation\Request;
18
19/**
20 * A request processor using the {@link Request} class of the HttpFoundation
21 * component.
22 *
23 * @author Bernhard Schussek <bschussek@gmail.com>
24 */
25class HttpFoundationRequestHandler implements RequestHandlerInterface
26{
27 /**
28 * {@inheritdoc}
29 */
30 public function handleRequest(FormInterface $form, $request = null)
31 {
32 if (!$request instanceof Request) {
33 throw new UnexpectedTypeException($request, 'Symfony\Component\HttpFoundation\Request');
34 }
35
36 $name = $form->getName();
37 $method = $form->getConfig()->getMethod();
38
39 if ($method !== $request->getMethod()) {
40 return;
41 }
42
43 if ('GET' === $method) {
44 if ('' === $name) {
45 $data = $request->query->all();
46 } else {
47 // Don't submit GET requests if the form's name does not exist
48 // in the request
49 if (!$request->query->has($name)) {
50 return;
51 }
52
53 $data = $request->query->get($name);
54 }
55 } else {
56 if ('' === $name) {
57 $params = $request->request->all();
58 $files = $request->files->all();
59 } else {
60 $default = $form->getConfig()->getCompound() ? array() : null;
61 $params = $request->request->get($name, $default);
62 $files = $request->files->get($name, $default);
63 }
64
65 if (is_array($params) && is_array($files)) {
66 $data = array_replace_recursive($params, $files);
67 } else {
68 $data = $params ?: $files;
69 }
70 }
71
72 // Don't auto-submit the form unless at least one field is present.
73 if ('' === $name && count(array_intersect_key($data, $form->all())) <= 0) {
74 return;
75 }
76
77 $form->submit($data, 'PATCH' !== $method);
78 }
79}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Extension/HttpFoundation/Type/FormTypeHttpFoundationExtension.php b/vendor/symfony/form/Symfony/Component/Form/Extension/HttpFoundation/Type/FormTypeHttpFoundationExtension.php
deleted file mode 100644
index 9b09b05c..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Extension/HttpFoundation/Type/FormTypeHttpFoundationExtension.php
+++ /dev/null
@@ -1,56 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Extension\HttpFoundation\Type;
13
14use Symfony\Component\Form\AbstractTypeExtension;
15use Symfony\Component\Form\Extension\HttpFoundation\EventListener\BindRequestListener;
16use Symfony\Component\Form\Extension\HttpFoundation\HttpFoundationRequestHandler;
17use Symfony\Component\Form\FormBuilderInterface;
18
19/**
20 * @author Bernhard Schussek <bschussek@gmail.com>
21 */
22class FormTypeHttpFoundationExtension extends AbstractTypeExtension
23{
24 /**
25 * @var BindRequestListener
26 */
27 private $listener;
28
29 /**
30 * @var HttpFoundationRequestHandler
31 */
32 private $requestHandler;
33
34 public function __construct()
35 {
36 $this->listener = new BindRequestListener();
37 $this->requestHandler = new HttpFoundationRequestHandler();
38 }
39
40 /**
41 * {@inheritdoc}
42 */
43 public function buildForm(FormBuilderInterface $builder, array $options)
44 {
45 $builder->addEventSubscriber($this->listener);
46 $builder->setRequestHandler($this->requestHandler);
47 }
48
49 /**
50 * {@inheritdoc}
51 */
52 public function getExtendedType()
53 {
54 return 'form';
55 }
56}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Extension/Templating/TemplatingExtension.php b/vendor/symfony/form/Symfony/Component/Form/Extension/Templating/TemplatingExtension.php
deleted file mode 100644
index 573cb518..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Extension/Templating/TemplatingExtension.php
+++ /dev/null
@@ -1,33 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Extension\Templating;
13
14use Symfony\Component\Form\AbstractExtension;
15use Symfony\Component\Form\FormRenderer;
16use Symfony\Component\Form\Extension\Csrf\CsrfProvider\CsrfProviderInterface;
17use Symfony\Component\Templating\PhpEngine;
18use Symfony\Bundle\FrameworkBundle\Templating\Helper\FormHelper;
19
20/**
21 * Integrates the Templating component with the Form library.
22 *
23 * @author Bernhard Schussek <bschussek@gmail.com>
24 */
25class TemplatingExtension extends AbstractExtension
26{
27 public function __construct(PhpEngine $engine, CsrfProviderInterface $csrfProvider = null, array $defaultThemes = array())
28 {
29 $engine->addHelpers(array(
30 new FormHelper(new FormRenderer(new TemplatingRendererEngine($engine, $defaultThemes), $csrfProvider))
31 ));
32 }
33}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Extension/Templating/TemplatingRendererEngine.php b/vendor/symfony/form/Symfony/Component/Form/Extension/Templating/TemplatingRendererEngine.php
deleted file mode 100644
index c1dda60b..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Extension/Templating/TemplatingRendererEngine.php
+++ /dev/null
@@ -1,125 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Extension\Templating;
13
14use Symfony\Component\Form\AbstractRendererEngine;
15use Symfony\Component\Form\FormView;
16use Symfony\Component\Templating\EngineInterface;
17
18/**
19 * @author Bernhard Schussek <bschussek@gmail.com>
20 */
21class TemplatingRendererEngine extends AbstractRendererEngine
22{
23 /**
24 * @var EngineInterface
25 */
26 private $engine;
27
28 public function __construct(EngineInterface $engine, array $defaultThemes = array())
29 {
30 parent::__construct($defaultThemes);
31
32 $this->engine = $engine;
33 }
34
35 /**
36 * {@inheritdoc}
37 */
38 public function renderBlock(FormView $view, $resource, $blockName, array $variables = array())
39 {
40 return trim($this->engine->render($resource, $variables));
41 }
42
43 /**
44 * Loads the cache with the resource for a given block name.
45 *
46 * This implementation tries to load as few blocks as possible, since each block
47 * is represented by a template on the file system.
48 *
49 * @see getResourceForBlock()
50 *
51 * @param string $cacheKey The cache key of the form view.
52 * @param FormView $view The form view for finding the applying themes.
53 * @param string $blockName The name of the block to load.
54 *
55 * @return Boolean True if the resource could be loaded, false otherwise.
56 */
57 protected function loadResourceForBlockName($cacheKey, FormView $view, $blockName)
58 {
59 // Recursively try to find the block in the themes assigned to $view,
60 // then of its parent form, then of the parent form of the parent and so on.
61 // When the root form is reached in this recursion, also the default
62 // themes are taken into account.
63
64 // Check each theme whether it contains the searched block
65 if (isset($this->themes[$cacheKey])) {
66 for ($i = count($this->themes[$cacheKey]) - 1; $i >= 0; --$i) {
67 if ($this->loadResourceFromTheme($cacheKey, $blockName, $this->themes[$cacheKey][$i])) {
68 return true;
69 }
70 }
71 }
72
73 // Check the default themes once we reach the root form without success
74 if (!$view->parent) {
75 for ($i = count($this->defaultThemes) - 1; $i >= 0; --$i) {
76 if ($this->loadResourceFromTheme($cacheKey, $blockName, $this->defaultThemes[$i])) {
77 return true;
78 }
79 }
80 }
81
82 // If we did not find anything in the themes of the current view, proceed
83 // with the themes of the parent view
84 if ($view->parent) {
85 $parentCacheKey = $view->parent->vars[self::CACHE_KEY_VAR];
86
87 if (!isset($this->resources[$parentCacheKey][$blockName])) {
88 $this->loadResourceForBlockName($parentCacheKey, $view->parent, $blockName);
89 }
90
91 // If a template exists in the parent themes, cache that template
92 // for the current theme as well to speed up further accesses
93 if ($this->resources[$parentCacheKey][$blockName]) {
94 $this->resources[$cacheKey][$blockName] = $this->resources[$parentCacheKey][$blockName];
95
96 return true;
97 }
98 }
99
100 // Cache that we didn't find anything to speed up further accesses
101 $this->resources[$cacheKey][$blockName] = false;
102
103 return false;
104 }
105
106 /**
107 * Tries to load the resource for a block from a theme.
108 *
109 * @param string $cacheKey The cache key for storing the resource.
110 * @param string $blockName The name of the block to load a resource for.
111 * @param mixed $theme The theme to load the block from.
112 *
113 * @return Boolean True if the resource could be loaded, false otherwise.
114 */
115 protected function loadResourceFromTheme($cacheKey, $blockName, $theme)
116 {
117 if ($this->engine->exists($templateName = $theme.':'.$blockName.'.html.php')) {
118 $this->resources[$cacheKey][$blockName] = $templateName;
119
120 return true;
121 }
122
123 return false;
124 }
125}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Extension/Validator/Constraints/Form.php b/vendor/symfony/form/Symfony/Component/Form/Extension/Validator/Constraints/Form.php
deleted file mode 100644
index 87e33297..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Extension/Validator/Constraints/Form.php
+++ /dev/null
@@ -1,33 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Extension\Validator\Constraints;
13
14use Symfony\Component\Validator\Constraint;
15
16/**
17 * @author Bernhard Schussek <bschussek@gmail.com>
18 */
19class Form extends Constraint
20{
21 /**
22 * Violation code marking an invalid form.
23 */
24 const ERR_INVALID = 1;
25
26 /**
27 * {@inheritdoc}
28 */
29 public function getTargets()
30 {
31 return self::CLASS_CONSTRAINT;
32 }
33}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Extension/Validator/Constraints/FormValidator.php b/vendor/symfony/form/Symfony/Component/Form/Extension/Validator/Constraints/FormValidator.php
deleted file mode 100644
index bad5a007..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Extension/Validator/Constraints/FormValidator.php
+++ /dev/null
@@ -1,236 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Extension\Validator\Constraints;
13
14use Symfony\Component\Form\ClickableInterface;
15use Symfony\Component\Form\FormInterface;
16use Symfony\Component\Form\Extension\Validator\Util\ServerParams;
17use Symfony\Component\Validator\Constraint;
18use Symfony\Component\Validator\ConstraintValidator;
19
20/**
21 * @author Bernhard Schussek <bschussek@gmail.com>
22 */
23class FormValidator extends ConstraintValidator
24{
25 /**
26 * @var ServerParams
27 */
28 private $serverParams;
29
30 /**
31 * Creates a validator with the given server parameters.
32 *
33 * @param ServerParams $params The server parameters. Default
34 * parameters are created if null.
35 */
36 public function __construct(ServerParams $params = null)
37 {
38 $this->serverParams = $params ?: new ServerParams();
39 }
40
41 /**
42 * {@inheritdoc}
43 */
44 public function validate($form, Constraint $constraint)
45 {
46 if (!$form instanceof FormInterface) {
47 return;
48 }
49
50 /* @var FormInterface $form */
51 $config = $form->getConfig();
52
53 if ($form->isSynchronized()) {
54 // Validate the form data only if transformation succeeded
55 $groups = self::getValidationGroups($form);
56
57 // Validate the data against its own constraints
58 if (self::allowDataWalking($form)) {
59 foreach ($groups as $group) {
60 $this->context->validate($form->getData(), 'data', $group, true);
61 }
62 }
63
64 // Validate the data against the constraints defined
65 // in the form
66 $constraints = $config->getOption('constraints');
67 foreach ($constraints as $constraint) {
68 foreach ($groups as $group) {
69 if (in_array($group, $constraint->groups)) {
70 $this->context->validateValue($form->getData(), $constraint, 'data', $group);
71
72 // Prevent duplicate validation
73 continue 2;
74 }
75 }
76 }
77 } else {
78 $childrenSynchronized = true;
79
80 foreach ($form as $child) {
81 if (!$child->isSynchronized()) {
82 $childrenSynchronized = false;
83 break;
84 }
85 }
86
87 // Mark the form with an error if it is not synchronized BUT all
88 // of its children are synchronized. If any child is not
89 // synchronized, an error is displayed there already and showing
90 // a second error in its parent form is pointless, or worse, may
91 // lead to duplicate errors if error bubbling is enabled on the
92 // child.
93 // See also https://github.com/symfony/symfony/issues/4359
94 if ($childrenSynchronized) {
95 $clientDataAsString = is_scalar($form->getViewData())
96 ? (string) $form->getViewData()
97 : gettype($form->getViewData());
98
99 $this->context->addViolation(
100 $config->getOption('invalid_message'),
101 array_replace(array('{{ value }}' => $clientDataAsString), $config->getOption('invalid_message_parameters')),
102 $form->getViewData(),
103 null,
104 Form::ERR_INVALID
105 );
106 }
107 }
108
109 // Mark the form with an error if it contains extra fields
110 if (count($form->getExtraData()) > 0) {
111 $this->context->addViolation(
112 $config->getOption('extra_fields_message'),
113 array('{{ extra_fields }}' => implode('", "', array_keys($form->getExtraData()))),
114 $form->getExtraData()
115 );
116 }
117
118 // Mark the form with an error if the uploaded size was too large
119 $length = $this->serverParams->getContentLength();
120
121 if ($form->isRoot() && null !== $length) {
122 $max = $this->serverParams->getPostMaxSize();
123
124 if (!empty($max) && $length > $max) {
125 $this->context->addViolation(
126 $config->getOption('post_max_size_message'),
127 array('{{ max }}' => $this->serverParams->getNormalizedIniPostMaxSize()),
128 $length
129 );
130 }
131 }
132 }
133
134 /**
135 * Returns whether the data of a form may be walked.
136 *
137 * @param FormInterface $form The form to test.
138 *
139 * @return Boolean Whether the graph walker may walk the data.
140 */
141 private static function allowDataWalking(FormInterface $form)
142 {
143 $data = $form->getData();
144
145 // Scalar values cannot have mapped constraints
146 if (!is_object($data) && !is_array($data)) {
147 return false;
148 }
149
150 // Root forms are always validated
151 if ($form->isRoot()) {
152 return true;
153 }
154
155 // Non-root forms are validated if validation cascading
156 // is enabled in all ancestor forms
157 while (null !== ($form = $form->getParent())) {
158 if (!$form->getConfig()->getOption('cascade_validation')) {
159 return false;
160 }
161 }
162
163 return true;
164 }
165
166 /**
167 * Returns the validation groups of the given form.
168 *
169 * @param FormInterface $form The form.
170 *
171 * @return array The validation groups.
172 */
173 private static function getValidationGroups(FormInterface $form)
174 {
175 $button = self::findClickedButton($form->getRoot());
176
177 if (null !== $button) {
178 $groups = $button->getConfig()->getOption('validation_groups');
179
180 if (null !== $groups) {
181 return self::resolveValidationGroups($groups, $form);
182 }
183 }
184
185 do {
186 $groups = $form->getConfig()->getOption('validation_groups');
187
188 if (null !== $groups) {
189 return self::resolveValidationGroups($groups, $form);
190 }
191
192 $form = $form->getParent();
193 } while (null !== $form);
194
195 return array(Constraint::DEFAULT_GROUP);
196 }
197
198 /**
199 * Extracts a clicked button from a form tree, if one exists.
200 *
201 * @param FormInterface $form The root form.
202 *
203 * @return ClickableInterface|null The clicked button or null.
204 */
205 private static function findClickedButton(FormInterface $form)
206 {
207 if ($form instanceof ClickableInterface && $form->isClicked()) {
208 return $form;
209 }
210
211 foreach ($form as $child) {
212 if (null !== ($button = self::findClickedButton($child))) {
213 return $button;
214 }
215 }
216
217 return null;
218 }
219
220 /**
221 * Post-processes the validation groups option for a given form.
222 *
223 * @param array|callable $groups The validation groups.
224 * @param FormInterface $form The validated form.
225 *
226 * @return array The validation groups.
227 */
228 private static function resolveValidationGroups($groups, FormInterface $form)
229 {
230 if (!is_string($groups) && is_callable($groups)) {
231 $groups = call_user_func($groups, $form);
232 }
233
234 return (array) $groups;
235 }
236}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Extension/Validator/EventListener/ValidationListener.php b/vendor/symfony/form/Symfony/Component/Form/Extension/Validator/EventListener/ValidationListener.php
deleted file mode 100644
index 14147531..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Extension/Validator/EventListener/ValidationListener.php
+++ /dev/null
@@ -1,68 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Extension\Validator\EventListener;
13
14use Symfony\Component\EventDispatcher\EventSubscriberInterface;
15use Symfony\Component\Form\Extension\Validator\ViolationMapper\ViolationMapperInterface;
16use Symfony\Component\Validator\ValidatorInterface;
17use Symfony\Component\Form\FormEvents;
18use Symfony\Component\Form\FormEvent;
19use Symfony\Component\Form\Extension\Validator\Constraints\Form;
20
21/**
22 * @author Bernhard Schussek <bschussek@gmail.com>
23 */
24class ValidationListener implements EventSubscriberInterface
25{
26 private $validator;
27
28 private $violationMapper;
29
30 /**
31 * {@inheritdoc}
32 */
33 public static function getSubscribedEvents()
34 {
35 return array(FormEvents::POST_SUBMIT => 'validateForm');
36 }
37
38 public function __construct(ValidatorInterface $validator, ViolationMapperInterface $violationMapper)
39 {
40 $this->validator = $validator;
41 $this->violationMapper = $violationMapper;
42 }
43
44 /**
45 * Validates the form and its domain object.
46 *
47 * @param FormEvent $event The event object
48 */
49 public function validateForm(FormEvent $event)
50 {
51 $form = $event->getForm();
52
53 if ($form->isRoot()) {
54 // Validate the form in group "Default"
55 $violations = $this->validator->validate($form);
56
57 if (count($violations) > 0) {
58 foreach ($violations as $violation) {
59 // Allow the "invalid" constraint to be put onto
60 // non-synchronized forms
61 $allowNonSynchronized = Form::ERR_INVALID === $violation->getCode();
62
63 $this->violationMapper->mapViolation($violation, $form, $allowNonSynchronized);
64 }
65 }
66 }
67 }
68}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Extension/Validator/Type/BaseValidatorExtension.php b/vendor/symfony/form/Symfony/Component/Form/Extension/Validator/Type/BaseValidatorExtension.php
deleted file mode 100644
index 7c5e6784..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Extension/Validator/Type/BaseValidatorExtension.php
+++ /dev/null
@@ -1,56 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Extension\Validator\Type;
13
14use Symfony\Component\Form\AbstractTypeExtension;
15use Symfony\Component\OptionsResolver\Options;
16use Symfony\Component\OptionsResolver\OptionsResolverInterface;
17
18/**
19 * Encapsulates common logic of {@link FormTypeValidatorExtension} and
20 * {@link SubmitTypeValidatorExtension}.
21 *
22 * @author Bernhard Schussek <bschussek@gmail.com>
23 */
24abstract class BaseValidatorExtension extends AbstractTypeExtension
25{
26 /**
27 * {@inheritdoc}
28 */
29 public function setDefaultOptions(OptionsResolverInterface $resolver)
30 {
31 // Make sure that validation groups end up as null, closure or array
32 $validationGroupsNormalizer = function (Options $options, $groups) {
33 if (false === $groups) {
34 return array();
35 }
36
37 if (empty($groups)) {
38 return null;
39 }
40
41 if (is_callable($groups)) {
42 return $groups;
43 }
44
45 return (array) $groups;
46 };
47
48 $resolver->setDefaults(array(
49 'validation_groups' => null,
50 ));
51
52 $resolver->setNormalizers(array(
53 'validation_groups' => $validationGroupsNormalizer,
54 ));
55 }
56}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Extension/Validator/Type/FormTypeValidatorExtension.php b/vendor/symfony/form/Symfony/Component/Form/Extension/Validator/Type/FormTypeValidatorExtension.php
deleted file mode 100644
index 344bddad..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Extension/Validator/Type/FormTypeValidatorExtension.php
+++ /dev/null
@@ -1,84 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Extension\Validator\Type;
13
14use Symfony\Component\Form\FormBuilderInterface;
15use Symfony\Component\Form\Extension\Validator\ViolationMapper\ViolationMapper;
16use Symfony\Component\Form\Extension\Validator\EventListener\ValidationListener;
17use Symfony\Component\Validator\ValidatorInterface;
18use Symfony\Component\OptionsResolver\Options;
19use Symfony\Component\OptionsResolver\OptionsResolverInterface;
20
21/**
22 * @author Bernhard Schussek <bschussek@gmail.com>
23 */
24class FormTypeValidatorExtension extends BaseValidatorExtension
25{
26 /**
27 * @var ValidatorInterface
28 */
29 private $validator;
30
31 /**
32 * @var ViolationMapper
33 */
34 private $violationMapper;
35
36 public function __construct(ValidatorInterface $validator)
37 {
38 $this->validator = $validator;
39 $this->violationMapper = new ViolationMapper();
40 }
41
42 /**
43 * {@inheritdoc}
44 */
45 public function buildForm(FormBuilderInterface $builder, array $options)
46 {
47 $builder->addEventSubscriber(new ValidationListener($this->validator, $this->violationMapper));
48 }
49
50 /**
51 * {@inheritdoc}
52 */
53 public function setDefaultOptions(OptionsResolverInterface $resolver)
54 {
55 parent::setDefaultOptions($resolver);
56
57 // Constraint should always be converted to an array
58 $constraintsNormalizer = function (Options $options, $constraints) {
59 return is_object($constraints) ? array($constraints) : (array) $constraints;
60 };
61
62 $resolver->setDefaults(array(
63 'error_mapping' => array(),
64 'constraints' => array(),
65 'cascade_validation' => false,
66 'invalid_message' => 'This value is not valid.',
67 'invalid_message_parameters' => array(),
68 'extra_fields_message' => 'This form should not contain extra fields.',
69 'post_max_size_message' => 'The uploaded file was too large. Please try to upload a smaller file.',
70 ));
71
72 $resolver->setNormalizers(array(
73 'constraints' => $constraintsNormalizer,
74 ));
75 }
76
77 /**
78 * {@inheritdoc}
79 */
80 public function getExtendedType()
81 {
82 return 'form';
83 }
84}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Extension/Validator/Type/RepeatedTypeValidatorExtension.php b/vendor/symfony/form/Symfony/Component/Form/Extension/Validator/Type/RepeatedTypeValidatorExtension.php
deleted file mode 100644
index 858ff0fa..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Extension/Validator/Type/RepeatedTypeValidatorExtension.php
+++ /dev/null
@@ -1,45 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Extension\Validator\Type;
13
14use Symfony\Component\Form\AbstractTypeExtension;
15use Symfony\Component\OptionsResolver\Options;
16use Symfony\Component\OptionsResolver\OptionsResolverInterface;
17
18/**
19 * @author Bernhard Schussek <bschussek@gmail.com>
20 */
21class RepeatedTypeValidatorExtension extends AbstractTypeExtension
22{
23 /**
24 * {@inheritdoc}
25 */
26 public function setDefaultOptions(OptionsResolverInterface $resolver)
27 {
28 // Map errors to the first field
29 $errorMapping = function (Options $options) {
30 return array('.' => $options['first_name']);
31 };
32
33 $resolver->setDefaults(array(
34 'error_mapping' => $errorMapping,
35 ));
36 }
37
38 /**
39 * {@inheritdoc}
40 */
41 public function getExtendedType()
42 {
43 return 'repeated';
44 }
45}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Extension/Validator/Type/SubmitTypeValidatorExtension.php b/vendor/symfony/form/Symfony/Component/Form/Extension/Validator/Type/SubmitTypeValidatorExtension.php
deleted file mode 100644
index 5aad67fb..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Extension/Validator/Type/SubmitTypeValidatorExtension.php
+++ /dev/null
@@ -1,28 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Extension\Validator\Type;
13
14use Symfony\Component\Form\AbstractTypeExtension;
15
16/**
17 * @author Bernhard Schussek <bschussek@gmail.com>
18 */
19class SubmitTypeValidatorExtension extends AbstractTypeExtension
20{
21 /**
22 * {@inheritdoc}
23 */
24 public function getExtendedType()
25 {
26 return 'submit';
27 }
28}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Extension/Validator/Util/ServerParams.php b/vendor/symfony/form/Symfony/Component/Form/Extension/Validator/Util/ServerParams.php
deleted file mode 100644
index fab6ac2a..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Extension/Validator/Util/ServerParams.php
+++ /dev/null
@@ -1,64 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Extension\Validator\Util;
13
14/**
15 * @author Bernhard Schussek <bschussek@gmail.com>
16 */
17class ServerParams
18{
19 /**
20 * Returns maximum post size in bytes.
21 *
22 * @return null|integer The maximum post size in bytes
23 */
24 public function getPostMaxSize()
25 {
26 $iniMax = $this->getNormalizedIniPostMaxSize();
27
28 if ('' === $iniMax) {
29 return null;
30 }
31
32 if (preg_match('#^\+?(0X?)?(.*?)([KMG]?)$#', $iniMax, $match)) {
33 $shifts = array('' => 0, 'K' => 10, 'M' => 20, 'G' => 30);
34 $bases = array('' => 10, '0' => 8, '0X' => 16);
35
36 return intval($match[2], $bases[$match[1]]) << $shifts[$match[3]];
37 }
38
39 return 0;
40 }
41
42 /**
43 * Returns the normalized "post_max_size" ini setting.
44 *
45 * @return string
46 */
47 public function getNormalizedIniPostMaxSize()
48 {
49 return strtoupper(trim(ini_get('post_max_size')));
50 }
51
52 /**
53 * Returns the content length of the request.
54 *
55 * @return mixed The request content length.
56 */
57 public function getContentLength()
58 {
59 return isset($_SERVER['CONTENT_LENGTH'])
60 ? (int) $_SERVER['CONTENT_LENGTH']
61 : null;
62 }
63
64}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Extension/Validator/ValidatorExtension.php b/vendor/symfony/form/Symfony/Component/Form/Extension/Validator/ValidatorExtension.php
deleted file mode 100644
index 9cff22a2..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Extension/Validator/ValidatorExtension.php
+++ /dev/null
@@ -1,57 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Extension\Validator;
13
14use Symfony\Component\Form\Extension\Validator\Type;
15use Symfony\Component\Form\Extension\Validator\Constraints\Form;
16use Symfony\Component\Form\AbstractExtension;
17use Symfony\Component\Validator\ValidatorInterface;
18use Symfony\Component\Validator\Constraints\Valid;
19
20/**
21 * Extension supporting the Symfony2 Validator component in forms.
22 *
23 * @author Bernhard Schussek <bschussek@gmail.com>
24 */
25class ValidatorExtension extends AbstractExtension
26{
27 private $validator;
28
29 public function __construct(ValidatorInterface $validator)
30 {
31 $this->validator = $validator;
32
33 // Register the form constraints in the validator programmatically.
34 // This functionality is required when using the Form component without
35 // the DIC, where the XML file is loaded automatically. Thus the following
36 // code must be kept synchronized with validation.xml
37
38 /** @var \Symfony\Component\Validator\Mapping\ClassMetadata $metadata */
39 $metadata = $this->validator->getMetadataFactory()->getMetadataFor('Symfony\Component\Form\Form');
40 $metadata->addConstraint(new Form());
41 $metadata->addPropertyConstraint('children', new Valid());
42 }
43
44 public function loadTypeGuesser()
45 {
46 return new ValidatorTypeGuesser($this->validator->getMetadataFactory());
47 }
48
49 protected function loadTypeExtensions()
50 {
51 return array(
52 new Type\FormTypeValidatorExtension($this->validator),
53 new Type\RepeatedTypeValidatorExtension(),
54 new Type\SubmitTypeValidatorExtension(),
55 );
56 }
57}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Extension/Validator/ValidatorTypeGuesser.php b/vendor/symfony/form/Symfony/Component/Form/Extension/Validator/ValidatorTypeGuesser.php
deleted file mode 100644
index dcd9cc55..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Extension/Validator/ValidatorTypeGuesser.php
+++ /dev/null
@@ -1,286 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Extension\Validator;
13
14use Symfony\Component\Form\FormTypeGuesserInterface;
15use Symfony\Component\Form\Guess\Guess;
16use Symfony\Component\Form\Guess\TypeGuess;
17use Symfony\Component\Form\Guess\ValueGuess;
18use Symfony\Component\Validator\MetadataFactoryInterface;
19use Symfony\Component\Validator\Constraint;
20
21class ValidatorTypeGuesser implements FormTypeGuesserInterface
22{
23 private $metadataFactory;
24
25 public function __construct(MetadataFactoryInterface $metadataFactory)
26 {
27 $this->metadataFactory = $metadataFactory;
28 }
29
30 /**
31 * {@inheritDoc}
32 */
33 public function guessType($class, $property)
34 {
35 $guesser = $this;
36
37 return $this->guess($class, $property, function (Constraint $constraint) use ($guesser) {
38 return $guesser->guessTypeForConstraint($constraint);
39 });
40 }
41
42 /**
43 * {@inheritDoc}
44 */
45 public function guessRequired($class, $property)
46 {
47 $guesser = $this;
48
49 return $this->guess($class, $property, function (Constraint $constraint) use ($guesser) {
50 return $guesser->guessRequiredForConstraint($constraint);
51 // If we don't find any constraint telling otherwise, we can assume
52 // that a field is not required (with LOW_CONFIDENCE)
53 }, false);
54 }
55
56 /**
57 * {@inheritDoc}
58 */
59 public function guessMaxLength($class, $property)
60 {
61 $guesser = $this;
62
63 return $this->guess($class, $property, function (Constraint $constraint) use ($guesser) {
64 return $guesser->guessMaxLengthForConstraint($constraint);
65 });
66 }
67
68 /**
69 * {@inheritDoc}
70 */
71 public function guessPattern($class, $property)
72 {
73 $guesser = $this;
74
75 return $this->guess($class, $property, function (Constraint $constraint) use ($guesser) {
76 return $guesser->guessPatternForConstraint($constraint);
77 });
78 }
79
80 /**
81 * Guesses a field class name for a given constraint
82 *
83 * @param Constraint $constraint The constraint to guess for
84 *
85 * @return TypeGuess The guessed field class and options
86 */
87 public function guessTypeForConstraint(Constraint $constraint)
88 {
89 switch (get_class($constraint)) {
90 case 'Symfony\Component\Validator\Constraints\Type':
91 switch ($constraint->type) {
92 case 'array':
93 return new TypeGuess('collection', array(), Guess::MEDIUM_CONFIDENCE);
94 case 'boolean':
95 case 'bool':
96 return new TypeGuess('checkbox', array(), Guess::MEDIUM_CONFIDENCE);
97
98 case 'double':
99 case 'float':
100 case 'numeric':
101 case 'real':
102 return new TypeGuess('number', array(), Guess::MEDIUM_CONFIDENCE);
103
104 case 'integer':
105 case 'int':
106 case 'long':
107 return new TypeGuess('integer', array(), Guess::MEDIUM_CONFIDENCE);
108
109 case '\DateTime':
110 return new TypeGuess('date', array(), Guess::MEDIUM_CONFIDENCE);
111
112 case 'string':
113 return new TypeGuess('text', array(), Guess::LOW_CONFIDENCE);
114 }
115 break;
116
117 case 'Symfony\Component\Validator\Constraints\Country':
118 return new TypeGuess('country', array(), Guess::HIGH_CONFIDENCE);
119
120 case 'Symfony\Component\Validator\Constraints\Date':
121 return new TypeGuess('date', array('input' => 'string'), Guess::HIGH_CONFIDENCE);
122
123 case 'Symfony\Component\Validator\Constraints\DateTime':
124 return new TypeGuess('datetime', array('input' => 'string'), Guess::HIGH_CONFIDENCE);
125
126 case 'Symfony\Component\Validator\Constraints\Email':
127 return new TypeGuess('email', array(), Guess::HIGH_CONFIDENCE);
128
129 case 'Symfony\Component\Validator\Constraints\File':
130 case 'Symfony\Component\Validator\Constraints\Image':
131 return new TypeGuess('file', array(), Guess::HIGH_CONFIDENCE);
132
133 case 'Symfony\Component\Validator\Constraints\Language':
134 return new TypeGuess('language', array(), Guess::HIGH_CONFIDENCE);
135
136 case 'Symfony\Component\Validator\Constraints\Locale':
137 return new TypeGuess('locale', array(), Guess::HIGH_CONFIDENCE);
138
139 case 'Symfony\Component\Validator\Constraints\Time':
140 return new TypeGuess('time', array('input' => 'string'), Guess::HIGH_CONFIDENCE);
141
142 case 'Symfony\Component\Validator\Constraints\Url':
143 return new TypeGuess('url', array(), Guess::HIGH_CONFIDENCE);
144
145 case 'Symfony\Component\Validator\Constraints\Ip':
146 return new TypeGuess('text', array(), Guess::MEDIUM_CONFIDENCE);
147
148 case 'Symfony\Component\Validator\Constraints\MaxLength':
149 case 'Symfony\Component\Validator\Constraints\MinLength':
150 case 'Symfony\Component\Validator\Constraints\Regex':
151 return new TypeGuess('text', array(), Guess::LOW_CONFIDENCE);
152
153 case 'Symfony\Component\Validator\Constraints\Min':
154 case 'Symfony\Component\Validator\Constraints\Max':
155 return new TypeGuess('number', array(), Guess::LOW_CONFIDENCE);
156
157 case 'Symfony\Component\Validator\Constraints\MinCount':
158 case 'Symfony\Component\Validator\Constraints\MaxCount':
159 return new TypeGuess('collection', array(), Guess::LOW_CONFIDENCE);
160
161 case 'Symfony\Component\Validator\Constraints\True':
162 case 'Symfony\Component\Validator\Constraints\False':
163 return new TypeGuess('checkbox', array(), Guess::MEDIUM_CONFIDENCE);
164 }
165
166 return null;
167 }
168
169 /**
170 * Guesses whether a field is required based on the given constraint
171 *
172 * @param Constraint $constraint The constraint to guess for
173 *
174 * @return Guess The guess whether the field is required
175 */
176 public function guessRequiredForConstraint(Constraint $constraint)
177 {
178 switch (get_class($constraint)) {
179 case 'Symfony\Component\Validator\Constraints\NotNull':
180 case 'Symfony\Component\Validator\Constraints\NotBlank':
181 case 'Symfony\Component\Validator\Constraints\True':
182 return new ValueGuess(true, Guess::HIGH_CONFIDENCE);
183 }
184
185 return null;
186 }
187
188 /**
189 * Guesses a field's maximum length based on the given constraint
190 *
191 * @param Constraint $constraint The constraint to guess for
192 *
193 * @return Guess The guess for the maximum length
194 */
195 public function guessMaxLengthForConstraint(Constraint $constraint)
196 {
197 switch (get_class($constraint)) {
198 case 'Symfony\Component\Validator\Constraints\MaxLength':
199 return new ValueGuess($constraint->limit, Guess::HIGH_CONFIDENCE);
200
201 case 'Symfony\Component\Validator\Constraints\Type':
202 if (in_array($constraint->type, array('double', 'float', 'numeric', 'real'))) {
203 return new ValueGuess(null, Guess::MEDIUM_CONFIDENCE);
204 }
205 break;
206
207 case 'Symfony\Component\Validator\Constraints\Max':
208 return new ValueGuess(strlen((string) $constraint->limit), Guess::LOW_CONFIDENCE);
209 }
210
211 return null;
212 }
213
214 /**
215 * Guesses a field's pattern based on the given constraint
216 *
217 * @param Constraint $constraint The constraint to guess for
218 *
219 * @return Guess The guess for the pattern
220 */
221 public function guessPatternForConstraint(Constraint $constraint)
222 {
223 switch (get_class($constraint)) {
224 case 'Symfony\Component\Validator\Constraints\MinLength':
225 return new ValueGuess(sprintf('.{%s,}', (string) $constraint->limit), Guess::LOW_CONFIDENCE);
226
227 case 'Symfony\Component\Validator\Constraints\Regex':
228 $htmlPattern = $constraint->getHtmlPattern();
229
230 if (null !== $htmlPattern) {
231 return new ValueGuess($htmlPattern, Guess::HIGH_CONFIDENCE);
232 }
233 break;
234
235 case 'Symfony\Component\Validator\Constraints\Min':
236 return new ValueGuess(sprintf('.{%s,}', strlen((string) $constraint->limit)), Guess::LOW_CONFIDENCE);
237
238 case 'Symfony\Component\Validator\Constraints\Type':
239 if (in_array($constraint->type, array('double', 'float', 'numeric', 'real'))) {
240 return new ValueGuess(null, Guess::MEDIUM_CONFIDENCE);
241 }
242 break;
243 }
244
245 return null;
246 }
247
248 /**
249 * Iterates over the constraints of a property, executes a constraints on
250 * them and returns the best guess
251 *
252 * @param string $class The class to read the constraints from
253 * @param string $property The property for which to find constraints
254 * @param \Closure $closure The closure that returns a guess
255 * for a given constraint
256 * @param mixed $defaultValue The default value assumed if no other value
257 * can be guessed.
258 *
259 * @return Guess The guessed value with the highest confidence
260 */
261 protected function guess($class, $property, \Closure $closure, $defaultValue = null)
262 {
263 $guesses = array();
264 $classMetadata = $this->metadataFactory->getMetadataFor($class);
265
266 if ($classMetadata->hasMemberMetadatas($property)) {
267 $memberMetadatas = $classMetadata->getMemberMetadatas($property);
268
269 foreach ($memberMetadatas as $memberMetadata) {
270 $constraints = $memberMetadata->getConstraints();
271
272 foreach ($constraints as $constraint) {
273 if ($guess = $closure($constraint)) {
274 $guesses[] = $guess;
275 }
276 }
277 }
278
279 if (null !== $defaultValue) {
280 $guesses[] = new ValueGuess($defaultValue, Guess::LOW_CONFIDENCE);
281 }
282 }
283
284 return Guess::getBestGuess($guesses);
285 }
286}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Extension/Validator/ViolationMapper/MappingRule.php b/vendor/symfony/form/Symfony/Component/Form/Extension/Validator/ViolationMapper/MappingRule.php
deleted file mode 100644
index 7b96efb4..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Extension/Validator/ViolationMapper/MappingRule.php
+++ /dev/null
@@ -1,106 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Extension\Validator\ViolationMapper;
13
14use Symfony\Component\Form\FormInterface;
15use Symfony\Component\Form\Exception\ErrorMappingException;
16
17/**
18 * @author Bernhard Schussek <bschussek@gmail.com>
19 */
20class MappingRule
21{
22 /**
23 * @var FormInterface
24 */
25 private $origin;
26
27 /**
28 * @var string
29 */
30 private $propertyPath;
31
32 /**
33 * @var string
34 */
35 private $targetPath;
36
37 public function __construct(FormInterface $origin, $propertyPath, $targetPath)
38 {
39 $this->origin = $origin;
40 $this->propertyPath = $propertyPath;
41 $this->targetPath = $targetPath;
42 }
43
44 /**
45 * @return FormInterface
46 */
47 public function getOrigin()
48 {
49 return $this->origin;
50 }
51
52 /**
53 * Matches a property path against the rule path.
54 *
55 * If the rule matches, the form mapped by the rule is returned.
56 * Otherwise this method returns false.
57 *
58 * @param string $propertyPath The property path to match against the rule.
59 *
60 * @return null|FormInterface The mapped form or null.
61 */
62 public function match($propertyPath)
63 {
64 if ($propertyPath === (string) $this->propertyPath) {
65 return $this->getTarget();
66 }
67
68 return null;
69 }
70
71 /**
72 * Matches a property path against a prefix of the rule path.
73 *
74 * @param string $propertyPath The property path to match against the rule.
75 *
76 * @return Boolean Whether the property path is a prefix of the rule or not.
77 */
78 public function isPrefix($propertyPath)
79 {
80 $length = strlen($propertyPath);
81 $prefix = substr($this->propertyPath, 0, $length);
82 $next = isset($this->propertyPath[$length]) ? $this->propertyPath[$length] : null;
83
84 return $prefix === $propertyPath && ('[' === $next || '.' === $next);
85 }
86
87 /**
88 * @return FormInterface
89 *
90 * @throws ErrorMappingException
91 */
92 public function getTarget()
93 {
94 $childNames = explode('.', $this->targetPath);
95 $target = $this->origin;
96
97 foreach ($childNames as $childName) {
98 if (!$target->has($childName)) {
99 throw new ErrorMappingException(sprintf('The child "%s" of "%s" mapped by the rule "%s" in "%s" does not exist.', $childName, $target->getName(), $this->targetPath, $this->origin->getName()));
100 }
101 $target = $target->get($childName);
102 }
103
104 return $target;
105 }
106}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Extension/Validator/ViolationMapper/RelativePath.php b/vendor/symfony/form/Symfony/Component/Form/Extension/Validator/ViolationMapper/RelativePath.php
deleted file mode 100644
index ef5c9fad..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Extension/Validator/ViolationMapper/RelativePath.php
+++ /dev/null
@@ -1,45 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Extension\Validator\ViolationMapper;
13
14use Symfony\Component\Form\FormInterface;
15use Symfony\Component\PropertyAccess\PropertyPath;
16
17/**
18 * @author Bernhard Schussek <bschussek@gmail.com>
19 */
20class RelativePath extends PropertyPath
21{
22 /**
23 * @var FormInterface
24 */
25 private $root;
26
27 /**
28 * @param FormInterface $root
29 * @param string $propertyPath
30 */
31 public function __construct(FormInterface $root, $propertyPath)
32 {
33 parent::__construct($propertyPath);
34
35 $this->root = $root;
36 }
37
38 /**
39 * @return FormInterface
40 */
41 public function getRoot()
42 {
43 return $this->root;
44 }
45}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Extension/Validator/ViolationMapper/ViolationMapper.php b/vendor/symfony/form/Symfony/Component/Form/Extension/Validator/ViolationMapper/ViolationMapper.php
deleted file mode 100644
index 8a7636c7..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Extension/Validator/ViolationMapper/ViolationMapper.php
+++ /dev/null
@@ -1,299 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Extension\Validator\ViolationMapper;
13
14use Symfony\Component\Form\FormInterface;
15use Symfony\Component\Form\Util\InheritDataAwareIterator;
16use Symfony\Component\PropertyAccess\PropertyPathIterator;
17use Symfony\Component\PropertyAccess\PropertyPathBuilder;
18use Symfony\Component\PropertyAccess\PropertyPathIteratorInterface;
19use Symfony\Component\Form\Extension\Validator\ViolationMapper\ViolationPathIterator;
20use Symfony\Component\Form\FormError;
21use Symfony\Component\Validator\ConstraintViolation;
22
23/**
24 * @author Bernhard Schussek <bschussek@gmail.com>
25 */
26class ViolationMapper implements ViolationMapperInterface
27{
28 /**
29 * @var Boolean
30 */
31 private $allowNonSynchronized;
32
33 /**
34 * {@inheritdoc}
35 */
36 public function mapViolation(ConstraintViolation $violation, FormInterface $form, $allowNonSynchronized = false)
37 {
38 $this->allowNonSynchronized = $allowNonSynchronized;
39
40 // The scope is the currently found most specific form that
41 // an error should be mapped to. After setting the scope, the
42 // mapper will try to continue to find more specific matches in
43 // the children of scope. If it cannot, the error will be
44 // mapped to this scope.
45 $scope = null;
46
47 $violationPath = null;
48 $relativePath = null;
49 $match = false;
50
51 // Don't create a ViolationPath instance for empty property paths
52 if (strlen($violation->getPropertyPath()) > 0) {
53 $violationPath = new ViolationPath($violation->getPropertyPath());
54 $relativePath = $this->reconstructPath($violationPath, $form);
55 }
56
57 // This case happens if the violation path is empty and thus
58 // the violation should be mapped to the root form
59 if (null === $violationPath) {
60 $scope = $form;
61 }
62
63 // In general, mapping happens from the root form to the leaf forms
64 // First, the rules of the root form are applied to determine
65 // the subsequent descendant. The rules of this descendant are then
66 // applied to find the next and so on, until we have found the
67 // most specific form that matches the violation.
68
69 // If any of the forms found in this process is not synchronized,
70 // mapping is aborted. Non-synchronized forms could not reverse
71 // transform the value entered by the user, thus any further violations
72 // caused by the (invalid) reverse transformed value should be
73 // ignored.
74
75 if (null !== $relativePath) {
76 // Set the scope to the root of the relative path
77 // This root will usually be $form. If the path contains
78 // an unmapped form though, the last unmapped form found
79 // will be the root of the path.
80 $scope = $relativePath->getRoot();
81 $it = new PropertyPathIterator($relativePath);
82
83 while ($this->acceptsErrors($scope) && null !== ($child = $this->matchChild($scope, $it))) {
84 $scope = $child;
85 $it->next();
86 $match = true;
87 }
88 }
89
90 // This case happens if an error happened in the data under a
91 // form inheriting its parent data that does not match any of the
92 // children of that form.
93 if (null !== $violationPath && !$match) {
94 // If we could not map the error to anything more specific
95 // than the root element, map it to the innermost directly
96 // mapped form of the violation path
97 // e.g. "children[foo].children[bar].data.baz"
98 // Here the innermost directly mapped child is "bar"
99
100 $scope = $form;
101 $it = new ViolationPathIterator($violationPath);
102
103 // Note: acceptsErrors() will always return true for forms inheriting
104 // their parent data, because these forms can never be non-synchronized
105 // (they don't do any data transformation on their own)
106 while ($this->acceptsErrors($scope) && $it->valid() && $it->mapsForm()) {
107 if (!$scope->has($it->current())) {
108 // Break if we find a reference to a non-existing child
109 break;
110 }
111
112 $scope = $scope->get($it->current());
113 $it->next();
114 }
115 }
116
117 // Follow dot rules until we have the final target
118 $mapping = $scope->getConfig()->getOption('error_mapping');
119
120 while ($this->acceptsErrors($scope) && isset($mapping['.'])) {
121 $dotRule = new MappingRule($scope, '.', $mapping['.']);
122 $scope = $dotRule->getTarget();
123 $mapping = $scope->getConfig()->getOption('error_mapping');
124 }
125
126 // Only add the error if the form is synchronized
127 if ($this->acceptsErrors($scope)) {
128 $scope->addError(new FormError(
129 $violation->getMessage(),
130 $violation->getMessageTemplate(),
131 $violation->getMessageParameters(),
132 $violation->getMessagePluralization()
133 ));
134 }
135 }
136
137 /**
138 * Tries to match the beginning of the property path at the
139 * current position against the children of the scope.
140 *
141 * If a matching child is found, it is returned. Otherwise
142 * null is returned.
143 *
144 * @param FormInterface $form The form to search.
145 * @param PropertyPathIteratorInterface $it The iterator at its current position.
146 *
147 * @return null|FormInterface The found match or null.
148 */
149 private function matchChild(FormInterface $form, PropertyPathIteratorInterface $it)
150 {
151 // Remember at what property path underneath "data"
152 // we are looking. Check if there is a child with that
153 // path, otherwise increase path by one more piece
154 $chunk = '';
155 $foundChild = null;
156 $foundAtIndex = 0;
157
158 // Construct mapping rules for the given form
159 $rules = array();
160
161 foreach ($form->getConfig()->getOption('error_mapping') as $propertyPath => $targetPath) {
162 // Dot rules are considered at the very end
163 if ('.' !== $propertyPath) {
164 $rules[] = new MappingRule($form, $propertyPath, $targetPath);
165 }
166 }
167
168 // Skip forms inheriting their parent data when iterating the children
169 $childIterator = new \RecursiveIteratorIterator(
170 new InheritDataAwareIterator($form->all())
171 );
172
173 // Make the path longer until we find a matching child
174 while (true) {
175 if (!$it->valid()) {
176 return null;
177 }
178
179 if ($it->isIndex()) {
180 $chunk .= '['.$it->current().']';
181 } else {
182 $chunk .= ('' === $chunk ? '' : '.').$it->current();
183 }
184
185 // Test mapping rules as long as we have any
186 foreach ($rules as $key => $rule) {
187 /* @var MappingRule $rule */
188
189 // Mapping rule matches completely, terminate.
190 if (null !== ($form = $rule->match($chunk))) {
191 return $form;
192 }
193
194 // Keep only rules that have $chunk as prefix
195 if (!$rule->isPrefix($chunk)) {
196 unset($rules[$key]);
197 }
198 }
199
200 // Test children unless we already found one
201 if (null === $foundChild) {
202 foreach ($childIterator as $child) {
203 /* @var FormInterface $child */
204 $childPath = (string) $child->getPropertyPath();
205
206 // Child found, mark as return value
207 if ($chunk === $childPath) {
208 $foundChild = $child;
209 $foundAtIndex = $it->key();
210 }
211 }
212 }
213
214 // Add element to the chunk
215 $it->next();
216
217 // If we reached the end of the path or if there are no
218 // more matching mapping rules, return the found child
219 if (null !== $foundChild && (!$it->valid() || count($rules) === 0)) {
220 // Reset index in case we tried to find mapping
221 // rules further down the path
222 $it->seek($foundAtIndex);
223
224 return $foundChild;
225 }
226 }
227
228 return null;
229 }
230
231 /**
232 * Reconstructs a property path from a violation path and a form tree.
233 *
234 * @param ViolationPath $violationPath The violation path.
235 * @param FormInterface $origin The root form of the tree.
236 *
237 * @return RelativePath The reconstructed path.
238 */
239 private function reconstructPath(ViolationPath $violationPath, FormInterface $origin)
240 {
241 $propertyPathBuilder = new PropertyPathBuilder($violationPath);
242 $it = $violationPath->getIterator();
243 $scope = $origin;
244
245 // Remember the current index in the builder
246 $i = 0;
247
248 // Expand elements that map to a form (like "children[address]")
249 for ($it->rewind(); $it->valid() && $it->mapsForm(); $it->next()) {
250 if (!$scope->has($it->current())) {
251 // Scope relates to a form that does not exist
252 // Bail out
253 break;
254 }
255
256 // Process child form
257 $scope = $scope->get($it->current());
258
259 if ($scope->getConfig()->getInheritData()) {
260 // Form inherits its parent data
261 // Cut the piece out of the property path and proceed
262 $propertyPathBuilder->remove($i);
263 } elseif (!$scope->getConfig()->getMapped()) {
264 // Form is not mapped
265 // Set the form as new origin and strip everything
266 // we have so far in the path
267 $origin = $scope;
268 $propertyPathBuilder->remove(0, $i + 1);
269 $i = 0;
270 } else {
271 /* @var \Symfony\Component\PropertyAccess\PropertyPathInterface $propertyPath */
272 $propertyPath = $scope->getPropertyPath();
273
274 if (null === $propertyPath) {
275 // Property path of a mapped form is null
276 // Should not happen, bail out
277 break;
278 }
279
280 $propertyPathBuilder->replace($i, 1, $propertyPath);
281 $i += $propertyPath->getLength();
282 }
283 }
284
285 $finalPath = $propertyPathBuilder->getPropertyPath();
286
287 return null !== $finalPath ? new RelativePath($origin, $finalPath) : null;
288 }
289
290 /**
291 * @param FormInterface $form
292 *
293 * @return Boolean
294 */
295 private function acceptsErrors(FormInterface $form)
296 {
297 return $this->allowNonSynchronized || $form->isSynchronized();
298 }
299}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Extension/Validator/ViolationMapper/ViolationMapperInterface.php b/vendor/symfony/form/Symfony/Component/Form/Extension/Validator/ViolationMapper/ViolationMapperInterface.php
deleted file mode 100644
index eb8907f1..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Extension/Validator/ViolationMapper/ViolationMapperInterface.php
+++ /dev/null
@@ -1,33 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Extension\Validator\ViolationMapper;
13
14use Symfony\Component\Form\FormInterface;
15use Symfony\Component\Validator\ConstraintViolation;
16
17/**
18 * @author Bernhard Schussek <bschussek@gmail.com>
19 */
20interface ViolationMapperInterface
21{
22 /**
23 * Maps a constraint violation to a form in the form tree under
24 * the given form.
25 *
26 * @param ConstraintViolation $violation The violation to map.
27 * @param FormInterface $form The root form of the tree
28 * to map it to.
29 * @param Boolean $allowNonSynchronized Whether to allow
30 * mapping to non-synchronized forms.
31 */
32 public function mapViolation(ConstraintViolation $violation, FormInterface $form, $allowNonSynchronized = false);
33}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Extension/Validator/ViolationMapper/ViolationPath.php b/vendor/symfony/form/Symfony/Component/Form/Extension/Validator/ViolationMapper/ViolationPath.php
deleted file mode 100644
index 06d09195..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Extension/Validator/ViolationMapper/ViolationPath.php
+++ /dev/null
@@ -1,250 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Extension\Validator\ViolationMapper;
13
14use Symfony\Component\Form\Exception\OutOfBoundsException;
15use Symfony\Component\PropertyAccess\PropertyPath;
16use Symfony\Component\PropertyAccess\PropertyPathInterface;
17
18/**
19 * @author Bernhard Schussek <bschussek@gmail.com>
20 */
21class ViolationPath implements \IteratorAggregate, PropertyPathInterface
22{
23 /**
24 * @var array
25 */
26 private $elements = array();
27
28 /**
29 * @var array
30 */
31 private $isIndex = array();
32
33 /**
34 * @var array
35 */
36 private $mapsForm = array();
37
38 /**
39 * @var string
40 */
41 private $pathAsString = '';
42
43 /**
44 * @var integer
45 */
46 private $length = 0;
47
48 /**
49 * Creates a new violation path from a string.
50 *
51 * @param string $violationPath The property path of a {@link ConstraintViolation}
52 * object.
53 */
54 public function __construct($violationPath)
55 {
56 $path = new PropertyPath($violationPath);
57 $elements = $path->getElements();
58 $data = false;
59
60 for ($i = 0, $l = count($elements); $i < $l; ++$i) {
61 if (!$data) {
62 // The element "data" has not yet been passed
63 if ('children' === $elements[$i] && $path->isProperty($i)) {
64 // Skip element "children"
65 ++$i;
66
67 // Next element must exist and must be an index
68 // Otherwise consider this the end of the path
69 if ($i >= $l || !$path->isIndex($i)) {
70 break;
71 }
72
73 $this->elements[] = $elements[$i];
74 $this->isIndex[] = true;
75 $this->mapsForm[] = true;
76 } elseif ('data' === $elements[$i] && $path->isProperty($i)) {
77 // Skip element "data"
78 ++$i;
79
80 // End of path
81 if ($i >= $l) {
82 break;
83 }
84
85 $this->elements[] = $elements[$i];
86 $this->isIndex[] = $path->isIndex($i);
87 $this->mapsForm[] = false;
88 $data = true;
89 } else {
90 // Neither "children" nor "data" property found
91 // Consider this the end of the path
92 break;
93 }
94 } else {
95 // Already after the "data" element
96 // Pick everything as is
97 $this->elements[] = $elements[$i];
98 $this->isIndex[] = $path->isIndex($i);
99 $this->mapsForm[] = false;
100 }
101 }
102
103 $this->length = count($this->elements);
104
105 $this->buildString();
106 }
107
108 /**
109 * {@inheritdoc}
110 */
111 public function __toString()
112 {
113 return $this->pathAsString;
114 }
115
116 /**
117 * {@inheritdoc}
118 */
119 public function getLength()
120 {
121 return $this->length;
122 }
123
124 /**
125 * {@inheritdoc}
126 */
127 public function getParent()
128 {
129 if ($this->length <= 1) {
130 return null;
131 }
132
133 $parent = clone $this;
134
135 --$parent->length;
136 array_pop($parent->elements);
137 array_pop($parent->isIndex);
138 array_pop($parent->mapsForm);
139
140 $parent->buildString();
141
142 return $parent;
143 }
144
145 /**
146 * {@inheritdoc}
147 */
148 public function getElements()
149 {
150 return $this->elements;
151 }
152
153 /**
154 * {@inheritdoc}
155 */
156 public function getElement($index)
157 {
158 if (!isset($this->elements[$index])) {
159 throw new OutOfBoundsException(sprintf('The index %s is not within the violation path', $index));
160 }
161
162 return $this->elements[$index];
163 }
164
165 /**
166 * {@inheritdoc}
167 */
168 public function isProperty($index)
169 {
170 if (!isset($this->isIndex[$index])) {
171 throw new OutOfBoundsException(sprintf('The index %s is not within the violation path', $index));
172 }
173
174 return !$this->isIndex[$index];
175 }
176
177 /**
178 * {@inheritdoc}
179 */
180 public function isIndex($index)
181 {
182 if (!isset($this->isIndex[$index])) {
183 throw new OutOfBoundsException(sprintf('The index %s is not within the violation path', $index));
184 }
185
186 return $this->isIndex[$index];
187 }
188
189 /**
190 * Returns whether an element maps directly to a form.
191 *
192 * Consider the following violation path:
193 *
194 * <code>
195 * children[address].children[office].data.street
196 * </code>
197 *
198 * In this example, "address" and "office" map to forms, while
199 * "street does not.
200 *
201 * @param integer $index The element index.
202 *
203 * @return Boolean Whether the element maps to a form.
204 *
205 * @throws OutOfBoundsException If the offset is invalid.
206 */
207 public function mapsForm($index)
208 {
209 if (!isset($this->mapsForm[$index])) {
210 throw new OutOfBoundsException(sprintf('The index %s is not within the violation path', $index));
211 }
212
213 return $this->mapsForm[$index];
214 }
215
216 /**
217 * Returns a new iterator for this path
218 *
219 * @return ViolationPathIterator
220 */
221 public function getIterator()
222 {
223 return new ViolationPathIterator($this);
224 }
225
226 /**
227 * Builds the string representation from the elements.
228 */
229 private function buildString()
230 {
231 $this->pathAsString = '';
232 $data = false;
233
234 foreach ($this->elements as $index => $element) {
235 if ($this->mapsForm[$index]) {
236 $this->pathAsString .= ".children[$element]";
237 } elseif (!$data) {
238 $this->pathAsString .= '.data'.($this->isIndex[$index] ? "[$element]" : ".$element");
239 $data = true;
240 } else {
241 $this->pathAsString .= $this->isIndex[$index] ? "[$element]" : ".$element";
242 }
243 }
244
245 if ('' !== $this->pathAsString) {
246 // remove leading dot
247 $this->pathAsString = substr($this->pathAsString, 1);
248 }
249 }
250}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Extension/Validator/ViolationMapper/ViolationPathIterator.php b/vendor/symfony/form/Symfony/Component/Form/Extension/Validator/ViolationMapper/ViolationPathIterator.php
deleted file mode 100644
index 50baa453..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Extension/Validator/ViolationMapper/ViolationPathIterator.php
+++ /dev/null
@@ -1,30 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Extension\Validator\ViolationMapper;
13
14use Symfony\Component\PropertyAccess\PropertyPathIterator;
15
16/**
17 * @author Bernhard Schussek <bschussek@gmail.com>
18 */
19class ViolationPathIterator extends PropertyPathIterator
20{
21 public function __construct(ViolationPath $violationPath)
22 {
23 parent::__construct($violationPath);
24 }
25
26 public function mapsForm()
27 {
28 return $this->path->mapsForm($this->key());
29 }
30}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Form.php b/vendor/symfony/form/Symfony/Component/Form/Form.php
deleted file mode 100644
index 35135274..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Form.php
+++ /dev/null
@@ -1,1046 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form;
13
14use Symfony\Component\Form\Exception\RuntimeException;
15use Symfony\Component\Form\Exception\UnexpectedTypeException;
16use Symfony\Component\Form\Exception\AlreadySubmittedException;
17use Symfony\Component\Form\Exception\TransformationFailedException;
18use Symfony\Component\Form\Exception\LogicException;
19use Symfony\Component\Form\Exception\OutOfBoundsException;
20use Symfony\Component\Form\Util\FormUtil;
21use Symfony\Component\Form\Util\InheritDataAwareIterator;
22use Symfony\Component\PropertyAccess\PropertyPath;
23
24/**
25 * Form represents a form.
26 *
27 * To implement your own form fields, you need to have a thorough understanding
28 * of the data flow within a form. A form stores its data in three different
29 * representations:
30 *
31 * (1) the "model" format required by the form's object
32 * (2) the "normalized" format for internal processing
33 * (3) the "view" format used for display
34 *
35 * A date field, for example, may store a date as "Y-m-d" string (1) in the
36 * object. To facilitate processing in the field, this value is normalized
37 * to a DateTime object (2). In the HTML representation of your form, a
38 * localized string (3) is presented to and modified by the user.
39 *
40 * In most cases, format (1) and format (2) will be the same. For example,
41 * a checkbox field uses a Boolean value for both internal processing and
42 * storage in the object. In these cases you simply need to set a value
43 * transformer to convert between formats (2) and (3). You can do this by
44 * calling addViewTransformer().
45 *
46 * In some cases though it makes sense to make format (1) configurable. To
47 * demonstrate this, let's extend our above date field to store the value
48 * either as "Y-m-d" string or as timestamp. Internally we still want to
49 * use a DateTime object for processing. To convert the data from string/integer
50 * to DateTime you can set a normalization transformer by calling
51 * addNormTransformer(). The normalized data is then converted to the displayed
52 * data as described before.
53 *
54 * The conversions (1) -> (2) -> (3) use the transform methods of the transformers.
55 * The conversions (3) -> (2) -> (1) use the reverseTransform methods of the transformers.
56 *
57 * @author Fabien Potencier <fabien@symfony.com>
58 * @author Bernhard Schussek <bschussek@gmail.com>
59 */
60class Form implements \IteratorAggregate, FormInterface
61{
62 /**
63 * The form's configuration
64 * @var FormConfigInterface
65 */
66 private $config;
67
68 /**
69 * The parent of this form
70 * @var FormInterface
71 */
72 private $parent;
73
74 /**
75 * The children of this form
76 * @var FormInterface[] An array of FormInterface instances
77 */
78 private $children = array();
79
80 /**
81 * The errors of this form
82 * @var FormError[] An array of FormError instances
83 */
84 private $errors = array();
85
86 /**
87 * Whether this form was submitted
88 * @var Boolean
89 */
90 private $submitted = false;
91
92 /**
93 * The form data in model format
94 * @var mixed
95 */
96 private $modelData;
97
98 /**
99 * The form data in normalized format
100 * @var mixed
101 */
102 private $normData;
103
104 /**
105 * The form data in view format
106 * @var mixed
107 */
108 private $viewData;
109
110 /**
111 * The submitted values that don't belong to any children
112 * @var array
113 */
114 private $extraData = array();
115
116 /**
117 * Whether the data in model, normalized and view format is
118 * synchronized. Data may not be synchronized if transformation errors
119 * occur.
120 * @var Boolean
121 */
122 private $synchronized = true;
123
124 /**
125 * Whether the form's data has been initialized.
126 *
127 * When the data is initialized with its default value, that default value
128 * is passed through the transformer chain in order to synchronize the
129 * model, normalized and view format for the first time. This is done
130 * lazily in order to save performance when {@link setData()} is called
131 * manually, making the initialization with the configured default value
132 * superfluous.
133 *
134 * @var Boolean
135 */
136 private $defaultDataSet = false;
137
138 /**
139 * Whether setData() is currently being called.
140 * @var Boolean
141 */
142 private $lockSetData = false;
143
144 /**
145 * Creates a new form based on the given configuration.
146 *
147 * @param FormConfigInterface $config The form configuration.
148 *
149 * @throws LogicException if a data mapper is not provided for a compound form
150 */
151 public function __construct(FormConfigInterface $config)
152 {
153 // Compound forms always need a data mapper, otherwise calls to
154 // `setData` and `add` will not lead to the correct population of
155 // the child forms.
156 if ($config->getCompound() && !$config->getDataMapper()) {
157 throw new LogicException('Compound forms need a data mapper');
158 }
159
160 // If the form inherits the data from its parent, it is not necessary
161 // to call setData() with the default data.
162 if ($config->getInheritData()) {
163 $this->defaultDataSet = true;
164 }
165
166 $this->config = $config;
167 }
168
169 public function __clone()
170 {
171 foreach ($this->children as $key => $child) {
172 $this->children[$key] = clone $child;
173 }
174 }
175
176 /**
177 * {@inheritdoc}
178 */
179 public function getConfig()
180 {
181 return $this->config;
182 }
183
184 /**
185 * {@inheritdoc}
186 */
187 public function getName()
188 {
189 return $this->config->getName();
190 }
191
192 /**
193 * {@inheritdoc}
194 */
195 public function getPropertyPath()
196 {
197 if (null !== $this->config->getPropertyPath()) {
198 return $this->config->getPropertyPath();
199 }
200
201 if (null === $this->getName() || '' === $this->getName()) {
202 return null;
203 }
204
205 $parent = $this->parent;
206
207 while ($parent && $parent->getConfig()->getInheritData()) {
208 $parent = $parent->getParent();
209 }
210
211 if ($parent && null === $parent->getConfig()->getDataClass()) {
212 return new PropertyPath('['.$this->getName().']');
213 }
214
215 return new PropertyPath($this->getName());
216 }
217
218 /**
219 * {@inheritdoc}
220 */
221 public function isRequired()
222 {
223 if (null === $this->parent || $this->parent->isRequired()) {
224 return $this->config->getRequired();
225 }
226
227 return false;
228 }
229
230 /**
231 * {@inheritDoc}
232 */
233 public function isDisabled()
234 {
235 if (null === $this->parent || !$this->parent->isDisabled()) {
236 return $this->config->getDisabled();
237 }
238
239 return true;
240 }
241
242 /**
243 * {@inheritdoc}
244 */
245 public function setParent(FormInterface $parent = null)
246 {
247 if ($this->submitted) {
248 throw new AlreadySubmittedException('You cannot set the parent of a submitted form');
249 }
250
251 if (null !== $parent && '' === $this->config->getName()) {
252 throw new LogicException('A form with an empty name cannot have a parent form.');
253 }
254
255 $this->parent = $parent;
256
257 return $this;
258 }
259
260 /**
261 * {@inheritdoc}
262 */
263 public function getParent()
264 {
265 return $this->parent;
266 }
267
268 /**
269 * {@inheritdoc}
270 */
271 public function getRoot()
272 {
273 return $this->parent ? $this->parent->getRoot() : $this;
274 }
275
276 /**
277 * {@inheritdoc}
278 */
279 public function isRoot()
280 {
281 return null === $this->parent;
282 }
283
284 /**
285 * {@inheritdoc}
286 */
287 public function setData($modelData)
288 {
289 // If the form is submitted while disabled, it is set to submitted, but the data is not
290 // changed. In such cases (i.e. when the form is not initialized yet) don't
291 // abort this method.
292 if ($this->submitted && $this->defaultDataSet) {
293 throw new AlreadySubmittedException('You cannot change the data of a submitted form.');
294 }
295
296 // If the form inherits its parent's data, disallow data setting to
297 // prevent merge conflicts
298 if ($this->config->getInheritData()) {
299 throw new RuntimeException('You cannot change the data of a form inheriting its parent data.');
300 }
301
302 // Don't allow modifications of the configured data if the data is locked
303 if ($this->config->getDataLocked() && $modelData !== $this->config->getData()) {
304 return $this;
305 }
306
307 if (is_object($modelData) && !$this->config->getByReference()) {
308 $modelData = clone $modelData;
309 }
310
311 if ($this->lockSetData) {
312 throw new RuntimeException('A cycle was detected. Listeners to the PRE_SET_DATA event must not call setData(). You should call setData() on the FormEvent object instead.');
313 }
314
315 $this->lockSetData = true;
316 $dispatcher = $this->config->getEventDispatcher();
317
318 // Hook to change content of the data
319 if ($dispatcher->hasListeners(FormEvents::PRE_SET_DATA)) {
320 $event = new FormEvent($this, $modelData);
321 $dispatcher->dispatch(FormEvents::PRE_SET_DATA, $event);
322 $modelData = $event->getData();
323 }
324
325 // Treat data as strings unless a value transformer exists
326 if (!$this->config->getViewTransformers() && !$this->config->getModelTransformers() && is_scalar($modelData)) {
327 $modelData = (string) $modelData;
328 }
329
330 // Synchronize representations - must not change the content!
331 $normData = $this->modelToNorm($modelData);
332 $viewData = $this->normToView($normData);
333
334 // Validate if view data matches data class (unless empty)
335 if (!FormUtil::isEmpty($viewData)) {
336 $dataClass = $this->config->getDataClass();
337
338 $actualType = is_object($viewData) ? 'an instance of class '.get_class($viewData) : ' a(n) '.gettype($viewData);
339
340 if (null === $dataClass && is_object($viewData) && !$viewData instanceof \ArrayAccess) {
341 $expectedType = 'scalar, array or an instance of \ArrayAccess';
342
343 throw new LogicException(
344 'The form\'s view data is expected to be of type '.$expectedType.', ' .
345 'but is '.$actualType.'. You ' .
346 'can avoid this error by setting the "data_class" option to ' .
347 '"'.get_class($viewData).'" or by adding a view transformer ' .
348 'that transforms '.$actualType.' to '.$expectedType.'.'
349 );
350 }
351
352 if (null !== $dataClass && !$viewData instanceof $dataClass) {
353 throw new LogicException(
354 'The form\'s view data is expected to be an instance of class ' .
355 $dataClass.', but is '. $actualType.'. You can avoid this error ' .
356 'by setting the "data_class" option to null or by adding a view ' .
357 'transformer that transforms '.$actualType.' to an instance of ' .
358 $dataClass.'.'
359 );
360 }
361 }
362
363 $this->modelData = $modelData;
364 $this->normData = $normData;
365 $this->viewData = $viewData;
366 $this->defaultDataSet = true;
367 $this->lockSetData = false;
368
369 // It is not necessary to invoke this method if the form doesn't have children,
370 // even if the form is compound.
371 if (count($this->children) > 0) {
372 // Update child forms from the data
373 $childrenIterator = new InheritDataAwareIterator($this->children);
374 $childrenIterator = new \RecursiveIteratorIterator($childrenIterator);
375 $this->config->getDataMapper()->mapDataToForms($viewData, $childrenIterator);
376 }
377
378 if ($dispatcher->hasListeners(FormEvents::POST_SET_DATA)) {
379 $event = new FormEvent($this, $modelData);
380 $dispatcher->dispatch(FormEvents::POST_SET_DATA, $event);
381 }
382
383 return $this;
384 }
385
386 /**
387 * {@inheritdoc}
388 */
389 public function getData()
390 {
391 if ($this->config->getInheritData()) {
392 if (!$this->parent) {
393 throw new RuntimeException('The form is configured to inherit its parent\'s data, but does not have a parent.');
394 }
395
396 return $this->parent->getData();
397 }
398
399 if (!$this->defaultDataSet) {
400 $this->setData($this->config->getData());
401 }
402
403 return $this->modelData;
404 }
405
406 /**
407 * {@inheritdoc}
408 */
409 public function getNormData()
410 {
411 if ($this->config->getInheritData()) {
412 if (!$this->parent) {
413 throw new RuntimeException('The form is configured to inherit its parent\'s data, but does not have a parent.');
414 }
415
416 return $this->parent->getNormData();
417 }
418
419 if (!$this->defaultDataSet) {
420 $this->setData($this->config->getData());
421 }
422
423 return $this->normData;
424 }
425
426 /**
427 * {@inheritdoc}
428 */
429 public function getViewData()
430 {
431 if ($this->config->getInheritData()) {
432 if (!$this->parent) {
433 throw new RuntimeException('The form is configured to inherit its parent\'s data, but does not have a parent.');
434 }
435
436 return $this->parent->getViewData();
437 }
438
439 if (!$this->defaultDataSet) {
440 $this->setData($this->config->getData());
441 }
442
443 return $this->viewData;
444 }
445
446 /**
447 * {@inheritdoc}
448 */
449 public function getExtraData()
450 {
451 return $this->extraData;
452 }
453
454 /**
455 * {@inheritdoc}
456 */
457 public function initialize()
458 {
459 if (null !== $this->parent) {
460 throw new RuntimeException('Only root forms should be initialized.');
461 }
462
463 // Guarantee that the *_SET_DATA events have been triggered once the
464 // form is initialized. This makes sure that dynamically added or
465 // removed fields are already visible after initialization.
466 if (!$this->defaultDataSet) {
467 $this->setData($this->config->getData());
468 }
469
470 return $this;
471 }
472
473 /**
474 * {@inheritdoc}
475 */
476 public function handleRequest($request = null)
477 {
478 $this->config->getRequestHandler()->handleRequest($this, $request);
479
480 return $this;
481 }
482
483 /**
484 * {@inheritdoc}
485 */
486 public function submit($submittedData, $clearMissing = true)
487 {
488 if ($this->submitted) {
489 throw new AlreadySubmittedException('A form can only be submitted once');
490 }
491
492 // Initialize errors in the very beginning so that we don't lose any
493 // errors added during listeners
494 $this->errors = array();
495
496 // Obviously, a disabled form should not change its data upon submission.
497 if ($this->isDisabled()) {
498 $this->submitted = true;
499
500 return $this;
501 }
502
503 // The data must be initialized if it was not initialized yet.
504 // This is necessary to guarantee that the *_SET_DATA listeners
505 // are always invoked before submit() takes place.
506 if (!$this->defaultDataSet) {
507 $this->setData($this->config->getData());
508 }
509
510 // Treat false as NULL to support binding false to checkboxes.
511 // Don't convert NULL to a string here in order to determine later
512 // whether an empty value has been submitted or whether no value has
513 // been submitted at all. This is important for processing checkboxes
514 // and radio buttons with empty values.
515 if (false === $submittedData) {
516 $submittedData = null;
517 } elseif (is_scalar($submittedData)) {
518 $submittedData = (string) $submittedData;
519 }
520
521 $dispatcher = $this->config->getEventDispatcher();
522
523 // Hook to change content of the data submitted by the browser
524 if ($dispatcher->hasListeners(FormEvents::PRE_SUBMIT)) {
525 $event = new FormEvent($this, $submittedData);
526 $dispatcher->dispatch(FormEvents::PRE_SUBMIT, $event);
527 $submittedData = $event->getData();
528 }
529
530 // Check whether the form is compound.
531 // This check is preferable over checking the number of children,
532 // since forms without children may also be compound.
533 // (think of empty collection forms)
534 if ($this->config->getCompound()) {
535 if (!is_array($submittedData)) {
536 $submittedData = array();
537 }
538
539 foreach ($this->children as $name => $child) {
540 if (isset($submittedData[$name]) || $clearMissing) {
541 $child->submit(isset($submittedData[$name]) ? $submittedData[$name] : null, $clearMissing);
542 unset($submittedData[$name]);
543 }
544 }
545
546 $this->extraData = $submittedData;
547 }
548
549 // Forms that inherit their parents' data also are not processed,
550 // because then it would be too difficult to merge the changes in
551 // the child and the parent form. Instead, the parent form also takes
552 // changes in the grandchildren (i.e. children of the form that inherits
553 // its parent's data) into account.
554 // (see InheritDataAwareIterator below)
555 if ($this->config->getInheritData()) {
556 $this->submitted = true;
557
558 // When POST_SUBMIT is reached, the data is not yet updated, so pass
559 // NULL to prevent hard-to-debug bugs.
560 $dataForPostSubmit = null;
561 } else {
562 // If the form is compound, the default data in view format
563 // is reused. The data of the children is merged into this
564 // default data using the data mapper.
565 // If the form is not compound, the submitted data is also the data in view format.
566 $viewData = $this->config->getCompound() ? $this->viewData : $submittedData;
567
568 if (FormUtil::isEmpty($viewData)) {
569 $emptyData = $this->config->getEmptyData();
570
571 if ($emptyData instanceof \Closure) {
572 /* @var \Closure $emptyData */
573 $emptyData = $emptyData($this, $viewData);
574 }
575
576 $viewData = $emptyData;
577 }
578
579 // Merge form data from children into existing view data
580 // It is not necessary to invoke this method if the form has no children,
581 // even if it is compound.
582 if (count($this->children) > 0) {
583 // Use InheritDataAwareIterator to process children of
584 // descendants that inherit this form's data.
585 // These descendants will not be submitted normally (see the check
586 // for $this->config->getInheritData() above)
587 $childrenIterator = new InheritDataAwareIterator($this->children);
588 $childrenIterator = new \RecursiveIteratorIterator($childrenIterator);
589 $this->config->getDataMapper()->mapFormsToData($childrenIterator, $viewData);
590 }
591
592 $modelData = null;
593 $normData = null;
594
595 try {
596 // Normalize data to unified representation
597 $normData = $this->viewToNorm($viewData);
598
599 // Hook to change content of the data into the normalized
600 // representation
601 if ($dispatcher->hasListeners(FormEvents::SUBMIT)) {
602 $event = new FormEvent($this, $normData);
603 $dispatcher->dispatch(FormEvents::SUBMIT, $event);
604 $normData = $event->getData();
605 }
606
607 // Synchronize representations - must not change the content!
608 $modelData = $this->normToModel($normData);
609 $viewData = $this->normToView($normData);
610 } catch (TransformationFailedException $e) {
611 $this->synchronized = false;
612 }
613
614 $this->submitted = true;
615 $this->modelData = $modelData;
616 $this->normData = $normData;
617 $this->viewData = $viewData;
618
619 $dataForPostSubmit = $viewData;
620 }
621
622 if ($dispatcher->hasListeners(FormEvents::POST_SUBMIT)) {
623 $event = new FormEvent($this, $dataForPostSubmit);
624 $dispatcher->dispatch(FormEvents::POST_SUBMIT, $event);
625 }
626
627 return $this;
628 }
629
630 /**
631 * Alias of {@link submit()}.
632 *
633 * @deprecated Deprecated since version 2.3, to be removed in 3.0. Use
634 * {@link submit()} instead.
635 */
636 public function bind($submittedData)
637 {
638 return $this->submit($submittedData);
639 }
640
641 /**
642 * {@inheritdoc}
643 */
644 public function addError(FormError $error)
645 {
646 if ($this->parent && $this->config->getErrorBubbling()) {
647 $this->parent->addError($error);
648 } else {
649 $this->errors[] = $error;
650 }
651
652 return $this;
653 }
654
655 /**
656 * {@inheritdoc}
657 */
658 public function isSubmitted()
659 {
660 return $this->submitted;
661 }
662
663 /**
664 * Alias of {@link isSubmitted()}.
665 *
666 * @deprecated Deprecated since version 2.3, to be removed in 3.0. Use
667 * {@link isSubmitted()} instead.
668 */
669 public function isBound()
670 {
671 return $this->submitted;
672 }
673
674 /**
675 * {@inheritdoc}
676 */
677 public function isSynchronized()
678 {
679 return $this->synchronized;
680 }
681
682 /**
683 * {@inheritdoc}
684 */
685 public function isEmpty()
686 {
687 foreach ($this->children as $child) {
688 if (!$child->isEmpty()) {
689 return false;
690 }
691 }
692
693 return FormUtil::isEmpty($this->modelData) ||
694 // arrays, countables
695 0 === count($this->modelData) ||
696 // traversables that are not countable
697 ($this->modelData instanceof \Traversable && 0 === iterator_count($this->modelData));
698 }
699
700 /**
701 * {@inheritdoc}
702 */
703 public function isValid()
704 {
705 if (!$this->submitted) {
706 return false;
707 }
708
709 if (count($this->errors) > 0) {
710 return false;
711 }
712
713 if (!$this->isDisabled()) {
714 foreach ($this->children as $child) {
715 if (!$child->isValid()) {
716 return false;
717 }
718 }
719 }
720
721 return true;
722 }
723
724 /**
725 * {@inheritdoc}
726 */
727 public function getErrors()
728 {
729 return $this->errors;
730 }
731
732 /**
733 * Returns a string representation of all form errors (including children errors).
734 *
735 * This method should only be used to help debug a form.
736 *
737 * @param integer $level The indentation level (used internally)
738 *
739 * @return string A string representation of all errors
740 */
741 public function getErrorsAsString($level = 0)
742 {
743 $errors = '';
744 foreach ($this->errors as $error) {
745 $errors .= str_repeat(' ', $level).'ERROR: '.$error->getMessage()."\n";
746 }
747
748 foreach ($this->children as $key => $child) {
749 $errors .= str_repeat(' ', $level).$key.":\n";
750 if ($err = $child->getErrorsAsString($level + 4)) {
751 $errors .= $err;
752 } else {
753 $errors .= str_repeat(' ', $level + 4)."No errors\n";
754 }
755 }
756
757 return $errors;
758 }
759
760 /**
761 * {@inheritdoc}
762 */
763 public function all()
764 {
765 return $this->children;
766 }
767
768 /**
769 * {@inheritdoc}
770 */
771 public function add($child, $type = null, array $options = array())
772 {
773 if ($this->submitted) {
774 throw new AlreadySubmittedException('You cannot add children to a submitted form');
775 }
776
777 if (!$this->config->getCompound()) {
778 throw new LogicException('You cannot add children to a simple form. Maybe you should set the option "compound" to true?');
779 }
780
781 // Obtain the view data
782 $viewData = null;
783
784 // If setData() is currently being called, there is no need to call
785 // mapDataToForms() here, as mapDataToForms() is called at the end
786 // of setData() anyway. Not doing this check leads to an endless
787 // recursion when initializing the form lazily and an event listener
788 // (such as ResizeFormListener) adds fields depending on the data:
789 //
790 // * setData() is called, the form is not initialized yet
791 // * add() is called by the listener (setData() is not complete, so
792 // the form is still not initialized)
793 // * getViewData() is called
794 // * setData() is called since the form is not initialized yet
795 // * ... endless recursion ...
796 //
797 // Also skip data mapping if setData() has not been called yet.
798 // setData() will be called upon form initialization and data mapping
799 // will take place by then.
800 if (!$this->lockSetData && $this->defaultDataSet && !$this->config->getInheritData()) {
801 $viewData = $this->getViewData();
802 }
803
804 if (!$child instanceof FormInterface) {
805 if (!is_string($child) && !is_int($child)) {
806 throw new UnexpectedTypeException($child, 'string, integer or Symfony\Component\Form\FormInterface');
807 }
808
809 if (null !== $type && !is_string($type) && !$type instanceof FormTypeInterface) {
810 throw new UnexpectedTypeException($type, 'string or Symfony\Component\Form\FormTypeInterface');
811 }
812
813 // Never initialize child forms automatically
814 $options['auto_initialize'] = false;
815
816 if (null === $type) {
817 $child = $this->config->getFormFactory()->createForProperty($this->config->getDataClass(), $child, null, $options);
818 } else {
819 $child = $this->config->getFormFactory()->createNamed($child, $type, null, $options);
820 }
821 } elseif ($child->getConfig()->getAutoInitialize()) {
822 throw new RuntimeException(sprintf(
823 'Automatic initialization is only supported on root forms. You '.
824 'should set the "auto_initialize" option to false on the field "%s".',
825 $child->getName()
826 ));
827 }
828
829 $this->children[$child->getName()] = $child;
830
831 $child->setParent($this);
832
833 if (!$this->lockSetData && $this->defaultDataSet && !$this->config->getInheritData()) {
834 $childrenIterator = new InheritDataAwareIterator(array($child));
835 $childrenIterator = new \RecursiveIteratorIterator($childrenIterator);
836 $this->config->getDataMapper()->mapDataToForms($viewData, $childrenIterator);
837 }
838
839 return $this;
840 }
841
842 /**
843 * {@inheritdoc}
844 */
845 public function remove($name)
846 {
847 if ($this->submitted) {
848 throw new AlreadySubmittedException('You cannot remove children from a submitted form');
849 }
850
851 if (isset($this->children[$name])) {
852 $this->children[$name]->setParent(null);
853
854 unset($this->children[$name]);
855 }
856
857 return $this;
858 }
859
860 /**
861 * {@inheritdoc}
862 */
863 public function has($name)
864 {
865 return isset($this->children[$name]);
866 }
867
868 /**
869 * {@inheritdoc}
870 */
871 public function get($name)
872 {
873 if (isset($this->children[$name])) {
874 return $this->children[$name];
875 }
876
877 throw new OutOfBoundsException(sprintf('Child "%s" does not exist.', $name));
878 }
879
880 /**
881 * Returns whether a child with the given name exists (implements the \ArrayAccess interface).
882 *
883 * @param string $name The name of the child
884 *
885 * @return Boolean
886 */
887 public function offsetExists($name)
888 {
889 return $this->has($name);
890 }
891
892 /**
893 * Returns the child with the given name (implements the \ArrayAccess interface).
894 *
895 * @param string $name The name of the child
896 *
897 * @return FormInterface The child form
898 *
899 * @throws \OutOfBoundsException If the named child does not exist.
900 */
901 public function offsetGet($name)
902 {
903 return $this->get($name);
904 }
905
906 /**
907 * Adds a child to the form (implements the \ArrayAccess interface).
908 *
909 * @param string $name Ignored. The name of the child is used.
910 * @param FormInterface $child The child to be added.
911 *
912 * @throws AlreadySubmittedException If the form has already been submitted.
913 * @throws LogicException When trying to add a child to a non-compound form.
914 *
915 * @see self::add()
916 */
917 public function offsetSet($name, $child)
918 {
919 $this->add($child);
920 }
921
922 /**
923 * Removes the child with the given name from the form (implements the \ArrayAccess interface).
924 *
925 * @param string $name The name of the child to remove
926 *
927 * @throws AlreadySubmittedException If the form has already been submitted.
928 */
929 public function offsetUnset($name)
930 {
931 $this->remove($name);
932 }
933
934 /**
935 * Returns the iterator for this group.
936 *
937 * @return \ArrayIterator
938 */
939 public function getIterator()
940 {
941 return new \ArrayIterator($this->children);
942 }
943
944 /**
945 * Returns the number of form children (implements the \Countable interface).
946 *
947 * @return integer The number of embedded form children
948 */
949 public function count()
950 {
951 return count($this->children);
952 }
953
954 /**
955 * {@inheritdoc}
956 */
957 public function createView(FormView $parent = null)
958 {
959 if (null === $parent && $this->parent) {
960 $parent = $this->parent->createView();
961 }
962
963 return $this->config->getType()->createView($this, $parent);
964 }
965
966 /**
967 * Normalizes the value if a normalization transformer is set.
968 *
969 * @param mixed $value The value to transform
970 *
971 * @return mixed
972 */
973 private function modelToNorm($value)
974 {
975 foreach ($this->config->getModelTransformers() as $transformer) {
976 $value = $transformer->transform($value);
977 }
978
979 return $value;
980 }
981
982 /**
983 * Reverse transforms a value if a normalization transformer is set.
984 *
985 * @param string $value The value to reverse transform
986 *
987 * @return mixed
988 */
989 private function normToModel($value)
990 {
991 $transformers = $this->config->getModelTransformers();
992
993 for ($i = count($transformers) - 1; $i >= 0; --$i) {
994 $value = $transformers[$i]->reverseTransform($value);
995 }
996
997 return $value;
998 }
999
1000 /**
1001 * Transforms the value if a value transformer is set.
1002 *
1003 * @param mixed $value The value to transform
1004 *
1005 * @return mixed
1006 */
1007 private function normToView($value)
1008 {
1009 // Scalar values should be converted to strings to
1010 // facilitate differentiation between empty ("") and zero (0).
1011 // Only do this for simple forms, as the resulting value in
1012 // compound forms is passed to the data mapper and thus should
1013 // not be converted to a string before.
1014 if (!$this->config->getViewTransformers() && !$this->config->getCompound()) {
1015 return null === $value || is_scalar($value) ? (string) $value : $value;
1016 }
1017
1018 foreach ($this->config->getViewTransformers() as $transformer) {
1019 $value = $transformer->transform($value);
1020 }
1021
1022 return $value;
1023 }
1024
1025 /**
1026 * Reverse transforms a value if a value transformer is set.
1027 *
1028 * @param string $value The value to reverse transform
1029 *
1030 * @return mixed
1031 */
1032 private function viewToNorm($value)
1033 {
1034 $transformers = $this->config->getViewTransformers();
1035
1036 if (!$transformers) {
1037 return '' === $value ? null : $value;
1038 }
1039
1040 for ($i = count($transformers) - 1; $i >= 0; --$i) {
1041 $value = $transformers[$i]->reverseTransform($value);
1042 }
1043
1044 return $value;
1045 }
1046}
diff --git a/vendor/symfony/form/Symfony/Component/Form/FormBuilder.php b/vendor/symfony/form/Symfony/Component/Form/FormBuilder.php
deleted file mode 100644
index 2caefe48..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/FormBuilder.php
+++ /dev/null
@@ -1,275 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form;
13
14use Symfony\Component\Form\Exception\BadMethodCallException;
15use Symfony\Component\Form\Exception\InvalidArgumentException;
16use Symfony\Component\Form\Exception\UnexpectedTypeException;
17use Symfony\Component\EventDispatcher\EventDispatcherInterface;
18
19/**
20 * A builder for creating {@link Form} instances.
21 *
22 * @author Bernhard Schussek <bschussek@gmail.com>
23 */
24class FormBuilder extends FormConfigBuilder implements \IteratorAggregate, FormBuilderInterface
25{
26 /**
27 * The children of the form builder.
28 *
29 * @var FormBuilderInterface[]
30 */
31 private $children = array();
32
33 /**
34 * The data of children who haven't been converted to form builders yet.
35 *
36 * @var array
37 */
38 private $unresolvedChildren = array();
39
40 /**
41 * Creates a new form builder.
42 *
43 * @param string $name
44 * @param string $dataClass
45 * @param EventDispatcherInterface $dispatcher
46 * @param FormFactoryInterface $factory
47 * @param array $options
48 */
49 public function __construct($name, $dataClass, EventDispatcherInterface $dispatcher, FormFactoryInterface $factory, array $options = array())
50 {
51 parent::__construct($name, $dataClass, $dispatcher, $options);
52
53 $this->setFormFactory($factory);
54 }
55
56 /**
57 * {@inheritdoc}
58 */
59 public function add($child, $type = null, array $options = array())
60 {
61 if ($this->locked) {
62 throw new BadMethodCallException('FormBuilder methods cannot be accessed anymore once the builder is turned into a FormConfigInterface instance.');
63 }
64
65 if ($child instanceof self) {
66 $this->children[$child->getName()] = $child;
67
68 // In case an unresolved child with the same name exists
69 unset($this->unresolvedChildren[$child->getName()]);
70
71 return $this;
72 }
73
74 if (!is_string($child) && !is_int($child)) {
75 throw new UnexpectedTypeException($child, 'string, integer or Symfony\Component\Form\FormBuilder');
76 }
77
78 if (null !== $type && !is_string($type) && !$type instanceof FormTypeInterface) {
79 throw new UnexpectedTypeException($type, 'string or Symfony\Component\Form\FormTypeInterface');
80 }
81
82 // Add to "children" to maintain order
83 $this->children[$child] = null;
84 $this->unresolvedChildren[$child] = array(
85 'type' => $type,
86 'options' => $options,
87 );
88
89 return $this;
90 }
91
92 /**
93 * {@inheritdoc}
94 */
95 public function create($name, $type = null, array $options = array())
96 {
97 if ($this->locked) {
98 throw new BadMethodCallException('FormBuilder methods cannot be accessed anymore once the builder is turned into a FormConfigInterface instance.');
99 }
100
101 if (null === $type && null === $this->getDataClass()) {
102 $type = 'text';
103 }
104
105 if (null !== $type) {
106 return $this->getFormFactory()->createNamedBuilder($name, $type, null, $options);
107 }
108
109 return $this->getFormFactory()->createBuilderForProperty($this->getDataClass(), $name, null, $options);
110 }
111
112 /**
113 * {@inheritdoc}
114 */
115 public function get($name)
116 {
117 if ($this->locked) {
118 throw new BadMethodCallException('FormBuilder methods cannot be accessed anymore once the builder is turned into a FormConfigInterface instance.');
119 }
120
121 if (isset($this->unresolvedChildren[$name])) {
122 return $this->resolveChild($name);
123 }
124
125 if (isset($this->children[$name])) {
126 return $this->children[$name];
127 }
128
129 throw new InvalidArgumentException(sprintf('The child with the name "%s" does not exist.', $name));
130 }
131
132 /**
133 * {@inheritdoc}
134 */
135 public function remove($name)
136 {
137 if ($this->locked) {
138 throw new BadMethodCallException('FormBuilder methods cannot be accessed anymore once the builder is turned into a FormConfigInterface instance.');
139 }
140
141 unset($this->unresolvedChildren[$name]);
142
143 if (array_key_exists($name, $this->children)) {
144 unset($this->children[$name]);
145 }
146
147 return $this;
148 }
149
150 /**
151 * {@inheritdoc}
152 */
153 public function has($name)
154 {
155 if ($this->locked) {
156 throw new BadMethodCallException('FormBuilder methods cannot be accessed anymore once the builder is turned into a FormConfigInterface instance.');
157 }
158
159 if (isset($this->unresolvedChildren[$name])) {
160 return true;
161 }
162
163 if (isset($this->children[$name])) {
164 return true;
165 }
166
167 return false;
168 }
169
170 /**
171 * {@inheritdoc}
172 */
173 public function all()
174 {
175 if ($this->locked) {
176 throw new BadMethodCallException('FormBuilder methods cannot be accessed anymore once the builder is turned into a FormConfigInterface instance.');
177 }
178
179 $this->resolveChildren();
180
181 return $this->children;
182 }
183
184 /**
185 * {@inheritdoc}
186 */
187 public function count()
188 {
189 if ($this->locked) {
190 throw new BadMethodCallException('FormBuilder methods cannot be accessed anymore once the builder is turned into a FormConfigInterface instance.');
191 }
192
193 return count($this->children);
194 }
195
196 /**
197 * {@inheritdoc}
198 */
199 public function getFormConfig()
200 {
201 $config = parent::getFormConfig();
202
203 $config->children = array();
204 $config->unresolvedChildren = array();
205
206 return $config;
207 }
208
209 /**
210 * {@inheritdoc}
211 */
212 public function getForm()
213 {
214 if ($this->locked) {
215 throw new BadMethodCallException('FormBuilder methods cannot be accessed anymore once the builder is turned into a FormConfigInterface instance.');
216 }
217
218 $this->resolveChildren();
219
220 $form = new Form($this->getFormConfig());
221
222 foreach ($this->children as $child) {
223 // Automatic initialization is only supported on root forms
224 $form->add($child->setAutoInitialize(false)->getForm());
225 }
226
227 if ($this->getAutoInitialize()) {
228 // Automatically initialize the form if it is configured so
229 $form->initialize();
230 }
231
232 return $form;
233 }
234
235 /**
236 * {@inheritdoc}
237 */
238 public function getIterator()
239 {
240 if ($this->locked) {
241 throw new BadMethodCallException('FormBuilder methods cannot be accessed anymore once the builder is turned into a FormConfigInterface instance.');
242 }
243
244 return new \ArrayIterator($this->children);
245 }
246
247 /**
248 * Converts an unresolved child into a {@link FormBuilder} instance.
249 *
250 * @param string $name The name of the unresolved child.
251 *
252 * @return FormBuilder The created instance.
253 */
254 private function resolveChild($name)
255 {
256 $info = $this->unresolvedChildren[$name];
257 $child = $this->create($name, $info['type'], $info['options']);
258 $this->children[$name] = $child;
259 unset($this->unresolvedChildren[$name]);
260
261 return $child;
262 }
263
264 /**
265 * Converts all unresolved children into {@link FormBuilder} instances.
266 */
267 private function resolveChildren()
268 {
269 foreach ($this->unresolvedChildren as $name => $info) {
270 $this->children[$name] = $this->create($name, $info['type'], $info['options']);
271 }
272
273 $this->unresolvedChildren = array();
274 }
275}
diff --git a/vendor/symfony/form/Symfony/Component/Form/FormBuilderInterface.php b/vendor/symfony/form/Symfony/Component/Form/FormBuilderInterface.php
deleted file mode 100644
index 1dc4a64e..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/FormBuilderInterface.php
+++ /dev/null
@@ -1,87 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form;
13
14/**
15 * @author Bernhard Schussek <bschussek@gmail.com>
16 */
17interface FormBuilderInterface extends \Traversable, \Countable, FormConfigBuilderInterface
18{
19 /**
20 * Adds a new field to this group. A field must have a unique name within
21 * the group. Otherwise the existing field is overwritten.
22 *
23 * If you add a nested group, this group should also be represented in the
24 * object hierarchy.
25 *
26 * @param string|integer|FormBuilderInterface $child
27 * @param string|FormTypeInterface $type
28 * @param array $options
29 *
30 * @return FormBuilderInterface The builder object.
31 */
32 public function add($child, $type = null, array $options = array());
33
34 /**
35 * Creates a form builder.
36 *
37 * @param string $name The name of the form or the name of the property
38 * @param string|FormTypeInterface $type The type of the form or null if name is a property
39 * @param array $options The options
40 *
41 * @return FormBuilderInterface The created builder.
42 */
43 public function create($name, $type = null, array $options = array());
44
45 /**
46 * Returns a child by name.
47 *
48 * @param string $name The name of the child
49 *
50 * @return FormBuilderInterface The builder for the child
51 *
52 * @throws Exception\InvalidArgumentException if the given child does not exist
53 */
54 public function get($name);
55
56 /**
57 * Removes the field with the given name.
58 *
59 * @param string $name
60 *
61 * @return FormBuilderInterface The builder object.
62 */
63 public function remove($name);
64
65 /**
66 * Returns whether a field with the given name exists.
67 *
68 * @param string $name
69 *
70 * @return Boolean
71 */
72 public function has($name);
73
74 /**
75 * Returns the children.
76 *
77 * @return array
78 */
79 public function all();
80
81 /**
82 * Creates the form.
83 *
84 * @return Form The form
85 */
86 public function getForm();
87}
diff --git a/vendor/symfony/form/Symfony/Component/Form/FormConfigBuilder.php b/vendor/symfony/form/Symfony/Component/Form/FormConfigBuilder.php
deleted file mode 100644
index 1015da4f..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/FormConfigBuilder.php
+++ /dev/null
@@ -1,919 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form;
13
14use Symfony\Component\Form\Exception\BadMethodCallException;
15use Symfony\Component\Form\Exception\InvalidArgumentException;
16use Symfony\Component\Form\Exception\UnexpectedTypeException;
17use Symfony\Component\PropertyAccess\PropertyPath;
18use Symfony\Component\PropertyAccess\PropertyPathInterface;
19use Symfony\Component\EventDispatcher\EventDispatcherInterface;
20use Symfony\Component\EventDispatcher\EventSubscriberInterface;
21use Symfony\Component\EventDispatcher\ImmutableEventDispatcher;
22
23/**
24 * A basic form configuration.
25 *
26 * @author Bernhard Schussek <bschussek@gmail.com>
27 */
28class FormConfigBuilder implements FormConfigBuilderInterface
29{
30 /**
31 * Caches a globally unique {@link NativeRequestHandler} instance.
32 *
33 * @var NativeRequestHandler
34 */
35 private static $nativeRequestProcessor;
36
37 /**
38 * The accepted request methods.
39 *
40 * @var array
41 */
42 private static $allowedMethods = array(
43 'GET',
44 'PUT',
45 'POST',
46 'DELETE',
47 'PATCH'
48 );
49
50 /**
51 * @var Boolean
52 */
53 protected $locked = false;
54
55 /**
56 * @var EventDispatcherInterface
57 */
58 private $dispatcher;
59
60 /**
61 * @var string
62 */
63 private $name;
64
65 /**
66 * @var PropertyPathInterface
67 */
68 private $propertyPath;
69
70 /**
71 * @var Boolean
72 */
73 private $mapped = true;
74
75 /**
76 * @var Boolean
77 */
78 private $byReference = true;
79
80 /**
81 * @var Boolean
82 */
83 private $inheritData = false;
84
85 /**
86 * @var Boolean
87 */
88 private $compound = false;
89
90 /**
91 * @var ResolvedFormTypeInterface
92 */
93 private $type;
94
95 /**
96 * @var array
97 */
98 private $viewTransformers = array();
99
100 /**
101 * @var array
102 */
103 private $modelTransformers = array();
104
105 /**
106 * @var DataMapperInterface
107 */
108 private $dataMapper;
109
110 /**
111 * @var Boolean
112 */
113 private $required = true;
114
115 /**
116 * @var Boolean
117 */
118 private $disabled = false;
119
120 /**
121 * @var Boolean
122 */
123 private $errorBubbling = false;
124
125 /**
126 * @var mixed
127 */
128 private $emptyData;
129
130 /**
131 * @var array
132 */
133 private $attributes = array();
134
135 /**
136 * @var mixed
137 */
138 private $data;
139
140 /**
141 * @var string
142 */
143 private $dataClass;
144
145 /**
146 * @var Boolean
147 */
148 private $dataLocked;
149
150 /**
151 * @var FormFactoryInterface
152 */
153 private $formFactory;
154
155 /**
156 * @var string
157 */
158 private $action;
159
160 /**
161 * @var string
162 */
163 private $method = 'POST';
164
165 /**
166 * @var RequestHandlerInterface
167 */
168 private $requestHandler;
169
170 /**
171 * @var Boolean
172 */
173 private $autoInitialize = false;
174
175 /**
176 * @var array
177 */
178 private $options;
179
180 /**
181 * Creates an empty form configuration.
182 *
183 * @param string|integer $name The form name
184 * @param string $dataClass The class of the form's data
185 * @param EventDispatcherInterface $dispatcher The event dispatcher
186 * @param array $options The form options
187 *
188 * @throws InvalidArgumentException If the data class is not a valid class or if
189 * the name contains invalid characters.
190 */
191 public function __construct($name, $dataClass, EventDispatcherInterface $dispatcher, array $options = array())
192 {
193 self::validateName($name);
194
195 if (null !== $dataClass && !class_exists($dataClass)) {
196 throw new InvalidArgumentException(sprintf('The data class "%s" is not a valid class.', $dataClass));
197 }
198
199 $this->name = (string) $name;
200 $this->dataClass = $dataClass;
201 $this->dispatcher = $dispatcher;
202 $this->options = $options;
203 }
204
205 /**
206 * {@inheritdoc}
207 */
208 public function addEventListener($eventName, $listener, $priority = 0)
209 {
210 if ($this->locked) {
211 throw new BadMethodCallException('FormConfigBuilder methods cannot be accessed anymore once the builder is turned into a FormConfigInterface instance.');
212 }
213
214 $this->dispatcher->addListener($eventName, $listener, $priority);
215
216 return $this;
217 }
218
219 /**
220 * {@inheritdoc}
221 */
222 public function addEventSubscriber(EventSubscriberInterface $subscriber)
223 {
224 if ($this->locked) {
225 throw new BadMethodCallException('FormConfigBuilder methods cannot be accessed anymore once the builder is turned into a FormConfigInterface instance.');
226 }
227
228 $this->dispatcher->addSubscriber($subscriber);
229
230 return $this;
231 }
232
233 /**
234 * {@inheritdoc}
235 */
236 public function addViewTransformer(DataTransformerInterface $viewTransformer, $forcePrepend = false)
237 {
238 if ($this->locked) {
239 throw new BadMethodCallException('FormConfigBuilder methods cannot be accessed anymore once the builder is turned into a FormConfigInterface instance.');
240 }
241
242 if ($forcePrepend) {
243 array_unshift($this->viewTransformers, $viewTransformer);
244 } else {
245 $this->viewTransformers[] = $viewTransformer;
246 }
247
248 return $this;
249 }
250
251 /**
252 * {@inheritdoc}
253 */
254 public function resetViewTransformers()
255 {
256 if ($this->locked) {
257 throw new BadMethodCallException('FormConfigBuilder methods cannot be accessed anymore once the builder is turned into a FormConfigInterface instance.');
258 }
259
260 $this->viewTransformers = array();
261
262 return $this;
263 }
264
265 /**
266 * {@inheritdoc}
267 */
268 public function addModelTransformer(DataTransformerInterface $modelTransformer, $forceAppend = false)
269 {
270 if ($this->locked) {
271 throw new BadMethodCallException('FormConfigBuilder methods cannot be accessed anymore once the builder is turned into a FormConfigInterface instance.');
272 }
273
274 if ($forceAppend) {
275 $this->modelTransformers[] = $modelTransformer;
276 } else {
277 array_unshift($this->modelTransformers, $modelTransformer);
278 }
279
280 return $this;
281 }
282
283 /**
284 * {@inheritdoc}
285 */
286 public function resetModelTransformers()
287 {
288 if ($this->locked) {
289 throw new BadMethodCallException('FormConfigBuilder methods cannot be accessed anymore once the builder is turned into a FormConfigInterface instance.');
290 }
291
292 $this->modelTransformers = array();
293
294 return $this;
295 }
296
297 /**
298 * {@inheritdoc}
299 */
300 public function getEventDispatcher()
301 {
302 if ($this->locked && !$this->dispatcher instanceof ImmutableEventDispatcher) {
303 $this->dispatcher = new ImmutableEventDispatcher($this->dispatcher);
304 }
305
306 return $this->dispatcher;
307 }
308
309 /**
310 * {@inheritdoc}
311 */
312 public function getName()
313 {
314 return $this->name;
315 }
316
317 /**
318 * {@inheritdoc}
319 */
320 public function getPropertyPath()
321 {
322 return $this->propertyPath;
323 }
324
325 /**
326 * {@inheritdoc}
327 */
328 public function getMapped()
329 {
330 return $this->mapped;
331 }
332
333 /**
334 * {@inheritdoc}
335 */
336 public function getByReference()
337 {
338 return $this->byReference;
339 }
340
341 /**
342 * {@inheritdoc}
343 */
344 public function getInheritData()
345 {
346 return $this->inheritData;
347 }
348
349 /**
350 * Alias of {@link getInheritData()}.
351 *
352 * @return FormConfigBuilder The configuration object.
353 *
354 * @deprecated Deprecated since version 2.3, to be removed in 3.0. Use
355 * {@link getInheritData()} instead.
356 */
357 public function getVirtual()
358 {
359 // Uncomment this as soon as the deprecation note should be shown
360 // trigger_error('getVirtual() is deprecated since version 2.3 and will be removed in 3.0. Use getInheritData() instead.', E_USER_DEPRECATED);
361 return $this->getInheritData();
362 }
363
364 /**
365 * {@inheritdoc}
366 */
367 public function getCompound()
368 {
369 return $this->compound;
370 }
371
372 /**
373 * {@inheritdoc}
374 */
375 public function getType()
376 {
377 return $this->type;
378 }
379
380 /**
381 * {@inheritdoc}
382 */
383 public function getViewTransformers()
384 {
385 return $this->viewTransformers;
386 }
387
388 /**
389 * {@inheritdoc}
390 */
391 public function getModelTransformers()
392 {
393 return $this->modelTransformers;
394 }
395
396 /**
397 * {@inheritdoc}
398 */
399 public function getDataMapper()
400 {
401 return $this->dataMapper;
402 }
403
404 /**
405 * {@inheritdoc}
406 */
407 public function getRequired()
408 {
409 return $this->required;
410 }
411
412 /**
413 * {@inheritdoc}
414 */
415 public function getDisabled()
416 {
417 return $this->disabled;
418 }
419
420 /**
421 * {@inheritdoc}
422 */
423 public function getErrorBubbling()
424 {
425 return $this->errorBubbling;
426 }
427
428 /**
429 * {@inheritdoc}
430 */
431 public function getEmptyData()
432 {
433 return $this->emptyData;
434 }
435
436 /**
437 * {@inheritdoc}
438 */
439 public function getAttributes()
440 {
441 return $this->attributes;
442 }
443
444 /**
445 * {@inheritdoc}
446 */
447 public function hasAttribute($name)
448 {
449 return array_key_exists($name, $this->attributes);
450 }
451
452 /**
453 * {@inheritdoc}
454 */
455 public function getAttribute($name, $default = null)
456 {
457 return array_key_exists($name, $this->attributes) ? $this->attributes[$name] : $default;
458 }
459
460 /**
461 * {@inheritdoc}
462 */
463 public function getData()
464 {
465 return $this->data;
466 }
467
468 /**
469 * {@inheritdoc}
470 */
471 public function getDataClass()
472 {
473 return $this->dataClass;
474 }
475
476 /**
477 * {@inheritdoc}
478 */
479 public function getDataLocked()
480 {
481 return $this->dataLocked;
482 }
483
484 /**
485 * {@inheritdoc}
486 */
487 public function getFormFactory()
488 {
489 return $this->formFactory;
490 }
491
492 /**
493 * {@inheritdoc}
494 */
495 public function getAction()
496 {
497 return $this->action;
498 }
499
500 /**
501 * {@inheritdoc}
502 */
503 public function getMethod()
504 {
505 return $this->method;
506 }
507
508 /**
509 * {@inheritdoc}
510 */
511 public function getRequestHandler()
512 {
513 if (null === $this->requestHandler) {
514 if (null === self::$nativeRequestProcessor) {
515 self::$nativeRequestProcessor = new NativeRequestHandler();
516 }
517 $this->requestHandler = self::$nativeRequestProcessor;
518 }
519
520 return $this->requestHandler;
521 }
522
523 /**
524 * {@inheritdoc}
525 */
526 public function getAutoInitialize()
527 {
528 return $this->autoInitialize;
529 }
530
531 /**
532 * {@inheritdoc}
533 */
534 public function getOptions()
535 {
536 return $this->options;
537 }
538
539 /**
540 * {@inheritdoc}
541 */
542 public function hasOption($name)
543 {
544 return array_key_exists($name, $this->options);
545 }
546
547 /**
548 * {@inheritdoc}
549 */
550 public function getOption($name, $default = null)
551 {
552 return array_key_exists($name, $this->options) ? $this->options[$name] : $default;
553 }
554
555 /**
556 * {@inheritdoc}
557 */
558 public function setAttribute($name, $value)
559 {
560 if ($this->locked) {
561 throw new BadMethodCallException('FormConfigBuilder methods cannot be accessed anymore once the builder is turned into a FormConfigInterface instance.');
562 }
563
564 $this->attributes[$name] = $value;
565
566 return $this;
567 }
568
569 /**
570 * {@inheritdoc}
571 */
572 public function setAttributes(array $attributes)
573 {
574 if ($this->locked) {
575 throw new BadMethodCallException('FormConfigBuilder methods cannot be accessed anymore once the builder is turned into a FormConfigInterface instance.');
576 }
577
578 $this->attributes = $attributes;
579
580 return $this;
581 }
582
583 /**
584 * {@inheritdoc}
585 */
586 public function setDataMapper(DataMapperInterface $dataMapper = null)
587 {
588 if ($this->locked) {
589 throw new BadMethodCallException('FormConfigBuilder methods cannot be accessed anymore once the builder is turned into a FormConfigInterface instance.');
590 }
591
592 $this->dataMapper = $dataMapper;
593
594 return $this;
595 }
596
597 /**
598 * {@inheritdoc}
599 */
600 public function setDisabled($disabled)
601 {
602 if ($this->locked) {
603 throw new BadMethodCallException('FormConfigBuilder methods cannot be accessed anymore once the builder is turned into a FormConfigInterface instance.');
604 }
605
606 $this->disabled = (Boolean) $disabled;
607
608 return $this;
609 }
610
611 /**
612 * {@inheritdoc}
613 */
614 public function setEmptyData($emptyData)
615 {
616 if ($this->locked) {
617 throw new BadMethodCallException('FormConfigBuilder methods cannot be accessed anymore once the builder is turned into a FormConfigInterface instance.');
618 }
619
620 $this->emptyData = $emptyData;
621
622 return $this;
623 }
624
625 /**
626 * {@inheritdoc}
627 */
628 public function setErrorBubbling($errorBubbling)
629 {
630 if ($this->locked) {
631 throw new BadMethodCallException('FormConfigBuilder methods cannot be accessed anymore once the builder is turned into a FormConfigInterface instance.');
632 }
633
634 $this->errorBubbling = null === $errorBubbling ? null : (Boolean) $errorBubbling;
635
636 return $this;
637 }
638
639 /**
640 * {@inheritdoc}
641 */
642 public function setRequired($required)
643 {
644 if ($this->locked) {
645 throw new BadMethodCallException('FormConfigBuilder methods cannot be accessed anymore once the builder is turned into a FormConfigInterface instance.');
646 }
647
648 $this->required = (Boolean) $required;
649
650 return $this;
651 }
652
653 /**
654 * {@inheritdoc}
655 */
656 public function setPropertyPath($propertyPath)
657 {
658 if ($this->locked) {
659 throw new BadMethodCallException('FormConfigBuilder methods cannot be accessed anymore once the builder is turned into a FormConfigInterface instance.');
660 }
661
662 if (null !== $propertyPath && !$propertyPath instanceof PropertyPathInterface) {
663 $propertyPath = new PropertyPath($propertyPath);
664 }
665
666 $this->propertyPath = $propertyPath;
667
668 return $this;
669 }
670
671 /**
672 * {@inheritdoc}
673 */
674 public function setMapped($mapped)
675 {
676 if ($this->locked) {
677 throw new BadMethodCallException('FormConfigBuilder methods cannot be accessed anymore once the builder is turned into a FormConfigInterface instance.');
678 }
679
680 $this->mapped = $mapped;
681
682 return $this;
683 }
684
685 /**
686 * {@inheritdoc}
687 */
688 public function setByReference($byReference)
689 {
690 if ($this->locked) {
691 throw new BadMethodCallException('FormConfigBuilder methods cannot be accessed anymore once the builder is turned into a FormConfigInterface instance.');
692 }
693
694 $this->byReference = $byReference;
695
696 return $this;
697 }
698
699 /**
700 * {@inheritdoc}
701 */
702 public function setInheritData($inheritData)
703 {
704 if ($this->locked) {
705 throw new BadMethodCallException('FormConfigBuilder methods cannot be accessed anymore once the builder is turned into a FormConfigInterface instance.');
706 }
707
708 $this->inheritData = $inheritData;
709
710 return $this;
711 }
712
713 /**
714 * Alias of {@link setInheritData()}.
715 *
716 * @param Boolean $inheritData Whether the form should inherit its parent's data.
717 *
718 * @return FormConfigBuilder The configuration object.
719 *
720 * @deprecated Deprecated since version 2.3, to be removed in 3.0. Use
721 * {@link setInheritData()} instead.
722 */
723 public function setVirtual($inheritData)
724 {
725 // Uncomment this as soon as the deprecation note should be shown
726 // trigger_error('setVirtual() is deprecated since version 2.3 and will be removed in 3.0. Use setInheritData() instead.', E_USER_DEPRECATED);
727
728 $this->setInheritData($inheritData);
729 }
730
731 /**
732 * {@inheritdoc}
733 */
734 public function setCompound($compound)
735 {
736 if ($this->locked) {
737 throw new BadMethodCallException('FormConfigBuilder methods cannot be accessed anymore once the builder is turned into a FormConfigInterface instance.');
738 }
739
740 $this->compound = $compound;
741
742 return $this;
743 }
744
745 /**
746 * {@inheritdoc}
747 */
748 public function setType(ResolvedFormTypeInterface $type)
749 {
750 if ($this->locked) {
751 throw new BadMethodCallException('FormConfigBuilder methods cannot be accessed anymore once the builder is turned into a FormConfigInterface instance.');
752 }
753
754 $this->type = $type;
755
756 return $this;
757 }
758
759 /**
760 * {@inheritdoc}
761 */
762 public function setData($data)
763 {
764 if ($this->locked) {
765 throw new BadMethodCallException('FormConfigBuilder methods cannot be accessed anymore once the builder is turned into a FormConfigInterface instance.');
766 }
767
768 $this->data = $data;
769
770 return $this;
771 }
772
773 /**
774 * {@inheritdoc}
775 */
776 public function setDataLocked($locked)
777 {
778 if ($this->locked) {
779 throw new BadMethodCallException('FormConfigBuilder methods cannot be accessed anymore once the builder is turned into a FormConfigInterface instance.');
780 }
781
782 $this->dataLocked = $locked;
783
784 return $this;
785 }
786
787 /**
788 * {@inheritdoc}
789 */
790 public function setFormFactory(FormFactoryInterface $formFactory)
791 {
792 if ($this->locked) {
793 throw new BadMethodCallException('FormConfigBuilder methods cannot be accessed anymore once the builder is turned into a FormConfigInterface instance.');
794 }
795
796 $this->formFactory = $formFactory;
797
798 return $this;
799 }
800
801 /**
802 * {@inheritdoc}
803 */
804 public function setAction($action)
805 {
806 if ($this->locked) {
807 throw new BadMethodCallException('The config builder cannot be modified anymore.');
808 }
809
810 $this->action = $action;
811
812 return $this;
813 }
814
815 /**
816 * {@inheritdoc}
817 */
818 public function setMethod($method)
819 {
820 if ($this->locked) {
821 throw new BadMethodCallException('The config builder cannot be modified anymore.');
822 }
823
824 $upperCaseMethod = strtoupper($method);
825
826 if (!in_array($upperCaseMethod, self::$allowedMethods)) {
827 throw new InvalidArgumentException(sprintf(
828 'The form method is "%s", but should be one of "%s".',
829 $method,
830 implode('", "', self::$allowedMethods)
831 ));
832 }
833
834 $this->method = $upperCaseMethod;
835
836 return $this;
837 }
838
839 /**
840 * {@inheritdoc}
841 */
842 public function setRequestHandler(RequestHandlerInterface $requestHandler)
843 {
844 if ($this->locked) {
845 throw new BadMethodCallException('The config builder cannot be modified anymore.');
846 }
847
848 $this->requestHandler = $requestHandler;
849
850 return $this;
851 }
852
853 /**
854 * {@inheritdoc}
855 */
856 public function setAutoInitialize($initialize)
857 {
858 $this->autoInitialize = (Boolean) $initialize;
859
860 return $this;
861 }
862
863 /**
864 * {@inheritdoc}
865 */
866 public function getFormConfig()
867 {
868 if ($this->locked) {
869 throw new BadMethodCallException('FormConfigBuilder methods cannot be accessed anymore once the builder is turned into a FormConfigInterface instance.');
870 }
871
872 // This method should be idempotent, so clone the builder
873 $config = clone $this;
874 $config->locked = true;
875
876 return $config;
877 }
878
879 /**
880 * Validates whether the given variable is a valid form name.
881 *
882 * @param string|integer $name The tested form name.
883 *
884 * @throws UnexpectedTypeException If the name is not a string or an integer.
885 * @throws InvalidArgumentException If the name contains invalid characters.
886 */
887 public static function validateName($name)
888 {
889 if (null !== $name && !is_string($name) && !is_int($name)) {
890 throw new UnexpectedTypeException($name, 'string, integer or null');
891 }
892
893 if (!self::isValidName($name)) {
894 throw new InvalidArgumentException(sprintf(
895 'The name "%s" contains illegal characters. Names should start with a letter, digit or underscore and only contain letters, digits, numbers, underscores ("_"), hyphens ("-") and colons (":").',
896 $name
897 ));
898 }
899 }
900
901 /**
902 * Returns whether the given variable contains a valid form name.
903 *
904 * A name is accepted if it
905 *
906 * * is empty
907 * * starts with a letter, digit or underscore
908 * * contains only letters, digits, numbers, underscores ("_"),
909 * hyphens ("-") and colons (":")
910 *
911 * @param string $name The tested form name.
912 *
913 * @return Boolean Whether the name is valid.
914 */
915 public static function isValidName($name)
916 {
917 return '' === $name || null === $name || preg_match('/^[a-zA-Z0-9_][a-zA-Z0-9_\-:]*$/D', $name);
918 }
919}
diff --git a/vendor/symfony/form/Symfony/Component/Form/FormConfigBuilderInterface.php b/vendor/symfony/form/Symfony/Component/Form/FormConfigBuilderInterface.php
deleted file mode 100644
index 62d12c09..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/FormConfigBuilderInterface.php
+++ /dev/null
@@ -1,287 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form;
13
14use Symfony\Component\EventDispatcher\EventSubscriberInterface;
15
16/**
17 * @author Bernhard Schussek <bschussek@gmail.com>
18 */
19interface FormConfigBuilderInterface extends FormConfigInterface
20{
21 /**
22 * Adds an event listener to an event on this form.
23 *
24 * @param string $eventName The name of the event to listen to.
25 * @param callable $listener The listener to execute.
26 * @param integer $priority The priority of the listener. Listeners
27 * with a higher priority are called before
28 * listeners with a lower priority.
29 *
30 * @return self The configuration object.
31 */
32 public function addEventListener($eventName, $listener, $priority = 0);
33
34 /**
35 * Adds an event subscriber for events on this form.
36 *
37 * @param EventSubscriberInterface $subscriber The subscriber to attach.
38 *
39 * @return self The configuration object.
40 */
41 public function addEventSubscriber(EventSubscriberInterface $subscriber);
42
43 /**
44 * Appends / prepends a transformer to the view transformer chain.
45 *
46 * The transform method of the transformer is used to convert data from the
47 * normalized to the view format.
48 * The reverseTransform method of the transformer is used to convert from the
49 * view to the normalized format.
50 *
51 * @param DataTransformerInterface $viewTransformer
52 * @param Boolean $forcePrepend if set to true, prepend instead of appending
53 *
54 * @return self The configuration object.
55 */
56 public function addViewTransformer(DataTransformerInterface $viewTransformer, $forcePrepend = false);
57
58 /**
59 * Clears the view transformers.
60 *
61 * @return self The configuration object.
62 */
63 public function resetViewTransformers();
64
65 /**
66 * Prepends / appends a transformer to the normalization transformer chain.
67 *
68 * The transform method of the transformer is used to convert data from the
69 * model to the normalized format.
70 * The reverseTransform method of the transformer is used to convert from the
71 * normalized to the model format.
72 *
73 * @param DataTransformerInterface $modelTransformer
74 * @param Boolean $forceAppend if set to true, append instead of prepending
75 *
76 * @return self The configuration object.
77 */
78 public function addModelTransformer(DataTransformerInterface $modelTransformer, $forceAppend = false);
79
80 /**
81 * Clears the normalization transformers.
82 *
83 * @return self The configuration object.
84 */
85 public function resetModelTransformers();
86
87 /**
88 * Sets the value for an attribute.
89 *
90 * @param string $name The name of the attribute
91 * @param string $value The value of the attribute
92 *
93 * @return self The configuration object.
94 */
95 public function setAttribute($name, $value);
96
97 /**
98 * Sets the attributes.
99 *
100 * @param array $attributes The attributes.
101 *
102 * @return self The configuration object.
103 */
104 public function setAttributes(array $attributes);
105
106 /**
107 * Sets the data mapper used by the form.
108 *
109 * @param DataMapperInterface $dataMapper
110 *
111 * @return self The configuration object.
112 */
113 public function setDataMapper(DataMapperInterface $dataMapper = null);
114
115 /**
116 * Set whether the form is disabled.
117 *
118 * @param Boolean $disabled Whether the form is disabled
119 *
120 * @return self The configuration object.
121 */
122 public function setDisabled($disabled);
123
124 /**
125 * Sets the data used for the client data when no value is submitted.
126 *
127 * @param mixed $emptyData The empty data.
128 *
129 * @return self The configuration object.
130 */
131 public function setEmptyData($emptyData);
132
133 /**
134 * Sets whether errors bubble up to the parent.
135 *
136 * @param Boolean $errorBubbling
137 *
138 * @return self The configuration object.
139 */
140 public function setErrorBubbling($errorBubbling);
141
142 /**
143 * Sets whether this field is required to be filled out when submitted.
144 *
145 * @param Boolean $required
146 *
147 * @return self The configuration object.
148 */
149 public function setRequired($required);
150
151 /**
152 * Sets the property path that the form should be mapped to.
153 *
154 * @param null|string|\Symfony\Component\PropertyAccess\PropertyPathInterface $propertyPath
155 * The property path or null if the path should be set
156 * automatically based on the form's name.
157 *
158 * @return self The configuration object.
159 */
160 public function setPropertyPath($propertyPath);
161
162 /**
163 * Sets whether the form should be mapped to an element of its
164 * parent's data.
165 *
166 * @param Boolean $mapped Whether the form should be mapped.
167 *
168 * @return self The configuration object.
169 */
170 public function setMapped($mapped);
171
172 /**
173 * Sets whether the form's data should be modified by reference.
174 *
175 * @param Boolean $byReference Whether the data should be
176 * modified by reference.
177 *
178 * @return self The configuration object.
179 */
180 public function setByReference($byReference);
181
182 /**
183 * Sets whether the form should read and write the data of its parent.
184 *
185 * @param Boolean $inheritData Whether the form should inherit its parent's data.
186 *
187 * @return self The configuration object.
188 */
189 public function setInheritData($inheritData);
190
191 /**
192 * Sets whether the form should be compound.
193 *
194 * @param Boolean $compound Whether the form should be compound.
195 *
196 * @return self The configuration object.
197 *
198 * @see FormConfigInterface::getCompound()
199 */
200 public function setCompound($compound);
201
202 /**
203 * Set the types.
204 *
205 * @param ResolvedFormTypeInterface $type The type of the form.
206 *
207 * @return self The configuration object.
208 */
209 public function setType(ResolvedFormTypeInterface $type);
210
211 /**
212 * Sets the initial data of the form.
213 *
214 * @param array $data The data of the form in application format.
215 *
216 * @return self The configuration object.
217 */
218 public function setData($data);
219
220 /**
221 * Locks the form's data to the data passed in the configuration.
222 *
223 * A form with locked data is restricted to the data passed in
224 * this configuration. The data can only be modified then by
225 * submitting the form.
226 *
227 * @param Boolean $locked Whether to lock the default data.
228 *
229 * @return self The configuration object.
230 */
231 public function setDataLocked($locked);
232
233 /**
234 * Sets the form factory used for creating new forms.
235 *
236 * @param FormFactoryInterface $formFactory The form factory.
237 */
238 public function setFormFactory(FormFactoryInterface $formFactory);
239
240 /**
241 * Sets the target URL of the form.
242 *
243 * @param string $action The target URL of the form.
244 *
245 * @return self The configuration object.
246 */
247 public function setAction($action);
248
249 /**
250 * Sets the HTTP method used by the form.
251 *
252 * @param string $method The HTTP method of the form.
253 *
254 * @return self The configuration object.
255 */
256 public function setMethod($method);
257
258 /**
259 * Sets the request handler used by the form.
260 *
261 * @param RequestHandlerInterface $requestHandler
262 *
263 * @return self The configuration object.
264 */
265 public function setRequestHandler(RequestHandlerInterface $requestHandler);
266
267 /**
268 * Sets whether the form should be initialized automatically.
269 *
270 * Should be set to true only for root forms.
271 *
272 * @param Boolean $initialize True to initialize the form automatically,
273 * false to suppress automatic initialization.
274 * In the second case, you need to call
275 * {@link FormInterface::initialize()} manually.
276 *
277 * @return self The configuration object.
278 */
279 public function setAutoInitialize($initialize);
280
281 /**
282 * Builds and returns the form configuration.
283 *
284 * @return FormConfigInterface
285 */
286 public function getFormConfig();
287}
diff --git a/vendor/symfony/form/Symfony/Component/Form/FormConfigInterface.php b/vendor/symfony/form/Symfony/Component/Form/FormConfigInterface.php
deleted file mode 100644
index 576fcd81..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/FormConfigInterface.php
+++ /dev/null
@@ -1,243 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form;
13
14/**
15 * The configuration of a {@link Form} object.
16 *
17 * @author Bernhard Schussek <bschussek@gmail.com>
18 */
19interface FormConfigInterface
20{
21 /**
22 * Returns the event dispatcher used to dispatch form events.
23 *
24 * @return \Symfony\Component\EventDispatcher\EventDispatcherInterface The dispatcher.
25 */
26 public function getEventDispatcher();
27
28 /**
29 * Returns the name of the form used as HTTP parameter.
30 *
31 * @return string The form name.
32 */
33 public function getName();
34
35 /**
36 * Returns the property path that the form should be mapped to.
37 *
38 * @return null|\Symfony\Component\PropertyAccess\PropertyPathInterface The property path.
39 */
40 public function getPropertyPath();
41
42 /**
43 * Returns whether the form should be mapped to an element of its
44 * parent's data.
45 *
46 * @return Boolean Whether the form is mapped.
47 */
48 public function getMapped();
49
50 /**
51 * Returns whether the form's data should be modified by reference.
52 *
53 * @return Boolean Whether to modify the form's data by reference.
54 */
55 public function getByReference();
56
57 /**
58 * Returns whether the form should read and write the data of its parent.
59 *
60 * @return Boolean Whether the form should inherit its parent's data.
61 */
62 public function getInheritData();
63
64 /**
65 * Returns whether the form is compound.
66 *
67 * This property is independent of whether the form actually has
68 * children. A form can be compound and have no children at all, like
69 * for example an empty collection form.
70 *
71 * @return Boolean Whether the form is compound.
72 */
73 public function getCompound();
74
75 /**
76 * Returns the form types used to construct the form.
77 *
78 * @return ResolvedFormTypeInterface The form's type.
79 */
80 public function getType();
81
82 /**
83 * Returns the view transformers of the form.
84 *
85 * @return DataTransformerInterface[] An array of {@link DataTransformerInterface} instances.
86 */
87 public function getViewTransformers();
88
89 /**
90 * Returns the model transformers of the form.
91 *
92 * @return DataTransformerInterface[] An array of {@link DataTransformerInterface} instances.
93 */
94 public function getModelTransformers();
95
96 /**
97 * Returns the data mapper of the form.
98 *
99 * @return DataMapperInterface The data mapper.
100 */
101 public function getDataMapper();
102
103 /**
104 * Returns whether the form is required.
105 *
106 * @return Boolean Whether the form is required.
107 */
108 public function getRequired();
109
110 /**
111 * Returns whether the form is disabled.
112 *
113 * @return Boolean Whether the form is disabled.
114 */
115 public function getDisabled();
116
117 /**
118 * Returns whether errors attached to the form will bubble to its parent.
119 *
120 * @return Boolean Whether errors will bubble up.
121 */
122 public function getErrorBubbling();
123
124 /**
125 * Returns the data that should be returned when the form is empty.
126 *
127 * @return mixed The data returned if the form is empty.
128 */
129 public function getEmptyData();
130
131 /**
132 * Returns additional attributes of the form.
133 *
134 * @return array An array of key-value combinations.
135 */
136 public function getAttributes();
137
138 /**
139 * Returns whether the attribute with the given name exists.
140 *
141 * @param string $name The attribute name.
142 *
143 * @return Boolean Whether the attribute exists.
144 */
145 public function hasAttribute($name);
146
147 /**
148 * Returns the value of the given attribute.
149 *
150 * @param string $name The attribute name.
151 * @param mixed $default The value returned if the attribute does not exist.
152 *
153 * @return mixed The attribute value.
154 */
155 public function getAttribute($name, $default = null);
156
157 /**
158 * Returns the initial data of the form.
159 *
160 * @return mixed The initial form data.
161 */
162 public function getData();
163
164 /**
165 * Returns the class of the form data or null if the data is scalar or an array.
166 *
167 * @return string The data class or null.
168 */
169 public function getDataClass();
170
171 /**
172 * Returns whether the form's data is locked.
173 *
174 * A form with locked data is restricted to the data passed in
175 * this configuration. The data can only be modified then by
176 * submitting the form.
177 *
178 * @return Boolean Whether the data is locked.
179 */
180 public function getDataLocked();
181
182 /**
183 * Returns the form factory used for creating new forms.
184 *
185 * @return FormFactoryInterface The form factory.
186 */
187 public function getFormFactory();
188
189 /**
190 * Returns the target URL of the form.
191 *
192 * @return string The target URL of the form.
193 */
194 public function getAction();
195
196 /**
197 * Returns the HTTP method used by the form.
198 *
199 * @return string The HTTP method of the form.
200 */
201 public function getMethod();
202
203 /**
204 * Returns the request handler used by the form.
205 *
206 * @return RequestHandlerInterface The request handler.
207 */
208 public function getRequestHandler();
209
210 /**
211 * Returns whether the form should be initialized upon creation.
212 *
213 * @return Boolean Returns true if the form should be initialized
214 * when created, false otherwise.
215 */
216 public function getAutoInitialize();
217
218 /**
219 * Returns all options passed during the construction of the form.
220 *
221 * @return array The passed options.
222 */
223 public function getOptions();
224
225 /**
226 * Returns whether a specific option exists.
227 *
228 * @param string $name The option name,
229 *
230 * @return Boolean Whether the option exists.
231 */
232 public function hasOption($name);
233
234 /**
235 * Returns the value of a specific option.
236 *
237 * @param string $name The option name.
238 * @param mixed $default The value returned if the option does not exist.
239 *
240 * @return mixed The option value.
241 */
242 public function getOption($name, $default = null);
243}
diff --git a/vendor/symfony/form/Symfony/Component/Form/FormError.php b/vendor/symfony/form/Symfony/Component/Form/FormError.php
deleted file mode 100644
index 343165ca..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/FormError.php
+++ /dev/null
@@ -1,105 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form;
13
14/**
15 * Wraps errors in forms
16 *
17 * @author Bernhard Schussek <bschussek@gmail.com>
18 */
19class FormError
20{
21 /**
22 * @var string
23 */
24 private $message;
25
26 /**
27 * The template for the error message
28 * @var string
29 */
30 protected $messageTemplate;
31
32 /**
33 * The parameters that should be substituted in the message template
34 * @var array
35 */
36 protected $messageParameters;
37
38 /**
39 * The value for error message pluralization
40 * @var integer|null
41 */
42 protected $messagePluralization;
43
44 /**
45 * Constructor
46 *
47 * Any array key in $messageParameters will be used as a placeholder in
48 * $messageTemplate.
49 *
50 * @param string $message The translated error message
51 * @param string|null $messageTemplate The template for the error message
52 * @param array $messageParameters The parameters that should be
53 * substituted in the message template.
54 * @param integer|null $messagePluralization The value for error message pluralization
55 *
56 * @see \Symfony\Component\Translation\Translator
57 */
58 public function __construct($message, $messageTemplate = null, array $messageParameters = array(), $messagePluralization = null)
59 {
60 $this->message = $message;
61 $this->messageTemplate = $messageTemplate ?: $message;
62 $this->messageParameters = $messageParameters;
63 $this->messagePluralization = $messagePluralization;
64 }
65
66 /**
67 * Returns the error message
68 *
69 * @return string
70 */
71 public function getMessage()
72 {
73 return $this->message;
74 }
75
76 /**
77 * Returns the error message template
78 *
79 * @return string
80 */
81 public function getMessageTemplate()
82 {
83 return $this->messageTemplate;
84 }
85
86 /**
87 * Returns the parameters to be inserted in the message template
88 *
89 * @return array
90 */
91 public function getMessageParameters()
92 {
93 return $this->messageParameters;
94 }
95
96 /**
97 * Returns the value for error message pluralization.
98 *
99 * @return integer|null
100 */
101 public function getMessagePluralization()
102 {
103 return $this->messagePluralization;
104 }
105}
diff --git a/vendor/symfony/form/Symfony/Component/Form/FormEvent.php b/vendor/symfony/form/Symfony/Component/Form/FormEvent.php
deleted file mode 100644
index 57cebade..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/FormEvent.php
+++ /dev/null
@@ -1,65 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form;
13
14use Symfony\Component\EventDispatcher\Event;
15
16/**
17 * @author Bernhard Schussek <bschussek@gmail.com>
18 */
19class FormEvent extends Event
20{
21 private $form;
22 protected $data;
23
24 /**
25 * Constructs an event.
26 *
27 * @param FormInterface $form The associated form
28 * @param mixed $data The data
29 */
30 public function __construct(FormInterface $form, $data)
31 {
32 $this->form = $form;
33 $this->data = $data;
34 }
35
36 /**
37 * Returns the form at the source of the event.
38 *
39 * @return FormInterface
40 */
41 public function getForm()
42 {
43 return $this->form;
44 }
45
46 /**
47 * Returns the data associated with this event.
48 *
49 * @return mixed
50 */
51 public function getData()
52 {
53 return $this->data;
54 }
55
56 /**
57 * Allows updating with some filtered data.
58 *
59 * @param mixed $data
60 */
61 public function setData($data)
62 {
63 $this->data = $data;
64 }
65}
diff --git a/vendor/symfony/form/Symfony/Component/Form/FormEvents.php b/vendor/symfony/form/Symfony/Component/Form/FormEvents.php
deleted file mode 100644
index 6c4efc5b..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/FormEvents.php
+++ /dev/null
@@ -1,49 +0,0 @@
1<?php
2/*
3 * This file is part of the Symfony package.
4 *
5 * (c) Fabien Potencier <fabien@symfony.com>
6 *
7 * For the full copyright and license information, please view the LICENSE
8 * file that was distributed with this source code.
9 */
10
11namespace Symfony\Component\Form;
12
13/**
14 * @author Bernhard Schussek <bschussek@gmail.com>
15 */
16final class FormEvents
17{
18 const PRE_SUBMIT = 'form.pre_bind';
19
20 const SUBMIT = 'form.bind';
21
22 const POST_SUBMIT = 'form.post_bind';
23
24 const PRE_SET_DATA = 'form.pre_set_data';
25
26 const POST_SET_DATA = 'form.post_set_data';
27
28 /**
29 * @deprecated Deprecated since version 2.3, to be removed in 3.0. Use
30 * {@link PRE_SUBMIT} instead.
31 */
32 const PRE_BIND = 'form.pre_bind';
33
34 /**
35 * @deprecated Deprecated since version 2.3, to be removed in 3.0. Use
36 * {@link SUBMIT} instead.
37 */
38 const BIND = 'form.bind';
39
40 /**
41 * @deprecated Deprecated since version 2.3, to be removed in 3.0. Use
42 * {@link POST_SUBMIT} instead.
43 */
44 const POST_BIND = 'form.post_bind';
45
46 private function __construct()
47 {
48 }
49}
diff --git a/vendor/symfony/form/Symfony/Component/Form/FormExtensionInterface.php b/vendor/symfony/form/Symfony/Component/Form/FormExtensionInterface.php
deleted file mode 100644
index a67055b7..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/FormExtensionInterface.php
+++ /dev/null
@@ -1,63 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form;
13
14/**
15 * Interface for extensions which provide types, type extensions and a guesser.
16 */
17interface FormExtensionInterface
18{
19 /**
20 * Returns a type by name.
21 *
22 * @param string $name The name of the type
23 *
24 * @return FormTypeInterface The type
25 *
26 * @throws Exception\InvalidArgumentException if the given type is not supported by this extension
27 */
28 public function getType($name);
29
30 /**
31 * Returns whether the given type is supported.
32 *
33 * @param string $name The name of the type
34 *
35 * @return Boolean Whether the type is supported by this extension
36 */
37 public function hasType($name);
38
39 /**
40 * Returns the extensions for the given type.
41 *
42 * @param string $name The name of the type
43 *
44 * @return FormTypeExtensionInterface[] An array of extensions as FormTypeExtensionInterface instances
45 */
46 public function getTypeExtensions($name);
47
48 /**
49 * Returns whether this extension provides type extensions for the given type.
50 *
51 * @param string $name The name of the type
52 *
53 * @return Boolean Whether the given type has extensions
54 */
55 public function hasTypeExtensions($name);
56
57 /**
58 * Returns the type guesser provided by this extension.
59 *
60 * @return FormTypeGuesserInterface|null The type guesser
61 */
62 public function getTypeGuesser();
63}
diff --git a/vendor/symfony/form/Symfony/Component/Form/FormFactory.php b/vendor/symfony/form/Symfony/Component/Form/FormFactory.php
deleted file mode 100644
index a5fd9cc0..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/FormFactory.php
+++ /dev/null
@@ -1,156 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form;
13
14use Symfony\Component\Form\Exception\UnexpectedTypeException;
15
16class FormFactory implements FormFactoryInterface
17{
18 /**
19 * @var FormRegistryInterface
20 */
21 private $registry;
22
23 /**
24 * @var ResolvedFormTypeFactoryInterface
25 */
26 private $resolvedTypeFactory;
27
28 public function __construct(FormRegistryInterface $registry, ResolvedFormTypeFactoryInterface $resolvedTypeFactory)
29 {
30 $this->registry = $registry;
31 $this->resolvedTypeFactory = $resolvedTypeFactory;
32 }
33
34 /**
35 * {@inheritdoc}
36 */
37 public function create($type = 'form', $data = null, array $options = array())
38 {
39 return $this->createBuilder($type, $data, $options)->getForm();
40 }
41
42 /**
43 * {@inheritdoc}
44 */
45 public function createNamed($name, $type = 'form', $data = null, array $options = array())
46 {
47 return $this->createNamedBuilder($name, $type, $data, $options)->getForm();
48 }
49
50 /**
51 * {@inheritdoc}
52 */
53 public function createForProperty($class, $property, $data = null, array $options = array())
54 {
55 return $this->createBuilderForProperty($class, $property, $data, $options)->getForm();
56 }
57
58 /**
59 * {@inheritdoc}
60 */
61 public function createBuilder($type = 'form', $data = null, array $options = array())
62 {
63 $name = $type instanceof FormTypeInterface || $type instanceof ResolvedFormTypeInterface
64 ? $type->getName()
65 : $type;
66
67 return $this->createNamedBuilder($name, $type, $data, $options);
68 }
69
70 /**
71 * {@inheritdoc}
72 */
73 public function createNamedBuilder($name, $type = 'form', $data = null, array $options = array())
74 {
75 if (null !== $data && !array_key_exists('data', $options)) {
76 $options['data'] = $data;
77 }
78
79 if ($type instanceof FormTypeInterface) {
80 $type = $this->resolveType($type);
81 } elseif (is_string($type)) {
82 $type = $this->registry->getType($type);
83 } elseif (!$type instanceof ResolvedFormTypeInterface) {
84 throw new UnexpectedTypeException($type, 'string, Symfony\Component\Form\ResolvedFormTypeInterface or Symfony\Component\Form\FormTypeInterface');
85 }
86
87 return $type->createBuilder($this, $name, $options);
88 }
89
90 /**
91 * {@inheritdoc}
92 */
93 public function createBuilderForProperty($class, $property, $data = null, array $options = array())
94 {
95 if (null === $guesser = $this->registry->getTypeGuesser()) {
96 return $this->createNamedBuilder($property, 'text', $data, $options);
97 }
98
99 $typeGuess = $guesser->guessType($class, $property);
100 $maxLengthGuess = $guesser->guessMaxLength($class, $property);
101 $requiredGuess = $guesser->guessRequired($class, $property);
102 $patternGuess = $guesser->guessPattern($class, $property);
103
104 $type = $typeGuess ? $typeGuess->getType() : 'text';
105
106 $maxLength = $maxLengthGuess ? $maxLengthGuess->getValue() : null;
107 $pattern = $patternGuess ? $patternGuess->getValue() : null;
108
109 if (null !== $pattern) {
110 $options = array_merge(array('pattern' => $pattern), $options);
111 }
112
113 if (null !== $maxLength) {
114 $options = array_merge(array('max_length' => $maxLength), $options);
115 }
116
117 if ($requiredGuess) {
118 $options = array_merge(array('required' => $requiredGuess->getValue()), $options);
119 }
120
121 // user options may override guessed options
122 if ($typeGuess) {
123 $options = array_merge($typeGuess->getOptions(), $options);
124 }
125
126 return $this->createNamedBuilder($property, $type, $data, $options);
127 }
128
129 /**
130 * Wraps a type into a ResolvedFormTypeInterface implementation and connects
131 * it with its parent type.
132 *
133 * @param FormTypeInterface $type The type to resolve.
134 *
135 * @return ResolvedFormTypeInterface The resolved type.
136 */
137 private function resolveType(FormTypeInterface $type)
138 {
139 $parentType = $type->getParent();
140
141 if ($parentType instanceof FormTypeInterface) {
142 $parentType = $this->resolveType($parentType);
143 } elseif (null !== $parentType) {
144 $parentType = $this->registry->getType($parentType);
145 }
146
147 return $this->resolvedTypeFactory->createResolvedType(
148 $type,
149 // Type extensions are not supported for unregistered type instances,
150 // i.e. type instances that are passed to the FormFactory directly,
151 // nor for their parents, if getParent() also returns a type instance.
152 array(),
153 $parentType
154 );
155 }
156}
diff --git a/vendor/symfony/form/Symfony/Component/Form/FormFactoryBuilder.php b/vendor/symfony/form/Symfony/Component/Form/FormFactoryBuilder.php
deleted file mode 100644
index 10383e84..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/FormFactoryBuilder.php
+++ /dev/null
@@ -1,162 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form;
13
14/**
15 * The default implementation of FormFactoryBuilderInterface.
16 *
17 * @author Bernhard Schussek <bschussek@gmail.com>
18 */
19class FormFactoryBuilder implements FormFactoryBuilderInterface
20{
21 /**
22 * @var ResolvedFormTypeFactoryInterface
23 */
24 private $resolvedTypeFactory;
25
26 /**
27 * @var array
28 */
29 private $extensions = array();
30
31 /**
32 * @var array
33 */
34 private $types = array();
35
36 /**
37 * @var array
38 */
39 private $typeExtensions = array();
40
41 /**
42 * @var array
43 */
44 private $typeGuessers = array();
45
46 /**
47 * {@inheritdoc}
48 */
49 public function setResolvedTypeFactory(ResolvedFormTypeFactoryInterface $resolvedTypeFactory)
50 {
51 $this->resolvedTypeFactory = $resolvedTypeFactory;
52
53 return $this;
54 }
55
56 /**
57 * {@inheritdoc}
58 */
59 public function addExtension(FormExtensionInterface $extension)
60 {
61 $this->extensions[] = $extension;
62
63 return $this;
64 }
65
66 /**
67 * {@inheritdoc}
68 */
69 public function addExtensions(array $extensions)
70 {
71 $this->extensions = array_merge($this->extensions, $extensions);
72
73 return $this;
74 }
75
76 /**
77 * {@inheritdoc}
78 */
79 public function addType(FormTypeInterface $type)
80 {
81 $this->types[$type->getName()] = $type;
82
83 return $this;
84 }
85
86 /**
87 * {@inheritdoc}
88 */
89 public function addTypes(array $types)
90 {
91 foreach ($types as $type) {
92 $this->types[$type->getName()] = $type;
93 }
94
95 return $this;
96 }
97
98 /**
99 * {@inheritdoc}
100 */
101 public function addTypeExtension(FormTypeExtensionInterface $typeExtension)
102 {
103 $this->typeExtensions[$typeExtension->getExtendedType()][] = $typeExtension;
104
105 return $this;
106 }
107
108 /**
109 * {@inheritdoc}
110 */
111 public function addTypeExtensions(array $typeExtensions)
112 {
113 foreach ($typeExtensions as $typeExtension) {
114 $this->typeExtensions[$typeExtension->getExtendedType()][] = $typeExtension;
115 }
116
117 return $this;
118 }
119
120 /**
121 * {@inheritdoc}
122 */
123 public function addTypeGuesser(FormTypeGuesserInterface $typeGuesser)
124 {
125 $this->typeGuessers[] = $typeGuesser;
126
127 return $this;
128 }
129
130 /**
131 * {@inheritdoc}
132 */
133 public function addTypeGuessers(array $typeGuessers)
134 {
135 $this->typeGuessers = array_merge($this->typeGuessers, $typeGuessers);
136
137 return $this;
138 }
139
140 /**
141 * {@inheritdoc}
142 */
143 public function getFormFactory()
144 {
145 $extensions = $this->extensions;
146
147 if (count($this->types) > 0 || count($this->typeExtensions) > 0 || count($this->typeGuessers) > 0) {
148 if (count($this->typeGuessers) > 1) {
149 $typeGuesser = new FormTypeGuesserChain($this->typeGuessers);
150 } else {
151 $typeGuesser = isset($this->typeGuessers[0]) ? $this->typeGuessers[0] : null;
152 }
153
154 $extensions[] = new PreloadedExtension($this->types, $this->typeExtensions, $typeGuesser);
155 }
156
157 $resolvedTypeFactory = $this->resolvedTypeFactory ?: new ResolvedFormTypeFactory();
158 $registry = new FormRegistry($extensions, $resolvedTypeFactory);
159
160 return new FormFactory($registry, $resolvedTypeFactory);
161 }
162}
diff --git a/vendor/symfony/form/Symfony/Component/Form/FormFactoryBuilderInterface.php b/vendor/symfony/form/Symfony/Component/Form/FormFactoryBuilderInterface.php
deleted file mode 100644
index 9370c573..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/FormFactoryBuilderInterface.php
+++ /dev/null
@@ -1,108 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form;
13
14/**
15 * A builder for FormFactoryInterface objects.
16 *
17 * @author Bernhard Schussek <bschussek@gmail.com>
18 */
19interface FormFactoryBuilderInterface
20{
21 /**
22 * Sets the factory for creating ResolvedFormTypeInterface instances.
23 *
24 * @param ResolvedFormTypeFactoryInterface $resolvedTypeFactory
25 *
26 * @return FormFactoryBuilderInterface The builder.
27 */
28 public function setResolvedTypeFactory(ResolvedFormTypeFactoryInterface $resolvedTypeFactory);
29
30 /**
31 * Adds an extension to be loaded by the factory.
32 *
33 * @param FormExtensionInterface $extension The extension.
34 *
35 * @return FormFactoryBuilderInterface The builder.
36 */
37 public function addExtension(FormExtensionInterface $extension);
38
39 /**
40 * Adds a list of extensions to be loaded by the factory.
41 *
42 * @param array $extensions The extensions.
43 *
44 * @return FormFactoryBuilderInterface The builder.
45 */
46 public function addExtensions(array $extensions);
47
48 /**
49 * Adds a form type to the factory.
50 *
51 * @param FormTypeInterface $type The form type.
52 *
53 * @return FormFactoryBuilderInterface The builder.
54 */
55 public function addType(FormTypeInterface $type);
56
57 /**
58 * Adds a list of form types to the factory.
59 *
60 * @param array $types The form types.
61 *
62 * @return FormFactoryBuilderInterface The builder.
63 */
64 public function addTypes(array $types);
65
66 /**
67 * Adds a form type extension to the factory.
68 *
69 * @param FormTypeExtensionInterface $typeExtension The form type extension.
70 *
71 * @return FormFactoryBuilderInterface The builder.
72 */
73 public function addTypeExtension(FormTypeExtensionInterface $typeExtension);
74
75 /**
76 * Adds a list of form type extensions to the factory.
77 *
78 * @param array $typeExtensions The form type extensions.
79 *
80 * @return FormFactoryBuilderInterface The builder.
81 */
82 public function addTypeExtensions(array $typeExtensions);
83
84 /**
85 * Adds a type guesser to the factory.
86 *
87 * @param FormTypeGuesserInterface $typeGuesser The type guesser.
88 *
89 * @return FormFactoryBuilderInterface The builder.
90 */
91 public function addTypeGuesser(FormTypeGuesserInterface $typeGuesser);
92
93 /**
94 * Adds a list of type guessers to the factory.
95 *
96 * @param array $typeGuessers The type guessers.
97 *
98 * @return FormFactoryBuilderInterface The builder.
99 */
100 public function addTypeGuessers(array $typeGuessers);
101
102 /**
103 * Builds and returns the factory.
104 *
105 * @return FormFactoryInterface The form factory.
106 */
107 public function getFormFactory();
108}
diff --git a/vendor/symfony/form/Symfony/Component/Form/FormFactoryInterface.php b/vendor/symfony/form/Symfony/Component/Form/FormFactoryInterface.php
deleted file mode 100644
index 31c46b55..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/FormFactoryInterface.php
+++ /dev/null
@@ -1,109 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form;
13
14/**
15 * @author Bernhard Schussek <bschussek@gmail.com>
16 */
17interface FormFactoryInterface
18{
19 /**
20 * Returns a form.
21 *
22 * @see createBuilder()
23 *
24 * @param string|FormTypeInterface $type The type of the form
25 * @param mixed $data The initial data
26 * @param array $options The options
27 *
28 * @return FormInterface The form named after the type
29 *
30 * @throws \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException if any given option is not applicable to the given type
31 */
32 public function create($type = 'form', $data = null, array $options = array());
33
34 /**
35 * Returns a form.
36 *
37 * @see createNamedBuilder()
38 *
39 * @param string|integer $name The name of the form
40 * @param string|FormTypeInterface $type The type of the form
41 * @param mixed $data The initial data
42 * @param array $options The options
43 *
44 * @return FormInterface The form
45 *
46 * @throws \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException if any given option is not applicable to the given type
47 */
48 public function createNamed($name, $type = 'form', $data = null, array $options = array());
49
50 /**
51 * Returns a form for a property of a class.
52 *
53 * @see createBuilderForProperty()
54 *
55 * @param string $class The fully qualified class name
56 * @param string $property The name of the property to guess for
57 * @param mixed $data The initial data
58 * @param array $options The options for the builder
59 *
60 * @return FormInterface The form named after the property
61 *
62 * @throws \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException if any given option is not applicable to the form type
63 */
64 public function createForProperty($class, $property, $data = null, array $options = array());
65
66 /**
67 * Returns a form builder.
68 *
69 * @param string|FormTypeInterface $type The type of the form
70 * @param mixed $data The initial data
71 * @param array $options The options
72 *
73 * @return FormBuilderInterface The form builder
74 *
75 * @throws \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException if any given option is not applicable to the given type
76 */
77 public function createBuilder($type = 'form', $data = null, array $options = array());
78
79 /**
80 * Returns a form builder.
81 *
82 * @param string|integer $name The name of the form
83 * @param string|FormTypeInterface $type The type of the form
84 * @param mixed $data The initial data
85 * @param array $options The options
86 *
87 * @return FormBuilderInterface The form builder
88 *
89 * @throws \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException if any given option is not applicable to the given type
90 */
91 public function createNamedBuilder($name, $type = 'form', $data = null, array $options = array());
92
93 /**
94 * Returns a form builder for a property of a class.
95 *
96 * If any of the 'max_length', 'required' and type options can be guessed,
97 * and are not provided in the options argument, the guessed value is used.
98 *
99 * @param string $class The fully qualified class name
100 * @param string $property The name of the property to guess for
101 * @param mixed $data The initial data
102 * @param array $options The options for the builder
103 *
104 * @return FormBuilderInterface The form builder named after the property
105 *
106 * @throws \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException if any given option is not applicable to the form type
107 */
108 public function createBuilderForProperty($class, $property, $data = null, array $options = array());
109}
diff --git a/vendor/symfony/form/Symfony/Component/Form/FormInterface.php b/vendor/symfony/form/Symfony/Component/Form/FormInterface.php
deleted file mode 100644
index 5a852e86..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/FormInterface.php
+++ /dev/null
@@ -1,288 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form;
13
14/**
15 * A form group bundling multiple forms in a hierarchical structure.
16 *
17 * @author Bernhard Schussek <bschussek@gmail.com>
18 */
19interface FormInterface extends \ArrayAccess, \Traversable, \Countable
20{
21 /**
22 * Sets the parent form.
23 *
24 * @param FormInterface|null $parent The parent form or null if it's the root.
25 *
26 * @return FormInterface The form instance
27 *
28 * @throws Exception\AlreadySubmittedException If the form has already been submitted.
29 * @throws Exception\LogicException When trying to set a parent for a form with
30 * an empty name.
31 */
32 public function setParent(FormInterface $parent = null);
33
34 /**
35 * Returns the parent form.
36 *
37 * @return FormInterface|null The parent form or null if there is none.
38 */
39 public function getParent();
40
41 /**
42 * Adds a child to the form.
43 *
44 * @param FormInterface|string|integer $child The FormInterface instance or the name of the child.
45 * @param string|null $type The child's type, if a name was passed.
46 * @param array $options The child's options, if a name was passed.
47 *
48 * @return FormInterface The form instance
49 *
50 * @throws Exception\AlreadySubmittedException If the form has already been submitted.
51 * @throws Exception\LogicException When trying to add a child to a non-compound form.
52 * @throws Exception\UnexpectedTypeException If $child or $type has an unexpected type.
53 */
54 public function add($child, $type = null, array $options = array());
55
56 /**
57 * Returns the child with the given name.
58 *
59 * @param string $name The name of the child
60 *
61 * @return FormInterface The child form
62 *
63 * @throws \OutOfBoundsException If the named child does not exist.
64 */
65 public function get($name);
66
67 /**
68 * Returns whether a child with the given name exists.
69 *
70 * @param string $name The name of the child
71 *
72 * @return Boolean
73 */
74 public function has($name);
75
76 /**
77 * Removes a child from the form.
78 *
79 * @param string $name The name of the child to remove
80 *
81 * @return FormInterface The form instance
82 *
83 * @throws Exception\AlreadySubmittedException If the form has already been submitted.
84 */
85 public function remove($name);
86
87 /**
88 * Returns all children in this group.
89 *
90 * @return FormInterface[] An array of FormInterface instances
91 */
92 public function all();
93
94 /**
95 * Returns all errors.
96 *
97 * @return FormError[] An array of FormError instances that occurred during validation
98 */
99 public function getErrors();
100
101 /**
102 * Updates the form with default data.
103 *
104 * @param mixed $modelData The data formatted as expected for the underlying object
105 *
106 * @return FormInterface The form instance
107 *
108 * @throws Exception\AlreadySubmittedException If the form has already been submitted.
109 * @throws Exception\LogicException If listeners try to call setData in a cycle. Or if
110 * the view data does not match the expected type
111 * according to {@link FormConfigInterface::getDataClass}.
112 */
113 public function setData($modelData);
114
115 /**
116 * Returns the data in the format needed for the underlying object.
117 *
118 * @return mixed
119 */
120 public function getData();
121
122 /**
123 * Returns the normalized data of the field.
124 *
125 * @return mixed When the field is not submitted, the default data is returned.
126 * When the field is submitted, the normalized submitted data is
127 * returned if the field is valid, null otherwise.
128 */
129 public function getNormData();
130
131 /**
132 * Returns the data transformed by the value transformer.
133 *
134 * @return mixed
135 */
136 public function getViewData();
137
138 /**
139 * Returns the extra data.
140 *
141 * @return array The submitted data which do not belong to a child
142 */
143 public function getExtraData();
144
145 /**
146 * Returns the form's configuration.
147 *
148 * @return FormConfigInterface The configuration.
149 */
150 public function getConfig();
151
152 /**
153 * Returns whether the form is submitted.
154 *
155 * @return Boolean true if the form is submitted, false otherwise
156 */
157 public function isSubmitted();
158
159 /**
160 * Returns the name by which the form is identified in forms.
161 *
162 * @return string The name of the form.
163 */
164 public function getName();
165
166 /**
167 * Returns the property path that the form is mapped to.
168 *
169 * @return \Symfony\Component\PropertyAccess\PropertyPathInterface The property path.
170 */
171 public function getPropertyPath();
172
173 /**
174 * Adds an error to this form.
175 *
176 * @param FormError $error
177 *
178 * @return FormInterface The form instance
179 */
180 public function addError(FormError $error);
181
182 /**
183 * Returns whether the form and all children are valid.
184 *
185 * If the form is not submitted, this method always returns false.
186 *
187 * @return Boolean
188 */
189 public function isValid();
190
191 /**
192 * Returns whether the form is required to be filled out.
193 *
194 * If the form has a parent and the parent is not required, this method
195 * will always return false. Otherwise the value set with setRequired()
196 * is returned.
197 *
198 * @return Boolean
199 */
200 public function isRequired();
201
202 /**
203 * Returns whether this form is disabled.
204 *
205 * The content of a disabled form is displayed, but not allowed to be
206 * modified. The validation of modified disabled forms should fail.
207 *
208 * Forms whose parents are disabled are considered disabled regardless of
209 * their own state.
210 *
211 * @return Boolean
212 */
213 public function isDisabled();
214
215 /**
216 * Returns whether the form is empty.
217 *
218 * @return Boolean
219 */
220 public function isEmpty();
221
222 /**
223 * Returns whether the data in the different formats is synchronized.
224 *
225 * @return Boolean
226 */
227 public function isSynchronized();
228
229 /**
230 * Initializes the form tree.
231 *
232 * Should be called on the root form after constructing the tree.
233 *
234 * @return FormInterface The form instance.
235 */
236 public function initialize();
237
238 /**
239 * Inspects the given request and calls {@link submit()} if the form was
240 * submitted.
241 *
242 * Internally, the request is forwarded to the configured
243 * {@link RequestHandlerInterface} instance, which determines whether to
244 * submit the form or not.
245 *
246 * @param mixed $request The request to handle.
247 *
248 * @return FormInterface The form instance.
249 */
250 public function handleRequest($request = null);
251
252 /**
253 * Submits data to the form, transforms and validates it.
254 *
255 * @param null|string|array $submittedData The submitted data.
256 * @param Boolean $clearMissing Whether to set fields to NULL
257 * when they are missing in the
258 * submitted data.
259 *
260 * @return FormInterface The form instance
261 *
262 * @throws Exception\AlreadySubmittedException If the form has already been submitted.
263 */
264 public function submit($submittedData, $clearMissing = true);
265
266 /**
267 * Returns the root of the form tree.
268 *
269 * @return FormInterface The root of the tree
270 */
271 public function getRoot();
272
273 /**
274 * Returns whether the field is the root of the form tree.
275 *
276 * @return Boolean
277 */
278 public function isRoot();
279
280 /**
281 * Creates a view.
282 *
283 * @param FormView $parent The parent view
284 *
285 * @return FormView The view
286 */
287 public function createView(FormView $parent = null);
288}
diff --git a/vendor/symfony/form/Symfony/Component/Form/FormRegistry.php b/vendor/symfony/form/Symfony/Component/Form/FormRegistry.php
deleted file mode 100644
index 0267a565..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/FormRegistry.php
+++ /dev/null
@@ -1,180 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form;
13
14use Symfony\Component\Form\Exception\ExceptionInterface;
15use Symfony\Component\Form\Exception\UnexpectedTypeException;
16use Symfony\Component\Form\Exception\InvalidArgumentException;
17
18/**
19 * The central registry of the Form component.
20 *
21 * @author Bernhard Schussek <bschussek@gmail.com>
22 */
23class FormRegistry implements FormRegistryInterface
24{
25 /**
26 * Extensions
27 *
28 * @var FormExtensionInterface[] An array of FormExtensionInterface
29 */
30 private $extensions = array();
31
32 /**
33 * @var array
34 */
35 private $types = array();
36
37 /**
38 * @var FormTypeGuesserInterface|false|null
39 */
40 private $guesser = false;
41
42 /**
43 * @var ResolvedFormTypeFactoryInterface
44 */
45 private $resolvedTypeFactory;
46
47 /**
48 * Constructor.
49 *
50 * @param FormExtensionInterface[] $extensions An array of FormExtensionInterface
51 * @param ResolvedFormTypeFactoryInterface $resolvedTypeFactory The factory for resolved form types.
52 *
53 * @throws UnexpectedTypeException if any extension does not implement FormExtensionInterface
54 */
55 public function __construct(array $extensions, ResolvedFormTypeFactoryInterface $resolvedTypeFactory)
56 {
57 foreach ($extensions as $extension) {
58 if (!$extension instanceof FormExtensionInterface) {
59 throw new UnexpectedTypeException($extension, 'Symfony\Component\Form\FormExtensionInterface');
60 }
61 }
62
63 $this->extensions = $extensions;
64 $this->resolvedTypeFactory = $resolvedTypeFactory;
65 }
66
67 /**
68 * {@inheritdoc}
69 */
70 public function getType($name)
71 {
72 if (!is_string($name)) {
73 throw new UnexpectedTypeException($name, 'string');
74 }
75
76 if (!isset($this->types[$name])) {
77 /** @var FormTypeInterface $type */
78 $type = null;
79
80 foreach ($this->extensions as $extension) {
81 /* @var FormExtensionInterface $extension */
82 if ($extension->hasType($name)) {
83 $type = $extension->getType($name);
84 break;
85 }
86 }
87
88 if (!$type) {
89 throw new InvalidArgumentException(sprintf('Could not load type "%s"', $name));
90 }
91
92 $this->resolveAndAddType($type);
93 }
94
95 return $this->types[$name];
96 }
97
98 /**
99 * Wraps a type into a ResolvedFormTypeInterface implementation and connects
100 * it with its parent type.
101 *
102 * @param FormTypeInterface $type The type to resolve.
103 *
104 * @return ResolvedFormTypeInterface The resolved type.
105 */
106 private function resolveAndAddType(FormTypeInterface $type)
107 {
108 $parentType = $type->getParent();
109
110 if ($parentType instanceof FormTypeInterface) {
111 $this->resolveAndAddType($parentType);
112 $parentType = $parentType->getName();
113 }
114
115 $typeExtensions = array();
116
117 foreach ($this->extensions as $extension) {
118 /* @var FormExtensionInterface $extension */
119 $typeExtensions = array_merge(
120 $typeExtensions,
121 $extension->getTypeExtensions($type->getName())
122 );
123 }
124
125 $this->types[$type->getName()] = $this->resolvedTypeFactory->createResolvedType(
126 $type,
127 $typeExtensions,
128 $parentType ? $this->getType($parentType) : null
129 );
130 }
131
132 /**
133 * {@inheritdoc}
134 */
135 public function hasType($name)
136 {
137 if (isset($this->types[$name])) {
138 return true;
139 }
140
141 try {
142 $this->getType($name);
143 } catch (ExceptionInterface $e) {
144 return false;
145 }
146
147 return true;
148 }
149
150 /**
151 * {@inheritdoc}
152 */
153 public function getTypeGuesser()
154 {
155 if (false === $this->guesser) {
156 $guessers = array();
157
158 foreach ($this->extensions as $extension) {
159 /* @var FormExtensionInterface $extension */
160 $guesser = $extension->getTypeGuesser();
161
162 if ($guesser) {
163 $guessers[] = $guesser;
164 }
165 }
166
167 $this->guesser = !empty($guessers) ? new FormTypeGuesserChain($guessers) : null;
168 }
169
170 return $this->guesser;
171 }
172
173 /**
174 * {@inheritdoc}
175 */
176 public function getExtensions()
177 {
178 return $this->extensions;
179 }
180}
diff --git a/vendor/symfony/form/Symfony/Component/Form/FormRegistryInterface.php b/vendor/symfony/form/Symfony/Component/Form/FormRegistryInterface.php
deleted file mode 100644
index 16cd9384..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/FormRegistryInterface.php
+++ /dev/null
@@ -1,57 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form;
13
14/**
15 * The central registry of the Form component.
16 *
17 * @author Bernhard Schussek <bschussek@gmail.com>
18 */
19interface FormRegistryInterface
20{
21 /**
22 * Returns a form type by name.
23 *
24 * This methods registers the type extensions from the form extensions.
25 *
26 * @param string $name The name of the type
27 *
28 * @return ResolvedFormTypeInterface The type
29 *
30 * @throws Exception\UnexpectedTypeException if the passed name is not a string
31 * @throws Exception\InvalidArgumentException if the type can not be retrieved from any extension
32 */
33 public function getType($name);
34
35 /**
36 * Returns whether the given form type is supported.
37 *
38 * @param string $name The name of the type
39 *
40 * @return Boolean Whether the type is supported
41 */
42 public function hasType($name);
43
44 /**
45 * Returns the guesser responsible for guessing types.
46 *
47 * @return FormTypeGuesserInterface|null
48 */
49 public function getTypeGuesser();
50
51 /**
52 * Returns the extensions loaded by the framework.
53 *
54 * @return array
55 */
56 public function getExtensions();
57}
diff --git a/vendor/symfony/form/Symfony/Component/Form/FormRenderer.php b/vendor/symfony/form/Symfony/Component/Form/FormRenderer.php
deleted file mode 100644
index 09b01056..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/FormRenderer.php
+++ /dev/null
@@ -1,304 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form;
13
14use Symfony\Component\Form\Exception\LogicException;
15use Symfony\Component\Form\Exception\BadMethodCallException;
16use Symfony\Component\Form\Extension\Csrf\CsrfProvider\CsrfProviderInterface;
17
18/**
19 * Renders a form into HTML using a rendering engine.
20 *
21 * @author Bernhard Schussek <bschussek@gmail.com>
22 */
23class FormRenderer implements FormRendererInterface
24{
25 const CACHE_KEY_VAR = 'unique_block_prefix';
26
27 /**
28 * @var FormRendererEngineInterface
29 */
30 private $engine;
31
32 /**
33 * @var CsrfProviderInterface
34 */
35 private $csrfProvider;
36
37 /**
38 * @var array
39 */
40 private $blockNameHierarchyMap = array();
41
42 /**
43 * @var array
44 */
45 private $hierarchyLevelMap = array();
46
47 /**
48 * @var array
49 */
50 private $variableStack = array();
51
52 public function __construct(FormRendererEngineInterface $engine, CsrfProviderInterface $csrfProvider = null)
53 {
54 $this->engine = $engine;
55 $this->csrfProvider = $csrfProvider;
56 }
57
58 /**
59 * {@inheritdoc}
60 */
61 public function getEngine()
62 {
63 return $this->engine;
64 }
65
66 /**
67 * {@inheritdoc}
68 */
69 public function setTheme(FormView $view, $themes)
70 {
71 $this->engine->setTheme($view, $themes);
72 }
73
74 /**
75 * {@inheritdoc}
76 */
77 public function renderCsrfToken($intention)
78 {
79 if (null === $this->csrfProvider) {
80 throw new BadMethodCallException('CSRF token can only be generated if a CsrfProviderInterface is injected in the constructor.');
81 }
82
83 return $this->csrfProvider->generateCsrfToken($intention);
84 }
85
86 /**
87 * {@inheritdoc}
88 */
89 public function renderBlock(FormView $view, $blockName, array $variables = array())
90 {
91 $resource = $this->engine->getResourceForBlockName($view, $blockName);
92
93 if (!$resource) {
94 throw new LogicException(sprintf('No block "%s" found while rendering the form.', $blockName));
95 }
96
97 $viewCacheKey = $view->vars[self::CACHE_KEY_VAR];
98
99 // The variables are cached globally for a view (instead of for the
100 // current suffix)
101 if (!isset($this->variableStack[$viewCacheKey])) {
102 $this->variableStack[$viewCacheKey] = array();
103
104 // The default variable scope contains all view variables, merged with
105 // the variables passed explicitly to the helper
106 $scopeVariables = $view->vars;
107
108 $varInit = true;
109 } else {
110 // Reuse the current scope and merge it with the explicitly passed variables
111 $scopeVariables = end($this->variableStack[$viewCacheKey]);
112
113 $varInit = false;
114 }
115
116 // Merge the passed with the existing attributes
117 if (isset($variables['attr']) && isset($scopeVariables['attr'])) {
118 $variables['attr'] = array_replace($scopeVariables['attr'], $variables['attr']);
119 }
120
121 // Merge the passed with the exist *label* attributes
122 if (isset($variables['label_attr']) && isset($scopeVariables['label_attr'])) {
123 $variables['label_attr'] = array_replace($scopeVariables['label_attr'], $variables['label_attr']);
124 }
125
126 // Do not use array_replace_recursive(), otherwise array variables
127 // cannot be overwritten
128 $variables = array_replace($scopeVariables, $variables);
129
130 $this->variableStack[$viewCacheKey][] = $variables;
131
132 // Do the rendering
133 $html = $this->engine->renderBlock($view, $resource, $blockName, $variables);
134
135 // Clear the stack
136 array_pop($this->variableStack[$viewCacheKey]);
137
138 if ($varInit) {
139 unset($this->variableStack[$viewCacheKey]);
140 }
141
142 return $html;
143 }
144
145 /**
146 * {@inheritdoc}
147 */
148 public function searchAndRenderBlock(FormView $view, $blockNameSuffix, array $variables = array())
149 {
150 $renderOnlyOnce = 'row' === $blockNameSuffix || 'widget' === $blockNameSuffix;
151
152 if ($renderOnlyOnce && $view->isRendered()) {
153 return '';
154 }
155
156 // The cache key for storing the variables and types
157 $viewCacheKey = $view->vars[self::CACHE_KEY_VAR];
158 $viewAndSuffixCacheKey = $viewCacheKey.$blockNameSuffix;
159
160 // In templates, we have to deal with two kinds of block hierarchies:
161 //
162 // +---------+ +---------+
163 // | Theme B | -------> | Theme A |
164 // +---------+ +---------+
165 //
166 // form_widget -------> form_widget
167 // ^
168 // |
169 // choice_widget -----> choice_widget
170 //
171 // The first kind of hierarchy is the theme hierarchy. This allows to
172 // override the block "choice_widget" from Theme A in the extending
173 // Theme B. This kind of inheritance needs to be supported by the
174 // template engine and, for example, offers "parent()" or similar
175 // functions to fall back from the custom to the parent implementation.
176 //
177 // The second kind of hierarchy is the form type hierarchy. This allows
178 // to implement a custom "choice_widget" block (no matter in which theme),
179 // or to fallback to the block of the parent type, which would be
180 // "form_widget" in this example (again, no matter in which theme).
181 // If the designer wants to explicitly fallback to "form_widget" in his
182 // custom "choice_widget", for example because he only wants to wrap
183 // a <div> around the original implementation, he can simply call the
184 // widget() function again to render the block for the parent type.
185 //
186 // The second kind is implemented in the following blocks.
187 if (!isset($this->blockNameHierarchyMap[$viewAndSuffixCacheKey])) {
188 // INITIAL CALL
189 // Calculate the hierarchy of template blocks and start on
190 // the bottom level of the hierarchy (= "_<id>_<section>" block)
191 $blockNameHierarchy = array();
192 foreach ($view->vars['block_prefixes'] as $blockNamePrefix) {
193 $blockNameHierarchy[] = $blockNamePrefix.'_'.$blockNameSuffix;
194 }
195 $hierarchyLevel = count($blockNameHierarchy) - 1;
196
197 $hierarchyInit = true;
198 } else {
199 // RECURSIVE CALL
200 // If a block recursively calls searchAndRenderBlock() again, resume rendering
201 // using the parent type in the hierarchy.
202 $blockNameHierarchy = $this->blockNameHierarchyMap[$viewAndSuffixCacheKey];
203 $hierarchyLevel = $this->hierarchyLevelMap[$viewAndSuffixCacheKey] - 1;
204
205 $hierarchyInit = false;
206 }
207
208 // The variables are cached globally for a view (instead of for the
209 // current suffix)
210 if (!isset($this->variableStack[$viewCacheKey])) {
211 $this->variableStack[$viewCacheKey] = array();
212
213 // The default variable scope contains all view variables, merged with
214 // the variables passed explicitly to the helper
215 $scopeVariables = $view->vars;
216
217 $varInit = true;
218 } else {
219 // Reuse the current scope and merge it with the explicitly passed variables
220 $scopeVariables = end($this->variableStack[$viewCacheKey]);
221
222 $varInit = false;
223 }
224
225 // Load the resource where this block can be found
226 $resource = $this->engine->getResourceForBlockNameHierarchy($view, $blockNameHierarchy, $hierarchyLevel);
227
228 // Update the current hierarchy level to the one at which the resource was
229 // found. For example, if looking for "choice_widget", but only a resource
230 // is found for its parent "form_widget", then the level is updated here
231 // to the parent level.
232 $hierarchyLevel = $this->engine->getResourceHierarchyLevel($view, $blockNameHierarchy, $hierarchyLevel);
233
234 // The actually existing block name in $resource
235 $blockName = $blockNameHierarchy[$hierarchyLevel];
236
237 // Escape if no resource exists for this block
238 if (!$resource) {
239 throw new LogicException(sprintf(
240 'Unable to render the form as none of the following blocks exist: "%s".',
241 implode('", "', array_reverse($blockNameHierarchy))
242 ));
243 }
244
245 // Merge the passed with the existing attributes
246 if (isset($variables['attr']) && isset($scopeVariables['attr'])) {
247 $variables['attr'] = array_replace($scopeVariables['attr'], $variables['attr']);
248 }
249
250 // Merge the passed with the exist *label* attributes
251 if (isset($variables['label_attr']) && isset($scopeVariables['label_attr'])) {
252 $variables['label_attr'] = array_replace($scopeVariables['label_attr'], $variables['label_attr']);
253 }
254
255 // Do not use array_replace_recursive(), otherwise array variables
256 // cannot be overwritten
257 $variables = array_replace($scopeVariables, $variables);
258
259 // In order to make recursive calls possible, we need to store the block hierarchy,
260 // the current level of the hierarchy and the variables so that this method can
261 // resume rendering one level higher of the hierarchy when it is called recursively.
262 //
263 // We need to store these values in maps (associative arrays) because within a
264 // call to widget() another call to widget() can be made, but for a different view
265 // object. These nested calls should not override each other.
266 $this->blockNameHierarchyMap[$viewAndSuffixCacheKey] = $blockNameHierarchy;
267 $this->hierarchyLevelMap[$viewAndSuffixCacheKey] = $hierarchyLevel;
268
269 // We also need to store the variables for the view so that we can render other
270 // blocks for the same view using the same variables as in the outer block.
271 $this->variableStack[$viewCacheKey][] = $variables;
272
273 // Do the rendering
274 $html = $this->engine->renderBlock($view, $resource, $blockName, $variables);
275
276 // Clear the stack
277 array_pop($this->variableStack[$viewCacheKey]);
278
279 // Clear the caches if they were filled for the first time within
280 // this function call
281 if ($hierarchyInit) {
282 unset($this->blockNameHierarchyMap[$viewAndSuffixCacheKey]);
283 unset($this->hierarchyLevelMap[$viewAndSuffixCacheKey]);
284 }
285
286 if ($varInit) {
287 unset($this->variableStack[$viewCacheKey]);
288 }
289
290 if ($renderOnlyOnce) {
291 $view->setRendered();
292 }
293
294 return $html;
295 }
296
297 /**
298 * {@inheritdoc}
299 */
300 public function humanize($text)
301 {
302 return ucfirst(trim(strtolower(preg_replace(array('/([A-Z])/', '/[_\s]+/'), array('_$1', ' '), $text))));
303 }
304}
diff --git a/vendor/symfony/form/Symfony/Component/Form/FormRendererEngineInterface.php b/vendor/symfony/form/Symfony/Component/Form/FormRendererEngineInterface.php
deleted file mode 100644
index e06824ec..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/FormRendererEngineInterface.php
+++ /dev/null
@@ -1,150 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form;
13
14/**
15 * Adapter for rendering form templates with a specific templating engine.
16 *
17 * @author Bernhard Schussek <bschussek@gmail.com>
18 */
19interface FormRendererEngineInterface
20{
21 /**
22 * Sets the theme(s) to be used for rendering a view and its children.
23 *
24 * @param FormView $view The view to assign the theme(s) to.
25 * @param mixed $themes The theme(s). The type of these themes
26 * is open to the implementation.
27 */
28 public function setTheme(FormView $view, $themes);
29
30 /**
31 * Returns the resource for a block name.
32 *
33 * The resource is first searched in the themes attached to $view, then
34 * in the themes of its parent view and so on, until a resource was found.
35 *
36 * The type of the resource is decided by the implementation. The resource
37 * is later passed to {@link renderBlock()} by the rendering algorithm.
38 *
39 * @param FormView $view The view for determining the used themes.
40 * First the themes attached directly to the
41 * view with {@link setTheme()} are considered,
42 * then the ones of its parent etc.
43 * @param string $blockName The name of the block to render.
44 *
45 * @return mixed The renderer resource or false, if none was found.
46 */
47 public function getResourceForBlockName(FormView $view, $blockName);
48
49 /**
50 * Returns the resource for a block hierarchy.
51 *
52 * A block hierarchy is an array which starts with the root of the hierarchy
53 * and continues with the child of that root, the child of that child etc.
54 * The following is an example for a block hierarchy:
55 *
56 * <code>
57 * form_widget
58 * text_widget
59 * url_widget
60 * </code>
61 *
62 * In this example, "url_widget" is the most specific block, while the other
63 * blocks are its ancestors in the hierarchy.
64 *
65 * The second parameter $hierarchyLevel determines the level of the hierarchy
66 * that should be rendered. For example, if $hierarchyLevel is 2 for the
67 * above hierarchy, the engine will first look for the block "url_widget",
68 * then, if that does not exist, for the block "text_widget" etc.
69 *
70 * The type of the resource is decided by the implementation. The resource
71 * is later passed to {@link renderBlock()} by the rendering algorithm.
72 *
73 * @param FormView $view The view for determining the
74 * used themes. First the themes
75 * attached directly to the view
76 * with {@link setTheme()} are
77 * considered, then the ones of
78 * its parent etc.
79 * @param array $blockNameHierarchy The block name hierarchy, with
80 * the root block at the beginning.
81 * @param integer $hierarchyLevel The level in the hierarchy at
82 * which to start looking. Level 0
83 * indicates the root block, i.e.
84 * the first element of
85 * $blockNameHierarchy.
86 *
87 * @return mixed The renderer resource or false, if none was found.
88 */
89 public function getResourceForBlockNameHierarchy(FormView $view, array $blockNameHierarchy, $hierarchyLevel);
90
91 /**
92 * Returns the hierarchy level at which a resource can be found.
93 *
94 * A block hierarchy is an array which starts with the root of the hierarchy
95 * and continues with the child of that root, the child of that child etc.
96 * The following is an example for a block hierarchy:
97 *
98 * <code>
99 * form_widget
100 * text_widget
101 * url_widget
102 * </code>
103 *
104 * The second parameter $hierarchyLevel determines the level of the hierarchy
105 * that should be rendered.
106 *
107 * If we call this method with the hierarchy level 2, the engine will first
108 * look for a resource for block "url_widget". If such a resource exists,
109 * the method returns 2. Otherwise it tries to find a resource for block
110 * "text_widget" (at level 1) and, again, returns 1 if a resource was found.
111 * The method continues to look for resources until the root level was
112 * reached and nothing was found. In this case false is returned.
113 *
114 * The type of the resource is decided by the implementation. The resource
115 * is later passed to {@link renderBlock()} by the rendering algorithm.
116 *
117 * @param FormView $view The view for determining the
118 * used themes. First the themes
119 * attached directly to the view
120 * with {@link setTheme()} are
121 * considered, then the ones of
122 * its parent etc.
123 * @param array $blockNameHierarchy The block name hierarchy, with
124 * the root block at the beginning.
125 * @param integer $hierarchyLevel The level in the hierarchy at
126 * which to start looking. Level 0
127 * indicates the root block, i.e.
128 * the first element of
129 * $blockNameHierarchy.
130 *
131 * @return integer|Boolean The hierarchy level or false, if no resource was found.
132 */
133 public function getResourceHierarchyLevel(FormView $view, array $blockNameHierarchy, $hierarchyLevel);
134
135 /**
136 * Renders a block in the given renderer resource.
137 *
138 * The resource can be obtained by calling {@link getResourceForBlock()}
139 * or {@link getResourceForBlockHierarchy()}. The type of the resource is
140 * decided by the implementation.
141 *
142 * @param FormView $view The view to render.
143 * @param mixed $resource The renderer resource.
144 * @param string $blockName The name of the block to render.
145 * @param array $variables The variables to pass to the template.
146 *
147 * @return string The HTML markup.
148 */
149 public function renderBlock(FormView $view, $resource, $blockName, array $variables = array());
150}
diff --git a/vendor/symfony/form/Symfony/Component/Form/FormRendererInterface.php b/vendor/symfony/form/Symfony/Component/Form/FormRendererInterface.php
deleted file mode 100644
index 848e7125..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/FormRendererInterface.php
+++ /dev/null
@@ -1,103 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form;
13
14/**
15 * Renders a form into HTML.
16 *
17 * @author Bernhard Schussek <bschussek@gmail.com>
18 */
19interface FormRendererInterface
20{
21 /**
22 * Returns the engine used by this renderer.
23 *
24 * @return FormRendererEngineInterface The renderer engine.
25 */
26 public function getEngine();
27
28 /**
29 * Sets the theme(s) to be used for rendering a view and its children.
30 *
31 * @param FormView $view The view to assign the theme(s) to.
32 * @param mixed $themes The theme(s). The type of these themes
33 * is open to the implementation.
34 */
35 public function setTheme(FormView $view, $themes);
36
37 /**
38 * Renders a named block of the form theme.
39 *
40 * @param FormView $view The view for which to render the block.
41 * @param string $blockName The name of the block.
42 * @param array $variables The variables to pass to the template.
43 *
44 * @return string The HTML markup
45 */
46 public function renderBlock(FormView $view, $blockName, array $variables = array());
47
48 /**
49 * Searches and renders a block for a given name suffix.
50 *
51 * The block is searched by combining the block names stored in the
52 * form view with the given suffix. If a block name is found, that
53 * block is rendered.
54 *
55 * If this method is called recursively, the block search is continued
56 * where a block was found before.
57 *
58 * @param FormView $view The view for which to render the block.
59 * @param string $blockNameSuffix The suffix of the block name.
60 * @param array $variables The variables to pass to the template.
61 *
62 * @return string The HTML markup
63 */
64 public function searchAndRenderBlock(FormView $view, $blockNameSuffix, array $variables = array());
65
66 /**
67 * Renders a CSRF token.
68 *
69 * Use this helper for CSRF protection without the overhead of creating a
70 * form.
71 *
72 * <code>
73 * <input type="hidden" name="token" value="<?php $renderer->renderCsrfToken('rm_user_'.$user->getId()) ?>">
74 * </code>
75 *
76 * Check the token in your action using the same intention.
77 *
78 * <code>
79 * $csrfProvider = $this->get('form.csrf_provider');
80 * if (!$csrfProvider->isCsrfTokenValid('rm_user_'.$user->getId(), $token)) {
81 * throw new \RuntimeException('CSRF attack detected.');
82 * }
83 * </code>
84 *
85 * @param string $intention The intention of the protected action
86 *
87 * @return string A CSRF token
88 */
89 public function renderCsrfToken($intention);
90
91 /**
92 * Makes a technical name human readable.
93 *
94 * Sequences of underscores are replaced by single spaces. The first letter
95 * of the resulting string is capitalized, while all other letters are
96 * turned to lowercase.
97 *
98 * @param string $text The text to humanize.
99 *
100 * @return string The humanized text.
101 */
102 public function humanize($text);
103}
diff --git a/vendor/symfony/form/Symfony/Component/Form/FormTypeExtensionInterface.php b/vendor/symfony/form/Symfony/Component/Form/FormTypeExtensionInterface.php
deleted file mode 100644
index 9866b28b..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/FormTypeExtensionInterface.php
+++ /dev/null
@@ -1,75 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form;
13
14use Symfony\Component\OptionsResolver\OptionsResolverInterface;
15
16/**
17 * @author Bernhard Schussek <bschussek@gmail.com>
18 */
19interface FormTypeExtensionInterface
20{
21 /**
22 * Builds the form.
23 *
24 * This method is called after the extended type has built the form to
25 * further modify it.
26 *
27 * @see FormTypeInterface::buildForm()
28 *
29 * @param FormBuilderInterface $builder The form builder
30 * @param array $options The options
31 */
32 public function buildForm(FormBuilderInterface $builder, array $options);
33
34 /**
35 * Builds the view.
36 *
37 * This method is called after the extended type has built the view to
38 * further modify it.
39 *
40 * @see FormTypeInterface::buildView()
41 *
42 * @param FormView $view The view
43 * @param FormInterface $form The form
44 * @param array $options The options
45 */
46 public function buildView(FormView $view, FormInterface $form, array $options);
47
48 /**
49 * Finishes the view.
50 *
51 * This method is called after the extended type has finished the view to
52 * further modify it.
53 *
54 * @see FormTypeInterface::finishView()
55 *
56 * @param FormView $view The view
57 * @param FormInterface $form The form
58 * @param array $options The options
59 */
60 public function finishView(FormView $view, FormInterface $form, array $options);
61
62 /**
63 * Overrides the default options from the extended type.
64 *
65 * @param OptionsResolverInterface $resolver The resolver for the options.
66 */
67 public function setDefaultOptions(OptionsResolverInterface $resolver);
68
69 /**
70 * Returns the name of the type being extended.
71 *
72 * @return string The name of the type being extended
73 */
74 public function getExtendedType();
75}
diff --git a/vendor/symfony/form/Symfony/Component/Form/FormTypeGuesserChain.php b/vendor/symfony/form/Symfony/Component/Form/FormTypeGuesserChain.php
deleted file mode 100644
index c7f8ece3..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/FormTypeGuesserChain.php
+++ /dev/null
@@ -1,104 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form;
13
14use Symfony\Component\Form\Guess\Guess;
15use Symfony\Component\Form\Exception\UnexpectedTypeException;
16
17class FormTypeGuesserChain implements FormTypeGuesserInterface
18{
19 private $guessers = array();
20
21 /**
22 * Constructor.
23 *
24 * @param array $guessers Guessers as instances of FormTypeGuesserInterface
25 *
26 * @throws UnexpectedTypeException if any guesser does not implement FormTypeGuesserInterface
27 */
28 public function __construct(array $guessers)
29 {
30 foreach ($guessers as $guesser) {
31 if (!$guesser instanceof FormTypeGuesserInterface) {
32 throw new UnexpectedTypeException($guesser, 'Symfony\Component\Form\FormTypeGuesserInterface');
33 }
34
35 if ($guesser instanceof self) {
36 $this->guessers = array_merge($this->guessers, $guesser->guessers);
37 } else {
38 $this->guessers[] = $guesser;
39 }
40 }
41 }
42
43 /**
44 * {@inheritDoc}
45 */
46 public function guessType($class, $property)
47 {
48 return $this->guess(function ($guesser) use ($class, $property) {
49 return $guesser->guessType($class, $property);
50 });
51 }
52
53 /**
54 * {@inheritDoc}
55 */
56 public function guessRequired($class, $property)
57 {
58 return $this->guess(function ($guesser) use ($class, $property) {
59 return $guesser->guessRequired($class, $property);
60 });
61 }
62
63 /**
64 * {@inheritDoc}
65 */
66 public function guessMaxLength($class, $property)
67 {
68 return $this->guess(function ($guesser) use ($class, $property) {
69 return $guesser->guessMaxLength($class, $property);
70 });
71 }
72
73 /**
74 * {@inheritDoc}
75 */
76 public function guessPattern($class, $property)
77 {
78 return $this->guess(function ($guesser) use ($class, $property) {
79 return $guesser->guessPattern($class, $property);
80 });
81 }
82
83 /**
84 * Executes a closure for each guesser and returns the best guess from the
85 * return values
86 *
87 * @param \Closure $closure The closure to execute. Accepts a guesser
88 * as argument and should return a Guess instance
89 *
90 * @return Guess The guess with the highest confidence
91 */
92 private function guess(\Closure $closure)
93 {
94 $guesses = array();
95
96 foreach ($this->guessers as $guesser) {
97 if ($guess = $closure($guesser)) {
98 $guesses[] = $guess;
99 }
100 }
101
102 return Guess::getBestGuess($guesses);
103 }
104}
diff --git a/vendor/symfony/form/Symfony/Component/Form/FormTypeGuesserInterface.php b/vendor/symfony/form/Symfony/Component/Form/FormTypeGuesserInterface.php
deleted file mode 100644
index e8b603fa..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/FormTypeGuesserInterface.php
+++ /dev/null
@@ -1,64 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form;
13
14/**
15 * @author Bernhard Schussek <bschussek@gmail.com>
16 */
17interface FormTypeGuesserInterface
18{
19 /**
20 * Returns a field guess for a property name of a class
21 *
22 * @param string $class The fully qualified class name
23 * @param string $property The name of the property to guess for
24 *
25 * @return Guess\TypeGuess A guess for the field's type and options
26 */
27 public function guessType($class, $property);
28
29 /**
30 * Returns a guess whether a property of a class is required
31 *
32 * @param string $class The fully qualified class name
33 * @param string $property The name of the property to guess for
34 *
35 * @return Guess\Guess A guess for the field's required setting
36 */
37 public function guessRequired($class, $property);
38
39 /**
40 * Returns a guess about the field's maximum length
41 *
42 * @param string $class The fully qualified class name
43 * @param string $property The name of the property to guess for
44 *
45 * @return Guess\Guess A guess for the field's maximum length
46 */
47 public function guessMaxLength($class, $property);
48
49 /**
50 * Returns a guess about the field's pattern
51 *
52 * - When you have a min value, you guess a min length of this min (LOW_CONFIDENCE) , lines below
53 * - If this value is a float type, this is wrong so you guess null with MEDIUM_CONFIDENCE to override the previous guess.
54 * Example:
55 * You want a float greater than 5, 4.512313 is not valid but length(4.512314) > length(5)
56 * @link https://github.com/symfony/symfony/pull/3927
57 *
58 * @param string $class The fully qualified class name
59 * @param string $property The name of the property to guess for
60 *
61 * @return Guess\Guess A guess for the field's required pattern
62 */
63 public function guessPattern($class, $property);
64}
diff --git a/vendor/symfony/form/Symfony/Component/Form/FormTypeInterface.php b/vendor/symfony/form/Symfony/Component/Form/FormTypeInterface.php
deleted file mode 100644
index bcef73c6..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/FormTypeInterface.php
+++ /dev/null
@@ -1,95 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form;
13
14use Symfony\Component\OptionsResolver\OptionsResolverInterface;
15
16/**
17 * @author Bernhard Schussek <bschussek@gmail.com>
18 */
19interface FormTypeInterface
20{
21 /**
22 * Builds the form.
23 *
24 * This method is called for each type in the hierarchy starting form the
25 * top most type. Type extensions can further modify the form.
26 *
27 * @see FormTypeExtensionInterface::buildForm()
28 *
29 * @param FormBuilderInterface $builder The form builder
30 * @param array $options The options
31 */
32 public function buildForm(FormBuilderInterface $builder, array $options);
33
34 /**
35 * Builds the form view.
36 *
37 * This method is called for each type in the hierarchy starting form the
38 * top most type. Type extensions can further modify the view.
39 *
40 * A view of a form is built before the views of the child forms are built.
41 * This means that you cannot access child views in this method. If you need
42 * to do so, move your logic to {@link finishView()} instead.
43 *
44 * @see FormTypeExtensionInterface::buildView()
45 *
46 * @param FormView $view The view
47 * @param FormInterface $form The form
48 * @param array $options The options
49 */
50 public function buildView(FormView $view, FormInterface $form, array $options);
51
52 /**
53 * Finishes the form view.
54 *
55 * This method gets called for each type in the hierarchy starting form the
56 * top most type. Type extensions can further modify the view.
57 *
58 * When this method is called, views of the form's children have already
59 * been built and finished and can be accessed. You should only implement
60 * such logic in this method that actually accesses child views. For everything
61 * else you are recommended to implement {@link buildView()} instead.
62 *
63 * @see FormTypeExtensionInterface::finishView()
64 *
65 * @param FormView $view The view
66 * @param FormInterface $form The form
67 * @param array $options The options
68 */
69 public function finishView(FormView $view, FormInterface $form, array $options);
70
71 /**
72 * Sets the default options for this type.
73 *
74 * @param OptionsResolverInterface $resolver The resolver for the options.
75 */
76 public function setDefaultOptions(OptionsResolverInterface $resolver);
77
78 /**
79 * Returns the name of the parent type.
80 *
81 * You can also return a type instance from this method, although doing so
82 * is discouraged because it leads to a performance penalty. The support
83 * for returning type instances may be dropped from future releases.
84 *
85 * @return string|null|FormTypeInterface The name of the parent type if any, null otherwise.
86 */
87 public function getParent();
88
89 /**
90 * Returns the name of this type.
91 *
92 * @return string The name of this type
93 */
94 public function getName();
95}
diff --git a/vendor/symfony/form/Symfony/Component/Form/FormView.php b/vendor/symfony/form/Symfony/Component/Form/FormView.php
deleted file mode 100644
index 1f53ec6a..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/FormView.php
+++ /dev/null
@@ -1,159 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form;
13
14use Symfony\Component\Form\Exception\BadMethodCallException;
15
16/**
17 * @author Bernhard Schussek <bschussek@gmail.com>
18 */
19class FormView implements \ArrayAccess, \IteratorAggregate, \Countable
20{
21 /**
22 * The variables assigned to this view.
23 * @var array
24 */
25 public $vars = array(
26 'value' => null,
27 'attr' => array(),
28 );
29
30 /**
31 * The parent view.
32 * @var FormView
33 */
34 public $parent;
35
36 /**
37 * The child views.
38 * @var array
39 */
40 public $children = array();
41
42 /**
43 * Is the form attached to this renderer rendered?
44 *
45 * Rendering happens when either the widget or the row method was called.
46 * Row implicitly includes widget, however certain rendering mechanisms
47 * have to skip widget rendering when a row is rendered.
48 *
49 * @var Boolean
50 */
51 private $rendered = false;
52
53 public function __construct(FormView $parent = null)
54 {
55 $this->parent = $parent;
56 }
57
58 /**
59 * Returns whether the view was already rendered.
60 *
61 * @return Boolean Whether this view's widget is rendered.
62 */
63 public function isRendered()
64 {
65 $hasChildren = 0 < count($this->children);
66
67 if (true === $this->rendered || !$hasChildren) {
68 return $this->rendered;
69 }
70
71 if ($hasChildren) {
72 foreach ($this->children as $child) {
73 if (!$child->isRendered()) {
74 return false;
75 }
76 }
77
78 return $this->rendered = true;
79 }
80
81 return false;
82 }
83
84 /**
85 * Marks the view as rendered.
86 *
87 * @return FormView The view object.
88 */
89 public function setRendered()
90 {
91 $this->rendered = true;
92
93 return $this;
94 }
95
96 /**
97 * Returns a child by name (implements \ArrayAccess).
98 *
99 * @param string $name The child name
100 *
101 * @return FormView The child view
102 */
103 public function offsetGet($name)
104 {
105 return $this->children[$name];
106 }
107
108 /**
109 * Returns whether the given child exists (implements \ArrayAccess).
110 *
111 * @param string $name The child name
112 *
113 * @return Boolean Whether the child view exists
114 */
115 public function offsetExists($name)
116 {
117 return isset($this->children[$name]);
118 }
119
120 /**
121 * Implements \ArrayAccess.
122 *
123 * @throws BadMethodCallException always as setting a child by name is not allowed
124 */
125 public function offsetSet($name, $value)
126 {
127 throw new BadMethodCallException('Not supported');
128 }
129
130 /**
131 * Removes a child (implements \ArrayAccess).
132 *
133 * @param string $name The child name
134 */
135 public function offsetUnset($name)
136 {
137 unset($this->children[$name]);
138 }
139
140 /**
141 * Returns an iterator to iterate over children (implements \IteratorAggregate)
142 *
143 * @return \ArrayIterator The iterator
144 */
145 public function getIterator()
146 {
147 return new \ArrayIterator($this->children);
148 }
149
150 /**
151 * Implements \Countable.
152 *
153 * @return integer The number of children views
154 */
155 public function count()
156 {
157 return count($this->children);
158 }
159}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Forms.php b/vendor/symfony/form/Symfony/Component/Form/Forms.php
deleted file mode 100644
index c949c1f4..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Forms.php
+++ /dev/null
@@ -1,185 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form;
13
14use Symfony\Component\Form\Extension\Core\CoreExtension;
15
16/**
17 * Entry point of the Form component.
18 *
19 * Use this class to conveniently create new form factories:
20 *
21 * <code>
22 * use Symfony\Component\Form\Forms;
23 *
24 * $formFactory = Forms::createFormFactory();
25 *
26 * $form = $formFactory->createBuilder()
27 * ->add('firstName', 'text')
28 * ->add('lastName', 'text')
29 * ->add('age', 'integer')
30 * ->add('gender', 'choice', array(
31 * 'choices' => array('m' => 'Male', 'f' => 'Female'),
32 * ))
33 * ->getForm();
34 * </code>
35 *
36 * You can also add custom extensions to the form factory:
37 *
38 * <code>
39 * $formFactory = Forms::createFormFactoryBuilder()
40 * ->addExtension(new AcmeExtension())
41 * ->getFormFactory();
42 * </code>
43 *
44 * If you create custom form types or type extensions, it is
45 * generally recommended to create your own extensions that lazily
46 * load these types and type extensions. In projects where performance
47 * does not matter that much, you can also pass them directly to the
48 * form factory:
49 *
50 * <code>
51 * $formFactory = Forms::createFormFactoryBuilder()
52 * ->addType(new PersonType())
53 * ->addType(new PhoneNumberType())
54 * ->addTypeExtension(new FormTypeHelpTextExtension())
55 * ->getFormFactory();
56 * </code>
57 *
58 * Support for CSRF protection is provided by the CsrfExtension.
59 * This extension needs a CSRF provider with a strong secret
60 * (e.g. a 20 character long random string). The default
61 * implementation for this is DefaultCsrfProvider:
62 *
63 * <code>
64 * use Symfony\Component\Form\Extension\Csrf\CsrfExtension;
65 * use Symfony\Component\Form\Extension\Csrf\CsrfProvider\DefaultCsrfProvider;
66 *
67 * $secret = 'V8a5Z97e...';
68 * $formFactory = Forms::createFormFactoryBuilder()
69 * ->addExtension(new CsrfExtension(new DefaultCsrfProvider($secret)))
70 * ->getFormFactory();
71 * </code>
72 *
73 * Support for the HttpFoundation is provided by the
74 * HttpFoundationExtension. You are also advised to load the CSRF
75 * extension with the driver for HttpFoundation's Session class:
76 *
77 * <code>
78 * use Symfony\Component\HttpFoundation\Session\Session;
79 * use Symfony\Component\Form\Extension\HttpFoundation\HttpFoundationExtension;
80 * use Symfony\Component\Form\Extension\Csrf\CsrfExtension;
81 * use Symfony\Component\Form\Extension\Csrf\CsrfProvider\SessionCsrfProvider;
82 *
83 * $session = new Session();
84 * $secret = 'V8a5Z97e...';
85 * $formFactory = Forms::createFormFactoryBuilder()
86 * ->addExtension(new HttpFoundationExtension())
87 * ->addExtension(new CsrfExtension(new SessionCsrfProvider($session, $secret)))
88 * ->getFormFactory();
89 * </code>
90 *
91 * Support for the Validator component is provided by ValidatorExtension.
92 * This extension needs a validator object to function properly:
93 *
94 * <code>
95 * use Symfony\Component\Validator\Validation;
96 * use Symfony\Component\Form\Extension\Validator\ValidatorExtension;
97 *
98 * $validator = Validation::createValidator();
99 * $formFactory = Forms::createFormFactoryBuilder()
100 * ->addExtension(new ValidatorExtension($validator))
101 * ->getFormFactory();
102 * </code>
103 *
104 * Support for the Templating component is provided by TemplatingExtension.
105 * This extension needs a PhpEngine object for rendering forms. As second
106 * argument you should pass the names of the default themes. Here is an
107 * example for using the default layout with "<div>" tags:
108 *
109 * <code>
110 * use Symfony\Component\Form\Extension\Templating\TemplatingExtension;
111 *
112 * $formFactory = Forms::createFormFactoryBuilder()
113 * ->addExtension(new TemplatingExtension($engine, null, array(
114 * 'FrameworkBundle:Form',
115 * )))
116 * ->getFormFactory();
117 * </code>
118 *
119 * The next example shows how to include the "<table>" layout:
120 *
121 * <code>
122 * use Symfony\Component\Form\Extension\Templating\TemplatingExtension;
123 *
124 * $formFactory = Forms::createFormFactoryBuilder()
125 * ->addExtension(new TemplatingExtension($engine, null, array(
126 * 'FrameworkBundle:Form',
127 * 'FrameworkBundle:FormTable',
128 * )))
129 * ->getFormFactory();
130 * </code>
131 *
132 * If you also loaded the CsrfExtension, you should pass the CSRF provider
133 * to the extension so that you can render CSRF tokens in your templates
134 * more easily:
135 *
136 * <code>
137 * use Symfony\Component\Form\Extension\Csrf\CsrfExtension;
138 * use Symfony\Component\Form\Extension\Csrf\CsrfProvider\DefaultCsrfProvider;
139 * use Symfony\Component\Form\Extension\Templating\TemplatingExtension;
140 *
141 *
142 * $secret = 'V8a5Z97e...';
143 * $csrfProvider = new DefaultCsrfProvider($secret);
144 * $formFactory = Forms::createFormFactoryBuilder()
145 * ->addExtension(new CsrfExtension($csrfProvider))
146 * ->addExtension(new TemplatingExtension($engine, $csrfProvider, array(
147 * 'FrameworkBundle:Form',
148 * )))
149 * ->getFormFactory();
150 * </code>
151 *
152 * @author Bernhard Schussek <bschussek@gmail.com>
153 */
154final class Forms
155{
156 /**
157 * Creates a form factory with the default configuration.
158 *
159 * @return FormFactoryInterface The form factory.
160 */
161 public static function createFormFactory()
162 {
163 return self::createFormFactoryBuilder()->getFormFactory();
164 }
165
166 /**
167 * Creates a form factory builder with the default configuration.
168 *
169 * @return FormFactoryBuilderInterface The form factory builder.
170 */
171 public static function createFormFactoryBuilder()
172 {
173 $builder = new FormFactoryBuilder();
174 $builder->addExtension(new CoreExtension());
175
176 return $builder;
177 }
178
179 /**
180 * This class cannot be instantiated.
181 */
182 private function __construct()
183 {
184 }
185}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Guess/Guess.php b/vendor/symfony/form/Symfony/Component/Form/Guess/Guess.php
deleted file mode 100644
index b33c3d80..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Guess/Guess.php
+++ /dev/null
@@ -1,113 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Guess;
13
14use Symfony\Component\Form\Exception\InvalidArgumentException;
15
16/**
17 * Base class for guesses made by TypeGuesserInterface implementation
18 *
19 * Each instance contains a confidence value about the correctness of the guess.
20 * Thus an instance with confidence HIGH_CONFIDENCE is more likely to be
21 * correct than an instance with confidence LOW_CONFIDENCE.
22 *
23 * @author Bernhard Schussek <bschussek@gmail.com>
24 */
25abstract class Guess
26{
27 /**
28 * Marks an instance with a value that is extremely likely to be correct
29 * @var integer
30 */
31 const VERY_HIGH_CONFIDENCE = 3;
32
33 /**
34 * Marks an instance with a value that is very likely to be correct
35 * @var integer
36 */
37 const HIGH_CONFIDENCE = 2;
38
39 /**
40 * Marks an instance with a value that is likely to be correct
41 * @var integer
42 */
43 const MEDIUM_CONFIDENCE = 1;
44
45 /**
46 * Marks an instance with a value that may be correct
47 * @var integer
48 */
49 const LOW_CONFIDENCE = 0;
50
51 /**
52 * The confidence about the correctness of the value
53 *
54 * One of VERY_HIGH_CONFIDENCE, HIGH_CONFIDENCE, MEDIUM_CONFIDENCE
55 * and LOW_CONFIDENCE.
56 *
57 * @var integer
58 */
59 private $confidence;
60
61 /**
62 * Returns the guess most likely to be correct from a list of guesses
63 *
64 * If there are multiple guesses with the same, highest confidence, the
65 * returned guess is any of them.
66 *
67 * @param array $guesses A list of guesses
68 *
69 * @return Guess The guess with the highest confidence
70 */
71 public static function getBestGuess(array $guesses)
72 {
73 $result = null;
74 $maxConfidence = -1;
75
76 foreach ($guesses as $guess) {
77 if ($maxConfidence < $confidence = $guess->getConfidence()) {
78 $maxConfidence = $confidence;
79 $result = $guess;
80 }
81 }
82
83 return $result;
84 }
85
86 /**
87 * Constructor
88 *
89 * @param integer $confidence The confidence
90 *
91 * @throws InvalidArgumentException if the given value of confidence is unknown
92 */
93 public function __construct($confidence)
94 {
95 if (self::VERY_HIGH_CONFIDENCE !== $confidence && self::HIGH_CONFIDENCE !== $confidence &&
96 self::MEDIUM_CONFIDENCE !== $confidence && self::LOW_CONFIDENCE !== $confidence) {
97 throw new InvalidArgumentException('The confidence should be one of the constants defined in Guess.');
98 }
99
100 $this->confidence = $confidence;
101 }
102
103 /**
104 * Returns the confidence that the guessed value is correct
105 *
106 * @return integer One of the constants VERY_HIGH_CONFIDENCE,
107 * HIGH_CONFIDENCE, MEDIUM_CONFIDENCE and LOW_CONFIDENCE
108 */
109 public function getConfidence()
110 {
111 return $this->confidence;
112 }
113}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Guess/TypeGuess.php b/vendor/symfony/form/Symfony/Component/Form/Guess/TypeGuess.php
deleted file mode 100644
index 3241e603..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Guess/TypeGuess.php
+++ /dev/null
@@ -1,70 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Guess;
13
14/**
15 * Contains a guessed class name and a list of options for creating an instance
16 * of that class
17 *
18 * @author Bernhard Schussek <bschussek@gmail.com>
19 */
20class TypeGuess extends Guess
21{
22 /**
23 * The guessed field type
24 * @var string
25 */
26 private $type;
27
28 /**
29 * The guessed options for creating an instance of the guessed class
30 * @var array
31 */
32 private $options;
33
34 /**
35 * Constructor
36 *
37 * @param string $type The guessed field type
38 * @param array $options The options for creating instances of the
39 * guessed class
40 * @param integer $confidence The confidence that the guessed class name
41 * is correct
42 */
43 public function __construct($type, array $options, $confidence)
44 {
45 parent::__construct($confidence);
46
47 $this->type = $type;
48 $this->options = $options;
49 }
50
51 /**
52 * Returns the guessed field type
53 *
54 * @return string
55 */
56 public function getType()
57 {
58 return $this->type;
59 }
60
61 /**
62 * Returns the guessed options for creating instances of the guessed type
63 *
64 * @return array
65 */
66 public function getOptions()
67 {
68 return $this->options;
69 }
70}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Guess/ValueGuess.php b/vendor/symfony/form/Symfony/Component/Form/Guess/ValueGuess.php
deleted file mode 100644
index 2e3333ba..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Guess/ValueGuess.php
+++ /dev/null
@@ -1,50 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Guess;
13
14/**
15 * Contains a guessed value
16 *
17 * @author Bernhard Schussek <bschussek@gmail.com>
18 */
19class ValueGuess extends Guess
20{
21 /**
22 * The guessed value
23 * @var array
24 */
25 private $value;
26
27 /**
28 * Constructor
29 *
30 * @param string $value The guessed value
31 * @param integer $confidence The confidence that the guessed class name
32 * is correct
33 */
34 public function __construct($value, $confidence)
35 {
36 parent::__construct($confidence);
37
38 $this->value = $value;
39 }
40
41 /**
42 * Returns the guessed value
43 *
44 * @return mixed
45 */
46 public function getValue()
47 {
48 return $this->value;
49 }
50}
diff --git a/vendor/symfony/form/Symfony/Component/Form/LICENSE b/vendor/symfony/form/Symfony/Component/Form/LICENSE
deleted file mode 100644
index 88a57f8d..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/LICENSE
+++ /dev/null
@@ -1,19 +0,0 @@
1Copyright (c) 2004-2013 Fabien Potencier
2
3Permission is hereby granted, free of charge, to any person obtaining a copy
4of this software and associated documentation files (the "Software"), to deal
5in the Software without restriction, including without limitation the rights
6to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7copies of the Software, and to permit persons to whom the Software is furnished
8to do so, subject to the following conditions:
9
10The above copyright notice and this permission notice shall be included in all
11copies or substantial portions of the Software.
12
13THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19THE SOFTWARE.
diff --git a/vendor/symfony/form/Symfony/Component/Form/NativeRequestHandler.php b/vendor/symfony/form/Symfony/Component/Form/NativeRequestHandler.php
deleted file mode 100644
index aaa4e4c0..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/NativeRequestHandler.php
+++ /dev/null
@@ -1,194 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form;
13
14use Symfony\Component\Form\Exception\UnexpectedTypeException;
15use Symfony\Component\Form\FormInterface;
16use Symfony\Component\Form\RequestHandlerInterface;
17
18/**
19 * A request handler using PHP's super globals $_GET, $_POST and $_SERVER.
20 *
21 * @author Bernhard Schussek <bschussek@gmail.com>
22 */
23class NativeRequestHandler implements RequestHandlerInterface
24{
25 /**
26 * The allowed keys of the $_FILES array.
27 *
28 * @var array
29 */
30 private static $fileKeys = array(
31 'error',
32 'name',
33 'size',
34 'tmp_name',
35 'type',
36 );
37
38 /**
39 * {@inheritdoc}
40 */
41 public function handleRequest(FormInterface $form, $request = null)
42 {
43 if (null !== $request) {
44 throw new UnexpectedTypeException($request, 'null');
45 }
46
47 $name = $form->getName();
48 $method = $form->getConfig()->getMethod();
49
50 if ($method !== self::getRequestMethod()) {
51 return;
52 }
53
54 if ('GET' === $method) {
55 if ('' === $name) {
56 $data = $_GET;
57 } else {
58 // Don't submit GET requests if the form's name does not exist
59 // in the request
60 if (!isset($_GET[$name])) {
61 return;
62 }
63
64 $data = $_GET[$name];
65 }
66 } else {
67 $fixedFiles = array();
68 foreach ($_FILES as $name => $file) {
69 $fixedFiles[$name] = self::stripEmptyFiles(self::fixPhpFilesArray($file));
70 }
71
72 if ('' === $name) {
73 $params = $_POST;
74 $files = $fixedFiles;
75 } else {
76 $default = $form->getConfig()->getCompound() ? array() : null;
77 $params = isset($_POST[$name]) ? $_POST[$name] : $default;
78 $files = isset($fixedFiles[$name]) ? $fixedFiles[$name] : $default;
79 }
80
81 if (is_array($params) && is_array($files)) {
82 $data = array_replace_recursive($params, $files);
83 } else {
84 $data = $params ?: $files;
85 }
86 }
87
88 // Don't auto-submit the form unless at least one field is present.
89 if ('' === $name && count(array_intersect_key($data, $form->all())) <= 0) {
90 return;
91 }
92
93 $form->submit($data, 'PATCH' !== $method);
94 }
95
96 /**
97 * Returns the method used to submit the request to the server.
98 *
99 * @return string The request method.
100 */
101 private static function getRequestMethod()
102 {
103 $method = isset($_SERVER['REQUEST_METHOD'])
104 ? strtoupper($_SERVER['REQUEST_METHOD'])
105 : 'GET';
106
107 if ('POST' === $method && isset($_SERVER['HTTP_X_HTTP_METHOD_OVERRIDE'])) {
108 $method = strtoupper($_SERVER['HTTP_X_HTTP_METHOD_OVERRIDE']);
109 }
110
111 return $method;
112 }
113
114 /**
115 * Fixes a malformed PHP $_FILES array.
116 *
117 * PHP has a bug that the format of the $_FILES array differs, depending on
118 * whether the uploaded file fields had normal field names or array-like
119 * field names ("normal" vs. "parent[child]").
120 *
121 * This method fixes the array to look like the "normal" $_FILES array.
122 *
123 * It's safe to pass an already converted array, in which case this method
124 * just returns the original array unmodified.
125 *
126 * This method is identical to {@link Symfony\Component\HttpFoundation\FileBag::fixPhpFilesArray}
127 * and should be kept as such in order to port fixes quickly and easily.
128 *
129 * @param array $data
130 *
131 * @return array
132 */
133 private static function fixPhpFilesArray($data)
134 {
135 if (!is_array($data)) {
136 return $data;
137 }
138
139 $keys = array_keys($data);
140 sort($keys);
141
142 if (self::$fileKeys !== $keys || !isset($data['name']) || !is_array($data['name'])) {
143 return $data;
144 }
145
146 $files = $data;
147 foreach (self::$fileKeys as $k) {
148 unset($files[$k]);
149 }
150
151 foreach (array_keys($data['name']) as $key) {
152 $files[$key] = self::fixPhpFilesArray(array(
153 'error' => $data['error'][$key],
154 'name' => $data['name'][$key],
155 'type' => $data['type'][$key],
156 'tmp_name' => $data['tmp_name'][$key],
157 'size' => $data['size'][$key]
158 ));
159 }
160
161 return $files;
162 }
163
164 /**
165 * Sets empty uploaded files to NULL in the given uploaded files array.
166 *
167 * @param mixed $data The file upload data.
168 *
169 * @return array|null Returns the stripped upload data.
170 */
171 private static function stripEmptyFiles($data)
172 {
173 if (!is_array($data)) {
174 return $data;
175 }
176
177 $keys = array_keys($data);
178 sort($keys);
179
180 if (self::$fileKeys === $keys) {
181 if (UPLOAD_ERR_NO_FILE === $data['error']) {
182 return null;
183 }
184
185 return $data;
186 }
187
188 foreach ($data as $key => $value) {
189 $data[$key] = self::stripEmptyFiles($value);
190 }
191
192 return $data;
193 }
194}
diff --git a/vendor/symfony/form/Symfony/Component/Form/PreloadedExtension.php b/vendor/symfony/form/Symfony/Component/Form/PreloadedExtension.php
deleted file mode 100644
index 2d3e9efb..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/PreloadedExtension.php
+++ /dev/null
@@ -1,97 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form;
13
14use Symfony\Component\Form\Exception\InvalidArgumentException;
15
16/**
17 * A form extension with preloaded types, type exceptions and type guessers.
18 *
19 * @author Bernhard Schussek <bschussek@gmail.com>
20 */
21class PreloadedExtension implements FormExtensionInterface
22{
23 /**
24 * @var array
25 */
26 private $types = array();
27
28 /**
29 * @var array
30 */
31 private $typeExtensions = array();
32
33 /**
34 * @var FormTypeGuesserInterface
35 */
36 private $typeGuesser;
37
38 /**
39 * Creates a new preloaded extension.
40 *
41 * @param array $types The types that the extension should support.
42 * @param array $typeExtensions The type extensions that the extension should support.
43 * @param FormTypeGuesserInterface|null $typeGuesser The guesser that the extension should support.
44 */
45 public function __construct(array $types, array $typeExtensions, FormTypeGuesserInterface $typeGuesser = null)
46 {
47 $this->types = $types;
48 $this->typeExtensions = $typeExtensions;
49 $this->typeGuesser = $typeGuesser;
50 }
51
52 /**
53 * {@inheritdoc}
54 */
55 public function getType($name)
56 {
57 if (!isset($this->types[$name])) {
58 throw new InvalidArgumentException(sprintf('The type "%s" can not be loaded by this extension', $name));
59 }
60
61 return $this->types[$name];
62 }
63
64 /**
65 * {@inheritdoc}
66 */
67 public function hasType($name)
68 {
69 return isset($this->types[$name]);
70 }
71
72 /**
73 * {@inheritdoc}
74 */
75 public function getTypeExtensions($name)
76 {
77 return isset($this->typeExtensions[$name])
78 ? $this->typeExtensions[$name]
79 : array();
80 }
81
82 /**
83 * {@inheritdoc}
84 */
85 public function hasTypeExtensions($name)
86 {
87 return !empty($this->typeExtensions[$name]);
88 }
89
90 /**
91 * {@inheritdoc}
92 */
93 public function getTypeGuesser()
94 {
95 return $this->typeGuesser;
96 }
97}
diff --git a/vendor/symfony/form/Symfony/Component/Form/README.md b/vendor/symfony/form/Symfony/Component/Form/README.md
deleted file mode 100644
index 7bfff7fd..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/README.md
+++ /dev/null
@@ -1,26 +0,0 @@
1Form Component
2==============
3
4Form provides tools for defining forms, rendering and mapping request data to
5related models. Furthermore it provides integration with the Validation
6component.
7
8Resources
9---------
10
11Silex integration:
12
13https://github.com/fabpot/Silex/blob/master/src/Silex/Provider/FormServiceProvider.php
14
15Documentation:
16
17http://symfony.com/doc/2.3/book/forms.html
18
19Resources
20---------
21
22You can run the unit tests with the following command:
23
24 $ cd path/to/Symfony/Component/Form/
25 $ composer.phar install --dev
26 $ phpunit
diff --git a/vendor/symfony/form/Symfony/Component/Form/RequestHandlerInterface.php b/vendor/symfony/form/Symfony/Component/Form/RequestHandlerInterface.php
deleted file mode 100644
index d0a58e69..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/RequestHandlerInterface.php
+++ /dev/null
@@ -1,28 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form;
13
14/**
15 * Submits forms if they were submitted.
16 *
17 * @author Bernhard Schussek <bschussek@gmail.com>
18 */
19interface RequestHandlerInterface
20{
21 /**
22 * Submits a form if it was submitted.
23 *
24 * @param FormInterface $form The form to submit.
25 * @param mixed $request The current request.
26 */
27 public function handleRequest(FormInterface $form, $request = null);
28}
diff --git a/vendor/symfony/form/Symfony/Component/Form/ResolvedFormType.php b/vendor/symfony/form/Symfony/Component/Form/ResolvedFormType.php
deleted file mode 100644
index 47d43553..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/ResolvedFormType.php
+++ /dev/null
@@ -1,284 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form;
13
14use Symfony\Component\Form\Exception\InvalidArgumentException;
15use Symfony\Component\Form\Exception\UnexpectedTypeException;
16use Symfony\Component\EventDispatcher\EventDispatcher;
17use Symfony\Component\OptionsResolver\OptionsResolver;
18
19/**
20 * A wrapper for a form type and its extensions.
21 *
22 * @author Bernhard Schussek <bschussek@gmail.com>
23 */
24class ResolvedFormType implements ResolvedFormTypeInterface
25{
26 /**
27 * @var FormTypeInterface
28 */
29 private $innerType;
30
31 /**
32 * @var array
33 */
34 private $typeExtensions;
35
36 /**
37 * @var ResolvedFormTypeInterface
38 */
39 private $parent;
40
41 /**
42 * @var OptionsResolver
43 */
44 private $optionsResolver;
45
46 public function __construct(FormTypeInterface $innerType, array $typeExtensions = array(), ResolvedFormTypeInterface $parent = null)
47 {
48 if (!preg_match('/^[a-z0-9_]*$/i', $innerType->getName())) {
49 throw new InvalidArgumentException(sprintf(
50 'The "%s" form type name ("%s") is not valid. Names must only contain letters, numbers, and "_".',
51 get_class($innerType),
52 $innerType->getName()
53 ));
54 }
55
56 foreach ($typeExtensions as $extension) {
57 if (!$extension instanceof FormTypeExtensionInterface) {
58 throw new UnexpectedTypeException($extension, 'Symfony\Component\Form\FormTypeExtensionInterface');
59 }
60 }
61
62 $this->innerType = $innerType;
63 $this->typeExtensions = $typeExtensions;
64 $this->parent = $parent;
65 }
66
67 /**
68 * {@inheritdoc}
69 */
70 public function getName()
71 {
72 return $this->innerType->getName();
73 }
74
75 /**
76 * {@inheritdoc}
77 */
78 public function getParent()
79 {
80 return $this->parent;
81 }
82
83 /**
84 * {@inheritdoc}
85 */
86 public function getInnerType()
87 {
88 return $this->innerType;
89 }
90
91 /**
92 * {@inheritdoc}
93 */
94 public function getTypeExtensions()
95 {
96 // BC
97 if ($this->innerType instanceof AbstractType) {
98 return $this->innerType->getExtensions();
99 }
100
101 return $this->typeExtensions;
102 }
103
104 /**
105 * {@inheritdoc}
106 */
107 public function createBuilder(FormFactoryInterface $factory, $name, array $options = array())
108 {
109 $options = $this->getOptionsResolver()->resolve($options);
110
111 // Should be decoupled from the specific option at some point
112 $dataClass = isset($options['data_class']) ? $options['data_class'] : null;
113
114 $builder = $this->newBuilder($name, $dataClass, $factory, $options);
115 $builder->setType($this);
116
117 $this->buildForm($builder, $options);
118
119 return $builder;
120 }
121
122 /**
123 * {@inheritdoc}
124 */
125 public function createView(FormInterface $form, FormView $parent = null)
126 {
127 $options = $form->getConfig()->getOptions();
128
129 $view = $this->newView($parent);
130
131 $this->buildView($view, $form, $options);
132
133 foreach ($form as $name => $child) {
134 /* @var FormInterface $child */
135 $view->children[$name] = $child->createView($view);
136 }
137
138 $this->finishView($view, $form, $options);
139
140 return $view;
141 }
142
143 /**
144 * Configures a form builder for the type hierarchy.
145 *
146 * This method is protected in order to allow implementing classes
147 * to change or call it in re-implementations of {@link createBuilder()}.
148 *
149 * @param FormBuilderInterface $builder The builder to configure.
150 * @param array $options The options used for the configuration.
151 */
152 public function buildForm(FormBuilderInterface $builder, array $options)
153 {
154 if (null !== $this->parent) {
155 $this->parent->buildForm($builder, $options);
156 }
157
158 $this->innerType->buildForm($builder, $options);
159
160 foreach ($this->typeExtensions as $extension) {
161 /* @var FormTypeExtensionInterface $extension */
162 $extension->buildForm($builder, $options);
163 }
164 }
165
166 /**
167 * Configures a form view for the type hierarchy.
168 *
169 * This method is protected in order to allow implementing classes
170 * to change or call it in re-implementations of {@link createView()}.
171 *
172 * It is called before the children of the view are built.
173 *
174 * @param FormView $view The form view to configure.
175 * @param FormInterface $form The form corresponding to the view.
176 * @param array $options The options used for the configuration.
177 */
178 public function buildView(FormView $view, FormInterface $form, array $options)
179 {
180 if (null !== $this->parent) {
181 $this->parent->buildView($view, $form, $options);
182 }
183
184 $this->innerType->buildView($view, $form, $options);
185
186 foreach ($this->typeExtensions as $extension) {
187 /* @var FormTypeExtensionInterface $extension */
188 $extension->buildView($view, $form, $options);
189 }
190 }
191
192 /**
193 * Finishes a form view for the type hierarchy.
194 *
195 * This method is protected in order to allow implementing classes
196 * to change or call it in re-implementations of {@link createView()}.
197 *
198 * It is called after the children of the view have been built.
199 *
200 * @param FormView $view The form view to configure.
201 * @param FormInterface $form The form corresponding to the view.
202 * @param array $options The options used for the configuration.
203 */
204 public function finishView(FormView $view, FormInterface $form, array $options)
205 {
206 if (null !== $this->parent) {
207 $this->parent->finishView($view, $form, $options);
208 }
209
210 $this->innerType->finishView($view, $form, $options);
211
212 foreach ($this->typeExtensions as $extension) {
213 /* @var FormTypeExtensionInterface $extension */
214 $extension->finishView($view, $form, $options);
215 }
216 }
217
218 /**
219 * Returns the configured options resolver used for this type.
220 *
221 * This method is protected in order to allow implementing classes
222 * to change or call it in re-implementations of {@link createBuilder()}.
223 *
224 * @return \Symfony\Component\OptionsResolver\OptionsResolverInterface The options resolver.
225 */
226 public function getOptionsResolver()
227 {
228 if (null === $this->optionsResolver) {
229 if (null !== $this->parent) {
230 $this->optionsResolver = clone $this->parent->getOptionsResolver();
231 } else {
232 $this->optionsResolver = new OptionsResolver();
233 }
234
235 $this->innerType->setDefaultOptions($this->optionsResolver);
236
237 foreach ($this->typeExtensions as $extension) {
238 /* @var FormTypeExtensionInterface $extension */
239 $extension->setDefaultOptions($this->optionsResolver);
240 }
241 }
242
243 return $this->optionsResolver;
244 }
245
246 /**
247 * Creates a new builder instance.
248 *
249 * Override this method if you want to customize the builder class.
250 *
251 * @param string $name The name of the builder.
252 * @param string $dataClass The data class.
253 * @param FormFactoryInterface $factory The current form factory.
254 * @param array $options The builder options.
255 *
256 * @return FormBuilderInterface The new builder instance.
257 */
258 protected function newBuilder($name, $dataClass, FormFactoryInterface $factory, array $options)
259 {
260 if ($this->innerType instanceof ButtonTypeInterface) {
261 return new ButtonBuilder($name, $options);
262 }
263
264 if ($this->innerType instanceof SubmitButtonTypeInterface) {
265 return new SubmitButtonBuilder($name, $options);
266 }
267
268 return new FormBuilder($name, $dataClass, new EventDispatcher(), $factory, $options);
269 }
270
271 /**
272 * Creates a new view instance.
273 *
274 * Override this method if you want to customize the view class.
275 *
276 * @param FormView|null $parent The parent view, if available.
277 *
278 * @return FormView A new view instance.
279 */
280 protected function newView(FormView $parent = null)
281 {
282 return new FormView($parent);
283 }
284}
diff --git a/vendor/symfony/form/Symfony/Component/Form/ResolvedFormTypeFactory.php b/vendor/symfony/form/Symfony/Component/Form/ResolvedFormTypeFactory.php
deleted file mode 100644
index d93d1c06..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/ResolvedFormTypeFactory.php
+++ /dev/null
@@ -1,26 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form;
13
14/**
15 * @author Bernhard Schussek <bschussek@gmail.com>
16 */
17class ResolvedFormTypeFactory implements ResolvedFormTypeFactoryInterface
18{
19 /**
20 * {@inheritdoc}
21 */
22 public function createResolvedType(FormTypeInterface $type, array $typeExtensions, ResolvedFormTypeInterface $parent = null)
23 {
24 return new ResolvedFormType($type, $typeExtensions, $parent);
25 }
26}
diff --git a/vendor/symfony/form/Symfony/Component/Form/ResolvedFormTypeFactoryInterface.php b/vendor/symfony/form/Symfony/Component/Form/ResolvedFormTypeFactoryInterface.php
deleted file mode 100644
index f0ec2330..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/ResolvedFormTypeFactoryInterface.php
+++ /dev/null
@@ -1,38 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form;
13
14/**
15 * Creates ResolvedFormTypeInterface instances.
16 *
17 * This interface allows you to use your custom ResolvedFormTypeInterface
18 * implementation, within which you can customize the concrete FormBuilderInterface
19 * implementations or FormView subclasses that are used by the framework.
20 *
21 * @author Bernhard Schussek <bschussek@gmail.com>
22 */
23interface ResolvedFormTypeFactoryInterface
24{
25 /**
26 * Resolves a form type.
27 *
28 * @param FormTypeInterface $type
29 * @param array $typeExtensions
30 * @param ResolvedFormTypeInterface $parent
31 *
32 * @return ResolvedFormTypeInterface
33 *
34 * @throws Exception\UnexpectedTypeException if the types parent {@link FormTypeInterface::getParent()} is not a string
35 * @throws Exception\InvalidArgumentException if the types parent can not be retrieved from any extension
36 */
37 public function createResolvedType(FormTypeInterface $type, array $typeExtensions, ResolvedFormTypeInterface $parent = null);
38}
diff --git a/vendor/symfony/form/Symfony/Component/Form/ResolvedFormTypeInterface.php b/vendor/symfony/form/Symfony/Component/Form/ResolvedFormTypeInterface.php
deleted file mode 100644
index c999bcdc..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/ResolvedFormTypeInterface.php
+++ /dev/null
@@ -1,106 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form;
13
14/**
15 * A wrapper for a form type and its extensions.
16 *
17 * @author Bernhard Schussek <bschussek@gmail.com>
18 */
19interface ResolvedFormTypeInterface
20{
21 /**
22 * Returns the name of the type.
23 *
24 * @return string The type name.
25 */
26 public function getName();
27
28 /**
29 * Returns the parent type.
30 *
31 * @return ResolvedFormTypeInterface The parent type or null.
32 */
33 public function getParent();
34
35 /**
36 * Returns the wrapped form type.
37 *
38 * @return FormTypeInterface The wrapped form type.
39 */
40 public function getInnerType();
41
42 /**
43 * Returns the extensions of the wrapped form type.
44 *
45 * @return FormTypeExtensionInterface[] An array of {@link FormTypeExtensionInterface} instances.
46 */
47 public function getTypeExtensions();
48
49 /**
50 * Creates a new form builder for this type.
51 *
52 * @param FormFactoryInterface $factory The form factory.
53 * @param string $name The name for the builder.
54 * @param array $options The builder options.
55 *
56 * @return FormBuilderInterface The created form builder.
57 */
58 public function createBuilder(FormFactoryInterface $factory, $name, array $options = array());
59
60 /**
61 * Creates a new form view for a form of this type.
62 *
63 * @param FormInterface $form The form to create a view for.
64 * @param FormView $parent The parent view or null.
65 *
66 * @return FormView The created form view.
67 */
68 public function createView(FormInterface $form, FormView $parent = null);
69
70 /**
71 * Configures a form builder for the type hierarchy.
72 *
73 * @param FormBuilderInterface $builder The builder to configure.
74 * @param array $options The options used for the configuration.
75 */
76 public function buildForm(FormBuilderInterface $builder, array $options);
77
78 /**
79 * Configures a form view for the type hierarchy.
80 *
81 * It is called before the children of the view are built.
82 *
83 * @param FormView $view The form view to configure.
84 * @param FormInterface $form The form corresponding to the view.
85 * @param array $options The options used for the configuration.
86 */
87 public function buildView(FormView $view, FormInterface $form, array $options);
88
89 /**
90 * Finishes a form view for the type hierarchy.
91 *
92 * It is called after the children of the view have been built.
93 *
94 * @param FormView $view The form view to configure.
95 * @param FormInterface $form The form corresponding to the view.
96 * @param array $options The options used for the configuration.
97 */
98 public function finishView(FormView $view, FormInterface $form, array $options);
99
100 /**
101 * Returns the configured options resolver used for this type.
102 *
103 * @return \Symfony\Component\OptionsResolver\OptionsResolverInterface The options resolver.
104 */
105 public function getOptionsResolver();
106}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Resources/config/validation.xml b/vendor/symfony/form/Symfony/Component/Form/Resources/config/validation.xml
deleted file mode 100644
index 2f2364bd..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Resources/config/validation.xml
+++ /dev/null
@@ -1,13 +0,0 @@
1<?xml version="1.0" ?>
2
3<constraint-mapping xmlns="http://symfony.com/schema/dic/constraint-mapping"
4 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5 xsi:schemaLocation="http://symfony.com/schema/dic/constraint-mapping http://symfony.com/schema/dic/constraint-mapping/constraint-mapping-1.0.xsd">
6
7 <class name="Symfony\Component\Form\Form">
8 <constraint name="Symfony\Component\Form\Extension\Validator\Constraints\Form" />
9 <property name="children">
10 <constraint name="Valid" />
11 </property>
12 </class>
13</constraint-mapping>
diff --git a/vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.ar.xlf b/vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.ar.xlf
deleted file mode 100644
index 990b039d..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.ar.xlf
+++ /dev/null
@@ -1,19 +0,0 @@
1<?xml version="1.0"?>
2<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
3 <file source-language="en" datatype="plaintext" original="file.ext">
4 <body>
5 <trans-unit id="28">
6 <source>This form should not contain extra fields.</source>
7 <target>هذا النموذج يجب الا يحتوى على اى حقول اضافية.</target>
8 </trans-unit>
9 <trans-unit id="29">
10 <source>The uploaded file was too large. Please try to upload a smaller file.</source>
11 <target>مساحة الملف المرسل كبيرة. من فضلك حاول ارسال ملف اصغر.</target>
12 </trans-unit>
13 <trans-unit id="30">
14 <source>The CSRF token is invalid. Please try to resubmit the form.</source>
15 <target>قيمة رمز الموقع غير صحيحة. من فضلك اعد ارسال النموذج.</target>
16 </trans-unit>
17 </body>
18 </file>
19</xliff>
diff --git a/vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.bg.xlf b/vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.bg.xlf
deleted file mode 100644
index 6f00bde9..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.bg.xlf
+++ /dev/null
@@ -1,19 +0,0 @@
1<?xml version="1.0"?>
2<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
3 <file source-language="en" datatype="plaintext" original="file.ext">
4 <body>
5 <trans-unit id="28">
6 <source>This form should not contain extra fields.</source>
7 <target>Тази форма не трябва да съдържа допълнителни полета.</target>
8 </trans-unit>
9 <trans-unit id="29">
10 <source>The uploaded file was too large. Please try to upload a smaller file.</source>
11 <target>Каченият файл е твърде голям. Моля, опитайте да качите по-малък файл.</target>
12 </trans-unit>
13 <trans-unit id="30">
14 <source>The CSRF token is invalid. Please try to resubmit the form.</source>
15 <target>Невалиден CSRF токен. Моля, опитайте да изпратите формата отново.</target>
16 </trans-unit>
17 </body>
18 </file>
19</xliff> \ No newline at end of file
diff --git a/vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.ca.xlf b/vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.ca.xlf
deleted file mode 100644
index 3a2fa484..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.ca.xlf
+++ /dev/null
@@ -1,19 +0,0 @@
1<?xml version="1.0"?>
2<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
3 <file source-language="en" datatype="plaintext" original="file.ext">
4 <body>
5 <trans-unit id="28">
6 <source>This form should not contain extra fields.</source>
7 <target>Aquest formulari no hauria de contenir camps addicionals.</target>
8 </trans-unit>
9 <trans-unit id="29">
10 <source>The uploaded file was too large. Please try to upload a smaller file.</source>
11 <target>L'arxiu pujat és massa gran. Per favor, pugi un arxiu més petit.</target>
12 </trans-unit>
13 <trans-unit id="30">
14 <source>The CSRF token is invalid. Please try to resubmit the form.</source>
15 <target>El token CSRF no és vàlid. Per favor, provi d'enviar novament el formulari.</target>
16 </trans-unit>
17 </body>
18 </file>
19</xliff>
diff --git a/vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.cs.xlf b/vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.cs.xlf
deleted file mode 100644
index 776da494..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.cs.xlf
+++ /dev/null
@@ -1,19 +0,0 @@
1<?xml version="1.0"?>
2<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
3 <file source-language="en" datatype="plaintext" original="file.ext">
4 <body>
5 <trans-unit id="28">
6 <source>This form should not contain extra fields.</source>
7 <target>Tato skupina polí nesmí obsahovat další pole.</target>
8 </trans-unit>
9 <trans-unit id="29">
10 <source>The uploaded file was too large. Please try to upload a smaller file.</source>
11 <target>Nahraný soubor je příliš velký. Nahrajte prosím menší soubor.</target>
12 </trans-unit>
13 <trans-unit id="30">
14 <source>The CSRF token is invalid. Please try to resubmit the form.</source>
15 <target>CSRF token je neplatný. Zkuste prosím znovu odeslat formulář.</target>
16 </trans-unit>
17 </body>
18 </file>
19</xliff>
diff --git a/vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.da.xlf b/vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.da.xlf
deleted file mode 100644
index c2dd4601..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.da.xlf
+++ /dev/null
@@ -1,19 +0,0 @@
1<?xml version="1.0"?>
2<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
3 <file source-language="en" datatype="plaintext" original="file.ext">
4 <body>
5 <trans-unit id="28">
6 <source>This form should not contain extra fields.</source>
7 <target>Feltgruppen må ikke indeholde ekstra felter.</target>
8 </trans-unit>
9 <trans-unit id="29">
10 <source>The uploaded file was too large. Please try to upload a smaller file.</source>
11 <target>Den oploadede fil var for stor. Opload venligst en mindre fil.</target>
12 </trans-unit>
13 <trans-unit id="30">
14 <source>The CSRF token is invalid. Please try to resubmit the form.</source>
15 <target>CSRF nøglen er ugyldig.</target>
16 </trans-unit>
17 </body>
18 </file>
19</xliff>
diff --git a/vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.de.xlf b/vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.de.xlf
deleted file mode 100644
index c801d677..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.de.xlf
+++ /dev/null
@@ -1,19 +0,0 @@
1<?xml version="1.0"?>
2<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
3 <file source-language="en" datatype="plaintext" original="file.ext">
4 <body>
5 <trans-unit id="28">
6 <source>This form should not contain extra fields.</source>
7 <target>Dieses Formular sollte keine zusätzlichen Felder enthalten.</target>
8 </trans-unit>
9 <trans-unit id="29">
10 <source>The uploaded file was too large. Please try to upload a smaller file.</source>
11 <target>Die hochgeladene Datei ist zu groß. Versuchen Sie bitte eine kleinere Datei hochzuladen.</target>
12 </trans-unit>
13 <trans-unit id="30">
14 <source>The CSRF token is invalid. Please try to resubmit the form.</source>
15 <target>Das CSRF-Token ist ungültig. Versuchen Sie bitte das Formular erneut zu senden.</target>
16 </trans-unit>
17 </body>
18 </file>
19</xliff> \ No newline at end of file
diff --git a/vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.el.xlf b/vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.el.xlf
deleted file mode 100644
index ba2ced74..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.el.xlf
+++ /dev/null
@@ -1,19 +0,0 @@
1<?xml version="1.0"?>
2<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
3 <file source-language="en" datatype="plaintext" original="file.ext">
4 <body>
5 <trans-unit id="28">
6 <source>This form should not contain extra fields.</source>
7 <target>Αυτή η φόρμα δεν πρέπει να περιέχει επιπλέον πεδία.</target>
8 </trans-unit>
9 <trans-unit id="29">
10 <source>The uploaded file was too large. Please try to upload a smaller file.</source>
11 <target>Το αρχείο είναι πολύ μεγάλο. Παρακαλούμε προσπαθήστε να ανεβάσετε ένα μικρότερο αρχείο.</target>
12 </trans-unit>
13 <trans-unit id="30">
14 <source>The CSRF token is invalid. Please try to resubmit the form.</source>
15 <target>Το CSRF token δεν είναι έγκυρο. Παρακαλούμε δοκιμάστε να υποβάλετε τη φόρμα ξανά.</target>
16 </trans-unit>
17 </body>
18 </file>
19</xliff>
diff --git a/vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.en.xlf b/vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.en.xlf
deleted file mode 100644
index b8542d31..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.en.xlf
+++ /dev/null
@@ -1,19 +0,0 @@
1<?xml version="1.0"?>
2<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
3 <file source-language="en" datatype="plaintext" original="file.ext">
4 <body>
5 <trans-unit id="28">
6 <source>This form should not contain extra fields.</source>
7 <target>This form should not contain extra fields.</target>
8 </trans-unit>
9 <trans-unit id="29">
10 <source>The uploaded file was too large. Please try to upload a smaller file.</source>
11 <target>The uploaded file was too large. Please try to upload a smaller file.</target>
12 </trans-unit>
13 <trans-unit id="30">
14 <source>The CSRF token is invalid. Please try to resubmit the form.</source>
15 <target>The CSRF token is invalid. Please try to resubmit the form.</target>
16 </trans-unit>
17 </body>
18 </file>
19</xliff>
diff --git a/vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.es.xlf b/vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.es.xlf
deleted file mode 100644
index ebfacfd4..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.es.xlf
+++ /dev/null
@@ -1,19 +0,0 @@
1<?xml version="1.0"?>
2<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
3 <file source-language="en" datatype="plaintext" original="file.ext">
4 <body>
5 <trans-unit id="28">
6 <source>This form should not contain extra fields.</source>
7 <target>Este formulario no debería contener campos adicionales.</target>
8 </trans-unit>
9 <trans-unit id="29">
10 <source>The uploaded file was too large. Please try to upload a smaller file.</source>
11 <target>El archivo subido es demasiado grande. Por favor, suba un archivo más pequeño.</target>
12 </trans-unit>
13 <trans-unit id="30">
14 <source>The CSRF token is invalid. Please try to resubmit the form.</source>
15 <target>El token CSRF no es válido. Por favor, pruebe de enviar nuevamente el formulario</target>
16 </trans-unit>
17 </body>
18 </file>
19</xliff>
diff --git a/vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.et.xlf b/vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.et.xlf
deleted file mode 100644
index 1a9867fa..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.et.xlf
+++ /dev/null
@@ -1,19 +0,0 @@
1<?xml version='1.0'?>
2<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
3 <file source-language="en" datatype="plaintext" original="file.ext">
4 <body>
5 <trans-unit id="28">
6 <source>This form should not contain extra fields.</source>
7 <target>Väljade grupp ei tohiks sisalda lisaväljasid.</target>
8 </trans-unit>
9 <trans-unit id="29">
10 <source>The uploaded file was too large. Please try to upload a smaller file.</source>
11 <target>Üleslaaditud fail oli liiga suur. Palun proovi uuesti väiksema failiga.</target>
12 </trans-unit>
13 <trans-unit id="30">
14 <source>The CSRF token is invalid. Please try to resubmit the form.</source>
15 <target>CSRF-märgis on vigane. Palun proovi vormi uuesti esitada.</target>
16 </trans-unit>
17 </body>
18 </file>
19</xliff>
diff --git a/vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.eu.xlf b/vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.eu.xlf
deleted file mode 100644
index a07f786c..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.eu.xlf
+++ /dev/null
@@ -1,19 +0,0 @@
1<?xml version="1.0"?>
2<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
3 <file source-language="en" datatype="plaintext" original="file.ext">
4 <body>
5 <trans-unit id="28">
6 <source>This form should not contain extra fields.</source>
7 <target>Formulario honek ez luke aparteko eremurik eduki behar.</target>
8 </trans-unit>
9 <trans-unit id="29">
10 <source>The uploaded file was too large. Please try to upload a smaller file.</source>
11 <target>Igotako fitxategia handiegia da. Mesedez saiatu fitxategi txikiago bat igotzen.</target>
12 </trans-unit>
13 <trans-unit id="30">
14 <source>The CSRF token is invalid.</source>
15 <target>CSFR tokena ez da egokia.</target>
16 </trans-unit>
17 </body>
18 </file>
19</xliff>
diff --git a/vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.fa.xlf b/vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.fa.xlf
deleted file mode 100644
index 468d2f6f..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.fa.xlf
+++ /dev/null
@@ -1,19 +0,0 @@
1<?xml version="1.0"?>
2<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
3 <file source-language="en" datatype="plaintext" original="file.ext">
4 <body>
5 <trans-unit id="28">
6 <source>This form should not contain extra fields.</source>
7 <target>این فرم نباید فیلد اضافی داشته باشد.</target>
8 </trans-unit>
9 <trans-unit id="29">
10 <source>The uploaded file was too large. Please try to upload a smaller file.</source>
11 <target>فایل بارگذاری شده بسیار بزرگ است. لطفا فایل کوچکتری را بارگزاری کنید.</target>
12 </trans-unit>
13 <trans-unit id="30">
14 <source>The CSRF token is invalid. Please try to resubmit the form.</source>
15 <target>مقدار CSRF نامعتبر است. لطفا فرم را مجددا ارسال فرمایید..</target>
16 </trans-unit>
17 </body>
18 </file>
19</xliff>
diff --git a/vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.fi.xlf b/vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.fi.xlf
deleted file mode 100644
index d223bb05..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.fi.xlf
+++ /dev/null
@@ -1,19 +0,0 @@
1<?xml version="1.0"?>
2<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
3 <file source-language="en" datatype="plaintext" original="file.ext">
4 <body>
5 <trans-unit id="28">
6 <source>This field group should not contain extra fields.</source>
7 <target>Tämä kenttäryhmä ei voi sisältää ylimääräisiä kenttiä.</target>
8 </trans-unit>
9 <trans-unit id="29">
10 <source>The uploaded file was too large. Please try to upload a smaller file.</source>
11 <target>Ladattu tiedosto on liian iso. Ole hyvä ja lataa pienempi tiedosto.</target>
12 </trans-unit>
13 <trans-unit id="30">
14 <source>The CSRF token is invalid. Please try to resubmit the form.</source>
15 <target>CSRF tarkiste on virheellinen. Olen hyvä ja yritä lähettää lomake uudestaan.</target>
16 </trans-unit>
17 </body>
18 </file>
19</xliff>
diff --git a/vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.fr.xlf b/vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.fr.xlf
deleted file mode 100644
index 21f90101..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.fr.xlf
+++ /dev/null
@@ -1,19 +0,0 @@
1<?xml version="1.0"?>
2<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
3 <file source-language="en" datatype="plaintext" original="file.ext">
4 <body>
5 <trans-unit id="28">
6 <source>This form should not contain extra fields.</source>
7 <target>Ce formulaire ne doit pas contenir des champs supplémentaires.</target>
8 </trans-unit>
9 <trans-unit id="29">
10 <source>The uploaded file was too large. Please try to upload a smaller file.</source>
11 <target>Le fichier téléchargé est trop volumineux. Merci d'essayer d'envoyer un fichier plus petit.</target>
12 </trans-unit>
13 <trans-unit id="30">
14 <source>The CSRF token is invalid. Please try to resubmit the form.</source>
15 <target>Le jeton CSRF est invalide. Veuillez renvoyer le formulaire.</target>
16 </trans-unit>
17 </body>
18 </file>
19</xliff>
diff --git a/vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.gl.xlf b/vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.gl.xlf
deleted file mode 100644
index db23fe2b..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.gl.xlf
+++ /dev/null
@@ -1,19 +0,0 @@
1<?xml version="1.0"?>
2<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
3 <file source-language="en" datatype="plaintext" original="file.ext">
4 <body>
5 <trans-unit id="28">
6 <source>This form should not contain extra fields.</source>
7 <target>Este formulario non debería conter campos adicionais.</target>
8 </trans-unit>
9 <trans-unit id="29">
10 <source>The uploaded file was too large. Please try to upload a smaller file.</source>
11 <target>O arquivo subido é demasiado grande. Por favor, suba un arquivo máis pequeno.</target>
12 </trans-unit>
13 <trans-unit id="30">
14 <source>The CSRF token is invalid. Please try to resubmit the form.</source>
15 <target>O token CSRF non é válido. Por favor, probe a enviar novamente o formulario</target>
16 </trans-unit>
17 </body>
18 </file>
19</xliff>
diff --git a/vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.he.xlf b/vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.he.xlf
deleted file mode 100644
index 5198738d..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.he.xlf
+++ /dev/null
@@ -1,19 +0,0 @@
1<?xml version="1.0"?>
2<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
3 <file source-language="en" datatype="plaintext" original="file.ext">
4 <body>
5 <trans-unit id="28">
6 <source>This form should not contain extra fields.</source>
7 <target>הטופס לא צריך להכיל שדות נוספים.</target>
8 </trans-unit>
9 <trans-unit id="29">
10 <source>The uploaded file was too large. Please try to upload a smaller file.</source>
11 <target>הקובץ שהועלה גדול מדי. נסה להעלות קובץ קטן יותר.</target>
12 </trans-unit>
13 <trans-unit id="30">
14 <source>The CSRF token is invalid.</source>
15 <target>אסימון CSRF אינו חוקי.</target>
16 </trans-unit>
17 </body>
18 </file>
19</xliff>
diff --git a/vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.hr.xlf b/vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.hr.xlf
deleted file mode 100644
index 8d0bd292..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.hr.xlf
+++ /dev/null
@@ -1,19 +0,0 @@
1<?xml version="1.0"?>
2<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
3 <file source-language="en" datatype="plaintext" original="file.ext">
4 <body>
5 <trans-unit id="28">
6 <source>This form should not contain extra fields.</source>
7 <target>Ovaj obrazac ne smije sadržavati dodatna polja.</target>
8 </trans-unit>
9 <trans-unit id="29">
10 <source>The uploaded file was too large. Please try to upload a smaller file.</source>
11 <target>Prenesena datoteka je prevelika. Molim pokušajte prenijeti manju datoteku.</target>
12 </trans-unit>
13 <trans-unit id="30">
14 <source>The CSRF token is invalid. Please try to resubmit the form.</source>
15 <target>CSRF vrijednost nije ispravna. Pokušajte ponovo poslati obrazac.</target>
16 </trans-unit>
17 </body>
18 </file>
19</xliff>
diff --git a/vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.hu.xlf b/vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.hu.xlf
deleted file mode 100644
index d1491e7e..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.hu.xlf
+++ /dev/null
@@ -1,19 +0,0 @@
1<?xml version="1.0"?>
2<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
3 <file source-language="en" datatype="plaintext" original="file.ext">
4 <body>
5 <trans-unit id="28">
6 <source>This form should not contain extra fields.</source>
7 <target>Ez a mezőcsoport nem tartalmazhat extra mezőket.</target>
8 </trans-unit>
9 <trans-unit id="29">
10 <source>The uploaded file was too large. Please try to upload a smaller file.</source>
11 <target>A feltöltött fájl túl nagy. Kérem próbáljon egy kisebb fájlt feltölteni.</target>
12 </trans-unit>
13 <trans-unit id="30">
14 <source>The CSRF token is invalid. Please try to resubmit the form.</source>
15 <target>Érvénytelen CSRF token. Kérem próbálja újra elküldeni az űrlapot.</target>
16 </trans-unit>
17 </body>
18 </file>
19</xliff>
diff --git a/vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.hy.xlf b/vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.hy.xlf
deleted file mode 100644
index 5a6091f8..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.hy.xlf
+++ /dev/null
@@ -1,19 +0,0 @@
1<?xml version="1.0"?>
2<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
3 <file source-language="en" datatype="plaintext" original="file.ext">
4 <body>
5 <trans-unit id="28">
6 <source>This form should not contain extra fields.</source>
7 <target>Այս ձևը չպետք է պարունակի լրացուցիչ տողեր.</target>
8 </trans-unit>
9 <trans-unit id="29">
10 <source>The uploaded file was too large. Please try to upload a smaller file.</source>
11 <target>Վերբեռնված ֆայլը չափազանց մեծ է: Խնդրվում է վերբեռնել ավելի փոքր չափսի ֆայլ.</target>
12 </trans-unit>
13 <trans-unit id="30">
14 <source>The CSRF token is invalid. Please try to resubmit the form.</source>
15 <target>CSRF արժեքը անթույլատրելի է: Փորձեք նորից ուղարկել ձևը.</target>
16 </trans-unit>
17 </body>
18 </file>
19</xliff> \ No newline at end of file
diff --git a/vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.id.xlf b/vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.id.xlf
deleted file mode 100644
index b067d984..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.id.xlf
+++ /dev/null
@@ -1,19 +0,0 @@
1<?xml version="1.0"?>
2<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
3 <file source-language="en" datatype="plaintext" original="file.ext">
4 <body>
5 <trans-unit id="28">
6 <source>This form should not contain extra fields.</source>
7 <target>Gabungan kolom tidak boleh mengandung kolom tambahan.</target>
8 </trans-unit>
9 <trans-unit id="29">
10 <source>The uploaded file was too large. Please try to upload a smaller file.</source>
11 <target>Berkas yang di unggah terlalu besar. Silahkan coba unggah berkas yang lebih kecil.</target>
12 </trans-unit>
13 <trans-unit id="30">
14 <source>The CSRF token is invalid. Please try to resubmit the form.</source>
15 <target>CSRF-Token tidak sah. Silahkan coba kirim ulang formulir.</target>
16 </trans-unit>
17 </body>
18 </file>
19</xliff>
diff --git a/vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.it.xlf b/vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.it.xlf
deleted file mode 100644
index aa15264d..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.it.xlf
+++ /dev/null
@@ -1,19 +0,0 @@
1<?xml version="1.0"?>
2<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
3 <file source-language="en" datatype="plaintext" original="file.ext">
4 <body>
5 <trans-unit id="28">
6 <source>This form should not contain extra fields.</source>
7 <target>Questo form non dovrebbe contenere nessun campo extra.</target>
8 </trans-unit>
9 <trans-unit id="29">
10 <source>The uploaded file was too large. Please try to upload a smaller file.</source>
11 <target>Il file caricato è troppo grande. Per favore caricare un file più piccolo.</target>
12 </trans-unit>
13 <trans-unit id="30">
14 <source>The CSRF token is invalid. Please try to resubmit the form.</source>
15 <target>Il token CSRF non è valido. Provare a reinviare il form.</target>
16 </trans-unit>
17 </body>
18 </file>
19</xliff>
diff --git a/vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.ja.xlf b/vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.ja.xlf
deleted file mode 100644
index 4559af17..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.ja.xlf
+++ /dev/null
@@ -1,19 +0,0 @@
1<?xml version="1.0"?>
2<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
3 <file source-language="en" datatype="plaintext" original="file.ext">
4 <body>
5 <trans-unit id="28">
6 <source>This form should not contain extra fields.</source>
7 <target>フィールドグループに追加のフィールドを含んではなりません.</target>
8 </trans-unit>
9 <trans-unit id="29">
10 <source>The uploaded file was too large. Please try to upload a smaller file.</source>
11 <target>アップロードされたファイルが大きすぎます。小さなファイルで再度アップロードしてください.</target>
12 </trans-unit>
13 <trans-unit id="30">
14 <source>The CSRF token is invalid.</source>
15 <target>CSRFトークンが無効です.</target>
16 </trans-unit>
17 </body>
18 </file>
19</xliff>
diff --git a/vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.lb.xlf b/vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.lb.xlf
deleted file mode 100644
index a111ffe3..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.lb.xlf
+++ /dev/null
@@ -1,19 +0,0 @@
1<?xml version="1.0"?>
2<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
3 <file source-language="en" datatype="plaintext" original="file.ext">
4 <body>
5 <trans-unit id="28">
6 <source>This form should not contain extra fields.</source>
7 <target>Dës Feldergrupp sollt keng zousätzlech Felder enthalen.</target>
8 </trans-unit>
9 <trans-unit id="29">
10 <source>The uploaded file was too large. Please try to upload a smaller file.</source>
11 <target>De geschécktene Fichier ass ze grouss. Versicht wann ech gelift ee méi klenge Fichier eropzelueden.</target>
12 </trans-unit>
13 <trans-unit id="30">
14 <source>The CSRF token is invalid. Please try to resubmit the form.</source>
15 <target>Den CSRF-Token ass ongëlteg. Versicht wann ech gelift de Formulaire nach eng Kéier ze schécken.</target>
16 </trans-unit>
17 </body>
18 </file>
19</xliff> \ No newline at end of file
diff --git a/vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.lt.xlf b/vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.lt.xlf
deleted file mode 100644
index 25f30887..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.lt.xlf
+++ /dev/null
@@ -1,19 +0,0 @@
1<?xml version="1.0"?>
2<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
3 <file source-language="en" datatype="plaintext" original="file.ext">
4 <body>
5 <trans-unit id="28">
6 <source>This form should not contain extra fields.</source>
7 <target>Forma negali turėti papildomų laukų.</target>
8 </trans-unit>
9 <trans-unit id="29">
10 <source>The uploaded file was too large. Please try to upload a smaller file.</source>
11 <target>Įkelta byla yra per didelė. bandykite įkelti mažesnę.</target>
12 </trans-unit>
13 <trans-unit id="30">
14 <source>The CSRF token is invalid. Please try to resubmit the form.</source>
15 <target>CSRF kodas nepriimtinas. Bandykite siųsti formos užklausą dar kartą.</target>
16 </trans-unit>
17 </body>
18 </file>
19</xliff> \ No newline at end of file
diff --git a/vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.lv.xlf b/vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.lv.xlf
deleted file mode 100644
index 9cdfb2cd..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.lv.xlf
+++ /dev/null
@@ -1,19 +0,0 @@
1<?xml version="1.0"?>
2<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
3 <file source-language="en" datatype="plaintext" original="file.ext">
4 <body>
5 <trans-unit id="28">
6 <source>This form should not contain extra fields.</source>
7 <target>Šajā veidlapā nevajadzētu būt papildus ievades laukiem.</target>
8 </trans-unit>
9 <trans-unit id="29">
10 <source>The uploaded file was too large. Please try to upload a smaller file.</source>
11 <target>Augšupielādētā faila izmērs bija par lielu. Lūdzu mēģiniet augšupielādēt mazāka izmēra failu.</target>
12 </trans-unit>
13 <trans-unit id="30">
14 <source>The CSRF token is invalid. Please try to resubmit the form.</source>
15 <target>Dotais CSRF talons nav derīgs. Lūdzu mēģiniet vēlreiz iesniegt veidlapu.</target>
16 </trans-unit>
17 </body>
18 </file>
19</xliff>
diff --git a/vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.mn.xlf b/vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.mn.xlf
deleted file mode 100644
index 002b01c1..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.mn.xlf
+++ /dev/null
@@ -1,19 +0,0 @@
1<?xml version="1.0"?>
2<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
3 <file source-language="en" datatype="plaintext" original="file.ext">
4 <body>
5 <trans-unit id="28">
6 <source>This form should not contain extra fields.</source>
7 <target>Форм нэмэлт талбар багтаах боломжгүй.</target>
8 </trans-unit>
9 <trans-unit id="29">
10 <source>The uploaded file was too large. Please try to upload a smaller file.</source>
11 <target>Upload хийсэн файл хэтэрхий том байна. Бага хэмжээтэй файл оруулна уу.</target>
12 </trans-unit>
13 <trans-unit id="30">
14 <source>The CSRF token is invalid. Please try to resubmit the form.</source>
15 <target>CSRF token буруу байна. Формоо дахин илгээнэ үү.</target>
16 </trans-unit>
17 </body>
18 </file>
19</xliff>
diff --git a/vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.nb.xlf b/vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.nb.xlf
deleted file mode 100644
index 5e36bd5f..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.nb.xlf
+++ /dev/null
@@ -1,19 +0,0 @@
1<?xml version="1.0"?>
2<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
3 <file source-language="en" datatype="plaintext" original="file.ext">
4 <body>
5 <trans-unit id="28">
6 <source>This form should not contain extra fields.</source>
7 <target>Feltgruppen må ikke inneholde ekstra felter.</target>
8 </trans-unit>
9 <trans-unit id="29">
10 <source>The uploaded file was too large. Please try to upload a smaller file.</source>
11 <target>Den opplastede file var for stor. Vennligst last opp en mindre fil.</target>
12 </trans-unit>
13 <trans-unit id="30">
14 <source>The CSRF token is invalid.</source>
15 <target>CSRF nøkkelen er ugyldig.</target>
16 </trans-unit>
17 </body>
18 </file>
19</xliff>
diff --git a/vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.nl.xlf b/vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.nl.xlf
deleted file mode 100644
index 3d737d79..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.nl.xlf
+++ /dev/null
@@ -1,19 +0,0 @@
1<?xml version="1.0"?>
2<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
3 <file source-language="en" datatype="plaintext" original="file.ext">
4 <body>
5 <trans-unit id="28">
6 <source>This form should not contain extra fields.</source>
7 <target>Dit formulier mag geen extra velden bevatten.</target>
8 </trans-unit>
9 <trans-unit id="29">
10 <source>The uploaded file was too large. Please try to upload a smaller file.</source>
11 <target>Het geüploade bestand is te groot. Probeer een kleiner bestand te uploaden.</target>
12 </trans-unit>
13 <trans-unit id="30">
14 <source>The CSRF token is invalid. Please try to resubmit the form.</source>
15 <target>De CSRF-token is ongeldig. Probeer het formulier opnieuw te versturen.</target>
16 </trans-unit>
17 </body>
18 </file>
19</xliff>
diff --git a/vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.pl.xlf b/vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.pl.xlf
deleted file mode 100644
index 64def2a6..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.pl.xlf
+++ /dev/null
@@ -1,19 +0,0 @@
1<?xml version="1.0"?>
2<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
3 <file source-language="en" datatype="plaintext" original="file.ext">
4 <body>
5 <trans-unit id="28">
6 <source>This form should not contain extra fields.</source>
7 <target>Ten formularz nie powinien zawierać dodatkowych pól.</target>
8 </trans-unit>
9 <trans-unit id="29">
10 <source>The uploaded file was too large. Please try to upload a smaller file.</source>
11 <target>Wgrany plik był za duży. Proszę spróbować wgrać mniejszy plik.</target>
12 </trans-unit>
13 <trans-unit id="30">
14 <source>The CSRF token is invalid. Please try to resubmit the form.</source>
15 <target>Token CSRF jest nieprawidłowy. Proszę spróbować wysłać formularz ponownie.</target>
16 </trans-unit>
17 </body>
18 </file>
19</xliff> \ No newline at end of file
diff --git a/vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.pt.xlf b/vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.pt.xlf
deleted file mode 100644
index 554a810c..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.pt.xlf
+++ /dev/null
@@ -1,19 +0,0 @@
1<?xml version="1.0"?>
2<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
3 <file source-language="en" datatype="plaintext" original="file.ext">
4 <body>
5 <trans-unit id="28">
6 <source>This form should not contain extra fields.</source>
7 <target>Este formulário não deveria conter campos extra.</target>
8 </trans-unit>
9 <trans-unit id="29">
10 <source>The uploaded file was too large. Please try to upload a smaller file.</source>
11 <target>O arquivo enviado é muito grande. Por favor, tente enviar um ficheiro mais pequeno.</target>
12 </trans-unit>
13 <trans-unit id="30">
14 <source>The CSRF token is invalid. Please try to resubmit the form.</source>
15 <target>O token CSRF é inválido. Por favor submeta o formulário novamente.</target>
16 </trans-unit>
17 </body>
18 </file>
19</xliff>
diff --git a/vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.pt_BR.xlf b/vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.pt_BR.xlf
deleted file mode 100644
index 9ae4d719..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.pt_BR.xlf
+++ /dev/null
@@ -1,19 +0,0 @@
1<?xml version="1.0"?>
2<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
3 <file source-language="en" datatype="plaintext" original="file.ext">
4 <body>
5 <trans-unit id="28">
6 <source>This form should not contain extra fields.</source>
7 <target>Este formulário não deve conter campos adicionais.</target>
8 </trans-unit>
9 <trans-unit id="29">
10 <source>The uploaded file was too large. Please try to upload a smaller file.</source>
11 <target>O arquivo enviado é muito grande. Por favor, tente enviar um arquivo menor.</target>
12 </trans-unit>
13 <trans-unit id="30">
14 <source>The CSRF token is invalid. Please try to resubmit the form.</source>
15 <target>O token CSRF é inválido. Por favor, tente reenviar o formulário.</target>
16 </trans-unit>
17 </body>
18 </file>
19</xliff>
diff --git a/vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.ro.xlf b/vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.ro.xlf
deleted file mode 100644
index 25abab3b..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.ro.xlf
+++ /dev/null
@@ -1,19 +0,0 @@
1<?xml version="1.0"?>
2<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
3 <file source-language="en" datatype="plaintext" original="file.ext">
4 <body>
5 <trans-unit id="28">
6 <source>This form should not contain extra fields.</source>
7 <target>Aceast formular nu ar trebui să conțină câmpuri suplimentare.</target>
8 </trans-unit>
9 <trans-unit id="29">
10 <source>The uploaded file was too large. Please try to upload a smaller file.</source>
11 <target>Fișierul încărcat a fost prea mare. Vă rugăm sa încărcați un fișier mai mic.</target>
12 </trans-unit>
13 <trans-unit id="30">
14 <source>The CSRF token is invalid. Please try to resubmit the form.</source>
15 <target>Token-ul CSRF este invalid. Vă rugăm să trimiteți formularul incă o dată.</target>
16 </trans-unit>
17 </body>
18 </file>
19</xliff> \ No newline at end of file
diff --git a/vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.ru.xlf b/vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.ru.xlf
deleted file mode 100644
index 8d829f1b..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.ru.xlf
+++ /dev/null
@@ -1,19 +0,0 @@
1<?xml version="1.0"?>
2<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
3 <file source-language="en" datatype="plaintext" original="file.ext">
4 <body>
5 <trans-unit id="28">
6 <source>This form should not contain extra fields.</source>
7 <target>Эта форма не должна содержать дополнительных полей.</target>
8 </trans-unit>
9 <trans-unit id="29">
10 <source>The uploaded file was too large. Please try to upload a smaller file.</source>
11 <target>Загруженный файл слишком большой. Пожалуйста, попробуйте загрузить файл меньшего размера.</target>
12 </trans-unit>
13 <trans-unit id="30">
14 <source>The CSRF token is invalid. Please try to resubmit the form.</source>
15 <target>CSRF значение недопустимо. Пожалуйста, попробуйте повторить отправку формы.</target>
16 </trans-unit>
17 </body>
18 </file>
19</xliff> \ No newline at end of file
diff --git a/vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.sk.xlf b/vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.sk.xlf
deleted file mode 100644
index 638d0cc4..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.sk.xlf
+++ /dev/null
@@ -1,19 +0,0 @@
1<?xml version="1.0"?>
2<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
3 <file source-language="en" datatype="plaintext" original="file.ext">
4 <body>
5 <trans-unit id="28">
6 <source>This form should not contain extra fields.</source>
7 <target>Polia by nemali obsahovať ďalšie prvky.</target>
8 </trans-unit>
9 <trans-unit id="29">
10 <source>The uploaded file was too large. Please try to upload a smaller file.</source>
11 <target>Odoslaný súbor je príliš veľký. Prosím odošlite súbor s menšou veľkosťou.</target>
12 </trans-unit>
13 <trans-unit id="30">
14 <source>The CSRF token is invalid. Please try to resubmit the form.</source>
15 <target>CSRF token je neplatný. Prosím skúste znovu odoslať formulár.</target>
16 </trans-unit>
17 </body>
18 </file>
19</xliff>
diff --git a/vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.sl.xlf b/vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.sl.xlf
deleted file mode 100644
index 103124d0..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.sl.xlf
+++ /dev/null
@@ -1,19 +0,0 @@
1<?xml version="1.0"?>
2<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
3 <file source-language="en" datatype="plaintext" original="file.ext">
4 <body>
5 <trans-unit id="28">
6 <source>This form should not contain extra fields.</source>
7 <target>To področje ne sme vsebovati dodatnih polj.</target>
8 </trans-unit>
9 <trans-unit id="29">
10 <source>The uploaded file was too large. Please try to upload a smaller file.</source>
11 <target>Naložena datoteka je prevelika. Prosim, poizkusite naložiti manjšo.</target>
12 </trans-unit>
13 <trans-unit id="30">
14 <source>The CSRF token is invalid. Please try to resubmit the form.</source>
15 <target>CSRF vrednost je napačna. Prosimo, ponovno pošljite obrazec.</target>
16 </trans-unit>
17 </body>
18 </file>
19</xliff>
diff --git a/vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.sr_Cyrl.xlf b/vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.sr_Cyrl.xlf
deleted file mode 100644
index ff7f550a..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.sr_Cyrl.xlf
+++ /dev/null
@@ -1,19 +0,0 @@
1<?xml version="1.0"?>
2<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
3 <file source-language="en" datatype="plaintext" original="file.ext">
4 <body>
5 <trans-unit id="28">
6 <source>This form should not contain extra fields.</source>
7 <target>Овај формулар не треба да садржи додатна поља.</target>
8 </trans-unit>
9 <trans-unit id="29">
10 <source>The uploaded file was too large. Please try to upload a smaller file.</source>
11 <target>Отпремљена датотека је била превелика. Молим покушајте отпремање мање датотеке.</target>
12 </trans-unit>
13 <trans-unit id="30">
14 <source>The CSRF token is invalid. Please try to resubmit the form.</source>
15 <target>CSRF вредност је невалидна. Покушајте поново.</target>
16 </trans-unit>
17 </body>
18 </file>
19</xliff> \ No newline at end of file
diff --git a/vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.sr_Latn.xlf b/vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.sr_Latn.xlf
deleted file mode 100644
index 6c4be358..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.sr_Latn.xlf
+++ /dev/null
@@ -1,19 +0,0 @@
1<?xml version="1.0"?>
2<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
3 <file source-language="en" datatype="plaintext" original="file.ext">
4 <body>
5 <trans-unit id="28">
6 <source>This form should not contain extra fields.</source>
7 <target>Ovaj formular ne treba da sadrži dodatna polja.</target>
8 </trans-unit>
9 <trans-unit id="29">
10 <source>The uploaded file was too large. Please try to upload a smaller file.</source>
11 <target>Otpremljena datoteka je bila prevelika. Molim pokušajte otpremanje manje datoteke.</target>
12 </trans-unit>
13 <trans-unit id="30">
14 <source>The CSRF token is invalid. Please try to resubmit the form.</source>
15 <target>CSRF vrednost je nevalidna. Pokušajte ponovo.</target>
16 </trans-unit>
17 </body>
18 </file>
19</xliff> \ No newline at end of file
diff --git a/vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.sv.xlf b/vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.sv.xlf
deleted file mode 100644
index 4e2518b1..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.sv.xlf
+++ /dev/null
@@ -1,19 +0,0 @@
1<?xml version="1.0"?>
2<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
3 <file source-language="en" datatype="plaintext" original="file.ext">
4 <body>
5 <trans-unit id="28">
6 <source>This form should not contain extra fields.</source>
7 <target>Formuläret kan inte innehålla extra fält.</target>
8 </trans-unit>
9 <trans-unit id="29">
10 <source>The uploaded file was too large. Please try to upload a smaller file.</source>
11 <target>Den uppladdade filen var för stor. Försök ladda upp en mindre fil.</target>
12 </trans-unit>
13 <trans-unit id="30">
14 <source>The CSRF token is invalid.</source>
15 <target>CSRF-symbolen är inte giltig.</target>
16 </trans-unit>
17 </body>
18 </file>
19</xliff>
diff --git a/vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.ua.xlf b/vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.ua.xlf
deleted file mode 100644
index 4c739fac..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.ua.xlf
+++ /dev/null
@@ -1,19 +0,0 @@
1<?xml version="1.0"?>
2<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
3 <file source-language="en" datatype="plaintext" original="file.ext">
4 <body>
5 <trans-unit id="28">
6 <source>This form should not contain extra fields.</source>
7 <target>Ця форма не повинна містити додаткових полів.</target>
8 </trans-unit>
9 <trans-unit id="29">
10 <source>The uploaded file was too large. Please try to upload a smaller file.</source>
11 <target>Завантажений файл занадто великий. Будь-ласка, спробуйте завантажити файл меншого розміру.</target>
12 </trans-unit>
13 <trans-unit id="30">
14 <source>The CSRF token is invalid. Please try to resubmit the form.</source>
15 <target>CSRF значення недопустиме. Будь-ласка, спробуйте відправити форму знову.</target>
16 </trans-unit>
17 </body>
18 </file>
19</xliff>
diff --git a/vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.zh_CN.xlf b/vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.zh_CN.xlf
deleted file mode 100644
index 8bdf7fb5..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Resources/translations/validators.zh_CN.xlf
+++ /dev/null
@@ -1,19 +0,0 @@
1<?xml version="1.0"?>
2<xliff version="1.2" xmlns="urn:oasis:names:tc:xliff:document:1.2">
3 <file source-language="en" datatype="plaintext" original="file.ext">
4 <body>
5 <trans-unit id="28">
6 <source>This form should not contain extra fields.</source>
7 <target>该表单中不可有额外字段.</target>
8 </trans-unit>
9 <trans-unit id="29">
10 <source>The uploaded file was too large. Please try to upload a smaller file.</source>
11 <target>上传文件太大, 请重新尝试上传一个较小的文件.</target>
12 </trans-unit>
13 <trans-unit id="30">
14 <source>The CSRF token is invalid. Please try to resubmit the form.</source>
15 <target>CSRF 验证符无效, 请重新提交.</target>
16 </trans-unit>
17 </body>
18 </file>
19</xliff>
diff --git a/vendor/symfony/form/Symfony/Component/Form/ReversedTransformer.php b/vendor/symfony/form/Symfony/Component/Form/ReversedTransformer.php
deleted file mode 100644
index 7069705f..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/ReversedTransformer.php
+++ /dev/null
@@ -1,55 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form;
13
14/**
15 * Reverses a transformer
16 *
17 * When the transform() method is called, the reversed transformer's
18 * reverseTransform() method is called and vice versa.
19 *
20 * @author Bernhard Schussek <bschussek@gmail.com>
21 */
22class ReversedTransformer implements DataTransformerInterface
23{
24 /**
25 * The reversed transformer
26 * @var DataTransformerInterface
27 */
28 protected $reversedTransformer;
29
30 /**
31 * Reverses this transformer
32 *
33 * @param DataTransformerInterface $reversedTransformer
34 */
35 public function __construct(DataTransformerInterface $reversedTransformer)
36 {
37 $this->reversedTransformer = $reversedTransformer;
38 }
39
40 /**
41 * {@inheritDoc}
42 */
43 public function transform($value)
44 {
45 return $this->reversedTransformer->reverseTransform($value);
46 }
47
48 /**
49 * {@inheritDoc}
50 */
51 public function reverseTransform($value)
52 {
53 return $this->reversedTransformer->transform($value);
54 }
55}
diff --git a/vendor/symfony/form/Symfony/Component/Form/SubmitButton.php b/vendor/symfony/form/Symfony/Component/Form/SubmitButton.php
deleted file mode 100644
index 47d4be0e..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/SubmitButton.php
+++ /dev/null
@@ -1,52 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form;
13
14/**
15 * A button that submits the form.
16 *
17 * @author Bernhard Schussek <bschussek@gmail.com>
18 */
19class SubmitButton extends Button implements ClickableInterface
20{
21 /**
22 * @var Boolean
23 */
24 private $clicked = false;
25
26 /**
27 * {@inheritdoc}
28 */
29 public function isClicked()
30 {
31 return $this->clicked;
32 }
33
34 /**
35 * Submits data to the button.
36 *
37 * @param null|string $submittedData The data.
38 * @param Boolean $clearMissing Not used.
39 *
40 * @return SubmitButton The button instance
41 *
42 * @throws Exception\AlreadySubmittedException If the form has already been submitted.
43 */
44 public function submit($submittedData, $clearMissing = true)
45 {
46 parent::submit($submittedData, $clearMissing);
47
48 $this->clicked = null !== $submittedData;
49
50 return $this;
51 }
52}
diff --git a/vendor/symfony/form/Symfony/Component/Form/SubmitButtonBuilder.php b/vendor/symfony/form/Symfony/Component/Form/SubmitButtonBuilder.php
deleted file mode 100644
index 088fb748..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/SubmitButtonBuilder.php
+++ /dev/null
@@ -1,30 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form;
13
14/**
15 * A builder for {@link SubmitButton} instances.
16 *
17 * @author Bernhard Schussek <bschussek@gmail.com>
18 */
19class SubmitButtonBuilder extends ButtonBuilder
20{
21 /**
22 * Creates the button.
23 *
24 * @return Button The button
25 */
26 public function getForm()
27 {
28 return new SubmitButton($this->getFormConfig());
29 }
30}
diff --git a/vendor/symfony/form/Symfony/Component/Form/SubmitButtonTypeInterface.php b/vendor/symfony/form/Symfony/Component/Form/SubmitButtonTypeInterface.php
deleted file mode 100644
index f7ac13f7..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/SubmitButtonTypeInterface.php
+++ /dev/null
@@ -1,21 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form;
13
14/**
15 * A type that should be converted into a {@link SubmitButton} instance.
16 *
17 * @author Bernhard Schussek <bschussek@gmail.com>
18 */
19interface SubmitButtonTypeInterface extends FormTypeInterface
20{
21}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Test/DeprecationErrorHandler.php b/vendor/symfony/form/Symfony/Component/Form/Test/DeprecationErrorHandler.php
deleted file mode 100644
index 36417f74..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Test/DeprecationErrorHandler.php
+++ /dev/null
@@ -1,42 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Test;
13
14use Symfony\Component\Form\FormEvent;
15
16class DeprecationErrorHandler
17{
18 public static function handle($errorNumber, $message, $file, $line, $context)
19 {
20 if ($errorNumber & E_USER_DEPRECATED) {
21 return true;
22 }
23
24 return \PHPUnit_Util_ErrorHandler::handleError($errorNumber, $message, $file, $line);
25 }
26
27 public static function handleBC($errorNumber, $message, $file, $line, $context)
28 {
29 if ($errorNumber & E_USER_DEPRECATED) {
30 return true;
31 }
32
33 return false;
34 }
35
36 public static function preBind($listener, FormEvent $event)
37 {
38 set_error_handler(array('Symfony\Component\Form\Test\DeprecationErrorHandler', 'handle'));
39 $listener->preBind($event);
40 restore_error_handler();
41 }
42}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Test/FormBuilderInterface.php b/vendor/symfony/form/Symfony/Component/Form/Test/FormBuilderInterface.php
deleted file mode 100644
index 711cecd0..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Test/FormBuilderInterface.php
+++ /dev/null
@@ -1,16 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Test;
13
14interface FormBuilderInterface extends \Iterator, \Symfony\Component\Form\FormBuilderInterface
15{
16}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Test/FormIntegrationTestCase.php b/vendor/symfony/form/Symfony/Component/Form/Test/FormIntegrationTestCase.php
deleted file mode 100644
index 68e5f244..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Test/FormIntegrationTestCase.php
+++ /dev/null
@@ -1,41 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Test;
13
14use Symfony\Component\Form\Forms;
15
16/**
17 * @author Bernhard Schussek <bschussek@gmail.com>
18 */
19abstract class FormIntegrationTestCase extends \PHPUnit_Framework_TestCase
20{
21 /**
22 * @var \Symfony\Component\Form\FormFactoryInterface
23 */
24 protected $factory;
25
26 protected function setUp()
27 {
28 if (!class_exists('Symfony\Component\EventDispatcher\EventDispatcher')) {
29 $this->markTestSkipped('The "EventDispatcher" component is not available');
30 }
31
32 $this->factory = Forms::createFormFactoryBuilder()
33 ->addExtensions($this->getExtensions())
34 ->getFormFactory();
35 }
36
37 protected function getExtensions()
38 {
39 return array();
40 }
41}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Test/FormInterface.php b/vendor/symfony/form/Symfony/Component/Form/Test/FormInterface.php
deleted file mode 100644
index 22a83fd7..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Test/FormInterface.php
+++ /dev/null
@@ -1,16 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Test;
13
14interface FormInterface extends \Iterator, \Symfony\Component\Form\FormInterface
15{
16}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Test/FormPerformanceTestCase.php b/vendor/symfony/form/Symfony/Component/Form/Test/FormPerformanceTestCase.php
deleted file mode 100644
index 573f4e91..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Test/FormPerformanceTestCase.php
+++ /dev/null
@@ -1,70 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Test;
13
14/**
15 * Base class for performance tests.
16 *
17 * Copied from Doctrine 2's OrmPerformanceTestCase.
18 *
19 * @author robo
20 * @author Bernhard Schussek <bschussek@gmail.com>
21 */
22abstract class FormPerformanceTestCase extends FormIntegrationTestCase
23{
24 /**
25 * @var integer
26 */
27 protected $maxRunningTime = 0;
28
29 /**
30 */
31 protected function runTest()
32 {
33 $s = microtime(true);
34 parent::runTest();
35 $time = microtime(true) - $s;
36
37 if ($this->maxRunningTime != 0 && $time > $this->maxRunningTime) {
38 $this->fail(
39 sprintf(
40 'expected running time: <= %s but was: %s',
41
42 $this->maxRunningTime,
43 $time
44 )
45 );
46 }
47 }
48
49 /**
50 * @param integer $maxRunningTime
51 * @throws \InvalidArgumentException
52 */
53 public function setMaxRunningTime($maxRunningTime)
54 {
55 if (is_integer($maxRunningTime) && $maxRunningTime >= 0) {
56 $this->maxRunningTime = $maxRunningTime;
57 } else {
58 throw new \InvalidArgumentException;
59 }
60 }
61
62 /**
63 * @return integer
64 * @since Method available since Release 2.3.0
65 */
66 public function getMaxRunningTime()
67 {
68 return $this->maxRunningTime;
69 }
70}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Test/TypeTestCase.php b/vendor/symfony/form/Symfony/Component/Form/Test/TypeTestCase.php
deleted file mode 100644
index 9d51a9ee..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Test/TypeTestCase.php
+++ /dev/null
@@ -1,41 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien.potencier@symfony-project.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Test;
13
14use Symfony\Component\Form\FormBuilder;
15use Symfony\Component\EventDispatcher\EventDispatcher;
16
17abstract class TypeTestCase extends FormIntegrationTestCase
18{
19 /**
20 * @var FormBuilder
21 */
22 protected $builder;
23
24 /**
25 * @var EventDispatcher
26 */
27 protected $dispatcher;
28
29 protected function setUp()
30 {
31 parent::setUp();
32
33 $this->dispatcher = $this->getMock('Symfony\Component\EventDispatcher\EventDispatcherInterface');
34 $this->builder = new FormBuilder(null, null, $this->dispatcher, $this->factory);
35 }
36
37 public static function assertDateTimeEquals(\DateTime $expected, \DateTime $actual)
38 {
39 self::assertEquals($expected->format('c'), $actual->format('c'));
40 }
41}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Tests/AbstractDivLayoutTest.php b/vendor/symfony/form/Symfony/Component/Form/Tests/AbstractDivLayoutTest.php
deleted file mode 100644
index ee9ed8f2..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Tests/AbstractDivLayoutTest.php
+++ /dev/null
@@ -1,732 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Tests;
13
14use Symfony\Component\Form\FormError;
15use Symfony\Component\Form\Tests\Fixtures\AlternatingRowType;
16
17abstract class AbstractDivLayoutTest extends AbstractLayoutTest
18{
19 public function testRow()
20 {
21 $form = $this->factory->createNamed('name', 'text');
22 $form->addError(new FormError('[trans]Error![/trans]'));
23 $view = $form->createView();
24 $html = $this->renderRow($view);
25
26 $this->assertMatchesXpath($html,
27'/div
28 [
29 ./label[@for="name"]
30 /following-sibling::ul
31 [./li[.="[trans]Error![/trans]"]]
32 [count(./li)=1]
33 /following-sibling::input[@id="name"]
34 ]
35'
36 );
37 }
38
39 public function testRowOverrideVariables()
40 {
41 $view = $this->factory->createNamed('name', 'text')->createView();
42 $html = $this->renderRow($view, array(
43 'attr' => array('class' => 'my&class'),
44 'label' => 'foo&bar',
45 'label_attr' => array('class' => 'my&label&class'),
46 ));
47
48 $this->assertMatchesXpath($html,
49'/div
50 [
51 ./label[@for="name"][@class="my&label&class required"][.="[trans]foo&bar[/trans]"]
52 /following-sibling::input[@id="name"][@class="my&class"]
53 ]
54'
55 );
56 }
57
58 public function testRepeatedRow()
59 {
60 $form = $this->factory->createNamed('name', 'repeated');
61 $form->addError(new FormError('[trans]Error![/trans]'));
62 $view = $form->createView();
63 $html = $this->renderRow($view);
64
65 // The errors of the form are not rendered by intention!
66 // In practice, repeated fields cannot have errors as all errors
67 // on them are mapped to the first child.
68 // (see RepeatedTypeValidatorExtension)
69
70 $this->assertMatchesXpath($html,
71'/div
72 [
73 ./label[@for="name_first"]
74 /following-sibling::input[@id="name_first"]
75 ]
76/following-sibling::div
77 [
78 ./label[@for="name_second"]
79 /following-sibling::input[@id="name_second"]
80 ]
81'
82 );
83 }
84
85 public function testButtonRow()
86 {
87 $form = $this->factory->createNamed('name', 'button');
88 $view = $form->createView();
89 $html = $this->renderRow($view);
90
91 $this->assertMatchesXpath($html,
92'/div
93 [
94 ./button[@type="button"][@name="name"]
95 ]
96 [count(//label)=0]
97'
98 );
99 }
100
101 public function testRest()
102 {
103 $view = $this->factory->createNamedBuilder('name', 'form')
104 ->add('field1', 'text')
105 ->add('field2', 'repeated')
106 ->add('field3', 'text')
107 ->add('field4', 'text')
108 ->getForm()
109 ->createView();
110
111 // Render field2 row -> does not implicitly call renderWidget because
112 // it is a repeated field!
113 $this->renderRow($view['field2']);
114
115 // Render field3 widget
116 $this->renderWidget($view['field3']);
117
118 // Rest should only contain field1 and field4
119 $html = $this->renderRest($view);
120
121 $this->assertMatchesXpath($html,
122'/div
123 [
124 ./label[@for="name_field1"]
125 /following-sibling::input[@type="text"][@id="name_field1"]
126 ]
127/following-sibling::div
128 [
129 ./label[@for="name_field4"]
130 /following-sibling::input[@type="text"][@id="name_field4"]
131 ]
132 [count(../div)=2]
133 [count(..//label)=2]
134 [count(..//input)=3]
135/following-sibling::input
136 [@type="hidden"]
137 [@id="name__token"]
138'
139 );
140 }
141
142 public function testRestWithChildrenForms()
143 {
144 $child1 = $this->factory->createNamedBuilder('child1', 'form')
145 ->add('field1', 'text')
146 ->add('field2', 'text');
147
148 $child2 = $this->factory->createNamedBuilder('child2', 'form')
149 ->add('field1', 'text')
150 ->add('field2', 'text');
151
152 $view = $this->factory->createNamedBuilder('parent', 'form')
153 ->add($child1)
154 ->add($child2)
155 ->getForm()
156 ->createView();
157
158 // Render child1.field1 row
159 $this->renderRow($view['child1']['field1']);
160
161 // Render child2.field2 widget (remember that widget don't render label)
162 $this->renderWidget($view['child2']['field2']);
163
164 // Rest should only contain child1.field2 and child2.field1
165 $html = $this->renderRest($view);
166
167 $this->assertMatchesXpath($html,
168'/div
169 [
170 ./label[not(@for)]
171 /following-sibling::div[@id="parent_child1"]
172 [
173 ./div
174 [
175 ./label[@for="parent_child1_field2"]
176 /following-sibling::input[@id="parent_child1_field2"]
177 ]
178 ]
179 ]
180
181/following-sibling::div
182 [
183 ./label[not(@for)]
184 /following-sibling::div[@id="parent_child2"]
185 [
186 ./div
187 [
188 ./label[@for="parent_child2_field1"]
189 /following-sibling::input[@id="parent_child2_field1"]
190 ]
191 ]
192 ]
193 [count(//label)=4]
194 [count(//input[@type="text"])=2]
195/following-sibling::input[@type="hidden"][@id="parent__token"]
196'
197 );
198 }
199
200 public function testRestAndRepeatedWithRow()
201 {
202 $view = $this->factory->createNamedBuilder('name', 'form')
203 ->add('first', 'text')
204 ->add('password', 'repeated')
205 ->getForm()
206 ->createView();
207
208 $this->renderRow($view['password']);
209
210 $html = $this->renderRest($view);
211
212 $this->assertMatchesXpath($html,
213'/div
214 [
215 ./label[@for="name_first"]
216 /following-sibling::input[@type="text"][@id="name_first"]
217 ]
218 [count(.//input)=1]
219/following-sibling::input
220 [@type="hidden"]
221 [@id="name__token"]
222'
223 );
224 }
225
226 public function testRestAndRepeatedWithRowPerChild()
227 {
228 $view = $this->factory->createNamedBuilder('name', 'form')
229 ->add('first', 'text')
230 ->add('password', 'repeated')
231 ->getForm()
232 ->createView();
233
234 $this->renderRow($view['password']['first']);
235 $this->renderRow($view['password']['second']);
236
237 $html = $this->renderRest($view);
238
239 $this->assertMatchesXpath($html,
240'/div
241 [
242 ./label[@for="name_first"]
243 /following-sibling::input[@type="text"][@id="name_first"]
244 ]
245 [count(.//input)=1]
246 [count(.//label)=1]
247/following-sibling::input
248 [@type="hidden"]
249 [@id="name__token"]
250'
251 );
252 }
253
254 public function testRestAndRepeatedWithWidgetPerChild()
255 {
256 $view = $this->factory->createNamedBuilder('name', 'form')
257 ->add('first', 'text')
258 ->add('password', 'repeated')
259 ->getForm()
260 ->createView();
261
262 // The password form is considered as rendered as all its children
263 // are rendered
264 $this->renderWidget($view['password']['first']);
265 $this->renderWidget($view['password']['second']);
266
267 $html = $this->renderRest($view);
268
269 $this->assertMatchesXpath($html,
270'/div
271 [
272 ./label[@for="name_first"]
273 /following-sibling::input[@type="text"][@id="name_first"]
274 ]
275 [count(//input)=2]
276 [count(//label)=1]
277/following-sibling::input
278 [@type="hidden"]
279 [@id="name__token"]
280'
281 );
282 }
283
284 public function testCollection()
285 {
286 $form = $this->factory->createNamed('name', 'collection', array('a', 'b'), array(
287 'type' => 'text',
288 ));
289
290 $this->assertWidgetMatchesXpath($form->createView(), array(),
291'/div
292 [
293 ./div[./input[@type="text"][@value="a"]]
294 /following-sibling::div[./input[@type="text"][@value="b"]]
295 ]
296 [count(./div[./input])=2]
297'
298 );
299 }
300
301 // https://github.com/symfony/symfony/issues/5038
302 public function testCollectionWithAlternatingRowTypes()
303 {
304 $data = array(
305 array('title' => 'a'),
306 array('title' => 'b'),
307 );
308 $form = $this->factory->createNamed('name', 'collection', $data, array(
309 'type' => new AlternatingRowType(),
310 ));
311
312 $this->assertWidgetMatchesXpath($form->createView(), array(),
313'/div
314 [
315 ./div[./div/div/input[@type="text"][@value="a"]]
316 /following-sibling::div[./div/div/textarea[.="b"]]
317 ]
318 [count(./div[./div/div/input])=1]
319 [count(./div[./div/div/textarea])=1]
320'
321 );
322 }
323
324 public function testEmptyCollection()
325 {
326 $form = $this->factory->createNamed('name', 'collection', array(), array(
327 'type' => 'text',
328 ));
329
330 $this->assertWidgetMatchesXpath($form->createView(), array(),
331'/div
332 [./input[@type="hidden"][@id="name__token"]]
333 [count(./div)=0]
334'
335 );
336 }
337
338 public function testCollectionRow()
339 {
340 $collection = $this->factory->createNamedBuilder(
341 'collection',
342 'collection',
343 array('a', 'b'),
344 array('type' => 'text')
345 );
346
347 $form = $this->factory->createNamedBuilder('form', 'form')
348 ->add($collection)
349 ->getForm();
350
351 $this->assertWidgetMatchesXpath($form->createView(), array(),
352'/div
353 [
354 ./div
355 [
356 ./label[not(@for)]
357 /following-sibling::div
358 [
359 ./div
360 [
361 ./label[@for="form_collection_0"]
362 /following-sibling::input[@type="text"][@value="a"]
363 ]
364 /following-sibling::div
365 [
366 ./label[@for="form_collection_1"]
367 /following-sibling::input[@type="text"][@value="b"]
368 ]
369 ]
370 ]
371 /following-sibling::input[@type="hidden"][@id="form__token"]
372 ]
373 [count(.//input)=3]
374'
375 );
376 }
377
378 public function testForm()
379 {
380 $form = $this->factory->createNamedBuilder('name', 'form')
381 ->setMethod('PUT')
382 ->setAction('http://example.com')
383 ->add('firstName', 'text')
384 ->add('lastName', 'text')
385 ->getForm();
386
387 // include ampersands everywhere to validate escaping
388 $html = $this->renderForm($form->createView(), array(
389 'id' => 'my&id',
390 'attr' => array('class' => 'my&class'),
391 ));
392
393 $this->assertMatchesXpath($html,
394'/form
395 [
396 ./input[@type="hidden"][@name="_method"][@value="PUT"]
397 /following-sibling::div
398 [
399 ./div
400 [
401 ./label[@for="name_firstName"]
402 /following-sibling::input[@type="text"][@id="name_firstName"]
403 ]
404 /following-sibling::div
405 [
406 ./label[@for="name_lastName"]
407 /following-sibling::input[@type="text"][@id="name_lastName"]
408 ]
409 /following-sibling::input[@type="hidden"][@id="name__token"]
410 ]
411 [count(.//input)=3]
412 [@id="my&id"]
413 [@class="my&class"]
414 ]
415 [@method="post"]
416 [@action="http://example.com"]
417 [@class="my&class"]
418'
419 );
420 }
421
422 public function testFormWidget()
423 {
424 $form = $this->factory->createNamedBuilder('name', 'form')
425 ->add('firstName', 'text')
426 ->add('lastName', 'text')
427 ->getForm();
428
429 $this->assertWidgetMatchesXpath($form->createView(), array(),
430'/div
431 [
432 ./div
433 [
434 ./label[@for="name_firstName"]
435 /following-sibling::input[@type="text"][@id="name_firstName"]
436 ]
437 /following-sibling::div
438 [
439 ./label[@for="name_lastName"]
440 /following-sibling::input[@type="text"][@id="name_lastName"]
441 ]
442 /following-sibling::input[@type="hidden"][@id="name__token"]
443 ]
444 [count(.//input)=3]
445'
446 );
447 }
448
449 // https://github.com/symfony/symfony/issues/2308
450 public function testNestedFormError()
451 {
452 $form = $this->factory->createNamedBuilder('name', 'form')
453 ->add($this->factory
454 ->createNamedBuilder('child', 'form', null, array('error_bubbling' => false))
455 ->add('grandChild', 'form')
456 )
457 ->getForm();
458
459 $form->get('child')->addError(new FormError('[trans]Error![/trans]'));
460
461 $this->assertWidgetMatchesXpath($form->createView(), array(),
462'/div
463 [
464 ./div/label
465 /following-sibling::ul[./li[.="[trans]Error![/trans]"]]
466 ]
467 [count(.//li[.="[trans]Error![/trans]"])=1]
468'
469 );
470 }
471
472 public function testCsrf()
473 {
474 $this->csrfProvider->expects($this->any())
475 ->method('generateCsrfToken')
476 ->will($this->returnValue('foo&bar'));
477
478 $form = $this->factory->createNamedBuilder('name', 'form')
479 ->add($this->factory
480 // No CSRF protection on nested forms
481 ->createNamedBuilder('child', 'form')
482 ->add($this->factory->createNamedBuilder('grandchild', 'text'))
483 )
484 ->getForm();
485
486 $this->assertWidgetMatchesXpath($form->createView(), array(),
487'/div
488 [
489 ./div
490 /following-sibling::input[@type="hidden"][@id="name__token"][@value="foo&bar"]
491 ]
492 [count(.//input[@type="hidden"])=1]
493'
494 );
495 }
496
497 public function testRepeated()
498 {
499 $form = $this->factory->createNamed('name', 'repeated', 'foobar', array(
500 'type' => 'text',
501 ));
502
503 $this->assertWidgetMatchesXpath($form->createView(), array(),
504'/div
505 [
506 ./div
507 [
508 ./label[@for="name_first"]
509 /following-sibling::input[@type="text"][@id="name_first"]
510 ]
511 /following-sibling::div
512 [
513 ./label[@for="name_second"]
514 /following-sibling::input[@type="text"][@id="name_second"]
515 ]
516 /following-sibling::input[@type="hidden"][@id="name__token"]
517 ]
518 [count(.//input)=3]
519'
520 );
521 }
522
523 public function testRepeatedWithCustomOptions()
524 {
525 $form = $this->factory->createNamed('name', 'repeated', null, array(
526 // the global required value cannot be overridden
527 'first_options' => array('label' => 'Test', 'required' => false),
528 'second_options' => array('label' => 'Test2')
529 ));
530
531 $this->assertWidgetMatchesXpath($form->createView(), array(),
532'/div
533 [
534 ./div
535 [
536 ./label[@for="name_first"][.="[trans]Test[/trans]"]
537 /following-sibling::input[@type="text"][@id="name_first"][@required="required"]
538 ]
539 /following-sibling::div
540 [
541 ./label[@for="name_second"][.="[trans]Test2[/trans]"]
542 /following-sibling::input[@type="text"][@id="name_second"][@required="required"]
543 ]
544 /following-sibling::input[@type="hidden"][@id="name__token"]
545 ]
546 [count(.//input)=3]
547'
548 );
549 }
550
551 public function testSearchInputName()
552 {
553 $form = $this->factory->createNamedBuilder('full', 'form')
554 ->add('name', 'search')
555 ->getForm();
556
557 $this->assertWidgetMatchesXpath($form->createView(), array(),
558'/div
559 [
560 ./div
561 [
562 ./label[@for="full_name"]
563 /following-sibling::input[@type="search"][@id="full_name"][@name="full[name]"]
564 ]
565 /following-sibling::input[@type="hidden"][@id="full__token"]
566 ]
567 [count(//input)=2]
568'
569 );
570 }
571
572 public function testLabelHasNoId()
573 {
574 $form = $this->factory->createNamed('name', 'text');
575 $html = $this->renderRow($form->createView());
576
577 $this->assertMatchesXpath($html,
578'/div
579 [
580 ./label[@for="name"][not(@id)]
581 /following-sibling::input[@id="name"]
582 ]
583'
584 );
585 }
586
587 public function testLabelIsNotRenderedWhenSetToFalse()
588 {
589 $form = $this->factory->createNamed('name', 'text', null, array(
590 'label' => false
591 ));
592 $html = $this->renderRow($form->createView());
593
594 $this->assertMatchesXpath($html,
595'/div
596 [
597 ./input[@id="name"]
598 ]
599 [count(//label)=0]
600'
601 );
602 }
603
604 /**
605 * @dataProvider themeBlockInheritanceProvider
606 */
607 public function testThemeBlockInheritance($theme)
608 {
609 $view = $this->factory
610 ->createNamed('name', 'email')
611 ->createView()
612 ;
613
614 $this->setTheme($view, $theme);
615
616 $this->assertMatchesXpath(
617 $this->renderWidget($view),
618 '/input[@type="email"][@rel="theme"]'
619 );
620 }
621
622 /**
623 * @dataProvider themeInheritanceProvider
624 */
625 public function testThemeInheritance($parentTheme, $childTheme)
626 {
627 $child = $this->factory->createNamedBuilder('child', 'form')
628 ->add('field', 'text');
629
630 $view = $this->factory->createNamedBuilder('parent', 'form')
631 ->add('field', 'text')
632 ->add($child)
633 ->getForm()
634 ->createView()
635 ;
636
637 $this->setTheme($view, $parentTheme);
638 $this->setTheme($view['child'], $childTheme);
639
640 $this->assertWidgetMatchesXpath($view, array(),
641'/div
642 [
643 ./div
644 [
645 ./label[.="parent"]
646 /following-sibling::input[@type="text"]
647 ]
648 /following-sibling::div
649 [
650 ./label[.="child"]
651 /following-sibling::div
652 [
653 ./div
654 [
655 ./label[.="child"]
656 /following-sibling::input[@type="text"]
657 ]
658 ]
659 ]
660 /following-sibling::input[@type="hidden"]
661 ]
662'
663 );
664 }
665
666 /**
667 * The block "_name_child_label" should be overridden in the theme of the
668 * implemented driver.
669 */
670 public function testCollectionRowWithCustomBlock()
671 {
672 $collection = array('one', 'two', 'three');
673 $form = $this->factory->createNamedBuilder('name', 'collection', $collection)
674 ->getForm();
675
676 $this->assertWidgetMatchesXpath($form->createView(), array(),
677'/div
678 [
679 ./div[./label[.="Custom label: [trans]0[/trans]"]]
680 /following-sibling::div[./label[.="Custom label: [trans]1[/trans]"]]
681 /following-sibling::div[./label[.="Custom label: [trans]2[/trans]"]]
682 ]
683'
684 );
685 }
686
687 public function testFormEndWithRest()
688 {
689 $view = $this->factory->createNamedBuilder('name', 'form')
690 ->add('field1', 'text')
691 ->add('field2', 'text')
692 ->getForm()
693 ->createView();
694
695 $this->renderWidget($view['field1']);
696
697 // Rest should only contain field2
698 $html = $this->renderEnd($view);
699
700 // Insert the start tag, the end tag should be rendered by the helper
701 $this->assertMatchesXpath('<form>' . $html,
702'/form
703 [
704 ./div
705 [
706 ./label[@for="name_field2"]
707 /following-sibling::input[@type="text"][@id="name_field2"]
708 ]
709 /following-sibling::input
710 [@type="hidden"]
711 [@id="name__token"]
712 ]
713'
714 );
715 }
716
717 public function testFormEndWithoutRest()
718 {
719 $view = $this->factory->createNamedBuilder('name', 'form')
720 ->add('field1', 'text')
721 ->add('field2', 'text')
722 ->getForm()
723 ->createView();
724
725 $this->renderWidget($view['field1']);
726
727 // Rest should only contain field2, but isn't rendered
728 $html = $this->renderEnd($view, array('render_rest' => false));
729
730 $this->assertEquals('</form>', $html);
731 }
732}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Tests/AbstractExtensionTest.php b/vendor/symfony/form/Symfony/Component/Form/Tests/AbstractExtensionTest.php
deleted file mode 100644
index c16cb221..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Tests/AbstractExtensionTest.php
+++ /dev/null
@@ -1,43 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Tests;
13
14use Symfony\Component\Form\AbstractExtension;
15use Symfony\Component\Form\Tests\Fixtures\FooType;
16
17class AbstractExtensionTest extends \PHPUnit_Framework_TestCase
18{
19 public function testHasType()
20 {
21 $loader = new ConcreteExtension();
22 $this->assertTrue($loader->hasType('foo'));
23 $this->assertFalse($loader->hasType('bar'));
24 }
25
26 public function testGetType()
27 {
28 $loader = new ConcreteExtension();
29 $this->assertInstanceOf('Symfony\Component\Form\Tests\Fixtures\FooType', $loader->getType('foo'));
30 }
31}
32
33class ConcreteExtension extends AbstractExtension
34{
35 protected function loadTypes()
36 {
37 return array(new FooType());
38 }
39
40 protected function loadTypeGuesser()
41 {
42 }
43}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Tests/AbstractFormTest.php b/vendor/symfony/form/Symfony/Component/Form/Tests/AbstractFormTest.php
deleted file mode 100644
index 29118187..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Tests/AbstractFormTest.php
+++ /dev/null
@@ -1,147 +0,0 @@
1<?php
2
3 /*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Tests;
13
14use Symfony\Component\Form\FormBuilder;
15use Symfony\Component\EventDispatcher\EventDispatcher;
16use Symfony\Component\EventDispatcher\EventDispatcherInterface;
17
18abstract class AbstractFormTest extends \PHPUnit_Framework_TestCase
19{
20 /**
21 * @var EventDispatcherInterface
22 */
23 protected $dispatcher;
24
25 /**
26 * @var \Symfony\Component\Form\FormFactoryInterface
27 */
28 protected $factory;
29
30 /**
31 * @var \Symfony\Component\Form\FormInterface
32 */
33 protected $form;
34
35 protected function setUp()
36 {
37 if (!class_exists('Symfony\Component\EventDispatcher\EventDispatcher')) {
38 $this->markTestSkipped('The "EventDispatcher" component is not available');
39 }
40
41 // We need an actual dispatcher to use the deprecated
42 // bindRequest() method
43 $this->dispatcher = new EventDispatcher();
44 $this->factory = $this->getMock('Symfony\Component\Form\FormFactoryInterface');
45 $this->form = $this->createForm();
46 }
47
48 protected function tearDown()
49 {
50 $this->dispatcher = null;
51 $this->factory = null;
52 $this->form = null;
53 }
54
55 /**
56 * @return \Symfony\Component\Form\FormInterface
57 */
58 abstract protected function createForm();
59
60 /**
61 * @param string $name
62 * @param EventDispatcherInterface $dispatcher
63 * @param string $dataClass
64 *
65 * @return FormBuilder
66 */
67 protected function getBuilder($name = 'name', EventDispatcherInterface $dispatcher = null, $dataClass = null)
68 {
69 return new FormBuilder($name, $dataClass, $dispatcher ?: $this->dispatcher, $this->factory);
70 }
71
72 /**
73 * @param string $name
74 *
75 * @return \PHPUnit_Framework_MockObject_MockObject
76 */
77 protected function getMockForm($name = 'name')
78 {
79 $form = $this->getMock('Symfony\Component\Form\Test\FormInterface');
80 $config = $this->getMock('Symfony\Component\Form\FormConfigInterface');
81
82 $form->expects($this->any())
83 ->method('getName')
84 ->will($this->returnValue($name));
85 $form->expects($this->any())
86 ->method('getConfig')
87 ->will($this->returnValue($config));
88
89 return $form;
90 }
91
92 /**
93 * @param string $name
94 *
95 * @return \PHPUnit_Framework_MockObject_MockObject
96 */
97 protected function getValidForm($name)
98 {
99 $form = $this->getMockForm($name);
100
101 $form->expects($this->any())
102 ->method('isValid')
103 ->will($this->returnValue(true));
104
105 return $form;
106 }
107
108 /**
109 * @param string $name
110 *
111 * @return \PHPUnit_Framework_MockObject_MockObject
112 */
113 protected function getInvalidForm($name)
114 {
115 $form = $this->getMockForm($name);
116
117 $form->expects($this->any())
118 ->method('isValid')
119 ->will($this->returnValue(false));
120
121 return $form;
122 }
123
124 /**
125 * @return \PHPUnit_Framework_MockObject_MockObject
126 */
127 protected function getDataMapper()
128 {
129 return $this->getMock('Symfony\Component\Form\DataMapperInterface');
130 }
131
132 /**
133 * @return \PHPUnit_Framework_MockObject_MockObject
134 */
135 protected function getDataTransformer()
136 {
137 return $this->getMock('Symfony\Component\Form\DataTransformerInterface');
138 }
139
140 /**
141 * @return \PHPUnit_Framework_MockObject_MockObject
142 */
143 protected function getFormValidator()
144 {
145 return $this->getMock('Symfony\Component\Form\FormValidatorInterface');
146 }
147}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Tests/AbstractLayoutTest.php b/vendor/symfony/form/Symfony/Component/Form/Tests/AbstractLayoutTest.php
deleted file mode 100644
index 8f632a2b..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Tests/AbstractLayoutTest.php
+++ /dev/null
@@ -1,1876 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Tests;
13
14use Symfony\Component\Form\FormError;
15use Symfony\Component\Form\FormView;
16use Symfony\Component\Form\Extension\Csrf\CsrfExtension;
17
18abstract class AbstractLayoutTest extends \Symfony\Component\Form\Test\FormIntegrationTestCase
19{
20 protected $csrfProvider;
21
22 protected function setUp()
23 {
24 if (!extension_loaded('intl')) {
25 $this->markTestSkipped('The "intl" extension is not available');
26 }
27
28 \Locale::setDefault('en');
29
30 $this->csrfProvider = $this->getMock('Symfony\Component\Form\Extension\Csrf\CsrfProvider\CsrfProviderInterface');
31
32 parent::setUp();
33 }
34
35 protected function getExtensions()
36 {
37 return array(
38 new CsrfExtension($this->csrfProvider),
39 );
40 }
41
42 protected function tearDown()
43 {
44 $this->csrfProvider = null;
45
46 parent::tearDown();
47 }
48
49 protected function assertXpathNodeValue(\DomElement $element, $expression, $nodeValue)
50 {
51 $xpath = new \DOMXPath($element->ownerDocument);
52 $nodeList = $xpath->evaluate($expression);
53 $this->assertEquals(1, $nodeList->length);
54 $this->assertEquals($nodeValue, $nodeList->item(0)->nodeValue);
55 }
56
57 protected function assertMatchesXpath($html, $expression, $count = 1)
58 {
59 $dom = new \DomDocument('UTF-8');
60 try {
61 // Wrap in <root> node so we can load HTML with multiple tags at
62 // the top level
63 $dom->loadXml('<root>'.$html.'</root>');
64 } catch (\Exception $e) {
65 $this->fail(sprintf(
66 "Failed loading HTML:\n\n%s\n\nError: %s",
67 $html,
68 $e->getMessage()
69 ));
70 }
71 $xpath = new \DOMXPath($dom);
72 $nodeList = $xpath->evaluate('/root'.$expression);
73
74 if ($nodeList->length != $count) {
75 $dom->formatOutput = true;
76 $this->fail(sprintf(
77 "Failed asserting that \n\n%s\n\nmatches exactly %s. Matches %s in \n\n%s",
78 $expression,
79 $count == 1 ? 'once' : $count.' times',
80 $nodeList->length == 1 ? 'once' : $nodeList->length.' times',
81 // strip away <root> and </root>
82 substr($dom->saveHTML(), 6, -8)
83 ));
84 }
85 }
86
87 protected function assertWidgetMatchesXpath(FormView $view, array $vars, $xpath)
88 {
89 // include ampersands everywhere to validate escaping
90 $html = $this->renderWidget($view, array_merge(array(
91 'id' => 'my&id',
92 'attr' => array('class' => 'my&class'),
93 ), $vars));
94
95 $xpath = trim($xpath).'
96 [@id="my&id"]
97 [@class="my&class"]';
98
99 $this->assertMatchesXpath($html, $xpath);
100 }
101
102 abstract protected function renderForm(FormView $view, array $vars = array());
103
104 abstract protected function renderEnctype(FormView $view);
105
106 abstract protected function renderLabel(FormView $view, $label = null, array $vars = array());
107
108 abstract protected function renderErrors(FormView $view);
109
110 abstract protected function renderWidget(FormView $view, array $vars = array());
111
112 abstract protected function renderRow(FormView $view, array $vars = array());
113
114 abstract protected function renderRest(FormView $view, array $vars = array());
115
116 abstract protected function renderStart(FormView $view, array $vars = array());
117
118 abstract protected function renderEnd(FormView $view, array $vars = array());
119
120 abstract protected function setTheme(FormView $view, array $themes);
121
122 public function testEnctype()
123 {
124 $form = $this->factory->createNamedBuilder('name', 'form')
125 ->add('file', 'file')
126 ->getForm();
127
128 $this->assertEquals('enctype="multipart/form-data"', $this->renderEnctype($form->createView()));
129 }
130
131 public function testNoEnctype()
132 {
133 $form = $this->factory->createNamedBuilder('name', 'form')
134 ->add('text', 'text')
135 ->getForm();
136
137 $this->assertEquals('', $this->renderEnctype($form->createView()));
138 }
139
140 public function testLabel()
141 {
142 $form = $this->factory->createNamed('name', 'text');
143 $view = $form->createView();
144 $this->renderWidget($view, array('label' => 'foo'));
145 $html = $this->renderLabel($view);
146
147 $this->assertMatchesXpath($html,
148'/label
149 [@for="name"]
150 [.="[trans]Name[/trans]"]
151'
152 );
153 }
154
155 public function testLabelOnForm()
156 {
157 $form = $this->factory->createNamed('name', 'date');
158 $view = $form->createView();
159 $this->renderWidget($view, array('label' => 'foo'));
160 $html = $this->renderLabel($view);
161
162 $this->assertMatchesXpath($html,
163'/label
164 [@class="required"]
165 [.="[trans]Name[/trans]"]
166'
167 );
168 }
169
170 public function testLabelWithCustomTextPassedAsOption()
171 {
172 $form = $this->factory->createNamed('name', 'text', null, array(
173 'label' => 'Custom label',
174 ));
175 $html = $this->renderLabel($form->createView());
176
177 $this->assertMatchesXpath($html,
178'/label
179 [@for="name"]
180 [.="[trans]Custom label[/trans]"]
181'
182 );
183 }
184
185 public function testLabelWithCustomTextPassedDirectly()
186 {
187 $form = $this->factory->createNamed('name', 'text');
188 $html = $this->renderLabel($form->createView(), 'Custom label');
189
190 $this->assertMatchesXpath($html,
191'/label
192 [@for="name"]
193 [.="[trans]Custom label[/trans]"]
194'
195 );
196 }
197
198 public function testLabelWithCustomTextPassedAsOptionAndDirectly()
199 {
200 $form = $this->factory->createNamed('name', 'text', null, array(
201 'label' => 'Custom label',
202 ));
203 $html = $this->renderLabel($form->createView(), 'Overridden label');
204
205 $this->assertMatchesXpath($html,
206'/label
207 [@for="name"]
208 [.="[trans]Overridden label[/trans]"]
209'
210 );
211 }
212
213 public function testLabelDoesNotRenderFieldAttributes()
214 {
215 $form = $this->factory->createNamed('name', 'text');
216 $html = $this->renderLabel($form->createView(), null, array(
217 'attr' => array(
218 'class' => 'my&class'
219 ),
220 ));
221
222 $this->assertMatchesXpath($html,
223'/label
224 [@for="name"]
225 [@class="required"]
226'
227 );
228 }
229
230 public function testLabelWithCustomAttributesPassedDirectly()
231 {
232 $form = $this->factory->createNamed('name', 'text');
233 $html = $this->renderLabel($form->createView(), null, array(
234 'label_attr' => array(
235 'class' => 'my&class'
236 ),
237 ));
238
239 $this->assertMatchesXpath($html,
240'/label
241 [@for="name"]
242 [@class="my&class required"]
243'
244 );
245 }
246
247 public function testLabelWithCustomTextAndCustomAttributesPassedDirectly()
248 {
249 $form = $this->factory->createNamed('name', 'text');
250 $html = $this->renderLabel($form->createView(), 'Custom label', array(
251 'label_attr' => array(
252 'class' => 'my&class'
253 ),
254 ));
255
256 $this->assertMatchesXpath($html,
257'/label
258 [@for="name"]
259 [@class="my&class required"]
260 [.="[trans]Custom label[/trans]"]
261'
262 );
263 }
264
265 // https://github.com/symfony/symfony/issues/5029
266 public function testLabelWithCustomTextAsOptionAndCustomAttributesPassedDirectly()
267 {
268 $form = $this->factory->createNamed('name', 'text', null, array(
269 'label' => 'Custom label',
270 ));
271 $html = $this->renderLabel($form->createView(), null, array(
272 'label_attr' => array(
273 'class' => 'my&class'
274 ),
275 ));
276
277 $this->assertMatchesXpath($html,
278 '/label
279 [@for="name"]
280 [@class="my&class required"]
281 [.="[trans]Custom label[/trans]"]
282'
283 );
284 }
285
286 public function testErrors()
287 {
288 $form = $this->factory->createNamed('name', 'text');
289 $form->addError(new FormError('[trans]Error 1[/trans]'));
290 $form->addError(new FormError('[trans]Error 2[/trans]'));
291 $view = $form->createView();
292 $html = $this->renderErrors($view);
293
294 $this->assertMatchesXpath($html,
295'/ul
296 [
297 ./li[.="[trans]Error 1[/trans]"]
298 /following-sibling::li[.="[trans]Error 2[/trans]"]
299 ]
300 [count(./li)=2]
301'
302 );
303 }
304
305 public function testWidgetById()
306 {
307 $form = $this->factory->createNamed('text_id', 'text');
308 $html = $this->renderWidget($form->createView());
309
310 $this->assertMatchesXpath($html,
311'/div
312 [
313 ./input
314 [@type="text"]
315 [@id="text_id"]
316 ]
317 [@id="container"]
318'
319 );
320 }
321
322 public function testCheckedCheckbox()
323 {
324 $form = $this->factory->createNamed('name', 'checkbox', true);
325
326 $this->assertWidgetMatchesXpath($form->createView(), array(),
327'/input
328 [@type="checkbox"]
329 [@name="name"]
330 [@checked="checked"]
331 [@value="1"]
332'
333 );
334 }
335
336 public function testUncheckedCheckbox()
337 {
338 $form = $this->factory->createNamed('name', 'checkbox', false);
339
340 $this->assertWidgetMatchesXpath($form->createView(), array(),
341'/input
342 [@type="checkbox"]
343 [@name="name"]
344 [not(@checked)]
345'
346 );
347 }
348
349 public function testCheckboxWithValue()
350 {
351 $form = $this->factory->createNamed('name', 'checkbox', false, array(
352 'value' => 'foo&bar',
353 ));
354
355 $this->assertWidgetMatchesXpath($form->createView(), array(),
356'/input
357 [@type="checkbox"]
358 [@name="name"]
359 [@value="foo&bar"]
360'
361 );
362 }
363
364 public function testSingleChoice()
365 {
366 $form = $this->factory->createNamed('name', 'choice', '&a', array(
367 'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'),
368 'multiple' => false,
369 'expanded' => false,
370 ));
371
372 $this->assertWidgetMatchesXpath($form->createView(), array(),
373'/select
374 [@name="name"]
375 [@required="required"]
376 [
377 ./option[@value="&a"][@selected="selected"][.="[trans]Choice&A[/trans]"]
378 /following-sibling::option[@value="&b"][not(@selected)][.="[trans]Choice&B[/trans]"]
379 ]
380 [count(./option)=2]
381'
382 );
383 }
384
385 public function testSingleChoiceWithPreferred()
386 {
387 $form = $this->factory->createNamed('name', 'choice', '&a', array(
388 'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'),
389 'preferred_choices' => array('&b'),
390 'multiple' => false,
391 'expanded' => false,
392 ));
393
394 $this->assertWidgetMatchesXpath($form->createView(), array('separator' => '-- sep --'),
395'/select
396 [@name="name"]
397 [@required="required"]
398 [
399 ./option[@value="&b"][not(@selected)][.="[trans]Choice&B[/trans]"]
400 /following-sibling::option[@disabled="disabled"][not(@selected)][.="-- sep --"]
401 /following-sibling::option[@value="&a"][@selected="selected"][.="[trans]Choice&A[/trans]"]
402 ]
403 [count(./option)=3]
404'
405 );
406 }
407
408 public function testSingleChoiceWithPreferredAndNoSeparator()
409 {
410 $form = $this->factory->createNamed('name', 'choice', '&a', array(
411 'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'),
412 'preferred_choices' => array('&b'),
413 'multiple' => false,
414 'expanded' => false,
415 ));
416
417 $this->assertWidgetMatchesXpath($form->createView(), array('separator' => null),
418'/select
419 [@name="name"]
420 [@required="required"]
421 [
422 ./option[@value="&b"][not(@selected)][.="[trans]Choice&B[/trans]"]
423 /following-sibling::option[@value="&a"][@selected="selected"][.="[trans]Choice&A[/trans]"]
424 ]
425 [count(./option)=2]
426'
427 );
428 }
429
430 public function testSingleChoiceWithPreferredAndBlankSeparator()
431 {
432 $form = $this->factory->createNamed('name', 'choice', '&a', array(
433 'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'),
434 'preferred_choices' => array('&b'),
435 'multiple' => false,
436 'expanded' => false,
437 ));
438
439 $this->assertWidgetMatchesXpath($form->createView(), array('separator' => ''),
440'/select
441 [@name="name"]
442 [@required="required"]
443 [
444 ./option[@value="&b"][not(@selected)][.="[trans]Choice&B[/trans]"]
445 /following-sibling::option[@disabled="disabled"][not(@selected)][.=""]
446 /following-sibling::option[@value="&a"][@selected="selected"][.="[trans]Choice&A[/trans]"]
447 ]
448 [count(./option)=3]
449'
450 );
451 }
452
453 public function testChoiceWithOnlyPreferred()
454 {
455 $form = $this->factory->createNamed('name', 'choice', '&a', array(
456 'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'),
457 'preferred_choices' => array('&a', '&b'),
458 'multiple' => false,
459 'expanded' => false,
460 ));
461
462 $this->assertWidgetMatchesXpath($form->createView(), array(),
463'/select
464 [count(./option)=2]
465'
466 );
467 }
468
469 public function testSingleChoiceNonRequired()
470 {
471 $form = $this->factory->createNamed('name', 'choice', '&a', array(
472 'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'),
473 'required' => false,
474 'multiple' => false,
475 'expanded' => false,
476 ));
477
478 $this->assertWidgetMatchesXpath($form->createView(), array(),
479'/select
480 [@name="name"]
481 [not(@required)]
482 [
483 ./option[@value=""][.="[trans][/trans]"]
484 /following-sibling::option[@value="&a"][@selected="selected"][.="[trans]Choice&A[/trans]"]
485 /following-sibling::option[@value="&b"][not(@selected)][.="[trans]Choice&B[/trans]"]
486 ]
487 [count(./option)=3]
488'
489 );
490 }
491
492 public function testSingleChoiceNonRequiredNoneSelected()
493 {
494 $form = $this->factory->createNamed('name', 'choice', null, array(
495 'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'),
496 'required' => false,
497 'multiple' => false,
498 'expanded' => false,
499 ));
500
501 $this->assertWidgetMatchesXpath($form->createView(), array(),
502'/select
503 [@name="name"]
504 [not(@required)]
505 [
506 ./option[@value=""][.="[trans][/trans]"]
507 /following-sibling::option[@value="&a"][not(@selected)][.="[trans]Choice&A[/trans]"]
508 /following-sibling::option[@value="&b"][not(@selected)][.="[trans]Choice&B[/trans]"]
509 ]
510 [count(./option)=3]
511'
512 );
513 }
514
515 public function testSingleChoiceWithNonRequiredEmptyValue()
516 {
517 $form = $this->factory->createNamed('name', 'choice', '&a', array(
518 'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'),
519 'multiple' => false,
520 'expanded' => false,
521 'required' => false,
522 'empty_value' => 'Select&Anything&Not&Me',
523 ));
524
525 $this->assertWidgetMatchesXpath($form->createView(), array(),
526'/select
527 [@name="name"]
528 [not(@required)]
529 [
530 ./option[@value=""][not(@selected)][not(@disabled)][.="[trans]Select&Anything&Not&Me[/trans]"]
531 /following-sibling::option[@value="&a"][@selected="selected"][.="[trans]Choice&A[/trans]"]
532 /following-sibling::option[@value="&b"][not(@selected)][.="[trans]Choice&B[/trans]"]
533 ]
534 [count(./option)=3]
535'
536 );
537 }
538
539 public function testSingleChoiceRequiredWithEmptyValue()
540 {
541 $form = $this->factory->createNamed('name', 'choice', '&a', array(
542 'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'),
543 'required' => true,
544 'multiple' => false,
545 'expanded' => false,
546 'empty_value' => 'Test&Me'
547 ));
548
549 $this->assertWidgetMatchesXpath($form->createView(), array(),
550'/select
551 [@name="name"]
552 [@required="required"]
553 [
554 ./option[not(@value)][not(@selected)][@disabled][.="[trans]Test&Me[/trans]"]
555 /following-sibling::option[@value="&a"][@selected="selected"][.="[trans]Choice&A[/trans]"]
556 /following-sibling::option[@value="&b"][not(@selected)][.="[trans]Choice&B[/trans]"]
557 ]
558 [count(./option)=3]
559'
560 );
561 }
562
563 public function testSingleChoiceRequiredWithEmptyValueViaView()
564 {
565 $form = $this->factory->createNamed('name', 'choice', '&a', array(
566 'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'),
567 'required' => true,
568 'multiple' => false,
569 'expanded' => false,
570 ));
571
572 $this->assertWidgetMatchesXpath($form->createView(), array('empty_value' => ''),
573'/select
574 [@name="name"]
575 [@required="required"]
576 [
577 ./option[not(@value)][not(@selected)][@disabled][.="[trans][/trans]"]
578 /following-sibling::option[@value="&a"][@selected="selected"][.="[trans]Choice&A[/trans]"]
579 /following-sibling::option[@value="&b"][not(@selected)][.="[trans]Choice&B[/trans]"]
580 ]
581 [count(./option)=3]
582'
583 );
584 }
585
586 public function testSingleChoiceGrouped()
587 {
588 $form = $this->factory->createNamed('name', 'choice', '&a', array(
589 'choices' => array(
590 'Group&1' => array('&a' => 'Choice&A', '&b' => 'Choice&B'),
591 'Group&2' => array('&c' => 'Choice&C'),
592 ),
593 'multiple' => false,
594 'expanded' => false,
595 ));
596
597 $this->assertWidgetMatchesXpath($form->createView(), array(),
598'/select
599 [@name="name"]
600 [./optgroup[@label="[trans]Group&1[/trans]"]
601 [
602 ./option[@value="&a"][@selected="selected"][.="[trans]Choice&A[/trans]"]
603 /following-sibling::option[@value="&b"][not(@selected)][.="[trans]Choice&B[/trans]"]
604 ]
605 [count(./option)=2]
606 ]
607 [./optgroup[@label="[trans]Group&2[/trans]"]
608 [./option[@value="&c"][not(@selected)][.="[trans]Choice&C[/trans]"]]
609 [count(./option)=1]
610 ]
611 [count(./optgroup)=2]
612'
613 );
614 }
615
616 public function testMultipleChoice()
617 {
618 $form = $this->factory->createNamed('name', 'choice', array('&a'), array(
619 'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'),
620 'multiple' => true,
621 'expanded' => false,
622 ));
623
624 $this->assertWidgetMatchesXpath($form->createView(), array(),
625'/select
626 [@name="name[]"]
627 [@multiple="multiple"]
628 [
629 ./option[@value="&a"][@selected="selected"][.="[trans]Choice&A[/trans]"]
630 /following-sibling::option[@value="&b"][not(@selected)][.="[trans]Choice&B[/trans]"]
631 ]
632 [count(./option)=2]
633'
634 );
635 }
636
637 public function testMultipleChoiceSkipsEmptyValue()
638 {
639 $form = $this->factory->createNamed('name', 'choice', array('&a'), array(
640 'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'),
641 'multiple' => true,
642 'expanded' => false,
643 'empty_value' => 'Test&Me'
644 ));
645
646 $this->assertWidgetMatchesXpath($form->createView(), array(),
647'/select
648 [@name="name[]"]
649 [@multiple="multiple"]
650 [
651 ./option[@value="&a"][@selected="selected"][.="[trans]Choice&A[/trans]"]
652 /following-sibling::option[@value="&b"][not(@selected)][.="[trans]Choice&B[/trans]"]
653 ]
654 [count(./option)=2]
655'
656 );
657 }
658
659 public function testMultipleChoiceNonRequired()
660 {
661 $form = $this->factory->createNamed('name', 'choice', array('&a'), array(
662 'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'),
663 'required' => false,
664 'multiple' => true,
665 'expanded' => false,
666 ));
667
668 $this->assertWidgetMatchesXpath($form->createView(), array(),
669'/select
670 [@name="name[]"]
671 [@multiple="multiple"]
672 [
673 ./option[@value="&a"][@selected="selected"][.="[trans]Choice&A[/trans]"]
674 /following-sibling::option[@value="&b"][not(@selected)][.="[trans]Choice&B[/trans]"]
675 ]
676 [count(./option)=2]
677'
678 );
679 }
680
681 public function testSingleChoiceExpanded()
682 {
683 $form = $this->factory->createNamed('name', 'choice', '&a', array(
684 'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'),
685 'multiple' => false,
686 'expanded' => true,
687 ));
688
689 $this->assertWidgetMatchesXpath($form->createView(), array(),
690'/div
691 [
692 ./input[@type="radio"][@name="name"][@id="name_0"][@value="&a"][@checked]
693 /following-sibling::label[@for="name_0"][.="[trans]Choice&A[/trans]"]
694 /following-sibling::input[@type="radio"][@name="name"][@id="name_1"][@value="&b"][not(@checked)]
695 /following-sibling::label[@for="name_1"][.="[trans]Choice&B[/trans]"]
696 /following-sibling::input[@type="hidden"][@id="name__token"]
697 ]
698 [count(./input)=3]
699'
700 );
701 }
702
703 public function testSingleChoiceExpandedWithEmptyValue()
704 {
705 $form = $this->factory->createNamed('name', 'choice', '&a', array(
706 'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B'),
707 'multiple' => false,
708 'expanded' => true,
709 'empty_value' => 'Test&Me'
710 ));
711
712 $this->assertWidgetMatchesXpath($form->createView(), array(),
713'/div
714 [
715 ./input[@type="radio"][@name="name"][@id="name_placeholder"][not(@checked)]
716 /following-sibling::label[@for="name_placeholder"][.="[trans]Test&Me[/trans]"]
717 /following-sibling::input[@type="radio"][@name="name"][@id="name_0"][@checked]
718 /following-sibling::label[@for="name_0"][.="[trans]Choice&A[/trans]"]
719 /following-sibling::input[@type="radio"][@name="name"][@id="name_1"][not(@checked)]
720 /following-sibling::label[@for="name_1"][.="[trans]Choice&B[/trans]"]
721 /following-sibling::input[@type="hidden"][@id="name__token"]
722 ]
723 [count(./input)=4]
724'
725 );
726 }
727
728 public function testSingleChoiceExpandedWithBooleanValue()
729 {
730 $form = $this->factory->createNamed('name', 'choice', true, array(
731 'choices' => array('1' => 'Choice&A', '0' => 'Choice&B'),
732 'multiple' => false,
733 'expanded' => true,
734 ));
735
736 $this->assertWidgetMatchesXpath($form->createView(), array(),
737'/div
738 [
739 ./input[@type="radio"][@name="name"][@id="name_0"][@checked]
740 /following-sibling::label[@for="name_0"][.="[trans]Choice&A[/trans]"]
741 /following-sibling::input[@type="radio"][@name="name"][@id="name_1"][not(@checked)]
742 /following-sibling::label[@for="name_1"][.="[trans]Choice&B[/trans]"]
743 /following-sibling::input[@type="hidden"][@id="name__token"]
744 ]
745 [count(./input)=3]
746'
747 );
748 }
749
750 public function testMultipleChoiceExpanded()
751 {
752 $form = $this->factory->createNamed('name', 'choice', array('&a', '&c'), array(
753 'choices' => array('&a' => 'Choice&A', '&b' => 'Choice&B', '&c' => 'Choice&C'),
754 'multiple' => true,
755 'expanded' => true,
756 'required' => true,
757 ));
758
759 $this->assertWidgetMatchesXpath($form->createView(), array(),
760'/div
761 [
762 ./input[@type="checkbox"][@name="name[]"][@id="name_0"][@checked][not(@required)]
763 /following-sibling::label[@for="name_0"][.="[trans]Choice&A[/trans]"]
764 /following-sibling::input[@type="checkbox"][@name="name[]"][@id="name_1"][not(@checked)][not(@required)]
765 /following-sibling::label[@for="name_1"][.="[trans]Choice&B[/trans]"]
766 /following-sibling::input[@type="checkbox"][@name="name[]"][@id="name_2"][@checked][not(@required)]
767 /following-sibling::label[@for="name_2"][.="[trans]Choice&C[/trans]"]
768 /following-sibling::input[@type="hidden"][@id="name__token"]
769 ]
770 [count(./input)=4]
771'
772 );
773 }
774
775 public function testCountry()
776 {
777 $form = $this->factory->createNamed('name', 'country', 'AT');
778
779 $this->assertWidgetMatchesXpath($form->createView(), array(),
780'/select
781 [@name="name"]
782 [./option[@value="AT"][@selected="selected"][.="[trans]Austria[/trans]"]]
783 [count(./option)>200]
784'
785 );
786 }
787
788 public function testCountryWithEmptyValue()
789 {
790 $form = $this->factory->createNamed('name', 'country', 'AT', array(
791 'empty_value' => 'Select&Country',
792 'required' => false,
793 ));
794
795 $this->assertWidgetMatchesXpath($form->createView(), array(),
796'/select
797 [@name="name"]
798 [./option[@value=""][not(@selected)][not(@disabled)][.="[trans]Select&Country[/trans]"]]
799 [./option[@value="AT"][@selected="selected"][.="[trans]Austria[/trans]"]]
800 [count(./option)>201]
801'
802 );
803 }
804
805 public function testDateTime()
806 {
807 $form = $this->factory->createNamed('name', 'datetime', '2011-02-03 04:05:06', array(
808 'input' => 'string',
809 'with_seconds' => false,
810 ));
811
812 $this->assertWidgetMatchesXpath($form->createView(), array(),
813'/div
814 [
815 ./div
816 [@id="name_date"]
817 [
818 ./select
819 [@id="name_date_month"]
820 [./option[@value="2"][@selected="selected"]]
821 /following-sibling::select
822 [@id="name_date_day"]
823 [./option[@value="3"][@selected="selected"]]
824 /following-sibling::select
825 [@id="name_date_year"]
826 [./option[@value="2011"][@selected="selected"]]
827 ]
828 /following-sibling::div
829 [@id="name_time"]
830 [
831 ./select
832 [@id="name_time_hour"]
833 [./option[@value="4"][@selected="selected"]]
834 /following-sibling::select
835 [@id="name_time_minute"]
836 [./option[@value="5"][@selected="selected"]]
837 ]
838 ]
839 [count(.//select)=5]
840'
841 );
842 }
843
844 public function testDateTimeWithEmptyValueGlobal()
845 {
846 $form = $this->factory->createNamed('name', 'datetime', null, array(
847 'input' => 'string',
848 'empty_value' => 'Change&Me',
849 'required' => false,
850 ));
851
852 $this->assertWidgetMatchesXpath($form->createView(), array(),
853'/div
854 [
855 ./div
856 [@id="name_date"]
857 [
858 ./select
859 [@id="name_date_month"]
860 [./option[@value=""][not(@selected)][not(@disabled)][.="[trans]Change&Me[/trans]"]]
861 /following-sibling::select
862 [@id="name_date_day"]
863 [./option[@value=""][not(@selected)][not(@disabled)][.="[trans]Change&Me[/trans]"]]
864 /following-sibling::select
865 [@id="name_date_year"]
866 [./option[@value=""][not(@selected)][not(@disabled)][.="[trans]Change&Me[/trans]"]]
867 ]
868 /following-sibling::div
869 [@id="name_time"]
870 [
871 ./select
872 [@id="name_time_hour"]
873 [./option[@value=""][.="[trans]Change&Me[/trans]"]]
874 /following-sibling::select
875 [@id="name_time_minute"]
876 [./option[@value=""][.="[trans]Change&Me[/trans]"]]
877 ]
878 ]
879 [count(.//select)=5]
880'
881 );
882 }
883
884 public function testDateTimeWithEmptyValueOnTime()
885 {
886 $data = array('year' => '2011', 'month' => '2', 'day' => '3', 'hour' => '', 'minute' => '');
887
888 $form = $this->factory->createNamed('name', 'datetime', $data, array(
889 'input' => 'array',
890 'empty_value' => array('hour' => 'Change&Me', 'minute' => 'Change&Me'),
891 'required' => false,
892 ));
893
894 $this->assertWidgetMatchesXpath($form->createView(), array(),
895'/div
896 [
897 ./div
898 [@id="name_date"]
899 [
900 ./select
901 [@id="name_date_month"]
902 [./option[@value="2"][@selected="selected"]]
903 /following-sibling::select
904 [@id="name_date_day"]
905 [./option[@value="3"][@selected="selected"]]
906 /following-sibling::select
907 [@id="name_date_year"]
908 [./option[@value="2011"][@selected="selected"]]
909 ]
910 /following-sibling::div
911 [@id="name_time"]
912 [
913 ./select
914 [@id="name_time_hour"]
915 [./option[@value=""][not(@selected)][not(@disabled)][.="[trans]Change&Me[/trans]"]]
916 /following-sibling::select
917 [@id="name_time_minute"]
918 [./option[@value=""][not(@selected)][not(@disabled)][.="[trans]Change&Me[/trans]"]]
919 ]
920 ]
921 [count(.//select)=5]
922'
923 );
924 }
925
926 public function testDateTimeWithSeconds()
927 {
928 $form = $this->factory->createNamed('name', 'datetime', '2011-02-03 04:05:06', array(
929 'input' => 'string',
930 'with_seconds' => true,
931 ));
932
933 $this->assertWidgetMatchesXpath($form->createView(), array(),
934'/div
935 [
936 ./div
937 [@id="name_date"]
938 [
939 ./select
940 [@id="name_date_month"]
941 [./option[@value="2"][@selected="selected"]]
942 /following-sibling::select
943 [@id="name_date_day"]
944 [./option[@value="3"][@selected="selected"]]
945 /following-sibling::select
946 [@id="name_date_year"]
947 [./option[@value="2011"][@selected="selected"]]
948 ]
949 /following-sibling::div
950 [@id="name_time"]
951 [
952 ./select
953 [@id="name_time_hour"]
954 [./option[@value="4"][@selected="selected"]]
955 /following-sibling::select
956 [@id="name_time_minute"]
957 [./option[@value="5"][@selected="selected"]]
958 /following-sibling::select
959 [@id="name_time_second"]
960 [./option[@value="6"][@selected="selected"]]
961 ]
962 ]
963 [count(.//select)=6]
964'
965 );
966 }
967
968 public function testDateTimeSingleText()
969 {
970 $form = $this->factory->createNamed('name', 'datetime', '2011-02-03 04:05:06', array(
971 'input' => 'string',
972 'date_widget' => 'single_text',
973 'time_widget' => 'single_text',
974 ));
975
976 $this->assertWidgetMatchesXpath($form->createView(), array(),
977'/div
978 [
979 ./input
980 [@type="date"]
981 [@id="name_date"]
982 [@name="name[date]"]
983 [@value="2011-02-03"]
984 /following-sibling::input
985 [@type="time"]
986 [@id="name_time"]
987 [@name="name[time]"]
988 [@value="04:05"]
989 ]
990'
991 );
992 }
993
994 public function testDateTimeWithWidgetSingleText()
995 {
996 $form = $this->factory->createNamed('name', 'datetime', '2011-02-03 04:05:06', array(
997 'input' => 'string',
998 'widget' => 'single_text',
999 'model_timezone' => 'UTC',
1000 'view_timezone' => 'UTC',
1001 ));
1002
1003 $this->assertWidgetMatchesXpath($form->createView(), array(),
1004'/input
1005 [@type="datetime"]
1006 [@name="name"]
1007 [@value="2011-02-03T04:05:06Z"]
1008'
1009 );
1010 }
1011
1012 public function testDateTimeWithWidgetSingleTextIgnoreDateAndTimeWidgets()
1013 {
1014 $form = $this->factory->createNamed('name', 'datetime', '2011-02-03 04:05:06', array(
1015 'input' => 'string',
1016 'date_widget' => 'choice',
1017 'time_widget' => 'choice',
1018 'widget' => 'single_text',
1019 'model_timezone' => 'UTC',
1020 'view_timezone' => 'UTC',
1021 ));
1022
1023 $this->assertWidgetMatchesXpath($form->createView(), array(),
1024'/input
1025 [@type="datetime"]
1026 [@name="name"]
1027 [@value="2011-02-03T04:05:06Z"]
1028'
1029 );
1030 }
1031
1032 public function testDateChoice()
1033 {
1034 $form = $this->factory->createNamed('name', 'date', '2011-02-03', array(
1035 'input' => 'string',
1036 'widget' => 'choice',
1037 ));
1038
1039 $this->assertWidgetMatchesXpath($form->createView(), array(),
1040'/div
1041 [
1042 ./select
1043 [@id="name_month"]
1044 [./option[@value="2"][@selected="selected"]]
1045 /following-sibling::select
1046 [@id="name_day"]
1047 [./option[@value="3"][@selected="selected"]]
1048 /following-sibling::select
1049 [@id="name_year"]
1050 [./option[@value="2011"][@selected="selected"]]
1051 ]
1052 [count(./select)=3]
1053'
1054 );
1055 }
1056
1057 public function testDateChoiceWithEmptyValueGlobal()
1058 {
1059 $form = $this->factory->createNamed('name', 'date', null, array(
1060 'input' => 'string',
1061 'widget' => 'choice',
1062 'empty_value' => 'Change&Me',
1063 'required' => false,
1064 ));
1065
1066 $this->assertWidgetMatchesXpath($form->createView(), array(),
1067'/div
1068 [
1069 ./select
1070 [@id="name_month"]
1071 [./option[@value=""][not(@selected)][not(@disabled)][.="[trans]Change&Me[/trans]"]]
1072 /following-sibling::select
1073 [@id="name_day"]
1074 [./option[@value=""][not(@selected)][not(@disabled)][.="[trans]Change&Me[/trans]"]]
1075 /following-sibling::select
1076 [@id="name_year"]
1077 [./option[@value=""][not(@selected)][not(@disabled)][.="[trans]Change&Me[/trans]"]]
1078 ]
1079 [count(./select)=3]
1080'
1081 );
1082 }
1083
1084 public function testDateChoiceWithEmptyValueOnYear()
1085 {
1086 $form = $this->factory->createNamed('name', 'date', null, array(
1087 'input' => 'string',
1088 'widget' => 'choice',
1089 'required' => false,
1090 'empty_value' => array('year' => 'Change&Me'),
1091 ));
1092
1093 $this->assertWidgetMatchesXpath($form->createView(), array(),
1094'/div
1095 [
1096 ./select
1097 [@id="name_month"]
1098 [./option[@value="1"]]
1099 /following-sibling::select
1100 [@id="name_day"]
1101 [./option[@value="1"]]
1102 /following-sibling::select
1103 [@id="name_year"]
1104 [./option[@value=""][not(@selected)][not(@disabled)][.="[trans]Change&Me[/trans]"]]
1105 ]
1106 [count(./select)=3]
1107'
1108 );
1109 }
1110
1111 public function testDateText()
1112 {
1113 $form = $this->factory->createNamed('name', 'date', '2011-02-03', array(
1114 'input' => 'string',
1115 'widget' => 'text',
1116 ));
1117
1118 $this->assertWidgetMatchesXpath($form->createView(), array(),
1119'/div
1120 [
1121 ./input
1122 [@id="name_month"]
1123 [@type="text"]
1124 [@value="2"]
1125 /following-sibling::input
1126 [@id="name_day"]
1127 [@type="text"]
1128 [@value="3"]
1129 /following-sibling::input
1130 [@id="name_year"]
1131 [@type="text"]
1132 [@value="2011"]
1133 ]
1134 [count(./input)=3]
1135'
1136 );
1137 }
1138
1139 public function testDateSingleText()
1140 {
1141 $form = $this->factory->createNamed('name', 'date', '2011-02-03', array(
1142 'input' => 'string',
1143 'widget' => 'single_text',
1144 ));
1145
1146 $this->assertWidgetMatchesXpath($form->createView(), array(),
1147'/input
1148 [@type="date"]
1149 [@name="name"]
1150 [@value="2011-02-03"]
1151'
1152 );
1153 }
1154
1155 public function testDateErrorBubbling()
1156 {
1157 $form = $this->factory->createNamedBuilder('form', 'form')
1158 ->add('date', 'date')
1159 ->getForm();
1160 $form->get('date')->addError(new FormError('[trans]Error![/trans]'));
1161 $view = $form->createView();
1162
1163 $this->assertEmpty($this->renderErrors($view));
1164 $this->assertNotEmpty($this->renderErrors($view['date']));
1165 }
1166
1167 public function testBirthDay()
1168 {
1169 $form = $this->factory->createNamed('name', 'birthday', '2000-02-03', array(
1170 'input' => 'string',
1171 ));
1172
1173 $this->assertWidgetMatchesXpath($form->createView(), array(),
1174'/div
1175 [
1176 ./select
1177 [@id="name_month"]
1178 [./option[@value="2"][@selected="selected"]]
1179 /following-sibling::select
1180 [@id="name_day"]
1181 [./option[@value="3"][@selected="selected"]]
1182 /following-sibling::select
1183 [@id="name_year"]
1184 [./option[@value="2000"][@selected="selected"]]
1185 ]
1186 [count(./select)=3]
1187'
1188 );
1189 }
1190
1191 public function testBirthDayWithEmptyValue()
1192 {
1193 $form = $this->factory->createNamed('name', 'birthday', '1950-01-01', array(
1194 'input' => 'string',
1195 'empty_value' => '',
1196 'required' => false,
1197 ));
1198
1199 $this->assertWidgetMatchesXpath($form->createView(), array(),
1200'/div
1201 [
1202 ./select
1203 [@id="name_month"]
1204 [./option[@value=""][not(@selected)][not(@disabled)][.="[trans][/trans]"]]
1205 [./option[@value="1"][@selected="selected"]]
1206 /following-sibling::select
1207 [@id="name_day"]
1208 [./option[@value=""][not(@selected)][not(@disabled)][.="[trans][/trans]"]]
1209 [./option[@value="1"][@selected="selected"]]
1210 /following-sibling::select
1211 [@id="name_year"]
1212 [./option[@value=""][not(@selected)][not(@disabled)][.="[trans][/trans]"]]
1213 [./option[@value="1950"][@selected="selected"]]
1214 ]
1215 [count(./select)=3]
1216'
1217 );
1218 }
1219
1220 public function testEmail()
1221 {
1222 $form = $this->factory->createNamed('name', 'email', 'foo&bar');
1223
1224 $this->assertWidgetMatchesXpath($form->createView(), array(),
1225'/input
1226 [@type="email"]
1227 [@name="name"]
1228 [@value="foo&bar"]
1229 [not(@maxlength)]
1230'
1231 );
1232 }
1233
1234 public function testEmailWithMaxLength()
1235 {
1236 $form = $this->factory->createNamed('name', 'email', 'foo&bar', array(
1237 'max_length' => 123,
1238 ));
1239
1240 $this->assertWidgetMatchesXpath($form->createView(), array(),
1241'/input
1242 [@type="email"]
1243 [@name="name"]
1244 [@value="foo&bar"]
1245 [@maxlength="123"]
1246'
1247 );
1248 }
1249
1250 public function testFile()
1251 {
1252 $form = $this->factory->createNamed('name', 'file');
1253
1254 $this->assertWidgetMatchesXpath($form->createView(), array(),
1255'/input
1256 [@type="file"]
1257'
1258 );
1259 }
1260
1261 public function testHidden()
1262 {
1263 $form = $this->factory->createNamed('name', 'hidden', 'foo&bar');
1264
1265 $this->assertWidgetMatchesXpath($form->createView(), array(),
1266'/input
1267 [@type="hidden"]
1268 [@name="name"]
1269 [@value="foo&bar"]
1270'
1271 );
1272 }
1273
1274 public function testReadOnly()
1275 {
1276 $form = $this->factory->createNamed('name', 'text', null, array(
1277 'read_only' => true,
1278 ));
1279
1280 $this->assertWidgetMatchesXpath($form->createView(), array(),
1281'/input
1282 [@type="text"]
1283 [@name="name"]
1284 [@readonly="readonly"]
1285'
1286 );
1287 }
1288
1289 public function testDisabled()
1290 {
1291 $form = $this->factory->createNamed('name', 'text', null, array(
1292 'disabled' => true,
1293 ));
1294
1295 $this->assertWidgetMatchesXpath($form->createView(), array(),
1296'/input
1297 [@type="text"]
1298 [@name="name"]
1299 [@disabled="disabled"]
1300'
1301 );
1302 }
1303
1304 public function testInteger()
1305 {
1306 $form = $this->factory->createNamed('name', 'integer', 123);
1307
1308 $this->assertWidgetMatchesXpath($form->createView(), array(),
1309'/input
1310 [@type="number"]
1311 [@name="name"]
1312 [@value="123"]
1313'
1314 );
1315 }
1316
1317 public function testLanguage()
1318 {
1319 $form = $this->factory->createNamed('name', 'language', 'de');
1320
1321 $this->assertWidgetMatchesXpath($form->createView(), array(),
1322'/select
1323 [@name="name"]
1324 [./option[@value="de"][@selected="selected"][.="[trans]German[/trans]"]]
1325 [count(./option)>200]
1326'
1327 );
1328 }
1329
1330 public function testLocale()
1331 {
1332 $form = $this->factory->createNamed('name', 'locale', 'de_AT');
1333
1334 $this->assertWidgetMatchesXpath($form->createView(), array(),
1335'/select
1336 [@name="name"]
1337 [./option[@value="de_AT"][@selected="selected"][.="[trans]German (Austria)[/trans]"]]
1338 [count(./option)>200]
1339'
1340 );
1341 }
1342
1343 public function testMoney()
1344 {
1345 $form = $this->factory->createNamed('name', 'money', 1234.56, array(
1346 'currency' => 'EUR',
1347 ));
1348
1349 $this->assertWidgetMatchesXpath($form->createView(), array(),
1350'/input
1351 [@type="text"]
1352 [@name="name"]
1353 [@value="1234.56"]
1354 [contains(.., "€")]
1355'
1356 );
1357 }
1358
1359 public function testNumber()
1360 {
1361 $form = $this->factory->createNamed('name', 'number', 1234.56);
1362
1363 $this->assertWidgetMatchesXpath($form->createView(), array(),
1364'/input
1365 [@type="text"]
1366 [@name="name"]
1367 [@value="1234.56"]
1368'
1369 );
1370 }
1371
1372 public function testPassword()
1373 {
1374 $form = $this->factory->createNamed('name', 'password', 'foo&bar');
1375
1376 $this->assertWidgetMatchesXpath($form->createView(), array(),
1377'/input
1378 [@type="password"]
1379 [@name="name"]
1380'
1381 );
1382 }
1383
1384 public function testPasswordSubmittedWithNotAlwaysEmpty()
1385 {
1386 $form = $this->factory->createNamed('name', 'password', null, array(
1387 'always_empty' => false,
1388 ));
1389 $form->submit('foo&bar');
1390
1391 $this->assertWidgetMatchesXpath($form->createView(), array(),
1392'/input
1393 [@type="password"]
1394 [@name="name"]
1395 [@value="foo&bar"]
1396'
1397 );
1398 }
1399
1400 public function testPasswordWithMaxLength()
1401 {
1402 $form = $this->factory->createNamed('name', 'password', 'foo&bar', array(
1403 'max_length' => 123,
1404 ));
1405
1406 $this->assertWidgetMatchesXpath($form->createView(), array(),
1407'/input
1408 [@type="password"]
1409 [@name="name"]
1410 [@maxlength="123"]
1411'
1412 );
1413 }
1414
1415 public function testPercent()
1416 {
1417 $form = $this->factory->createNamed('name', 'percent', 0.1);
1418
1419 $this->assertWidgetMatchesXpath($form->createView(), array(),
1420'/input
1421 [@type="text"]
1422 [@name="name"]
1423 [@value="10"]
1424 [contains(.., "%")]
1425'
1426 );
1427 }
1428
1429 public function testCheckedRadio()
1430 {
1431 $form = $this->factory->createNamed('name', 'radio', true);
1432
1433 $this->assertWidgetMatchesXpath($form->createView(), array(),
1434'/input
1435 [@type="radio"]
1436 [@name="name"]
1437 [@checked="checked"]
1438 [@value="1"]
1439'
1440 );
1441 }
1442
1443 public function testUncheckedRadio()
1444 {
1445 $form = $this->factory->createNamed('name', 'radio', false);
1446
1447 $this->assertWidgetMatchesXpath($form->createView(), array(),
1448'/input
1449 [@type="radio"]
1450 [@name="name"]
1451 [not(@checked)]
1452'
1453 );
1454 }
1455
1456 public function testRadioWithValue()
1457 {
1458 $form = $this->factory->createNamed('name', 'radio', false, array(
1459 'value' => 'foo&bar',
1460 ));
1461
1462 $this->assertWidgetMatchesXpath($form->createView(), array(),
1463'/input
1464 [@type="radio"]
1465 [@name="name"]
1466 [@value="foo&bar"]
1467'
1468 );
1469 }
1470
1471 public function testTextarea()
1472 {
1473 $form = $this->factory->createNamed('name', 'textarea', 'foo&bar', array(
1474 'pattern' => 'foo',
1475 ));
1476
1477 $this->assertWidgetMatchesXpath($form->createView(), array(),
1478'/textarea
1479 [@name="name"]
1480 [not(@pattern)]
1481 [.="foo&bar"]
1482'
1483 );
1484 }
1485
1486 public function testText()
1487 {
1488 $form = $this->factory->createNamed('name', 'text', 'foo&bar');
1489
1490 $this->assertWidgetMatchesXpath($form->createView(), array(),
1491'/input
1492 [@type="text"]
1493 [@name="name"]
1494 [@value="foo&bar"]
1495 [not(@maxlength)]
1496'
1497 );
1498 }
1499
1500 public function testTextWithMaxLength()
1501 {
1502 $form = $this->factory->createNamed('name', 'text', 'foo&bar', array(
1503 'max_length' => 123,
1504 ));
1505
1506 $this->assertWidgetMatchesXpath($form->createView(), array(),
1507'/input
1508 [@type="text"]
1509 [@name="name"]
1510 [@value="foo&bar"]
1511 [@maxlength="123"]
1512'
1513 );
1514 }
1515
1516 public function testSearch()
1517 {
1518 $form = $this->factory->createNamed('name', 'search', 'foo&bar');
1519
1520 $this->assertWidgetMatchesXpath($form->createView(), array(),
1521'/input
1522 [@type="search"]
1523 [@name="name"]
1524 [@value="foo&bar"]
1525 [not(@maxlength)]
1526'
1527 );
1528 }
1529
1530 public function testTime()
1531 {
1532 $form = $this->factory->createNamed('name', 'time', '04:05:06', array(
1533 'input' => 'string',
1534 'with_seconds' => false,
1535 ));
1536
1537 $this->assertWidgetMatchesXpath($form->createView(), array(),
1538'/div
1539 [
1540 ./select
1541 [@id="name_hour"]
1542 [not(@size)]
1543 [./option[@value="4"][@selected="selected"]]
1544 /following-sibling::select
1545 [@id="name_minute"]
1546 [not(@size)]
1547 [./option[@value="5"][@selected="selected"]]
1548 ]
1549 [count(./select)=2]
1550'
1551 );
1552 }
1553
1554 public function testTimeWithSeconds()
1555 {
1556 $form = $this->factory->createNamed('name', 'time', '04:05:06', array(
1557 'input' => 'string',
1558 'with_seconds' => true,
1559 ));
1560
1561 $this->assertWidgetMatchesXpath($form->createView(), array(),
1562'/div
1563 [
1564 ./select
1565 [@id="name_hour"]
1566 [not(@size)]
1567 [./option[@value="4"][@selected="selected"]]
1568 [count(./option)>23]
1569 /following-sibling::select
1570 [@id="name_minute"]
1571 [not(@size)]
1572 [./option[@value="5"][@selected="selected"]]
1573 [count(./option)>59]
1574 /following-sibling::select
1575 [@id="name_second"]
1576 [not(@size)]
1577 [./option[@value="6"][@selected="selected"]]
1578 [count(./option)>59]
1579 ]
1580 [count(./select)=3]
1581'
1582 );
1583 }
1584
1585 public function testTimeText()
1586 {
1587 $form = $this->factory->createNamed('name', 'time', '04:05:06', array(
1588 'input' => 'string',
1589 'widget' => 'text',
1590 ));
1591
1592 $this->assertWidgetMatchesXpath($form->createView(), array(),
1593'/div
1594 [
1595 ./input
1596 [@type="text"]
1597 [@id="name_hour"]
1598 [@name="name[hour]"]
1599 [@value="04"]
1600 [@size="1"]
1601 [@required="required"]
1602 /following-sibling::input
1603 [@type="text"]
1604 [@id="name_minute"]
1605 [@name="name[minute]"]
1606 [@value="05"]
1607 [@size="1"]
1608 [@required="required"]
1609 ]
1610 [count(./input)=2]
1611'
1612 );
1613 }
1614
1615 public function testTimeSingleText()
1616 {
1617 $form = $this->factory->createNamed('name', 'time', '04:05:06', array(
1618 'input' => 'string',
1619 'widget' => 'single_text',
1620 ));
1621
1622 $this->assertWidgetMatchesXpath($form->createView(), array(),
1623'/input
1624 [@type="time"]
1625 [@name="name"]
1626 [@value="04:05"]
1627 [not(@size)]
1628'
1629 );
1630 }
1631
1632 public function testTimeWithEmptyValueGlobal()
1633 {
1634 $form = $this->factory->createNamed('name', 'time', null, array(
1635 'input' => 'string',
1636 'empty_value' => 'Change&Me',
1637 'required' => false,
1638 ));
1639
1640 $this->assertWidgetMatchesXpath($form->createView(), array(),
1641'/div
1642 [
1643 ./select
1644 [@id="name_hour"]
1645 [./option[@value=""][not(@selected)][not(@disabled)][.="[trans]Change&Me[/trans]"]]
1646 [count(./option)>24]
1647 /following-sibling::select
1648 [@id="name_minute"]
1649 [./option[@value=""][not(@selected)][not(@disabled)][.="[trans]Change&Me[/trans]"]]
1650 [count(./option)>60]
1651 ]
1652 [count(./select)=2]
1653'
1654 );
1655 }
1656
1657 public function testTimeWithEmptyValueOnYear()
1658 {
1659 $form = $this->factory->createNamed('name', 'time', null, array(
1660 'input' => 'string',
1661 'required' => false,
1662 'empty_value' => array('hour' => 'Change&Me'),
1663 ));
1664
1665 $this->assertWidgetMatchesXpath($form->createView(), array(),
1666'/div
1667 [
1668 ./select
1669 [@id="name_hour"]
1670 [./option[@value=""][not(@selected)][not(@disabled)][.="[trans]Change&Me[/trans]"]]
1671 [count(./option)>24]
1672 /following-sibling::select
1673 [@id="name_minute"]
1674 [./option[@value="1"]]
1675 [count(./option)>59]
1676 ]
1677 [count(./select)=2]
1678'
1679 );
1680 }
1681
1682 public function testTimeErrorBubbling()
1683 {
1684 $form = $this->factory->createNamedBuilder('form', 'form')
1685 ->add('time', 'time')
1686 ->getForm();
1687 $form->get('time')->addError(new FormError('[trans]Error![/trans]'));
1688 $view = $form->createView();
1689
1690 $this->assertEmpty($this->renderErrors($view));
1691 $this->assertNotEmpty($this->renderErrors($view['time']));
1692 }
1693
1694 public function testTimezone()
1695 {
1696 $form = $this->factory->createNamed('name', 'timezone', 'Europe/Vienna');
1697
1698 $this->assertWidgetMatchesXpath($form->createView(), array(),
1699'/select
1700 [@name="name"]
1701 [@required="required"]
1702 [./optgroup
1703 [@label="[trans]Europe[/trans]"]
1704 [./option[@value="Europe/Vienna"][@selected="selected"][.="[trans]Vienna[/trans]"]]
1705 ]
1706 [count(./optgroup)>10]
1707 [count(.//option)>200]
1708'
1709 );
1710 }
1711
1712 public function testTimezoneWithEmptyValue()
1713 {
1714 $form = $this->factory->createNamed('name', 'timezone', null, array(
1715 'empty_value' => 'Select&Timezone',
1716 'required' => false,
1717 ));
1718
1719 $this->assertWidgetMatchesXpath($form->createView(), array(),
1720'/select
1721 [./option[@value=""][not(@selected)][not(@disabled)][.="[trans]Select&Timezone[/trans]"]]
1722 [count(./optgroup)>10]
1723 [count(.//option)>201]
1724'
1725 );
1726 }
1727
1728 public function testUrl()
1729 {
1730 $url = 'http://www.google.com?foo1=bar1&foo2=bar2';
1731 $form = $this->factory->createNamed('name', 'url', $url);
1732
1733 $this->assertWidgetMatchesXpath($form->createView(), array(),
1734'/input
1735 [@type="url"]
1736 [@name="name"]
1737 [@value="http://www.google.com?foo1=bar1&foo2=bar2"]
1738'
1739 );
1740 }
1741
1742 public function testCollectionPrototype()
1743 {
1744 $form = $this->factory->createNamedBuilder('name', 'form', array('items' => array('one', 'two', 'three')))
1745 ->add('items', 'collection', array('allow_add' => true))
1746 ->getForm()
1747 ->createView();
1748
1749 $html = $this->renderWidget($form);
1750
1751 $this->assertMatchesXpath($html,
1752 '//div[@id="name_items"][@data-prototype]
1753 |
1754 //table[@id="name_items"][@data-prototype]'
1755 );
1756 }
1757
1758 public function testEmptyRootFormName()
1759 {
1760 $form = $this->factory->createNamedBuilder('', 'form')
1761 ->add('child', 'text')
1762 ->getForm();
1763
1764 $this->assertMatchesXpath($this->renderWidget($form->createView()),
1765 '//input[@type="hidden"][@id="_token"][@name="_token"]
1766 |
1767 //input[@type="text"][@id="child"][@name="child"]'
1768 , 2);
1769 }
1770
1771 public function testButton()
1772 {
1773 $form = $this->factory->createNamed('name', 'button');
1774
1775 $this->assertWidgetMatchesXpath($form->createView(), array(),
1776 '/button[@type="button"][@name="name"][.="[trans]Name[/trans]"]'
1777 );
1778 }
1779
1780 public function testButtonLabelIsEmpty()
1781 {
1782 $form = $this->factory->createNamed('name', 'button');
1783
1784 $this->assertSame('', $this->renderLabel($form->createView()));
1785 }
1786
1787 public function testSubmit()
1788 {
1789 $form = $this->factory->createNamed('name', 'submit');
1790
1791 $this->assertWidgetMatchesXpath($form->createView(), array(),
1792 '/button[@type="submit"][@name="name"]'
1793 );
1794 }
1795
1796 public function testReset()
1797 {
1798 $form = $this->factory->createNamed('name', 'reset');
1799
1800 $this->assertWidgetMatchesXpath($form->createView(), array(),
1801 '/button[@type="reset"][@name="name"]'
1802 );
1803 }
1804
1805 public function testStartTag()
1806 {
1807 $form = $this->factory->create('form', null, array(
1808 'method' => 'get',
1809 'action' => 'http://example.com/directory'
1810 ));
1811
1812 $html = $this->renderStart($form->createView());
1813
1814 $this->assertSame('<form method="get" action="http://example.com/directory">', $html);
1815 }
1816
1817 public function testStartTagForPutRequest()
1818 {
1819 $form = $this->factory->create('form', null, array(
1820 'method' => 'put',
1821 'action' => 'http://example.com/directory'
1822 ));
1823
1824 $html = $this->renderStart($form->createView());
1825
1826 $this->assertMatchesXpath($html . '</form>',
1827'/form
1828 [./input[@type="hidden"][@name="_method"][@value="PUT"]]
1829 [@method="post"]
1830 [@action="http://example.com/directory"]'
1831 );
1832 }
1833
1834 public function testStartTagWithOverriddenVars()
1835 {
1836 $form = $this->factory->create('form', null, array(
1837 'method' => 'put',
1838 'action' => 'http://example.com/directory',
1839 ));
1840
1841 $html = $this->renderStart($form->createView(), array(
1842 'method' => 'post',
1843 'action' => 'http://foo.com/directory'
1844 ));
1845
1846 $this->assertSame('<form method="post" action="http://foo.com/directory">', $html);
1847 }
1848
1849 public function testStartTagForMultipartForm()
1850 {
1851 $form = $this->factory->createBuilder('form', null, array(
1852 'method' => 'get',
1853 'action' => 'http://example.com/directory'
1854 ))
1855 ->add('file', 'file')
1856 ->getForm();
1857
1858 $html = $this->renderStart($form->createView());
1859
1860 $this->assertSame('<form method="get" action="http://example.com/directory" enctype="multipart/form-data">', $html);
1861 }
1862
1863 public function testStartTagWithExtraAttributes()
1864 {
1865 $form = $this->factory->create('form', null, array(
1866 'method' => 'get',
1867 'action' => 'http://example.com/directory'
1868 ));
1869
1870 $html = $this->renderStart($form->createView(), array(
1871 'attr' => array('class' => 'foobar'),
1872 ));
1873
1874 $this->assertSame('<form method="get" action="http://example.com/directory" class="foobar">', $html);
1875 }
1876}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Tests/AbstractRequestHandlerTest.php b/vendor/symfony/form/Symfony/Component/Form/Tests/AbstractRequestHandlerTest.php
deleted file mode 100644
index cef8f3bf..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Tests/AbstractRequestHandlerTest.php
+++ /dev/null
@@ -1,280 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Tests;
13
14/**
15 * @author Bernhard Schussek <bschussek@gmail.com>
16 */
17abstract class AbstractRequestHandlerTest extends \PHPUnit_Framework_TestCase
18{
19 /**
20 * @var \Symfony\Component\Form\RequestHandlerInterface
21 */
22 protected $requestHandler;
23
24 protected $request;
25
26 protected function setUp()
27 {
28 $this->requestHandler = $this->getRequestHandler();
29 $this->request = null;
30 }
31
32 public function methodExceptGetProvider()
33 {
34 return array(
35 array('POST'),
36 array('PUT'),
37 array('DELETE'),
38 array('PATCH'),
39 );
40 }
41
42 public function methodProvider()
43 {
44 return array_merge(array(
45 array('GET'),
46 ), $this->methodExceptGetProvider());
47 }
48
49 /**
50 * @dataProvider methodProvider
51 */
52 public function testSubmitIfNameInRequest($method)
53 {
54 $form = $this->getMockForm('param1', $method);
55
56 $this->setRequestData($method, array(
57 'param1' => 'DATA',
58 ));
59
60 $form->expects($this->once())
61 ->method('submit')
62 ->with('DATA', 'PATCH' !== $method);
63
64 $this->requestHandler->handleRequest($form, $this->request);
65 }
66
67 /**
68 * @dataProvider methodProvider
69 */
70 public function testDoNotSubmitIfWrongRequestMethod($method)
71 {
72 $form = $this->getMockForm('param1', $method);
73
74 $otherMethod = 'POST' === $method ? 'PUT' : 'POST';
75
76 $this->setRequestData($otherMethod, array(
77 'param1' => 'DATA',
78 ));
79
80 $form->expects($this->never())
81 ->method('submit');
82
83 $this->requestHandler->handleRequest($form, $this->request);
84 }
85
86 /**
87 * @dataProvider methodExceptGetProvider
88 */
89 public function testSubmitSimpleFormWithNullIfNameNotInRequestAndNotGetRequest($method)
90 {
91 $form = $this->getMockForm('param1', $method, false);
92
93 $this->setRequestData($method, array(
94 'paramx' => array(),
95 ));
96
97 $form->expects($this->once())
98 ->method('submit')
99 ->with($this->identicalTo(null), 'PATCH' !== $method);
100
101 $this->requestHandler->handleRequest($form, $this->request);
102 }
103
104 /**
105 * @dataProvider methodExceptGetProvider
106 */
107 public function testSubmitCompoundFormWithArrayIfNameNotInRequestAndNotGetRequest($method)
108 {
109 $form = $this->getMockForm('param1', $method, true);
110
111 $this->setRequestData($method, array(
112 'paramx' => array(),
113 ));
114
115 $form->expects($this->once())
116 ->method('submit')
117 ->with($this->identicalTo(array()), 'PATCH' !== $method);
118
119 $this->requestHandler->handleRequest($form, $this->request);
120 }
121
122 public function testDoNotSubmitIfNameNotInRequestAndGetRequest()
123 {
124 $form = $this->getMockForm('param1', 'GET');
125
126 $this->setRequestData('GET', array(
127 'paramx' => array(),
128 ));
129
130 $form->expects($this->never())
131 ->method('submit');
132
133 $this->requestHandler->handleRequest($form, $this->request);
134 }
135
136 /**
137 * @dataProvider methodProvider
138 */
139 public function testSubmitFormWithEmptyNameIfAtLeastOneFieldInRequest($method)
140 {
141 $form = $this->getMockForm('', $method);
142 $form->expects($this->any())
143 ->method('all')
144 ->will($this->returnValue(array(
145 'param1' => $this->getMockForm('param1'),
146 'param2' => $this->getMockForm('param2'),
147 )));
148
149 $this->setRequestData($method, $requestData = array(
150 'param1' => 'submitted value',
151 'paramx' => 'submitted value',
152 ));
153
154 $form->expects($this->once())
155 ->method('submit')
156 ->with($requestData, 'PATCH' !== $method);
157
158 $this->requestHandler->handleRequest($form, $this->request);
159 }
160
161 /**
162 * @dataProvider methodProvider
163 */
164 public function testDoNotSubmitFormWithEmptyNameIfNoFieldInRequest($method)
165 {
166 $form = $this->getMockForm('', $method);
167 $form->expects($this->any())
168 ->method('all')
169 ->will($this->returnValue(array(
170 'param1' => $this->getMockForm('param1'),
171 'param2' => $this->getMockForm('param2'),
172 )));
173
174 $this->setRequestData($method, array(
175 'paramx' => 'submitted value',
176 ));
177
178 $form->expects($this->never())
179 ->method('submit');
180
181 $this->requestHandler->handleRequest($form, $this->request);
182 }
183
184 /**
185 * @dataProvider methodExceptGetProvider
186 */
187 public function testMergeParamsAndFiles($method)
188 {
189 $form = $this->getMockForm('param1', $method);
190 $file = $this->getMockFile();
191
192 $this->setRequestData($method, array(
193 'param1' => array(
194 'field1' => 'DATA',
195 ),
196 ), array(
197 'param1' => array(
198 'field2' => $file,
199 ),
200 ));
201
202 $form->expects($this->once())
203 ->method('submit')
204 ->with(array(
205 'field1' => 'DATA',
206 'field2' => $file,
207 ), 'PATCH' !== $method);
208
209 $this->requestHandler->handleRequest($form, $this->request);
210 }
211
212 /**
213 * @dataProvider methodExceptGetProvider
214 */
215 public function testParamTakesPrecedenceOverFile($method)
216 {
217 $form = $this->getMockForm('param1', $method);
218 $file = $this->getMockFile();
219
220 $this->setRequestData($method, array(
221 'param1' => 'DATA',
222 ), array(
223 'param1' => $file,
224 ));
225
226 $form->expects($this->once())
227 ->method('submit')
228 ->with('DATA', 'PATCH' !== $method);
229
230 $this->requestHandler->handleRequest($form, $this->request);
231 }
232
233 /**
234 * @dataProvider methodExceptGetProvider
235 */
236 public function testSubmitFileIfNoParam($method)
237 {
238 $form = $this->getMockForm('param1', $method);
239 $file = $this->getMockFile();
240
241 $this->setRequestData($method, array(
242 'param1' => null,
243 ), array(
244 'param1' => $file,
245 ));
246
247 $form->expects($this->once())
248 ->method('submit')
249 ->with($file, 'PATCH' !== $method);
250
251 $this->requestHandler->handleRequest($form, $this->request);
252 }
253
254 abstract protected function setRequestData($method, $data, $files = array());
255
256 abstract protected function getRequestHandler();
257
258 abstract protected function getMockFile();
259
260 protected function getMockForm($name, $method = null, $compound = true)
261 {
262 $config = $this->getMock('Symfony\Component\Form\FormConfigInterface');
263 $config->expects($this->any())
264 ->method('getMethod')
265 ->will($this->returnValue($method));
266 $config->expects($this->any())
267 ->method('getCompound')
268 ->will($this->returnValue($compound));
269
270 $form = $this->getMock('Symfony\Component\Form\Test\FormInterface');
271 $form->expects($this->any())
272 ->method('getName')
273 ->will($this->returnValue($name));
274 $form->expects($this->any())
275 ->method('getConfig')
276 ->will($this->returnValue($config));
277
278 return $form;
279 }
280}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Tests/AbstractTableLayoutTest.php b/vendor/symfony/form/Symfony/Component/Form/Tests/AbstractTableLayoutTest.php
deleted file mode 100644
index 5c911951..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Tests/AbstractTableLayoutTest.php
+++ /dev/null
@@ -1,509 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Tests;
13
14use Symfony\Component\Form\FormError;
15
16abstract class AbstractTableLayoutTest extends AbstractLayoutTest
17{
18 public function testRow()
19 {
20 $form = $this->factory->createNamed('name', 'text');
21 $form->addError(new FormError('[trans]Error![/trans]'));
22 $view = $form->createView();
23 $html = $this->renderRow($view);
24
25 $this->assertMatchesXpath($html,
26'/tr
27 [
28 ./td
29 [./label[@for="name"]]
30 /following-sibling::td
31 [
32 ./ul
33 [./li[.="[trans]Error![/trans]"]]
34 [count(./li)=1]
35 /following-sibling::input[@id="name"]
36 ]
37 ]
38'
39 );
40 }
41
42 public function testLabelIsNotRenderedWhenSetToFalse()
43 {
44 $form = $this->factory->createNamed('name', 'text', null, array(
45 'label' => false
46 ));
47 $html = $this->renderRow($form->createView());
48
49 $this->assertMatchesXpath($html,
50'/tr
51 [
52 ./td
53 [count(//label)=0]
54 /following-sibling::td
55 [./input[@id="name"]]
56 ]
57'
58 );
59 }
60
61 public function testRepeatedRow()
62 {
63 $form = $this->factory->createNamed('name', 'repeated');
64 $html = $this->renderRow($form->createView());
65
66 $this->assertMatchesXpath($html,
67'/tr
68 [
69 ./td
70 [./label[@for="name_first"]]
71 /following-sibling::td
72 [./input[@id="name_first"]]
73 ]
74/following-sibling::tr
75 [
76 ./td
77 [./label[@for="name_second"]]
78 /following-sibling::td
79 [./input[@id="name_second"]]
80 ]
81/following-sibling::tr[@style="display: none"]
82 [./td[@colspan="2"]/input
83 [@type="hidden"]
84 [@id="name__token"]
85 ]
86 [count(../tr)=3]
87'
88 );
89 }
90
91 public function testRepeatedRowWithErrors()
92 {
93 $form = $this->factory->createNamed('name', 'repeated');
94 $form->addError(new FormError('[trans]Error![/trans]'));
95 $view = $form->createView();
96 $html = $this->renderRow($view);
97
98 // The errors of the form are not rendered by intention!
99 // In practice, repeated fields cannot have errors as all errors
100 // on them are mapped to the first child.
101 // (see RepeatedTypeValidatorExtension)
102
103 $this->assertMatchesXpath($html,
104'/tr
105 [
106 ./td
107 [./label[@for="name_first"]]
108 /following-sibling::td
109 [./input[@id="name_first"]]
110 ]
111/following-sibling::tr
112 [
113 ./td
114 [./label[@for="name_second"]]
115 /following-sibling::td
116 [./input[@id="name_second"]]
117 ]
118/following-sibling::tr[@style="display: none"]
119 [./td[@colspan="2"]/input
120 [@type="hidden"]
121 [@id="name__token"]
122 ]
123 [count(../tr)=3]
124'
125 );
126 }
127
128 public function testButtonRow()
129 {
130 $form = $this->factory->createNamed('name', 'button');
131 $view = $form->createView();
132 $html = $this->renderRow($view);
133
134 $this->assertMatchesXpath($html,
135'/tr
136 [
137 ./td
138 [.=""]
139 /following-sibling::td
140 [./button[@type="button"][@name="name"]]
141 ]
142 [count(//label)=0]
143'
144 );
145 }
146
147 public function testRest()
148 {
149 $view = $this->factory->createNamedBuilder('name', 'form')
150 ->add('field1', 'text')
151 ->add('field2', 'repeated')
152 ->add('field3', 'text')
153 ->add('field4', 'text')
154 ->getForm()
155 ->createView();
156
157 // Render field2 row -> does not implicitly call renderWidget because
158 // it is a repeated field!
159 $this->renderRow($view['field2']);
160
161 // Render field3 widget
162 $this->renderWidget($view['field3']);
163
164 // Rest should only contain field1 and field4
165 $html = $this->renderRest($view);
166
167 $this->assertMatchesXpath($html,
168'/tr
169 [
170 ./td
171 [./label[@for="name_field1"]]
172 /following-sibling::td
173 [./input[@id="name_field1"]]
174 ]
175/following-sibling::tr
176 [
177 ./td
178 [./label[@for="name_field4"]]
179 /following-sibling::td
180 [./input[@id="name_field4"]]
181 ]
182 [count(../tr)=3]
183 [count(..//label)=2]
184 [count(..//input)=3]
185/following-sibling::tr[@style="display: none"]
186 [./td[@colspan="2"]/input
187 [@type="hidden"]
188 [@id="name__token"]
189 ]
190'
191 );
192 }
193
194 public function testCollection()
195 {
196 $form = $this->factory->createNamed('name', 'collection', array('a', 'b'), array(
197 'type' => 'text',
198 ));
199
200 $this->assertWidgetMatchesXpath($form->createView(), array(),
201'/table
202 [
203 ./tr[./td/input[@type="text"][@value="a"]]
204 /following-sibling::tr[./td/input[@type="text"][@value="b"]]
205 /following-sibling::tr[@style="display: none"][./td[@colspan="2"]/input[@type="hidden"][@id="name__token"]]
206 ]
207 [count(./tr[./td/input])=3]
208'
209 );
210 }
211
212 public function testEmptyCollection()
213 {
214 $form = $this->factory->createNamed('name', 'collection', array(), array(
215 'type' => 'text',
216 ));
217
218 $this->assertWidgetMatchesXpath($form->createView(), array(),
219'/table
220 [./tr[@style="display: none"][./td[@colspan="2"]/input[@type="hidden"][@id="name__token"]]]
221 [count(./tr[./td/input])=1]
222'
223 );
224 }
225
226 public function testForm()
227 {
228 $view = $this->factory->createNamedBuilder('name', 'form')
229 ->setMethod('PUT')
230 ->setAction('http://example.com')
231 ->add('firstName', 'text')
232 ->add('lastName', 'text')
233 ->getForm()
234 ->createView();
235
236 $html = $this->renderForm($view, array(
237 'id' => 'my&id',
238 'attr' => array('class' => 'my&class'),
239 ));
240
241 $this->assertMatchesXpath($html,
242'/form
243 [
244 ./input[@type="hidden"][@name="_method"][@value="PUT"]
245 /following-sibling::table
246 [
247 ./tr
248 [
249 ./td
250 [./label[@for="name_firstName"]]
251 /following-sibling::td
252 [./input[@id="name_firstName"]]
253 ]
254 /following-sibling::tr
255 [
256 ./td
257 [./label[@for="name_lastName"]]
258 /following-sibling::td
259 [./input[@id="name_lastName"]]
260 ]
261 /following-sibling::tr[@style="display: none"]
262 [./td[@colspan="2"]/input
263 [@type="hidden"]
264 [@id="name__token"]
265 ]
266 ]
267 [count(.//input)=3]
268 [@id="my&id"]
269 [@class="my&class"]
270 ]
271 [@method="post"]
272 [@action="http://example.com"]
273 [@class="my&class"]
274'
275 );
276 }
277
278 public function testFormWidget()
279 {
280 $view = $this->factory->createNamedBuilder('name', 'form')
281 ->add('firstName', 'text')
282 ->add('lastName', 'text')
283 ->getForm()
284 ->createView();
285
286 $this->assertWidgetMatchesXpath($view, array(),
287'/table
288 [
289 ./tr
290 [
291 ./td
292 [./label[@for="name_firstName"]]
293 /following-sibling::td
294 [./input[@id="name_firstName"]]
295 ]
296 /following-sibling::tr
297 [
298 ./td
299 [./label[@for="name_lastName"]]
300 /following-sibling::td
301 [./input[@id="name_lastName"]]
302 ]
303 /following-sibling::tr[@style="display: none"]
304 [./td[@colspan="2"]/input
305 [@type="hidden"]
306 [@id="name__token"]
307 ]
308 ]
309 [count(.//input)=3]
310'
311 );
312 }
313
314 // https://github.com/symfony/symfony/issues/2308
315 public function testNestedFormError()
316 {
317 $form = $this->factory->createNamedBuilder('name', 'form')
318 ->add($this->factory
319 ->createNamedBuilder('child', 'form', null, array('error_bubbling' => false))
320 ->add('grandChild', 'form')
321 )
322 ->getForm();
323
324 $form->get('child')->addError(new FormError('[trans]Error![/trans]'));
325
326 $this->assertWidgetMatchesXpath($form->createView(), array(),
327'/table
328 [
329 ./tr/td/ul[./li[.="[trans]Error![/trans]"]]
330 /following-sibling::table[@id="name_child"]
331 ]
332 [count(.//li[.="[trans]Error![/trans]"])=1]
333'
334 );
335 }
336
337 public function testCsrf()
338 {
339 $this->csrfProvider->expects($this->any())
340 ->method('generateCsrfToken')
341 ->will($this->returnValue('foo&bar'));
342
343 $form = $this->factory->createNamedBuilder('name', 'form')
344 ->add($this->factory
345 // No CSRF protection on nested forms
346 ->createNamedBuilder('child', 'form')
347 ->add($this->factory->createNamedBuilder('grandchild', 'text'))
348 )
349 ->getForm();
350
351 $this->assertWidgetMatchesXpath($form->createView(), array(),
352'/table
353 [
354 ./tr[@style="display: none"]
355 [./td[@colspan="2"]/input
356 [@type="hidden"]
357 [@id="name__token"]
358 ]
359 ]
360 [count(.//input[@type="hidden"])=1]
361'
362 );
363 }
364
365 public function testRepeated()
366 {
367 $form = $this->factory->createNamed('name', 'repeated', 'foobar', array(
368 'type' => 'text',
369 ));
370
371 $this->assertWidgetMatchesXpath($form->createView(), array(),
372'/table
373 [
374 ./tr
375 [
376 ./td
377 [./label[@for="name_first"]]
378 /following-sibling::td
379 [./input[@type="text"][@id="name_first"]]
380 ]
381 /following-sibling::tr
382 [
383 ./td
384 [./label[@for="name_second"]]
385 /following-sibling::td
386 [./input[@type="text"][@id="name_second"]]
387 ]
388 /following-sibling::tr[@style="display: none"]
389 [./td[@colspan="2"]/input
390 [@type="hidden"]
391 [@id="name__token"]
392 ]
393 ]
394 [count(.//input)=3]
395'
396 );
397 }
398
399 public function testRepeatedWithCustomOptions()
400 {
401 $form = $this->factory->createNamed('name', 'repeated', 'foobar', array(
402 'type' => 'password',
403 'first_options' => array('label' => 'Test', 'required' => false),
404 'second_options' => array('label' => 'Test2')
405 ));
406
407 $this->assertWidgetMatchesXpath($form->createView(), array(),
408'/table
409 [
410 ./tr
411 [
412 ./td
413 [./label[@for="name_first"][.="[trans]Test[/trans]"]]
414 /following-sibling::td
415 [./input[@type="password"][@id="name_first"][@required="required"]]
416 ]
417 /following-sibling::tr
418 [
419 ./td
420 [./label[@for="name_second"][.="[trans]Test2[/trans]"]]
421 /following-sibling::td
422 [./input[@type="password"][@id="name_second"][@required="required"]]
423 ]
424 /following-sibling::tr[@style="display: none"]
425 [./td[@colspan="2"]/input
426 [@type="hidden"]
427 [@id="name__token"]
428 ]
429 ]
430 [count(.//input)=3]
431'
432 );
433 }
434
435 /**
436 * The block "_name_child_label" should be overridden in the theme of the
437 * implemented driver.
438 */
439 public function testCollectionRowWithCustomBlock()
440 {
441 $collection = array('one', 'two', 'three');
442 $form = $this->factory->createNamedBuilder('name', 'collection', $collection)
443 ->getForm();
444
445 $this->assertWidgetMatchesXpath($form->createView(), array(),
446'/table
447 [
448 ./tr[./td/label[.="Custom label: [trans]0[/trans]"]]
449 /following-sibling::tr[./td/label[.="Custom label: [trans]1[/trans]"]]
450 /following-sibling::tr[./td/label[.="Custom label: [trans]2[/trans]"]]
451 ]
452'
453 );
454 }
455
456 public function testFormEndWithRest()
457 {
458 $view = $this->factory->createNamedBuilder('name', 'form')
459 ->add('field1', 'text')
460 ->add('field2', 'text')
461 ->getForm()
462 ->createView();
463
464 $this->renderWidget($view['field1']);
465
466 // Rest should only contain field2
467 $html = $this->renderEnd($view);
468
469 // Insert the start tag, the end tag should be rendered by the helper
470 // Unfortunately this is not valid HTML, because the surrounding table
471 // tag is missing. If someone renders a form with table layout
472 // manually, she should call form_rest() explicitly within the <table>
473 // tag.
474 $this->assertMatchesXpath('<form>' . $html,
475'/form
476 [
477 ./tr
478 [
479 ./td
480 [./label[@for="name_field2"]]
481 /following-sibling::td
482 [./input[@id="name_field2"]]
483 ]
484 /following-sibling::tr[@style="display: none"]
485 [./td[@colspan="2"]/input
486 [@type="hidden"]
487 [@id="name__token"]
488 ]
489 ]
490'
491 );
492 }
493
494 public function testFormEndWithoutRest()
495 {
496 $view = $this->factory->createNamedBuilder('name', 'form')
497 ->add('field1', 'text')
498 ->add('field2', 'text')
499 ->getForm()
500 ->createView();
501
502 $this->renderWidget($view['field1']);
503
504 // Rest should only contain field2, but isn't rendered
505 $html = $this->renderEnd($view, array('render_rest' => false));
506
507 $this->assertEquals('</form>', $html);
508 }
509}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Tests/CompoundFormPerformanceTest.php b/vendor/symfony/form/Symfony/Component/Form/Tests/CompoundFormPerformanceTest.php
deleted file mode 100644
index 73c602c5..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Tests/CompoundFormPerformanceTest.php
+++ /dev/null
@@ -1,48 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Tests;
13
14/**
15 * @author Bernhard Schussek <bschussek@gmail.com>
16 */
17class CompoundFormPerformanceTest extends \Symfony\Component\Form\Tests\FormPerformanceTestCase
18{
19 /**
20 * Create a compound form multiple times, as happens in a collection form
21 *
22 * @group benchmark
23 */
24 public function testArrayBasedForm()
25 {
26 $this->setMaxRunningTime(1);
27
28 for ($i = 0; $i < 40; ++$i) {
29 $form = $this->factory->createBuilder('form')
30 ->add('firstName', 'text')
31 ->add('lastName', 'text')
32 ->add('gender', 'choice', array(
33 'choices' => array('male' => 'Male', 'female' => 'Female'),
34 'required' => false,
35 ))
36 ->add('age', 'number')
37 ->add('birthDate', 'birthday')
38 ->add('city', 'choice', array(
39 // simulate 300 different cities
40 'choices' => range(1, 300),
41 ))
42 ->getForm();
43
44 // load the form into a view
45 $form->createView();
46 }
47 }
48}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Tests/CompoundFormTest.php b/vendor/symfony/form/Symfony/Component/Form/Tests/CompoundFormTest.php
deleted file mode 100644
index b240d2d0..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Tests/CompoundFormTest.php
+++ /dev/null
@@ -1,759 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Tests;
13
14use Symfony\Component\Form\Extension\HttpFoundation\HttpFoundationRequestHandler;
15use Symfony\Component\Form\FormError;
16use Symfony\Component\HttpFoundation\Request;
17use Symfony\Component\HttpFoundation\File\UploadedFile;
18use Symfony\Component\Form\Tests\Fixtures\FixedDataTransformer;
19
20class CompoundFormTest extends AbstractFormTest
21{
22 public function testValidIfAllChildrenAreValid()
23 {
24 $this->form->add($this->getValidForm('firstName'));
25 $this->form->add($this->getValidForm('lastName'));
26
27 $this->form->submit(array(
28 'firstName' => 'Bernhard',
29 'lastName' => 'Schussek',
30 ));
31
32 $this->assertTrue($this->form->isValid());
33 }
34
35 public function testInvalidIfChildIsInvalid()
36 {
37 $this->form->add($this->getValidForm('firstName'));
38 $this->form->add($this->getInvalidForm('lastName'));
39
40 $this->form->submit(array(
41 'firstName' => 'Bernhard',
42 'lastName' => 'Schussek',
43 ));
44
45 $this->assertFalse($this->form->isValid());
46 }
47
48 public function testSubmitForwardsNullIfValueIsMissing()
49 {
50 $child = $this->getMockForm('firstName');
51
52 $this->form->add($child);
53
54 $child->expects($this->once())
55 ->method('submit')
56 ->with($this->equalTo(null));
57
58 $this->form->submit(array());
59 }
60
61 public function testSubmitDoesNotForwardNullIfNotClearMissing()
62 {
63 $child = $this->getMockForm('firstName');
64
65 $this->form->add($child);
66
67 $child->expects($this->never())
68 ->method('submit');
69
70 $this->form->submit(array(), false);
71 }
72
73 public function testClearMissingFlagIsForwarded()
74 {
75 $child = $this->getMockForm('firstName');
76
77 $this->form->add($child);
78
79 $child->expects($this->once())
80 ->method('submit')
81 ->with($this->equalTo('foo'), false);
82
83 $this->form->submit(array('firstName' => 'foo'), false);
84 }
85
86 public function testCloneChildren()
87 {
88 $child = $this->getBuilder('child')->getForm();
89 $this->form->add($child);
90
91 $clone = clone $this->form;
92
93 $this->assertNotSame($this->form, $clone);
94 $this->assertNotSame($child, $clone['child']);
95 }
96
97 public function testNotEmptyIfChildNotEmpty()
98 {
99 $child = $this->getMockForm();
100 $child->expects($this->once())
101 ->method('isEmpty')
102 ->will($this->returnValue(false));
103
104 $this->form->setData(null);
105 $this->form->add($child);
106
107 $this->assertFalse($this->form->isEmpty());
108 }
109
110 public function testValidIfSubmittedAndDisabledWithChildren()
111 {
112 $this->factory->expects($this->once())
113 ->method('createNamedBuilder')
114 ->with('name', 'text', null, array())
115 ->will($this->returnValue($this->getBuilder('name')));
116
117 $form = $this->getBuilder('person')
118 ->setDisabled(true)
119 ->setCompound(true)
120 ->setDataMapper($this->getDataMapper())
121 ->add('name', 'text')
122 ->getForm();
123 $form->submit(array('name' => 'Jacques Doe'));
124
125 $this->assertTrue($form->isValid());
126 }
127
128 public function testNotValidIfChildNotValid()
129 {
130 $child = $this->getMockForm();
131 $child->expects($this->once())
132 ->method('isValid')
133 ->will($this->returnValue(false));
134
135 $this->form->add($child);
136 $this->form->submit(array());
137
138 $this->assertFalse($this->form->isValid());
139 }
140
141 public function testAdd()
142 {
143 $child = $this->getBuilder('foo')->getForm();
144 $this->form->add($child);
145
146 $this->assertTrue($this->form->has('foo'));
147 $this->assertSame($this->form, $child->getParent());
148 $this->assertSame(array('foo' => $child), $this->form->all());
149 }
150
151 public function testAddUsingNameAndType()
152 {
153 $child = $this->getBuilder('foo')->getForm();
154
155 $this->factory->expects($this->once())
156 ->method('createNamed')
157 ->with('foo', 'text', null, array(
158 'bar' => 'baz',
159 'auto_initialize' => false,
160 ))
161 ->will($this->returnValue($child));
162
163 $this->form->add('foo', 'text', array('bar' => 'baz'));
164
165 $this->assertTrue($this->form->has('foo'));
166 $this->assertSame($this->form, $child->getParent());
167 $this->assertSame(array('foo' => $child), $this->form->all());
168 }
169
170 public function testAddUsingIntegerNameAndType()
171 {
172 $child = $this->getBuilder(0)->getForm();
173
174 $this->factory->expects($this->once())
175 ->method('createNamed')
176 ->with('0', 'text', null, array(
177 'bar' => 'baz',
178 'auto_initialize' => false,
179 ))
180 ->will($this->returnValue($child));
181
182 // in order to make casting unnecessary
183 $this->form->add(0, 'text', array('bar' => 'baz'));
184
185 $this->assertTrue($this->form->has(0));
186 $this->assertSame($this->form, $child->getParent());
187 $this->assertSame(array(0 => $child), $this->form->all());
188 }
189
190 public function testAddUsingNameButNoType()
191 {
192 $this->form = $this->getBuilder('name', null, '\stdClass')
193 ->setCompound(true)
194 ->setDataMapper($this->getDataMapper())
195 ->getForm();
196
197 $child = $this->getBuilder('foo')->getForm();
198
199 $this->factory->expects($this->once())
200 ->method('createForProperty')
201 ->with('\stdClass', 'foo')
202 ->will($this->returnValue($child));
203
204 $this->form->add('foo');
205
206 $this->assertTrue($this->form->has('foo'));
207 $this->assertSame($this->form, $child->getParent());
208 $this->assertSame(array('foo' => $child), $this->form->all());
209 }
210
211 public function testAddUsingNameButNoTypeAndOptions()
212 {
213 $this->form = $this->getBuilder('name', null, '\stdClass')
214 ->setCompound(true)
215 ->setDataMapper($this->getDataMapper())
216 ->getForm();
217
218 $child = $this->getBuilder('foo')->getForm();
219
220 $this->factory->expects($this->once())
221 ->method('createForProperty')
222 ->with('\stdClass', 'foo', null, array(
223 'bar' => 'baz',
224 'auto_initialize' => false,
225 ))
226 ->will($this->returnValue($child));
227
228 $this->form->add('foo', null, array('bar' => 'baz'));
229
230 $this->assertTrue($this->form->has('foo'));
231 $this->assertSame($this->form, $child->getParent());
232 $this->assertSame(array('foo' => $child), $this->form->all());
233 }
234
235 /**
236 * @expectedException \Symfony\Component\Form\Exception\AlreadySubmittedException
237 */
238 public function testAddThrowsExceptionIfAlreadySubmitted()
239 {
240 $this->form->submit(array());
241 $this->form->add($this->getBuilder('foo')->getForm());
242 }
243
244 public function testRemove()
245 {
246 $child = $this->getBuilder('foo')->getForm();
247 $this->form->add($child);
248 $this->form->remove('foo');
249
250 $this->assertNull($child->getParent());
251 $this->assertCount(0, $this->form);
252 }
253
254 /**
255 * @expectedException \Symfony\Component\Form\Exception\AlreadySubmittedException
256 */
257 public function testRemoveThrowsExceptionIfAlreadySubmitted()
258 {
259 $this->form->add($this->getBuilder('foo')->setCompound(false)->getForm());
260 $this->form->submit(array('foo' => 'bar'));
261 $this->form->remove('foo');
262 }
263
264 public function testRemoveIgnoresUnknownName()
265 {
266 $this->form->remove('notexisting');
267 }
268
269 public function testArrayAccess()
270 {
271 $child = $this->getBuilder('foo')->getForm();
272
273 $this->form[] = $child;
274
275 $this->assertTrue(isset($this->form['foo']));
276 $this->assertSame($child, $this->form['foo']);
277
278 unset($this->form['foo']);
279
280 $this->assertFalse(isset($this->form['foo']));
281 }
282
283 public function testCountable()
284 {
285 $this->form->add($this->getBuilder('foo')->getForm());
286 $this->form->add($this->getBuilder('bar')->getForm());
287
288 $this->assertCount(2, $this->form);
289 }
290
291 public function testIterator()
292 {
293 $this->form->add($this->getBuilder('foo')->getForm());
294 $this->form->add($this->getBuilder('bar')->getForm());
295
296 $this->assertSame($this->form->all(), iterator_to_array($this->form));
297 }
298
299 public function testAddMapsViewDataToFormIfInitialized()
300 {
301 $test = $this;
302 $mapper = $this->getDataMapper();
303 $form = $this->getBuilder()
304 ->setCompound(true)
305 ->setDataMapper($mapper)
306 ->addViewTransformer(new FixedDataTransformer(array(
307 '' => '',
308 'foo' => 'bar',
309 )))
310 ->setData('foo')
311 ->getForm();
312
313 $child = $this->getBuilder()->getForm();
314 $mapper->expects($this->once())
315 ->method('mapDataToForms')
316 ->with('bar', $this->isInstanceOf('\RecursiveIteratorIterator'))
317 ->will($this->returnCallback(function ($data, \RecursiveIteratorIterator $iterator) use ($child, $test) {
318 $test->assertInstanceOf('Symfony\Component\Form\Util\InheritDataAwareIterator', $iterator->getInnerIterator());
319 $test->assertSame(array($child), iterator_to_array($iterator));
320 }));
321
322 $form->initialize();
323 $form->add($child);
324 }
325
326 public function testAddDoesNotMapViewDataToFormIfNotInitialized()
327 {
328 $mapper = $this->getDataMapper();
329 $form = $this->getBuilder()
330 ->setCompound(true)
331 ->setDataMapper($mapper)
332 ->getForm();
333
334 $child = $this->getBuilder()->getForm();
335 $mapper->expects($this->never())
336 ->method('mapDataToForms');
337
338 $form->add($child);
339 }
340
341 public function testAddDoesNotMapViewDataToFormIfInheritData()
342 {
343 $mapper = $this->getDataMapper();
344 $form = $this->getBuilder()
345 ->setCompound(true)
346 ->setDataMapper($mapper)
347 ->setInheritData(true)
348 ->getForm();
349
350 $child = $this->getBuilder()->getForm();
351 $mapper->expects($this->never())
352 ->method('mapDataToForms');
353
354 $form->initialize();
355 $form->add($child);
356 }
357
358 public function testSetDataMapsViewDataToChildren()
359 {
360 $test = $this;
361 $mapper = $this->getDataMapper();
362 $form = $this->getBuilder()
363 ->setCompound(true)
364 ->setDataMapper($mapper)
365 ->addViewTransformer(new FixedDataTransformer(array(
366 '' => '',
367 'foo' => 'bar',
368 )))
369 ->getForm();
370
371 $form->add($child1 = $this->getBuilder('firstName')->getForm());
372 $form->add($child2 = $this->getBuilder('lastName')->getForm());
373
374 $mapper->expects($this->once())
375 ->method('mapDataToForms')
376 ->with('bar', $this->isInstanceOf('\RecursiveIteratorIterator'))
377 ->will($this->returnCallback(function ($data, \RecursiveIteratorIterator $iterator) use ($child1, $child2, $test) {
378 $test->assertInstanceOf('Symfony\Component\Form\Util\InheritDataAwareIterator', $iterator->getInnerIterator());
379 $test->assertSame(array('firstName' => $child1, 'lastName' => $child2), iterator_to_array($iterator));
380 }));
381
382 $form->setData('foo');
383 }
384
385 public function testSubmitMapsSubmittedChildrenOntoExistingViewData()
386 {
387 $test = $this;
388 $mapper = $this->getDataMapper();
389 $form = $this->getBuilder()
390 ->setCompound(true)
391 ->setDataMapper($mapper)
392 ->addViewTransformer(new FixedDataTransformer(array(
393 '' => '',
394 'foo' => 'bar',
395 )))
396 ->setData('foo')
397 ->getForm();
398
399 $form->add($child1 = $this->getBuilder('firstName')->setCompound(false)->getForm());
400 $form->add($child2 = $this->getBuilder('lastName')->setCompound(false)->getForm());
401
402 $mapper->expects($this->once())
403 ->method('mapFormsToData')
404 ->with($this->isInstanceOf('\RecursiveIteratorIterator'), 'bar')
405 ->will($this->returnCallback(function (\RecursiveIteratorIterator $iterator) use ($child1, $child2, $test) {
406 $test->assertInstanceOf('Symfony\Component\Form\Util\InheritDataAwareIterator', $iterator->getInnerIterator());
407 $test->assertSame(array('firstName' => $child1, 'lastName' => $child2), iterator_to_array($iterator));
408 $test->assertEquals('Bernhard', $child1->getData());
409 $test->assertEquals('Schussek', $child2->getData());
410 }));
411
412 $form->submit(array(
413 'firstName' => 'Bernhard',
414 'lastName' => 'Schussek',
415 ));
416 }
417
418 public function testMapFormsToDataIsNotInvokedIfInheritData()
419 {
420 $mapper = $this->getDataMapper();
421 $form = $this->getBuilder()
422 ->setCompound(true)
423 ->setDataMapper($mapper)
424 ->setInheritData(true)
425 ->addViewTransformer(new FixedDataTransformer(array(
426 '' => '',
427 'foo' => 'bar',
428 )))
429 ->getForm();
430
431 $form->add($child1 = $this->getBuilder('firstName')->setCompound(false)->getForm());
432 $form->add($child2 = $this->getBuilder('lastName')->setCompound(false)->getForm());
433
434 $mapper->expects($this->never())
435 ->method('mapFormsToData');
436
437 $form->submit(array(
438 'firstName' => 'Bernhard',
439 'lastName' => 'Schussek',
440 ));
441 }
442
443 /*
444 * https://github.com/symfony/symfony/issues/4480
445 */
446 public function testSubmitRestoresViewDataIfCompoundAndEmpty()
447 {
448 $mapper = $this->getDataMapper();
449 $object = new \stdClass();
450 $form = $this->getBuilder('name', null, 'stdClass')
451 ->setCompound(true)
452 ->setDataMapper($mapper)
453 ->setData($object)
454 ->getForm();
455
456 $form->submit(array());
457
458 $this->assertSame($object, $form->getData());
459 }
460
461 public function testSubmitMapsSubmittedChildrenOntoEmptyData()
462 {
463 $test = $this;
464 $mapper = $this->getDataMapper();
465 $object = new \stdClass();
466 $form = $this->getBuilder()
467 ->setCompound(true)
468 ->setDataMapper($mapper)
469 ->setEmptyData($object)
470 ->setData(null)
471 ->getForm();
472
473 $form->add($child = $this->getBuilder('name')->setCompound(false)->getForm());
474
475 $mapper->expects($this->once())
476 ->method('mapFormsToData')
477 ->with($this->isInstanceOf('\RecursiveIteratorIterator'), $object)
478 ->will($this->returnCallback(function (\RecursiveIteratorIterator $iterator) use ($child, $test) {
479 $test->assertInstanceOf('Symfony\Component\Form\Util\InheritDataAwareIterator', $iterator->getInnerIterator());
480 $test->assertSame(array('name' => $child), iterator_to_array($iterator));
481 }));
482
483 $form->submit(array(
484 'name' => 'Bernhard',
485 ));
486 }
487
488 public function requestMethodProvider()
489 {
490 return array(
491 array('POST'),
492 array('PUT'),
493 array('DELETE'),
494 array('PATCH'),
495 );
496 }
497
498 /**
499 * @dataProvider requestMethodProvider
500 */
501 public function testSubmitPostOrPutRequest($method)
502 {
503 if (!class_exists('Symfony\Component\HttpFoundation\Request')) {
504 $this->markTestSkipped('The "HttpFoundation" component is not available');
505 }
506
507 $path = tempnam(sys_get_temp_dir(), 'sf2');
508 touch($path);
509
510 $values = array(
511 'author' => array(
512 'name' => 'Bernhard',
513 'image' => array('filename' => 'foobar.png'),
514 ),
515 );
516
517 $files = array(
518 'author' => array(
519 'error' => array('image' => UPLOAD_ERR_OK),
520 'name' => array('image' => 'upload.png'),
521 'size' => array('image' => 123),
522 'tmp_name' => array('image' => $path),
523 'type' => array('image' => 'image/png'),
524 ),
525 );
526
527 $request = new Request(array(), $values, array(), array(), $files, array(
528 'REQUEST_METHOD' => $method,
529 ));
530
531 $form = $this->getBuilder('author')
532 ->setMethod($method)
533 ->setCompound(true)
534 ->setDataMapper($this->getDataMapper())
535 ->setRequestHandler(new HttpFoundationRequestHandler())
536 ->getForm();
537 $form->add($this->getBuilder('name')->getForm());
538 $form->add($this->getBuilder('image')->getForm());
539
540 $form->handleRequest($request);
541
542 $file = new UploadedFile($path, 'upload.png', 'image/png', 123, UPLOAD_ERR_OK);
543
544 $this->assertEquals('Bernhard', $form['name']->getData());
545 $this->assertEquals($file, $form['image']->getData());
546
547 unlink($path);
548 }
549
550 /**
551 * @dataProvider requestMethodProvider
552 */
553 public function testSubmitPostOrPutRequestWithEmptyRootFormName($method)
554 {
555 if (!class_exists('Symfony\Component\HttpFoundation\Request')) {
556 $this->markTestSkipped('The "HttpFoundation" component is not available');
557 }
558
559 $path = tempnam(sys_get_temp_dir(), 'sf2');
560 touch($path);
561
562 $values = array(
563 'name' => 'Bernhard',
564 'extra' => 'data',
565 );
566
567 $files = array(
568 'image' => array(
569 'error' => UPLOAD_ERR_OK,
570 'name' => 'upload.png',
571 'size' => 123,
572 'tmp_name' => $path,
573 'type' => 'image/png',
574 ),
575 );
576
577 $request = new Request(array(), $values, array(), array(), $files, array(
578 'REQUEST_METHOD' => $method,
579 ));
580
581 $form = $this->getBuilder('')
582 ->setMethod($method)
583 ->setCompound(true)
584 ->setDataMapper($this->getDataMapper())
585 ->setRequestHandler(new HttpFoundationRequestHandler())
586 ->getForm();
587 $form->add($this->getBuilder('name')->getForm());
588 $form->add($this->getBuilder('image')->getForm());
589
590 $form->handleRequest($request);
591
592 $file = new UploadedFile($path, 'upload.png', 'image/png', 123, UPLOAD_ERR_OK);
593
594 $this->assertEquals('Bernhard', $form['name']->getData());
595 $this->assertEquals($file, $form['image']->getData());
596 $this->assertEquals(array('extra' => 'data'), $form->getExtraData());
597
598 unlink($path);
599 }
600
601 /**
602 * @dataProvider requestMethodProvider
603 */
604 public function testSubmitPostOrPutRequestWithSingleChildForm($method)
605 {
606 if (!class_exists('Symfony\Component\HttpFoundation\Request')) {
607 $this->markTestSkipped('The "HttpFoundation" component is not available');
608 }
609
610 $path = tempnam(sys_get_temp_dir(), 'sf2');
611 touch($path);
612
613 $files = array(
614 'image' => array(
615 'error' => UPLOAD_ERR_OK,
616 'name' => 'upload.png',
617 'size' => 123,
618 'tmp_name' => $path,
619 'type' => 'image/png',
620 ),
621 );
622
623 $request = new Request(array(), array(), array(), array(), $files, array(
624 'REQUEST_METHOD' => $method,
625 ));
626
627 $form = $this->getBuilder('image')
628 ->setMethod($method)
629 ->setRequestHandler(new HttpFoundationRequestHandler())
630 ->getForm();
631
632 $form->handleRequest($request);
633
634 $file = new UploadedFile($path, 'upload.png', 'image/png', 123, UPLOAD_ERR_OK);
635
636 $this->assertEquals($file, $form->getData());
637
638 unlink($path);
639 }
640
641 /**
642 * @dataProvider requestMethodProvider
643 */
644 public function testSubmitPostOrPutRequestWithSingleChildFormUploadedFile($method)
645 {
646 if (!class_exists('Symfony\Component\HttpFoundation\Request')) {
647 $this->markTestSkipped('The "HttpFoundation" component is not available');
648 }
649
650 $path = tempnam(sys_get_temp_dir(), 'sf2');
651 touch($path);
652
653 $values = array(
654 'name' => 'Bernhard',
655 );
656
657 $request = new Request(array(), $values, array(), array(), array(), array(
658 'REQUEST_METHOD' => $method,
659 ));
660
661 $form = $this->getBuilder('name')
662 ->setMethod($method)
663 ->setRequestHandler(new HttpFoundationRequestHandler())
664 ->getForm();
665
666 $form->handleRequest($request);
667
668 $this->assertEquals('Bernhard', $form->getData());
669
670 unlink($path);
671 }
672
673 public function testSubmitGetRequest()
674 {
675 if (!class_exists('Symfony\Component\HttpFoundation\Request')) {
676 $this->markTestSkipped('The "HttpFoundation" component is not available');
677 }
678
679 $values = array(
680 'author' => array(
681 'firstName' => 'Bernhard',
682 'lastName' => 'Schussek',
683 ),
684 );
685
686 $request = new Request($values, array(), array(), array(), array(), array(
687 'REQUEST_METHOD' => 'GET',
688 ));
689
690 $form = $this->getBuilder('author')
691 ->setMethod('GET')
692 ->setCompound(true)
693 ->setDataMapper($this->getDataMapper())
694 ->setRequestHandler(new HttpFoundationRequestHandler())
695 ->getForm();
696 $form->add($this->getBuilder('firstName')->getForm());
697 $form->add($this->getBuilder('lastName')->getForm());
698
699 $form->handleRequest($request);
700
701 $this->assertEquals('Bernhard', $form['firstName']->getData());
702 $this->assertEquals('Schussek', $form['lastName']->getData());
703 }
704
705 public function testSubmitGetRequestWithEmptyRootFormName()
706 {
707 if (!class_exists('Symfony\Component\HttpFoundation\Request')) {
708 $this->markTestSkipped('The "HttpFoundation" component is not available');
709 }
710
711 $values = array(
712 'firstName' => 'Bernhard',
713 'lastName' => 'Schussek',
714 'extra' => 'data'
715 );
716
717 $request = new Request($values, array(), array(), array(), array(), array(
718 'REQUEST_METHOD' => 'GET',
719 ));
720
721 $form = $this->getBuilder('')
722 ->setMethod('GET')
723 ->setCompound(true)
724 ->setDataMapper($this->getDataMapper())
725 ->setRequestHandler(new HttpFoundationRequestHandler())
726 ->getForm();
727 $form->add($this->getBuilder('firstName')->getForm());
728 $form->add($this->getBuilder('lastName')->getForm());
729
730 $form->handleRequest($request);
731
732 $this->assertEquals('Bernhard', $form['firstName']->getData());
733 $this->assertEquals('Schussek', $form['lastName']->getData());
734 $this->assertEquals(array('extra' => 'data'), $form->getExtraData());
735 }
736
737 public function testGetErrorsAsStringDeep()
738 {
739 $parent = $this->getBuilder()
740 ->setCompound(true)
741 ->setDataMapper($this->getDataMapper())
742 ->getForm();
743
744 $this->form->addError(new FormError('Error!'));
745
746 $parent->add($this->form);
747 $parent->add($this->getBuilder('foo')->getForm());
748
749 $this->assertEquals("name:\n ERROR: Error!\nfoo:\n No errors\n", $parent->getErrorsAsString());
750 }
751
752 protected function createForm()
753 {
754 return $this->getBuilder()
755 ->setCompound(true)
756 ->setDataMapper($this->getDataMapper())
757 ->getForm();
758 }
759}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/ChoiceList/ChoiceListTest.php b/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/ChoiceList/ChoiceListTest.php
deleted file mode 100644
index 63eae9bf..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/ChoiceList/ChoiceListTest.php
+++ /dev/null
@@ -1,200 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Tests\Extension\Core\ChoiceList;
13
14use Symfony\Component\Form\Extension\Core\ChoiceList\ChoiceList;
15use Symfony\Component\Form\Extension\Core\View\ChoiceView;
16
17class ChoiceListTest extends \PHPUnit_Framework_TestCase
18{
19 private $obj1;
20
21 private $obj2;
22
23 private $obj3;
24
25 private $obj4;
26
27 private $list;
28
29 protected function setUp()
30 {
31 parent::setUp();
32
33 $this->obj1 = new \stdClass();
34 $this->obj2 = new \stdClass();
35 $this->obj3 = new \stdClass();
36 $this->obj4 = new \stdClass();
37
38 $this->list = new ChoiceList(
39 array(
40 'Group 1' => array($this->obj1, $this->obj2),
41 'Group 2' => array($this->obj3, $this->obj4),
42 ),
43 array(
44 'Group 1' => array('A', 'B'),
45 'Group 2' => array('C', 'D'),
46 ),
47 array($this->obj2, $this->obj3)
48 );
49 }
50
51 protected function tearDown()
52 {
53 parent::tearDown();
54
55 $this->obj1 = null;
56 $this->obj2 = null;
57 $this->obj3 = null;
58 $this->obj4 = null;
59 $this->list = null;
60 }
61
62 public function testInitArray()
63 {
64 $this->list = new ChoiceList(
65 array($this->obj1, $this->obj2, $this->obj3, $this->obj4),
66 array('A', 'B', 'C', 'D'),
67 array($this->obj2)
68 );
69
70 $this->assertSame(array($this->obj1, $this->obj2, $this->obj3, $this->obj4), $this->list->getChoices());
71 $this->assertSame(array('0', '1', '2', '3'), $this->list->getValues());
72 $this->assertEquals(array(1 => new ChoiceView($this->obj2, '1', 'B')), $this->list->getPreferredViews());
73 $this->assertEquals(array(0 => new ChoiceView($this->obj1, '0', 'A'), 2 => new ChoiceView($this->obj3, '2', 'C'), 3 => new ChoiceView($this->obj4, '3', 'D')), $this->list->getRemainingViews());
74 }
75
76 /**
77 * Necessary for interoperability with MongoDB cursors or ORM relations as
78 * choices parameter. A choice itself that is an object implementing \Traversable
79 * is not treated as hierarchical structure, but as-is.
80 */
81 public function testInitNestedTraversable()
82 {
83 $traversableChoice = new \ArrayIterator(array($this->obj3, $this->obj4));
84
85 $this->list = new ChoiceList(
86 new \ArrayIterator(array(
87 'Group' => array($this->obj1, $this->obj2),
88 'Not a Group' => $traversableChoice
89 )),
90 array(
91 'Group' => array('A', 'B'),
92 'Not a Group' => 'C',
93 ),
94 array($this->obj2)
95 );
96
97 $this->assertSame(array($this->obj1, $this->obj2, $traversableChoice), $this->list->getChoices());
98 $this->assertSame(array('0', '1', '2'), $this->list->getValues());
99 $this->assertEquals(array(
100 'Group' => array(1 => new ChoiceView($this->obj2, '1', 'B'))
101 ), $this->list->getPreferredViews());
102 $this->assertEquals(array(
103 'Group' => array(0 => new ChoiceView($this->obj1, '0', 'A')),
104 2 => new ChoiceView($traversableChoice, '2', 'C')
105 ), $this->list->getRemainingViews());
106 }
107
108 public function testInitNestedArray()
109 {
110 $this->assertSame(array($this->obj1, $this->obj2, $this->obj3, $this->obj4), $this->list->getChoices());
111 $this->assertSame(array('0', '1', '2', '3'), $this->list->getValues());
112 $this->assertEquals(array(
113 'Group 1' => array(1 => new ChoiceView($this->obj2, '1', 'B')),
114 'Group 2' => array(2 => new ChoiceView($this->obj3, '2', 'C'))
115 ), $this->list->getPreferredViews());
116 $this->assertEquals(array(
117 'Group 1' => array(0 => new ChoiceView($this->obj1, '0', 'A')),
118 'Group 2' => array(3 => new ChoiceView($this->obj4, '3', 'D'))
119 ), $this->list->getRemainingViews());
120 }
121
122 public function testGetIndicesForChoices()
123 {
124 $choices = array($this->obj2, $this->obj3);
125 $this->assertSame(array(1, 2), $this->list->getIndicesForChoices($choices));
126 }
127
128 public function testGetIndicesForChoicesIgnoresNonExistingChoices()
129 {
130 $choices = array($this->obj2, $this->obj3, 'foobar');
131 $this->assertSame(array(1, 2), $this->list->getIndicesForChoices($choices));
132 }
133
134 public function testGetIndicesForValues()
135 {
136 // values and indices are always the same
137 $values = array('1', '2');
138 $this->assertSame(array(1, 2), $this->list->getIndicesForValues($values));
139 }
140
141 public function testGetIndicesForValuesIgnoresNonExistingValues()
142 {
143 $values = array('1', '2', '5');
144 $this->assertSame(array(1, 2), $this->list->getIndicesForValues($values));
145 }
146
147 public function testGetChoicesForValues()
148 {
149 $values = array('1', '2');
150 $this->assertSame(array($this->obj2, $this->obj3), $this->list->getChoicesForValues($values));
151 }
152
153 public function testGetChoicesForValuesCorrectOrderingOfResult()
154 {
155 $values = array('2', '1');
156 $this->assertSame(array($this->obj3, $this->obj2), $this->list->getChoicesForValues($values));
157 }
158
159 public function testGetChoicesForValuesIgnoresNonExistingValues()
160 {
161 $values = array('1', '2', '5');
162 $this->assertSame(array($this->obj2, $this->obj3), $this->list->getChoicesForValues($values));
163 }
164
165 public function testGetValuesForChoices()
166 {
167 $choices = array($this->obj2, $this->obj3);
168 $this->assertSame(array('1', '2'), $this->list->getValuesForChoices($choices));
169 }
170
171 public function testGetValuesForChoicesIgnoresNonExistingChoices()
172 {
173 $choices = array($this->obj2, $this->obj3, 'foobar');
174 $this->assertSame(array('1', '2'), $this->list->getValuesForChoices($choices));
175 }
176
177 /**
178 * @expectedException \InvalidArgumentException
179 */
180 public function testNonMatchingLabels()
181 {
182 $this->list = new ChoiceList(
183 array($this->obj1, $this->obj2),
184 array('A')
185 );
186 }
187
188 public function testLabelsContainingNull()
189 {
190 $this->list = new ChoiceList(
191 array($this->obj1, $this->obj2),
192 array('A', null)
193 );
194
195 $this->assertEquals(
196 array(0 => new ChoiceView($this->obj1, '0', 'A'), 1 => new ChoiceView($this->obj2, '1', null)),
197 $this->list->getRemainingViews()
198 );
199 }
200}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/ChoiceList/LazyChoiceListTest.php b/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/ChoiceList/LazyChoiceListTest.php
deleted file mode 100644
index bcd309e0..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/ChoiceList/LazyChoiceListTest.php
+++ /dev/null
@@ -1,116 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Tests\Extension\Core\ChoiceList;
13
14use Symfony\Component\Form\Extension\Core\ChoiceList\SimpleChoiceList;
15use Symfony\Component\Form\Extension\Core\ChoiceList\LazyChoiceList;
16use Symfony\Component\Form\Extension\Core\View\ChoiceView;
17
18class LazyChoiceListTest extends \PHPUnit_Framework_TestCase
19{
20 private $list;
21
22 protected function setUp()
23 {
24 parent::setUp();
25
26 $this->list = new LazyChoiceListTest_Impl(new SimpleChoiceList(array(
27 'a' => 'A',
28 'b' => 'B',
29 'c' => 'C',
30 ), array('b')));
31 }
32
33 protected function tearDown()
34 {
35 parent::tearDown();
36
37 $this->list = null;
38 }
39
40 public function testGetChoices()
41 {
42 $this->assertSame(array(0 => 'a', 1 => 'b', 2 => 'c'), $this->list->getChoices());
43 }
44
45 public function testGetValues()
46 {
47 $this->assertSame(array(0 => 'a', 1 => 'b', 2 => 'c'), $this->list->getValues());
48 }
49
50 public function testGetPreferredViews()
51 {
52 $this->assertEquals(array(1 => new ChoiceView('b', 'b', 'B')), $this->list->getPreferredViews());
53 }
54
55 public function testGetRemainingViews()
56 {
57 $this->assertEquals(array(0 => new ChoiceView('a', 'a', 'A'), 2 => new ChoiceView('c', 'c', 'C')), $this->list->getRemainingViews());
58 }
59
60 public function testGetIndicesForChoices()
61 {
62 $choices = array('b', 'c');
63 $this->assertSame(array(1, 2), $this->list->getIndicesForChoices($choices));
64 }
65
66 public function testGetIndicesForValues()
67 {
68 $values = array('b', 'c');
69 $this->assertSame(array(1, 2), $this->list->getIndicesForValues($values));
70 }
71
72 public function testGetChoicesForValues()
73 {
74 $values = array('b', 'c');
75 $this->assertSame(array('b', 'c'), $this->list->getChoicesForValues($values));
76 }
77
78 public function testGetValuesForChoices()
79 {
80 $choices = array('b', 'c');
81 $this->assertSame(array('b', 'c'), $this->list->getValuesForChoices($choices));
82 }
83
84 /**
85 * @expectedException \Symfony\Component\Form\Exception\InvalidArgumentException
86 */
87 public function testLoadChoiceListShouldReturnChoiceList()
88 {
89 $list = new LazyChoiceListTest_InvalidImpl();
90
91 $list->getChoices();
92 }
93}
94
95class LazyChoiceListTest_Impl extends LazyChoiceList
96{
97 private $choiceList;
98
99 public function __construct($choiceList)
100 {
101 $this->choiceList = $choiceList;
102 }
103
104 protected function loadChoiceList()
105 {
106 return $this->choiceList;
107 }
108}
109
110class LazyChoiceListTest_InvalidImpl extends LazyChoiceList
111{
112 protected function loadChoiceList()
113 {
114 return new \stdClass();
115 }
116}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/ChoiceList/ObjectChoiceListTest.php b/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/ChoiceList/ObjectChoiceListTest.php
deleted file mode 100644
index 69c5aa0f..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/ChoiceList/ObjectChoiceListTest.php
+++ /dev/null
@@ -1,212 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Tests\Extension\Core\ChoiceList;
13
14use Symfony\Component\Form\Extension\Core\ChoiceList\ObjectChoiceList;
15use Symfony\Component\Form\Extension\Core\View\ChoiceView;
16
17class ObjectChoiceListTest_EntityWithToString
18{
19 private $property;
20
21 public function __construct($property)
22 {
23 $this->property = $property;
24 }
25
26 public function __toString()
27 {
28 return $this->property;
29 }
30}
31
32class ObjectChoiceListTest extends \PHPUnit_Framework_TestCase
33{
34 private $obj1;
35
36 private $obj2;
37
38 private $obj3;
39
40 private $obj4;
41
42 /**
43 * @var ObjectChoiceList
44 */
45 private $list;
46
47 protected function setUp()
48 {
49 parent::setUp();
50
51 $this->obj1 = (object) array('name' => 'A');
52 $this->obj2 = (object) array('name' => 'B');
53 $this->obj3 = (object) array('name' => 'C');
54 $this->obj4 = (object) array('name' => 'D');
55
56 $this->list = new ObjectChoiceList(
57 array(
58 'Group 1' => array($this->obj1, $this->obj2),
59 'Group 2' => array($this->obj3, $this->obj4),
60 ),
61 'name',
62 array($this->obj2, $this->obj3)
63 );
64 }
65
66 protected function tearDown()
67 {
68 parent::tearDown();
69
70 $this->obj1 = null;
71 $this->obj2 = null;
72 $this->obj3 = null;
73 $this->obj4 = null;
74 $this->list = null;
75 }
76
77 public function testInitArray()
78 {
79 $this->list = new ObjectChoiceList(
80 array($this->obj1, $this->obj2, $this->obj3, $this->obj4),
81 'name',
82 array($this->obj2)
83 );
84
85 $this->assertSame(array($this->obj1, $this->obj2, $this->obj3, $this->obj4), $this->list->getChoices());
86 $this->assertSame(array('0', '1', '2', '3'), $this->list->getValues());
87 $this->assertEquals(array(1 => new ChoiceView($this->obj2, '1', 'B')), $this->list->getPreferredViews());
88 $this->assertEquals(array(0 => new ChoiceView($this->obj1, '0', 'A'), 2 => new ChoiceView($this->obj3, '2', 'C'), 3 => new ChoiceView($this->obj4, '3', 'D')), $this->list->getRemainingViews());
89 }
90
91 public function testInitNestedArray()
92 {
93 $this->assertSame(array($this->obj1, $this->obj2, $this->obj3, $this->obj4), $this->list->getChoices());
94 $this->assertSame(array('0', '1', '2', '3'), $this->list->getValues());
95 $this->assertEquals(array(
96 'Group 1' => array(1 => new ChoiceView($this->obj2, '1', 'B')),
97 'Group 2' => array(2 => new ChoiceView($this->obj3, '2', 'C'))
98 ), $this->list->getPreferredViews());
99 $this->assertEquals(array(
100 'Group 1' => array(0 => new ChoiceView($this->obj1, '0', 'A')),
101 'Group 2' => array(3 => new ChoiceView($this->obj4, '3', 'D'))
102 ), $this->list->getRemainingViews());
103 }
104
105 public function testInitArrayWithGroupPath()
106 {
107 $this->obj1 = (object) array('name' => 'A', 'category' => 'Group 1');
108 $this->obj2 = (object) array('name' => 'B', 'category' => 'Group 1');
109 $this->obj3 = (object) array('name' => 'C', 'category' => 'Group 2');
110 $this->obj4 = (object) array('name' => 'D', 'category' => 'Group 2');
111
112 // Objects with NULL groups are not grouped
113 $obj5 = (object) array('name' => 'E', 'category' => null);
114
115 // Objects without the group property are not grouped either
116 // see https://github.com/symfony/symfony/commit/d9b7abb7c7a0f28e0ce970afc5e305dce5dccddf
117 $obj6 = (object) array('name' => 'F');
118
119 $this->list = new ObjectChoiceList(
120 array($this->obj1, $this->obj2, $this->obj3, $this->obj4, $obj5, $obj6),
121 'name',
122 array($this->obj2, $this->obj3),
123 'category'
124 );
125
126 $this->assertSame(array($this->obj1, $this->obj2, $this->obj3, $this->obj4, $obj5, $obj6), $this->list->getChoices());
127 $this->assertSame(array('0', '1', '2', '3', '4', '5'), $this->list->getValues());
128 $this->assertEquals(array(
129 'Group 1' => array(1 => new ChoiceView($this->obj2, '1', 'B')),
130 'Group 2' => array(2 => new ChoiceView($this->obj3, '2', 'C'))
131 ), $this->list->getPreferredViews());
132 $this->assertEquals(array(
133 'Group 1' => array(0 => new ChoiceView($this->obj1, '0', 'A')),
134 'Group 2' => array(3 => new ChoiceView($this->obj4, '3', 'D')),
135 4 => new ChoiceView($obj5, '4', 'E'),
136 5 => new ChoiceView($obj6, '5', 'F'),
137 ), $this->list->getRemainingViews());
138 }
139
140 /**
141 * @expectedException \InvalidArgumentException
142 */
143 public function testInitArrayWithGroupPathThrowsExceptionIfNestedArray()
144 {
145 $this->obj1 = (object) array('name' => 'A', 'category' => 'Group 1');
146 $this->obj2 = (object) array('name' => 'B', 'category' => 'Group 1');
147 $this->obj3 = (object) array('name' => 'C', 'category' => 'Group 2');
148 $this->obj4 = (object) array('name' => 'D', 'category' => 'Group 2');
149
150 new ObjectChoiceList(
151 array(
152 'Group 1' => array($this->obj1, $this->obj2),
153 'Group 2' => array($this->obj3, $this->obj4),
154 ),
155 'name',
156 array($this->obj2, $this->obj3),
157 'category'
158 );
159 }
160
161 public function testInitArrayWithValuePath()
162 {
163 $this->obj1 = (object) array('name' => 'A', 'id' => 10);
164 $this->obj2 = (object) array('name' => 'B', 'id' => 20);
165 $this->obj3 = (object) array('name' => 'C', 'id' => 30);
166 $this->obj4 = (object) array('name' => 'D', 'id' => 40);
167
168 $this->list = new ObjectChoiceList(
169 array($this->obj1, $this->obj2, $this->obj3, $this->obj4),
170 'name',
171 array($this->obj2, $this->obj3),
172 null,
173 'id'
174 );
175
176 $this->assertSame(array($this->obj1, $this->obj2, $this->obj3, $this->obj4), $this->list->getChoices());
177 $this->assertSame(array('10', '20', '30', '40'), $this->list->getValues());
178 $this->assertEquals(array(1 => new ChoiceView($this->obj2, '20', 'B'), 2 => new ChoiceView($this->obj3, '30', 'C')), $this->list->getPreferredViews());
179 $this->assertEquals(array(0 => new ChoiceView($this->obj1, '10', 'A'), 3 => new ChoiceView($this->obj4, '40', 'D')), $this->list->getRemainingViews());
180 }
181
182 public function testInitArrayUsesToString()
183 {
184 $this->obj1 = new ObjectChoiceListTest_EntityWithToString('A');
185 $this->obj2 = new ObjectChoiceListTest_EntityWithToString('B');
186 $this->obj3 = new ObjectChoiceListTest_EntityWithToString('C');
187 $this->obj4 = new ObjectChoiceListTest_EntityWithToString('D');
188
189 $this->list = new ObjectChoiceList(
190 array($this->obj1, $this->obj2, $this->obj3, $this->obj4)
191 );
192
193 $this->assertSame(array($this->obj1, $this->obj2, $this->obj3, $this->obj4), $this->list->getChoices());
194 $this->assertSame(array('0', '1', '2', '3'), $this->list->getValues());
195 $this->assertEquals(array(0 => new ChoiceView($this->obj1, '0', 'A'), 1 => new ChoiceView($this->obj2, '1', 'B'), 2 => new ChoiceView($this->obj3, '2', 'C'), 3 => new ChoiceView($this->obj4, '3', 'D')), $this->list->getRemainingViews());
196 }
197
198 /**
199 * @expectedException \Symfony\Component\Form\Exception\StringCastException
200 */
201 public function testInitArrayThrowsExceptionIfToStringNotFound()
202 {
203 $this->obj1 = new ObjectChoiceListTest_EntityWithToString('A');
204 $this->obj2 = new ObjectChoiceListTest_EntityWithToString('B');
205 $this->obj3 = (object) array('name' => 'C');
206 $this->obj4 = new ObjectChoiceListTest_EntityWithToString('D');
207
208 new ObjectChoiceList(
209 array($this->obj1, $this->obj2, $this->obj3, $this->obj4)
210 );
211 }
212}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/ChoiceList/SimpleChoiceListTest.php b/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/ChoiceList/SimpleChoiceListTest.php
deleted file mode 100644
index 69d27a18..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/ChoiceList/SimpleChoiceListTest.php
+++ /dev/null
@@ -1,188 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Tests\Extension\Core\ChoiceList;
13
14use Symfony\Component\Form\Extension\Core\ChoiceList\ChoiceList;
15use Symfony\Component\Form\Extension\Core\ChoiceList\SimpleChoiceList;
16use Symfony\Component\Form\Extension\Core\View\ChoiceView;
17
18class SimpleChoiceListTest extends \PHPUnit_Framework_TestCase
19{
20 private $list;
21
22 private $numericList;
23
24 protected function setUp()
25 {
26 parent::setUp();
27
28 $choices = array(
29 'Group 1' => array('a' => 'A', 'b' => 'B'),
30 'Group 2' => array('c' => 'C', 'd' => 'D'),
31 );
32 $numericChoices = array(
33 'Group 1' => array(0 => 'A', 1 => 'B'),
34 'Group 2' => array(2 => 'C', 3 => 'D'),
35 );
36
37 $this->list = new SimpleChoiceList($choices, array('b', 'c'));
38
39 // Use COPY_CHOICE strategy to test for the various associated problems
40 $this->numericList = new SimpleChoiceList($numericChoices, array(1, 2));
41 }
42
43 protected function tearDown()
44 {
45 parent::tearDown();
46
47 $this->list = null;
48 $this->numericList = null;
49 }
50
51 public function testInitArray()
52 {
53 $choices = array('a' => 'A', 'b' => 'B', 'c' => 'C');
54 $this->list = new SimpleChoiceList($choices, array('b'));
55
56 $this->assertSame(array(0 => 'a', 1 => 'b', 2 => 'c'), $this->list->getChoices());
57 $this->assertSame(array(0 => 'a', 1 => 'b', 2 => 'c'), $this->list->getValues());
58 $this->assertEquals(array(1 => new ChoiceView('b', 'b', 'B')), $this->list->getPreferredViews());
59 $this->assertEquals(array(0 => new ChoiceView('a', 'a', 'A'), 2 => new ChoiceView('c', 'c', 'C')), $this->list->getRemainingViews());
60 }
61
62 public function testInitNestedArray()
63 {
64 $this->assertSame(array(0 => 'a', 1 => 'b', 2 => 'c', 3 => 'd'), $this->list->getChoices());
65 $this->assertSame(array(0 => 'a', 1 => 'b', 2 => 'c', 3 => 'd'), $this->list->getValues());
66 $this->assertEquals(array(
67 'Group 1' => array(1 => new ChoiceView('b', 'b', 'B')),
68 'Group 2' => array(2 => new ChoiceView('c', 'c', 'C'))
69 ), $this->list->getPreferredViews());
70 $this->assertEquals(array(
71 'Group 1' => array(0 => new ChoiceView('a', 'a', 'A')),
72 'Group 2' => array(3 => new ChoiceView('d', 'd', 'D'))
73 ), $this->list->getRemainingViews());
74 }
75
76 public function testGetIndicesForChoices()
77 {
78 $choices = array('b', 'c');
79 $this->assertSame(array(1, 2), $this->list->getIndicesForChoices($choices));
80 }
81
82 public function testGetIndicesForChoicesIgnoresNonExistingChoices()
83 {
84 $choices = array('b', 'c', 'foobar');
85 $this->assertSame(array(1, 2), $this->list->getIndicesForChoices($choices));
86 }
87
88 public function testGetIndicesForChoicesDealsWithNumericChoices()
89 {
90 // Pass choices as strings although they are integers
91 $choices = array('0', '1');
92 $this->assertSame(array(0, 1), $this->numericList->getIndicesForChoices($choices));
93 }
94
95 public function testGetIndicesForValues()
96 {
97 $values = array('b', 'c');
98 $this->assertSame(array(1, 2), $this->list->getIndicesForValues($values));
99 }
100
101 public function testGetIndicesForValuesIgnoresNonExistingValues()
102 {
103 $values = array('b', 'c', '100');
104 $this->assertSame(array(1, 2), $this->list->getIndicesForValues($values));
105 }
106
107 public function testGetIndicesForValuesDealsWithNumericValues()
108 {
109 // Pass values as strings although they are integers
110 $values = array('0', '1');
111 $this->assertSame(array(0, 1), $this->numericList->getIndicesForValues($values));
112 }
113
114 public function testGetChoicesForValues()
115 {
116 $values = array('b', 'c');
117 $this->assertSame(array('b', 'c'), $this->list->getChoicesForValues($values));
118 }
119
120 public function testGetChoicesForValuesIgnoresNonExistingValues()
121 {
122 $values = array('b', 'c', '100');
123 $this->assertSame(array('b', 'c'), $this->list->getChoicesForValues($values));
124 }
125
126 public function testGetChoicesForValuesDealsWithNumericValues()
127 {
128 // Pass values as strings although they are integers
129 $values = array('0', '1');
130 $this->assertSame(array(0, 1), $this->numericList->getChoicesForValues($values));
131 }
132
133 public function testGetValuesForChoices()
134 {
135 $choices = array('b', 'c');
136 $this->assertSame(array('b', 'c'), $this->list->getValuesForChoices($choices));
137 }
138
139 public function testGetValuesForChoicesIgnoresNonExistingValues()
140 {
141 $choices = array('b', 'c', 'foobar');
142 $this->assertSame(array('b', 'c'), $this->list->getValuesForChoices($choices));
143 }
144
145 public function testGetValuesForChoicesDealsWithNumericValues()
146 {
147 // Pass values as strings although they are integers
148 $values = array('0', '1');
149
150 $this->assertSame(array('0', '1'), $this->numericList->getValuesForChoices($values));
151 }
152
153 /**
154 * @dataProvider dirtyValuesProvider
155 */
156 public function testGetValuesForChoicesDealsWithDirtyValues($choice, $value)
157 {
158 $choices = array(
159 '0' => 'Zero',
160 '1' => 'One',
161 '' => 'Empty',
162 '1.23' => 'Float',
163 'foo' => 'Foo',
164 'foo10' => 'Foo 10',
165 );
166
167 // use COPY_CHOICE strategy to test the problems
168 $this->list = new SimpleChoiceList($choices, array());
169
170 $this->assertSame(array($value), $this->list->getValuesForChoices(array($choice)));
171 }
172
173 public function dirtyValuesProvider()
174 {
175 return array(
176 array(0, '0'),
177 array('0', '0'),
178 array('1', '1'),
179 array(false, '0'),
180 array(true, '1'),
181 array('', ''),
182 array(null, ''),
183 array('1.23', '1.23'),
184 array('foo', 'foo'),
185 array('foo10', 'foo10'),
186 );
187 }
188}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/DataMapper/PropertyPathMapperTest.php b/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/DataMapper/PropertyPathMapperTest.php
deleted file mode 100644
index ee2e3351..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/DataMapper/PropertyPathMapperTest.php
+++ /dev/null
@@ -1,319 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Tests\Extension\Core\DataMapper;
13
14use Symfony\Component\Form\FormConfigBuilder;
15use Symfony\Component\Form\FormConfigInterface;
16use Symfony\Component\Form\Extension\Core\DataMapper\PropertyPathMapper;
17
18class PropertyPathMapperTest extends \PHPUnit_Framework_TestCase
19{
20 /**
21 * @var PropertyPathMapper
22 */
23 private $mapper;
24
25 /**
26 * @var \PHPUnit_Framework_MockObject_MockObject
27 */
28 private $dispatcher;
29
30 /**
31 * @var \PHPUnit_Framework_MockObject_MockObject
32 */
33 private $propertyAccessor;
34
35 protected function setUp()
36 {
37 if (!class_exists('Symfony\Component\EventDispatcher\Event')) {
38 $this->markTestSkipped('The "EventDispatcher" component is not available');
39 }
40
41 if (!class_exists('Symfony\Component\PropertyAccess\PropertyAccess')) {
42 $this->markTestSkipped('The "PropertyAccess" component is not available');
43 }
44
45 $this->dispatcher = $this->getMock('Symfony\Component\EventDispatcher\EventDispatcherInterface');
46 $this->propertyAccessor = $this->getMock('Symfony\Component\PropertyAccess\PropertyAccessorInterface');
47 $this->mapper = new PropertyPathMapper($this->propertyAccessor);
48 }
49
50 /**
51 * @param $path
52 * @return \PHPUnit_Framework_MockObject_MockObject
53 */
54 private function getPropertyPath($path)
55 {
56 return $this->getMockBuilder('Symfony\Component\PropertyAccess\PropertyPath')
57 ->setConstructorArgs(array($path))
58 ->setMethods(array('getValue', 'setValue'))
59 ->getMock();
60 }
61
62 /**
63 * @param FormConfigInterface $config
64 * @param Boolean $synchronized
65 * @return \PHPUnit_Framework_MockObject_MockObject
66 */
67 private function getForm(FormConfigInterface $config, $synchronized = true)
68 {
69 $form = $this->getMockBuilder('Symfony\Component\Form\Form')
70 ->setConstructorArgs(array($config))
71 ->setMethods(array('isSynchronized'))
72 ->getMock();
73
74 $form->expects($this->any())
75 ->method('isSynchronized')
76 ->will($this->returnValue($synchronized));
77
78 return $form;
79 }
80
81 /**
82 * @return \PHPUnit_Framework_MockObject_MockObject
83 */
84 private function getDataMapper()
85 {
86 return $this->getMock('Symfony\Component\Form\DataMapperInterface');
87 }
88
89 public function testMapDataToFormsPassesObjectRefIfByReference()
90 {
91 $car = new \stdClass();
92 $engine = new \stdClass();
93 $propertyPath = $this->getPropertyPath('engine');
94
95 $this->propertyAccessor->expects($this->once())
96 ->method('getValue')
97 ->with($car, $propertyPath)
98 ->will($this->returnValue($engine));
99
100 $config = new FormConfigBuilder('name', '\stdClass', $this->dispatcher);
101 $config->setByReference(true);
102 $config->setPropertyPath($propertyPath);
103 $form = $this->getForm($config);
104
105 $this->mapper->mapDataToForms($car, array($form));
106
107 // Can't use isIdentical() above because mocks always clone their
108 // arguments which can't be disabled in PHPUnit 3.6
109 $this->assertSame($engine, $form->getData());
110 }
111
112 public function testMapDataToFormsPassesObjectCloneIfNotByReference()
113 {
114 $car = new \stdClass();
115 $engine = new \stdClass();
116 $propertyPath = $this->getPropertyPath('engine');
117
118 $this->propertyAccessor->expects($this->once())
119 ->method('getValue')
120 ->with($car, $propertyPath)
121 ->will($this->returnValue($engine));
122
123 $config = new FormConfigBuilder('name', '\stdClass', $this->dispatcher);
124 $config->setByReference(false);
125 $config->setPropertyPath($propertyPath);
126 $form = $this->getForm($config);
127
128 $this->mapper->mapDataToForms($car, array($form));
129
130 $this->assertNotSame($engine, $form->getData());
131 $this->assertEquals($engine, $form->getData());
132 }
133
134 public function testMapDataToFormsIgnoresEmptyPropertyPath()
135 {
136 $car = new \stdClass();
137
138 $config = new FormConfigBuilder(null, '\stdClass', $this->dispatcher);
139 $config->setByReference(true);
140 $form = $this->getForm($config);
141
142 $this->assertNull($form->getPropertyPath());
143
144 $this->mapper->mapDataToForms($car, array($form));
145
146 $this->assertNull($form->getData());
147 }
148
149 public function testMapDataToFormsIgnoresUnmapped()
150 {
151 $car = new \stdClass();
152 $propertyPath = $this->getPropertyPath('engine');
153
154 $this->propertyAccessor->expects($this->never())
155 ->method('getValue');
156
157 $config = new FormConfigBuilder('name', '\stdClass', $this->dispatcher);
158 $config->setByReference(true);
159 $config->setMapped(false);
160 $config->setPropertyPath($propertyPath);
161 $form = $this->getForm($config);
162
163 $this->mapper->mapDataToForms($car, array($form));
164
165 $this->assertNull($form->getData());
166 }
167
168 public function testMapDataToFormsIgnoresEmptyData()
169 {
170 $propertyPath = $this->getPropertyPath('engine');
171
172 $this->propertyAccessor->expects($this->never())
173 ->method('getValue');
174
175 $config = new FormConfigBuilder('name', '\stdClass', $this->dispatcher);
176 $config->setByReference(true);
177 $config->setPropertyPath($propertyPath);
178 $form = $this->getForm($config);
179
180 $this->mapper->mapDataToForms(null, array($form));
181
182 $this->assertNull($form->getData());
183 }
184
185 public function testMapFormsToDataWritesBackIfNotByReference()
186 {
187 $car = new \stdClass();
188 $engine = new \stdClass();
189 $propertyPath = $this->getPropertyPath('engine');
190
191 $this->propertyAccessor->expects($this->once())
192 ->method('setValue')
193 ->with($car, $propertyPath, $engine);
194
195 $config = new FormConfigBuilder('name', '\stdClass', $this->dispatcher);
196 $config->setByReference(false);
197 $config->setPropertyPath($propertyPath);
198 $config->setData($engine);
199 $form = $this->getForm($config);
200
201 $this->mapper->mapFormsToData(array($form), $car);
202 }
203
204 public function testMapFormsToDataWritesBackIfByReferenceButNoReference()
205 {
206 $car = new \stdClass();
207 $engine = new \stdClass();
208 $propertyPath = $this->getPropertyPath('engine');
209
210 $this->propertyAccessor->expects($this->once())
211 ->method('setValue')
212 ->with($car, $propertyPath, $engine);
213
214 $config = new FormConfigBuilder('name', '\stdClass', $this->dispatcher);
215 $config->setByReference(true);
216 $config->setPropertyPath($propertyPath);
217 $config->setData($engine);
218 $form = $this->getForm($config);
219
220 $this->mapper->mapFormsToData(array($form), $car);
221 }
222
223 public function testMapFormsToDataWritesBackIfByReferenceAndReference()
224 {
225 $car = new \stdClass();
226 $engine = new \stdClass();
227 $propertyPath = $this->getPropertyPath('engine');
228
229 // $car already contains the reference of $engine
230 $this->propertyAccessor->expects($this->once())
231 ->method('getValue')
232 ->with($car, $propertyPath)
233 ->will($this->returnValue($engine));
234
235 $this->propertyAccessor->expects($this->never())
236 ->method('setValue');
237
238 $config = new FormConfigBuilder('name', '\stdClass', $this->dispatcher);
239 $config->setByReference(true);
240 $config->setPropertyPath($propertyPath);
241 $config->setData($engine);
242 $form = $this->getForm($config);
243
244 $this->mapper->mapFormsToData(array($form), $car);
245 }
246
247 public function testMapFormsToDataIgnoresUnmapped()
248 {
249 $car = new \stdClass();
250 $engine = new \stdClass();
251 $propertyPath = $this->getPropertyPath('engine');
252
253 $this->propertyAccessor->expects($this->never())
254 ->method('setValue');
255
256 $config = new FormConfigBuilder('name', '\stdClass', $this->dispatcher);
257 $config->setByReference(true);
258 $config->setPropertyPath($propertyPath);
259 $config->setData($engine);
260 $config->setMapped(false);
261 $form = $this->getForm($config);
262
263 $this->mapper->mapFormsToData(array($form), $car);
264 }
265
266 public function testMapFormsToDataIgnoresEmptyData()
267 {
268 $car = new \stdClass();
269 $propertyPath = $this->getPropertyPath('engine');
270
271 $this->propertyAccessor->expects($this->never())
272 ->method('setValue');
273
274 $config = new FormConfigBuilder('name', '\stdClass', $this->dispatcher);
275 $config->setByReference(true);
276 $config->setPropertyPath($propertyPath);
277 $config->setData(null);
278 $form = $this->getForm($config);
279
280 $this->mapper->mapFormsToData(array($form), $car);
281 }
282
283 public function testMapFormsToDataIgnoresUnsynchronized()
284 {
285 $car = new \stdClass();
286 $engine = new \stdClass();
287 $propertyPath = $this->getPropertyPath('engine');
288
289 $this->propertyAccessor->expects($this->never())
290 ->method('setValue');
291
292 $config = new FormConfigBuilder('name', '\stdClass', $this->dispatcher);
293 $config->setByReference(true);
294 $config->setPropertyPath($propertyPath);
295 $config->setData($engine);
296 $form = $this->getForm($config, false);
297
298 $this->mapper->mapFormsToData(array($form), $car);
299 }
300
301 public function testMapFormsToDataIgnoresDisabled()
302 {
303 $car = new \stdClass();
304 $engine = new \stdClass();
305 $propertyPath = $this->getPropertyPath('engine');
306
307 $this->propertyAccessor->expects($this->never())
308 ->method('setValue');
309
310 $config = new FormConfigBuilder('name', '\stdClass', $this->dispatcher);
311 $config->setByReference(true);
312 $config->setPropertyPath($propertyPath);
313 $config->setData($engine);
314 $config->setDisabled(true);
315 $form = $this->getForm($config);
316
317 $this->mapper->mapFormsToData(array($form), $car);
318 }
319}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/ArrayToPartsTransformerTest.php b/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/ArrayToPartsTransformerTest.php
deleted file mode 100644
index bafe5c09..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/ArrayToPartsTransformerTest.php
+++ /dev/null
@@ -1,149 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien.potencier@symfony-project.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Tests\Extension\Core\DataTransformer;
13
14use Symfony\Component\Form\Extension\Core\DataTransformer\ArrayToPartsTransformer;
15
16class ArrayToPartsTransformerTest extends \PHPUnit_Framework_TestCase
17{
18 private $transformer;
19
20 protected function setUp()
21 {
22 $this->transformer = new ArrayToPartsTransformer(array(
23 'first' => array('a', 'b', 'c'),
24 'second' => array('d', 'e', 'f'),
25 ));
26 }
27
28 protected function tearDown()
29 {
30 $this->transformer = null;
31 }
32
33 public function testTransform()
34 {
35 $input = array(
36 'a' => '1',
37 'b' => '2',
38 'c' => '3',
39 'd' => '4',
40 'e' => '5',
41 'f' => '6',
42 );
43
44 $output = array(
45 'first' => array(
46 'a' => '1',
47 'b' => '2',
48 'c' => '3',
49 ),
50 'second' => array(
51 'd' => '4',
52 'e' => '5',
53 'f' => '6',
54 ),
55 );
56
57 $this->assertSame($output, $this->transformer->transform($input));
58 }
59
60 public function testTransformEmpty()
61 {
62 $output = array(
63 'first' => null,
64 'second' => null,
65 );
66
67 $this->assertSame($output, $this->transformer->transform(null));
68 }
69
70 /**
71 * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
72 */
73 public function testTransformRequiresArray()
74 {
75 $this->transformer->transform('12345');
76 }
77
78 public function testReverseTransform()
79 {
80 $input = array(
81 'first' => array(
82 'a' => '1',
83 'b' => '2',
84 'c' => '3',
85 ),
86 'second' => array(
87 'd' => '4',
88 'e' => '5',
89 'f' => '6',
90 ),
91 );
92
93 $output = array(
94 'a' => '1',
95 'b' => '2',
96 'c' => '3',
97 'd' => '4',
98 'e' => '5',
99 'f' => '6',
100 );
101
102 $this->assertSame($output, $this->transformer->reverseTransform($input));
103 }
104
105 public function testReverseTransformCompletelyEmpty()
106 {
107 $input = array(
108 'first' => '',
109 'second' => '',
110 );
111
112 $this->assertNull($this->transformer->reverseTransform($input));
113 }
114
115 public function testReverseTransformCompletelyNull()
116 {
117 $input = array(
118 'first' => null,
119 'second' => null,
120 );
121
122 $this->assertNull($this->transformer->reverseTransform($input));
123 }
124
125 /**
126 * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
127 */
128 public function testReverseTransformPartiallyNull()
129 {
130 $input = array(
131 'first' => array(
132 'a' => '1',
133 'b' => '2',
134 'c' => '3',
135 ),
136 'second' => null,
137 );
138
139 $this->transformer->reverseTransform($input);
140 }
141
142 /**
143 * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
144 */
145 public function testReverseTransformRequiresArray()
146 {
147 $this->transformer->reverseTransform('12345');
148 }
149}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/BooleanToStringTransformerTest.php b/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/BooleanToStringTransformerTest.php
deleted file mode 100644
index 41f8f956..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/BooleanToStringTransformerTest.php
+++ /dev/null
@@ -1,60 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Tests\Extension\Core\DataTransformer;
13
14use Symfony\Component\Form\Extension\Core\DataTransformer\BooleanToStringTransformer;
15
16class BooleanToStringTransformerTest extends \PHPUnit_Framework_TestCase
17{
18 const TRUE_VALUE = '1';
19
20 protected $transformer;
21
22 protected function setUp()
23 {
24 $this->transformer = new BooleanToStringTransformer(self::TRUE_VALUE);
25 }
26
27 protected function tearDown()
28 {
29 $this->transformer = null;
30 }
31
32 public function testTransform()
33 {
34 $this->assertEquals(self::TRUE_VALUE, $this->transformer->transform(true));
35 $this->assertNull($this->transformer->transform(false));
36 $this->assertNull($this->transformer->transform(null));
37 }
38
39 public function testTransformExpectsBoolean()
40 {
41 $this->setExpectedException('Symfony\Component\Form\Exception\TransformationFailedException');
42
43 $this->transformer->transform('1');
44 }
45
46 public function testReverseTransformExpectsString()
47 {
48 $this->setExpectedException('Symfony\Component\Form\Exception\TransformationFailedException');
49
50 $this->transformer->reverseTransform(1);
51 }
52
53 public function testReverseTransform()
54 {
55 $this->assertTrue($this->transformer->reverseTransform(self::TRUE_VALUE));
56 $this->assertTrue($this->transformer->reverseTransform('foobar'));
57 $this->assertTrue($this->transformer->reverseTransform(''));
58 $this->assertFalse($this->transformer->reverseTransform(null));
59 }
60}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/ChoiceToValueTransformerTest.php b/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/ChoiceToValueTransformerTest.php
deleted file mode 100644
index bbae0621..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/ChoiceToValueTransformerTest.php
+++ /dev/null
@@ -1,76 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Tests\Extension\Core\DataTransformer;
13
14use Symfony\Component\Form\Extension\Core\ChoiceList\SimpleChoiceList;
15use Symfony\Component\Form\Extension\Core\DataTransformer\ChoiceToValueTransformer;
16
17class ChoiceToValueTransformerTest extends \PHPUnit_Framework_TestCase
18{
19 protected $transformer;
20
21 protected function setUp()
22 {
23 $list = new SimpleChoiceList(array('' => 'A', 0 => 'B', 1 => 'C'));
24 $this->transformer = new ChoiceToValueTransformer($list);
25 }
26
27 protected function tearDown()
28 {
29 $this->transformer = null;
30 }
31
32 public function transformProvider()
33 {
34 return array(
35 // more extensive test set can be found in FormUtilTest
36 array(0, '0'),
37 array(false, '0'),
38 array('', ''),
39 );
40 }
41
42 /**
43 * @dataProvider transformProvider
44 */
45 public function testTransform($in, $out)
46 {
47 $this->assertSame($out, $this->transformer->transform($in));
48 }
49
50 public function reverseTransformProvider()
51 {
52 return array(
53 // values are expected to be valid choice keys already and stay
54 // the same
55 array('0', 0),
56 array('', null),
57 array(null, null),
58 );
59 }
60
61 /**
62 * @dataProvider reverseTransformProvider
63 */
64 public function testReverseTransform($in, $out)
65 {
66 $this->assertSame($out, $this->transformer->reverseTransform($in));
67 }
68
69 /**
70 * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
71 */
72 public function testReverseTransformExpectsScalar()
73 {
74 $this->transformer->reverseTransform(array());
75 }
76}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/ChoicesToValuesTransformerTest.php b/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/ChoicesToValuesTransformerTest.php
deleted file mode 100644
index 57297193..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/ChoicesToValuesTransformerTest.php
+++ /dev/null
@@ -1,76 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Tests\Extension\Core\DataTransformer;
13
14use Symfony\Component\Form\Extension\Core\ChoiceList\SimpleChoiceList;
15
16use Symfony\Component\Form\Extension\Core\DataTransformer\ChoicesToValuesTransformer;
17
18class ChoicesToValuesTransformerTest extends \PHPUnit_Framework_TestCase
19{
20 protected $transformer;
21
22 protected function setUp()
23 {
24 $list = new SimpleChoiceList(array(0 => 'A', 1 => 'B', 2 => 'C'));
25 $this->transformer = new ChoicesToValuesTransformer($list);
26 }
27
28 protected function tearDown()
29 {
30 $this->transformer = null;
31 }
32
33 public function testTransform()
34 {
35 // Value strategy in SimpleChoiceList is to copy and convert to string
36 $in = array(0, 1, 2);
37 $out = array('0', '1', '2');
38
39 $this->assertSame($out, $this->transformer->transform($in));
40 }
41
42 public function testTransformNull()
43 {
44 $this->assertSame(array(), $this->transformer->transform(null));
45 }
46
47 /**
48 * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
49 */
50 public function testTransformExpectsArray()
51 {
52 $this->transformer->transform('foobar');
53 }
54
55 public function testReverseTransform()
56 {
57 // values are expected to be valid choices and stay the same
58 $in = array('0', '1', '2');
59 $out = array(0, 1, 2);
60
61 $this->assertSame($out, $this->transformer->reverseTransform($in));
62 }
63
64 public function testReverseTransformNull()
65 {
66 $this->assertSame(array(), $this->transformer->reverseTransform(null));
67 }
68
69 /**
70 * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
71 */
72 public function testReverseTransformExpectsArray()
73 {
74 $this->transformer->reverseTransform('foobar');
75 }
76}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DataTransformerChainTest.php b/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DataTransformerChainTest.php
deleted file mode 100644
index 2ee2f22d..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DataTransformerChainTest.php
+++ /dev/null
@@ -1,53 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Tests\Extension\Core\DataTransformer;
13
14use Symfony\Component\Form\Extension\Core\DataTransformer\DataTransformerChain;
15
16class DataTransformerChainTest extends \PHPUnit_Framework_TestCase
17{
18 public function testTransform()
19 {
20 $transformer1 = $this->getMock('Symfony\Component\Form\DataTransformerInterface');
21 $transformer1->expects($this->once())
22 ->method('transform')
23 ->with($this->identicalTo('foo'))
24 ->will($this->returnValue('bar'));
25 $transformer2 = $this->getMock('Symfony\Component\Form\DataTransformerInterface');
26 $transformer2->expects($this->once())
27 ->method('transform')
28 ->with($this->identicalTo('bar'))
29 ->will($this->returnValue('baz'));
30
31 $chain = new DataTransformerChain(array($transformer1, $transformer2));
32
33 $this->assertEquals('baz', $chain->transform('foo'));
34 }
35
36 public function testReverseTransform()
37 {
38 $transformer2 = $this->getMock('Symfony\Component\Form\DataTransformerInterface');
39 $transformer2->expects($this->once())
40 ->method('reverseTransform')
41 ->with($this->identicalTo('foo'))
42 ->will($this->returnValue('bar'));
43 $transformer1 = $this->getMock('Symfony\Component\Form\DataTransformerInterface');
44 $transformer1->expects($this->once())
45 ->method('reverseTransform')
46 ->with($this->identicalTo('bar'))
47 ->will($this->returnValue('baz'));
48
49 $chain = new DataTransformerChain(array($transformer1, $transformer2));
50
51 $this->assertEquals('baz', $chain->reverseTransform('foo'));
52 }
53}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeTestCase.php b/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeTestCase.php
deleted file mode 100644
index f7722c49..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeTestCase.php
+++ /dev/null
@@ -1,20 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Tests\Extension\Core\DataTransformer;
13
14abstract class DateTimeTestCase extends \PHPUnit_Framework_TestCase
15{
16 public static function assertDateTimeEquals(\DateTime $expected, \DateTime $actual)
17 {
18 self::assertEquals($expected->format('c'), $actual->format('c'));
19 }
20}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToArrayTransformerTest.php b/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToArrayTransformerTest.php
deleted file mode 100644
index 4898b88d..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToArrayTransformerTest.php
+++ /dev/null
@@ -1,512 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Tests\Extension\Core\DataTransformer;
13
14use Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeToArrayTransformer;
15
16class DateTimeToArrayTransformerTest extends DateTimeTestCase
17{
18 public function testTransform()
19 {
20 $transformer = new DateTimeToArrayTransformer('UTC', 'UTC');
21
22 $input = new \DateTime('2010-02-03 04:05:06 UTC');
23
24 $output = array(
25 'year' => '2010',
26 'month' => '2',
27 'day' => '3',
28 'hour' => '4',
29 'minute' => '5',
30 'second' => '6',
31 );
32
33 $this->assertSame($output, $transformer->transform($input));
34 }
35
36 public function testTransformEmpty()
37 {
38 $transformer = new DateTimeToArrayTransformer();
39
40 $output = array(
41 'year' => '',
42 'month' => '',
43 'day' => '',
44 'hour' => '',
45 'minute' => '',
46 'second' => '',
47 );
48
49 $this->assertSame($output, $transformer->transform(null));
50 }
51
52 public function testTransformEmptyWithFields()
53 {
54 $transformer = new DateTimeToArrayTransformer(null, null, array('year', 'minute', 'second'));
55
56 $output = array(
57 'year' => '',
58 'minute' => '',
59 'second' => '',
60 );
61
62 $this->assertSame($output, $transformer->transform(null));
63 }
64
65 public function testTransformWithFields()
66 {
67 $transformer = new DateTimeToArrayTransformer('UTC', 'UTC', array('year', 'month', 'minute', 'second'));
68
69 $input = new \DateTime('2010-02-03 04:05:06 UTC');
70
71 $output = array(
72 'year' => '2010',
73 'month' => '2',
74 'minute' => '5',
75 'second' => '6',
76 );
77
78 $this->assertSame($output, $transformer->transform($input));
79 }
80
81 public function testTransformWithPadding()
82 {
83 $transformer = new DateTimeToArrayTransformer('UTC', 'UTC', null, true);
84
85 $input = new \DateTime('2010-02-03 04:05:06 UTC');
86
87 $output = array(
88 'year' => '2010',
89 'month' => '02',
90 'day' => '03',
91 'hour' => '04',
92 'minute' => '05',
93 'second' => '06',
94 );
95
96 $this->assertSame($output, $transformer->transform($input));
97 }
98
99 public function testTransformDifferentTimezones()
100 {
101 $transformer = new DateTimeToArrayTransformer('America/New_York', 'Asia/Hong_Kong');
102
103 $input = new \DateTime('2010-02-03 04:05:06 America/New_York');
104
105 $dateTime = new \DateTime('2010-02-03 04:05:06 America/New_York');
106 $dateTime->setTimezone(new \DateTimeZone('Asia/Hong_Kong'));
107 $output = array(
108 'year' => (string) (int) $dateTime->format('Y'),
109 'month' => (string) (int) $dateTime->format('m'),
110 'day' => (string) (int) $dateTime->format('d'),
111 'hour' => (string) (int) $dateTime->format('H'),
112 'minute' => (string) (int) $dateTime->format('i'),
113 'second' => (string) (int) $dateTime->format('s'),
114 );
115
116 $this->assertSame($output, $transformer->transform($input));
117 }
118
119 /**
120 * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
121 */
122 public function testTransformRequiresDateTime()
123 {
124 $transformer = new DateTimeToArrayTransformer();
125 $transformer->reverseTransform('12345');
126 }
127
128 public function testReverseTransform()
129 {
130 $transformer = new DateTimeToArrayTransformer('UTC', 'UTC');
131
132 $input = array(
133 'year' => '2010',
134 'month' => '2',
135 'day' => '3',
136 'hour' => '4',
137 'minute' => '5',
138 'second' => '6',
139 );
140
141 $output = new \DateTime('2010-02-03 04:05:06 UTC');
142
143 $this->assertDateTimeEquals($output, $transformer->reverseTransform($input));
144 }
145
146 public function testReverseTransformWithSomeZero()
147 {
148 $transformer = new DateTimeToArrayTransformer('UTC', 'UTC');
149
150 $input = array(
151 'year' => '2010',
152 'month' => '2',
153 'day' => '3',
154 'hour' => '4',
155 'minute' => '0',
156 'second' => '0',
157 );
158
159 $output = new \DateTime('2010-02-03 04:00:00 UTC');
160
161 $this->assertDateTimeEquals($output, $transformer->reverseTransform($input));
162 }
163
164 public function testReverseTransformCompletelyEmpty()
165 {
166 $transformer = new DateTimeToArrayTransformer();
167
168 $input = array(
169 'year' => '',
170 'month' => '',
171 'day' => '',
172 'hour' => '',
173 'minute' => '',
174 'second' => '',
175 );
176
177 $this->assertNull($transformer->reverseTransform($input));
178 }
179
180 public function testReverseTransformCompletelyEmptySubsetOfFields()
181 {
182 $transformer = new DateTimeToArrayTransformer(null, null, array('year', 'month', 'day'));
183
184 $input = array(
185 'year' => '',
186 'month' => '',
187 'day' => '',
188 );
189
190 $this->assertNull($transformer->reverseTransform($input));
191 }
192
193 /**
194 * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
195 */
196 public function testReverseTransformPartiallyEmptyYear()
197 {
198 $transformer = new DateTimeToArrayTransformer();
199 $transformer->reverseTransform(array(
200 'month' => '2',
201 'day' => '3',
202 'hour' => '4',
203 'minute' => '5',
204 'second' => '6',
205 ));
206 }
207
208 /**
209 * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
210 */
211 public function testReverseTransformPartiallyEmptyMonth()
212 {
213 $transformer = new DateTimeToArrayTransformer();
214 $transformer->reverseTransform(array(
215 'year' => '2010',
216 'day' => '3',
217 'hour' => '4',
218 'minute' => '5',
219 'second' => '6',
220 ));
221 }
222
223 /**
224 * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
225 */
226 public function testReverseTransformPartiallyEmptyDay()
227 {
228 $transformer = new DateTimeToArrayTransformer();
229 $transformer->reverseTransform(array(
230 'year' => '2010',
231 'month' => '2',
232 'hour' => '4',
233 'minute' => '5',
234 'second' => '6',
235 ));
236 }
237
238 /**
239 * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
240 */
241 public function testReverseTransformPartiallyEmptyHour()
242 {
243 $transformer = new DateTimeToArrayTransformer();
244 $transformer->reverseTransform(array(
245 'year' => '2010',
246 'month' => '2',
247 'day' => '3',
248 'minute' => '5',
249 'second' => '6',
250 ));
251 }
252
253 /**
254 * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
255 */
256 public function testReverseTransformPartiallyEmptyMinute()
257 {
258 $transformer = new DateTimeToArrayTransformer();
259 $transformer->reverseTransform(array(
260 'year' => '2010',
261 'month' => '2',
262 'day' => '3',
263 'hour' => '4',
264 'second' => '6',
265 ));
266 }
267
268 /**
269 * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
270 */
271 public function testReverseTransformPartiallyEmptySecond()
272 {
273 $transformer = new DateTimeToArrayTransformer();
274 $transformer->reverseTransform(array(
275 'year' => '2010',
276 'month' => '2',
277 'day' => '3',
278 'hour' => '4',
279 'minute' => '5',
280 ));
281 }
282
283 public function testReverseTransformNull()
284 {
285 $transformer = new DateTimeToArrayTransformer();
286
287 $this->assertNull($transformer->reverseTransform(null));
288 }
289
290 public function testReverseTransformDifferentTimezones()
291 {
292 $transformer = new DateTimeToArrayTransformer('America/New_York', 'Asia/Hong_Kong');
293
294 $input = array(
295 'year' => '2010',
296 'month' => '2',
297 'day' => '3',
298 'hour' => '4',
299 'minute' => '5',
300 'second' => '6',
301 );
302
303 $output = new \DateTime('2010-02-03 04:05:06 Asia/Hong_Kong');
304 $output->setTimezone(new \DateTimeZone('America/New_York'));
305
306 $this->assertDateTimeEquals($output, $transformer->reverseTransform($input));
307 }
308
309 public function testReverseTransformToDifferentTimezone()
310 {
311 $transformer = new DateTimeToArrayTransformer('Asia/Hong_Kong', 'UTC');
312
313 $input = array(
314 'year' => '2010',
315 'month' => '2',
316 'day' => '3',
317 'hour' => '4',
318 'minute' => '5',
319 'second' => '6',
320 );
321
322 $output = new \DateTime('2010-02-03 04:05:06 UTC');
323 $output->setTimezone(new \DateTimeZone('Asia/Hong_Kong'));
324
325 $this->assertDateTimeEquals($output, $transformer->reverseTransform($input));
326 }
327
328 /**
329 * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
330 */
331 public function testReverseTransformRequiresArray()
332 {
333 $transformer = new DateTimeToArrayTransformer();
334 $transformer->reverseTransform('12345');
335 }
336
337 /**
338 * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
339 */
340 public function testReverseTransformWithNegativeYear()
341 {
342 $transformer = new DateTimeToArrayTransformer();
343 $transformer->reverseTransform(array(
344 'year' => '-1',
345 'month' => '2',
346 'day' => '3',
347 'hour' => '4',
348 'minute' => '5',
349 'second' => '6',
350 ));
351 }
352
353 /**
354 * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
355 */
356 public function testReverseTransformWithNegativeMonth()
357 {
358 $transformer = new DateTimeToArrayTransformer();
359 $transformer->reverseTransform(array(
360 'year' => '2010',
361 'month' => '-1',
362 'day' => '3',
363 'hour' => '4',
364 'minute' => '5',
365 'second' => '6',
366 ));
367 }
368
369 /**
370 * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
371 */
372 public function testReverseTransformWithNegativeDay()
373 {
374 $transformer = new DateTimeToArrayTransformer();
375 $transformer->reverseTransform(array(
376 'year' => '2010',
377 'month' => '2',
378 'day' => '-1',
379 'hour' => '4',
380 'minute' => '5',
381 'second' => '6',
382 ));
383 }
384
385 /**
386 * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
387 */
388 public function testReverseTransformWithNegativeHour()
389 {
390 $transformer = new DateTimeToArrayTransformer();
391 $transformer->reverseTransform(array(
392 'year' => '2010',
393 'month' => '2',
394 'day' => '3',
395 'hour' => '-1',
396 'minute' => '5',
397 'second' => '6',
398 ));
399 }
400
401 /**
402 * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
403 */
404 public function testReverseTransformWithNegativeMinute()
405 {
406 $transformer = new DateTimeToArrayTransformer();
407 $transformer->reverseTransform(array(
408 'year' => '2010',
409 'month' => '2',
410 'day' => '3',
411 'hour' => '4',
412 'minute' => '-1',
413 'second' => '6',
414 ));
415 }
416
417 /**
418 * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
419 */
420 public function testReverseTransformWithNegativeSecond()
421 {
422 $transformer = new DateTimeToArrayTransformer();
423 $transformer->reverseTransform(array(
424 'year' => '2010',
425 'month' => '2',
426 'day' => '3',
427 'hour' => '4',
428 'minute' => '5',
429 'second' => '-1',
430 ));
431 }
432
433 /**
434 * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
435 */
436 public function testReverseTransformWithInvalidMonth()
437 {
438 $transformer = new DateTimeToArrayTransformer();
439 $transformer->reverseTransform(array(
440 'year' => '2010',
441 'month' => '13',
442 'day' => '3',
443 'hour' => '4',
444 'minute' => '5',
445 'second' => '6',
446 ));
447 }
448
449 /**
450 * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
451 */
452 public function testReverseTransformWithInvalidDay()
453 {
454 $transformer = new DateTimeToArrayTransformer();
455 $transformer->reverseTransform(array(
456 'year' => '2010',
457 'month' => '2',
458 'day' => '31',
459 'hour' => '4',
460 'minute' => '5',
461 'second' => '6',
462 ));
463 }
464
465 /**
466 * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
467 */
468 public function testReverseTransformWithStringDay()
469 {
470 $transformer = new DateTimeToArrayTransformer();
471 $transformer->reverseTransform(array(
472 'year' => '2010',
473 'month' => '2',
474 'day' => 'bazinga',
475 'hour' => '4',
476 'minute' => '5',
477 'second' => '6',
478 ));
479 }
480
481 /**
482 * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
483 */
484 public function testReverseTransformWithStringMonth()
485 {
486 $transformer = new DateTimeToArrayTransformer();
487 $transformer->reverseTransform(array(
488 'year' => '2010',
489 'month' => 'bazinga',
490 'day' => '31',
491 'hour' => '4',
492 'minute' => '5',
493 'second' => '6',
494 ));
495 }
496
497 /**
498 * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
499 */
500 public function testReverseTransformWithStringYear()
501 {
502 $transformer = new DateTimeToArrayTransformer();
503 $transformer->reverseTransform(array(
504 'year' => 'bazinga',
505 'month' => '2',
506 'day' => '31',
507 'hour' => '4',
508 'minute' => '5',
509 'second' => '6',
510 ));
511 }
512}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToLocalizedStringTransformerTest.php b/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToLocalizedStringTransformerTest.php
deleted file mode 100644
index cb50fc36..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToLocalizedStringTransformerTest.php
+++ /dev/null
@@ -1,275 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Tests\Extension\Core\DataTransformer;
13
14use Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeToLocalizedStringTransformer;
15use Symfony\Component\Intl\Util\IntlTestHelper;
16
17class DateTimeToLocalizedStringTransformerTest extends DateTimeTestCase
18{
19 protected $dateTime;
20 protected $dateTimeWithoutSeconds;
21
22 protected function setUp()
23 {
24 parent::setUp();
25
26 // Since we test against "de_AT", we need the full implementation
27 IntlTestHelper::requireFullIntl($this);
28
29 \Locale::setDefault('de_AT');
30
31 $this->dateTime = new \DateTime('2010-02-03 04:05:06 UTC');
32 $this->dateTimeWithoutSeconds = new \DateTime('2010-02-03 04:05:00 UTC');
33 }
34
35 protected function tearDown()
36 {
37 $this->dateTime = null;
38 $this->dateTimeWithoutSeconds = null;
39 }
40
41 public static function assertEquals($expected, $actual, $message = '', $delta = 0, $maxDepth = 10, $canonicalize = false, $ignoreCase = false)
42 {
43 if ($expected instanceof \DateTime && $actual instanceof \DateTime) {
44 $expected = $expected->format('c');
45 $actual = $actual->format('c');
46 }
47
48 parent::assertEquals($expected, $actual, $message, $delta, $maxDepth, $canonicalize, $ignoreCase);
49 }
50
51 public function dataProvider()
52 {
53 return array(
54 array(\IntlDateFormatter::SHORT, null, null, '03.02.10 04:05', '2010-02-03 04:05:00 UTC'),
55 array(\IntlDateFormatter::MEDIUM, null, null, '03.02.2010 04:05', '2010-02-03 04:05:00 UTC'),
56 array(\IntlDateFormatter::LONG, null, null, '03. Februar 2010 04:05', '2010-02-03 04:05:00 UTC'),
57 array(\IntlDateFormatter::FULL, null, null, 'Mittwoch, 03. Februar 2010 04:05', '2010-02-03 04:05:00 UTC'),
58 array(\IntlDateFormatter::SHORT, \IntlDateFormatter::NONE, null, '03.02.10', '2010-02-03 00:00:00 UTC'),
59 array(\IntlDateFormatter::MEDIUM, \IntlDateFormatter::NONE, null, '03.02.2010', '2010-02-03 00:00:00 UTC'),
60 array(\IntlDateFormatter::LONG, \IntlDateFormatter::NONE, null, '03. Februar 2010', '2010-02-03 00:00:00 UTC'),
61 array(\IntlDateFormatter::FULL, \IntlDateFormatter::NONE, null, 'Mittwoch, 03. Februar 2010', '2010-02-03 00:00:00 UTC'),
62 array(null, \IntlDateFormatter::SHORT, null, '03.02.2010 04:05', '2010-02-03 04:05:00 UTC'),
63 array(null, \IntlDateFormatter::MEDIUM, null, '03.02.2010 04:05:06', '2010-02-03 04:05:06 UTC'),
64 array(null, \IntlDateFormatter::LONG, null, '03.02.2010 04:05:06 GMT', '2010-02-03 04:05:06 UTC'),
65 // see below for extra test case for time format FULL
66 array(\IntlDateFormatter::NONE, \IntlDateFormatter::SHORT, null, '04:05', '1970-01-01 04:05:00 UTC'),
67 array(\IntlDateFormatter::NONE, \IntlDateFormatter::MEDIUM, null, '04:05:06', '1970-01-01 04:05:06 UTC'),
68 array(\IntlDateFormatter::NONE, \IntlDateFormatter::LONG, null, '04:05:06 GMT', '1970-01-01 04:05:06 UTC'),
69 array(null, null, 'yyyy-MM-dd HH:mm:00', '2010-02-03 04:05:00', '2010-02-03 04:05:00 UTC'),
70 array(null, null, 'yyyy-MM-dd HH:mm', '2010-02-03 04:05', '2010-02-03 04:05:00 UTC'),
71 array(null, null, 'yyyy-MM-dd HH', '2010-02-03 04', '2010-02-03 04:00:00 UTC'),
72 array(null, null, 'yyyy-MM-dd', '2010-02-03', '2010-02-03 00:00:00 UTC'),
73 array(null, null, 'yyyy-MM', '2010-02', '2010-02-01 00:00:00 UTC'),
74 array(null, null, 'yyyy', '2010', '2010-01-01 00:00:00 UTC'),
75 array(null, null, 'dd-MM-yyyy', '03-02-2010', '2010-02-03 00:00:00 UTC'),
76 array(null, null, 'HH:mm:ss', '04:05:06', '1970-01-01 04:05:06 UTC'),
77 array(null, null, 'HH:mm:00', '04:05:00', '1970-01-01 04:05:00 UTC'),
78 array(null, null, 'HH:mm', '04:05', '1970-01-01 04:05:00 UTC'),
79 array(null, null, 'HH', '04', '1970-01-01 04:00:00 UTC'),
80 );
81 }
82
83 /**
84 * @dataProvider dataProvider
85 */
86 public function testTransform($dateFormat, $timeFormat, $pattern, $output, $input)
87 {
88 $transformer = new DateTimeToLocalizedStringTransformer(
89 'UTC',
90 'UTC',
91 $dateFormat,
92 $timeFormat,
93 \IntlDateFormatter::GREGORIAN,
94 $pattern
95 );
96
97 $input = new \DateTime($input);
98
99 $this->assertEquals($output, $transformer->transform($input));
100 }
101
102 public function testTransformFullTime()
103 {
104 $transformer = new DateTimeToLocalizedStringTransformer('UTC', 'UTC', null, \IntlDateFormatter::FULL);
105
106 $this->assertEquals('03.02.2010 04:05:06 GMT', $transformer->transform($this->dateTime));
107 }
108
109 public function testTransformToDifferentLocale()
110 {
111 \Locale::setDefault('en_US');
112
113 $transformer = new DateTimeToLocalizedStringTransformer('UTC', 'UTC');
114
115 $this->assertEquals('Feb 3, 2010, 4:05 AM', $transformer->transform($this->dateTime));
116 }
117
118 public function testTransformEmpty()
119 {
120 $transformer = new DateTimeToLocalizedStringTransformer();
121
122 $this->assertSame('', $transformer->transform(null));
123 }
124
125 public function testTransformWithDifferentTimezones()
126 {
127 $transformer = new DateTimeToLocalizedStringTransformer('America/New_York', 'Asia/Hong_Kong');
128
129 $input = new \DateTime('2010-02-03 04:05:06 America/New_York');
130
131 $dateTime = clone $input;
132 $dateTime->setTimezone(new \DateTimeZone('Asia/Hong_Kong'));
133
134 $this->assertEquals($dateTime->format('d.m.Y H:i'), $transformer->transform($input));
135 }
136
137 public function testTransformWithDifferentPatterns()
138 {
139 $transformer = new DateTimeToLocalizedStringTransformer('UTC', 'UTC', \IntlDateFormatter::FULL, \IntlDateFormatter::FULL, \IntlDateFormatter::GREGORIAN, 'MM*yyyy*dd HH|mm|ss');
140
141 $this->assertEquals('02*2010*03 04|05|06', $transformer->transform($this->dateTime));
142 }
143
144 /**
145 * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
146 */
147 public function testTransformRequiresValidDateTime()
148 {
149 $transformer = new DateTimeToLocalizedStringTransformer();
150 $transformer->transform('2010-01-01');
151 }
152
153 public function testTransformWrapsIntlErrors()
154 {
155 $transformer = new DateTimeToLocalizedStringTransformer();
156
157 // HOW TO REPRODUCE?
158
159 //$this->setExpectedException('Symfony\Component\Form\Extension\Core\DataTransformer\Transdate_formationFailedException');
160
161 //$transformer->transform(1.5);
162 }
163
164 /**
165 * @dataProvider dataProvider
166 */
167 public function testReverseTransform($dateFormat, $timeFormat, $pattern, $input, $output)
168 {
169 $transformer = new DateTimeToLocalizedStringTransformer(
170 'UTC',
171 'UTC',
172 $dateFormat,
173 $timeFormat,
174 \IntlDateFormatter::GREGORIAN,
175 $pattern
176 );
177
178 $output = new \DateTime($output);
179
180 $this->assertEquals($output, $transformer->reverseTransform($input));
181 }
182
183 public function testReverseTransformFullTime()
184 {
185 $transformer = new DateTimeToLocalizedStringTransformer('UTC', 'UTC', null, \IntlDateFormatter::FULL);
186
187 $this->assertDateTimeEquals($this->dateTime, $transformer->reverseTransform('03.02.2010 04:05:06 GMT+00:00'));
188 }
189
190 public function testReverseTransformFromDifferentLocale()
191 {
192 \Locale::setDefault('en_US');
193
194 $transformer = new DateTimeToLocalizedStringTransformer('UTC', 'UTC');
195
196 $this->assertDateTimeEquals($this->dateTimeWithoutSeconds, $transformer->reverseTransform('Feb 3, 2010, 04:05 AM'));
197 }
198
199 public function testReverseTransformWithDifferentTimezones()
200 {
201 $transformer = new DateTimeToLocalizedStringTransformer('America/New_York', 'Asia/Hong_Kong');
202
203 $dateTime = new \DateTime('2010-02-03 04:05:00 Asia/Hong_Kong');
204 $dateTime->setTimezone(new \DateTimeZone('America/New_York'));
205
206 $this->assertDateTimeEquals($dateTime, $transformer->reverseTransform('03.02.2010 04:05'));
207 }
208
209 public function testReverseTransformWithDifferentPatterns()
210 {
211 $transformer = new DateTimeToLocalizedStringTransformer('UTC', 'UTC', \IntlDateFormatter::FULL, \IntlDateFormatter::FULL, \IntlDateFormatter::GREGORIAN, 'MM*yyyy*dd HH|mm|ss');
212
213 $this->assertDateTimeEquals($this->dateTime, $transformer->reverseTransform('02*2010*03 04|05|06'));
214 }
215
216 public function testReverseTransformEmpty()
217 {
218 $transformer = new DateTimeToLocalizedStringTransformer();
219
220 $this->assertNull($transformer->reverseTransform(''));
221 }
222
223 /**
224 * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
225 */
226 public function testReverseTransformRequiresString()
227 {
228 $transformer = new DateTimeToLocalizedStringTransformer();
229 $transformer->reverseTransform(12345);
230 }
231
232 /**
233 * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
234 */
235 public function testReverseTransformWrapsIntlErrors()
236 {
237 $transformer = new DateTimeToLocalizedStringTransformer();
238 $transformer->reverseTransform('12345');
239 }
240
241 /**
242 * @expectedException \Symfony\Component\Form\Exception\UnexpectedTypeException
243 */
244 public function testValidateDateFormatOption()
245 {
246 new DateTimeToLocalizedStringTransformer(null, null, 'foobar');
247 }
248
249 /**
250 * @expectedException \Symfony\Component\Form\Exception\UnexpectedTypeException
251 */
252 public function testValidateTimeFormatOption()
253 {
254 new DateTimeToLocalizedStringTransformer(null, null, null, 'foobar');
255 }
256
257 /**
258 * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
259 */
260 public function testReverseTransformWithNonExistingDate()
261 {
262 $transformer = new DateTimeToLocalizedStringTransformer('UTC', 'UTC', \IntlDateFormatter::SHORT);
263
264 $this->assertDateTimeEquals($this->dateTimeWithoutSeconds, $transformer->reverseTransform('31.04.10 04:05'));
265 }
266
267 /**
268 * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
269 */
270 public function testReverseTransformOutOfTimestampRange()
271 {
272 $transformer = new DateTimeToLocalizedStringTransformer('UTC', 'UTC');
273 $transformer->reverseTransform('1789-07-14');
274 }
275}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToRfc3339TransformerTest.php b/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToRfc3339TransformerTest.php
deleted file mode 100644
index 98aeb772..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToRfc3339TransformerTest.php
+++ /dev/null
@@ -1,132 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Tests\Extension\Core\DataTransformer;
13
14use Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeToRfc3339Transformer;
15
16class DateTimeToRfc3339TransformerTest extends DateTimeTestCase
17{
18 protected $dateTime;
19 protected $dateTimeWithoutSeconds;
20
21 protected function setUp()
22 {
23 parent::setUp();
24
25 $this->dateTime = new \DateTime('2010-02-03 04:05:06 UTC');
26 $this->dateTimeWithoutSeconds = new \DateTime('2010-02-03 04:05:00 UTC');
27 }
28
29 protected function tearDown()
30 {
31 $this->dateTime = null;
32 $this->dateTimeWithoutSeconds = null;
33 }
34
35 public static function assertEquals($expected, $actual, $message = '', $delta = 0, $maxDepth = 10, $canonicalize = FALSE, $ignoreCase = FALSE)
36 {
37 if ($expected instanceof \DateTime && $actual instanceof \DateTime) {
38 $expected = $expected->format('c');
39 $actual = $actual->format('c');
40 }
41
42 parent::assertEquals($expected, $actual, $message, $delta, $maxDepth, $canonicalize, $ignoreCase);
43 }
44
45 public function allProvider()
46 {
47 return array(
48 array('UTC', 'UTC', '2010-02-03 04:05:06 UTC', '2010-02-03T04:05:06Z'),
49 array('UTC', 'UTC', null, ''),
50 array('America/New_York', 'Asia/Hong_Kong', '2010-02-03 04:05:06 America/New_York', '2010-02-03T17:05:06+08:00'),
51 array('America/New_York', 'Asia/Hong_Kong', null, ''),
52 array('UTC', 'Asia/Hong_Kong', '2010-02-03 04:05:06 UTC', '2010-02-03T12:05:06+08:00'),
53 array('America/New_York', 'UTC', '2010-02-03 04:05:06 America/New_York', '2010-02-03T09:05:06Z'),
54 );
55 }
56
57 public function transformProvider()
58 {
59 return $this->allProvider();
60 }
61
62 public function reverseTransformProvider()
63 {
64 return array_merge($this->allProvider(), array(
65 // format without seconds, as appears in some browsers
66 array('UTC', 'UTC', '2010-02-03 04:05:00 UTC', '2010-02-03T04:05Z'),
67 array('America/New_York', 'Asia/Hong_Kong', '2010-02-03 04:05:00 America/New_York', '2010-02-03T17:05+08:00'),
68 ));
69 }
70
71 /**
72 * @dataProvider transformProvider
73 */
74 public function testTransform($fromTz, $toTz, $from, $to)
75 {
76 $transformer = new DateTimeToRfc3339Transformer($fromTz, $toTz);
77
78 $this->assertSame($to, $transformer->transform(null !== $from ? new \DateTime($from) : null));
79 }
80
81 /**
82 * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
83 */
84 public function testTransformRequiresValidDateTime()
85 {
86 $transformer = new DateTimeToRfc3339Transformer();
87 $transformer->transform('2010-01-01');
88 }
89
90 /**
91 * @dataProvider reverseTransformProvider
92 */
93 public function testReverseTransform($toTz, $fromTz, $to, $from)
94 {
95 $transformer = new DateTimeToRfc3339Transformer($toTz, $fromTz);
96
97 if (null !== $to) {
98 $this->assertDateTimeEquals(new \DateTime($to), $transformer->reverseTransform($from));
99 } else {
100 $this->assertSame($to, $transformer->reverseTransform($from));
101 }
102 }
103
104 /**
105 * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
106 */
107 public function testReverseTransformRequiresString()
108 {
109 $transformer = new DateTimeToRfc3339Transformer();
110 $transformer->reverseTransform(12345);
111 }
112
113 /**
114 * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
115 */
116 public function testReverseTransformWithNonExistingDate()
117 {
118 $transformer = new DateTimeToRfc3339Transformer('UTC', 'UTC');
119
120 $transformer->reverseTransform('2010-04-31T04:05Z');
121 }
122
123 /**
124 * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
125 */
126 public function testReverseTransformExpectsValidDateString()
127 {
128 $transformer = new DateTimeToRfc3339Transformer('UTC', 'UTC');
129
130 $transformer->reverseTransform('2010-2010-2010');
131 }
132}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToStringTransformerTest.php b/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToStringTransformerTest.php
deleted file mode 100644
index 987df1d8..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToStringTransformerTest.php
+++ /dev/null
@@ -1,181 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Tests\Extension\Core\DataTransformer;
13
14use Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeToStringTransformer;
15
16class DateTimeToStringTransformerTest extends DateTimeTestCase
17{
18 public function dataProvider()
19 {
20 $data = array(
21 array('Y-m-d H:i:s', '2010-02-03 16:05:06', '2010-02-03 16:05:06 UTC'),
22 array('Y-m-d H:i:00', '2010-02-03 16:05:00', '2010-02-03 16:05:00 UTC'),
23 array('Y-m-d H:i', '2010-02-03 16:05', '2010-02-03 16:05:00 UTC'),
24 array('Y-m-d H', '2010-02-03 16', '2010-02-03 16:00:00 UTC'),
25 array('Y-m-d', '2010-02-03', '2010-02-03 00:00:00 UTC'),
26 array('Y-m', '2010-12', '2010-12-01 00:00:00 UTC'),
27 array('Y', '2010', '2010-01-01 00:00:00 UTC'),
28 array('d-m-Y', '03-02-2010', '2010-02-03 00:00:00 UTC'),
29 array('H:i:s', '16:05:06', '1970-01-01 16:05:06 UTC'),
30 array('H:i:00', '16:05:00', '1970-01-01 16:05:00 UTC'),
31 array('H:i', '16:05', '1970-01-01 16:05:00 UTC'),
32 array('H', '16', '1970-01-01 16:00:00 UTC'),
33
34 // different day representations
35 array('Y-m-j', '2010-02-3', '2010-02-03 00:00:00 UTC'),
36 array('z', '33', '1970-02-03 00:00:00 UTC'),
37
38 // not bijective
39 // this will not work as php will use actual date to replace missing info
40 // and after change of date will lookup for closest Wednesday
41 // i.e. value: 2010-02, php value: 2010-02-(today i.e. 20), parsed date: 2010-02-24
42 //array('Y-m-D', '2010-02-Wed', '2010-02-03 00:00:00 UTC'),
43 //array('Y-m-l', '2010-02-Wednesday', '2010-02-03 00:00:00 UTC'),
44
45 // different month representations
46 array('Y-n-d', '2010-2-03', '2010-02-03 00:00:00 UTC'),
47 array('Y-M-d', '2010-Feb-03', '2010-02-03 00:00:00 UTC'),
48 array('Y-F-d', '2010-February-03', '2010-02-03 00:00:00 UTC'),
49
50 // different year representations
51 array('y-m-d', '10-02-03', '2010-02-03 00:00:00 UTC'),
52
53 // different time representations
54 array('G:i:s', '16:05:06', '1970-01-01 16:05:06 UTC'),
55 array('g:i:s a', '4:05:06 pm', '1970-01-01 16:05:06 UTC'),
56 array('h:i:s a', '04:05:06 pm', '1970-01-01 16:05:06 UTC'),
57
58 // seconds since unix
59 array('U', '1265213106', '2010-02-03 16:05:06 UTC'),
60 );
61
62 // This test will fail < 5.3.9 - see https://bugs.php.net/51994
63 if (version_compare(phpversion(), '5.3.9', '>=')) {
64 $data[] = array('Y-z', '2010-33', '2010-02-03 00:00:00 UTC');
65 }
66
67 return $data;
68 }
69
70 /**
71 * @dataProvider dataProvider
72 */
73 public function testTransform($format, $output, $input)
74 {
75 $transformer = new DateTimeToStringTransformer('UTC', 'UTC', $format);
76
77 $input = new \DateTime($input);
78
79 $this->assertEquals($output, $transformer->transform($input));
80 }
81
82 public function testTransformEmpty()
83 {
84 $transformer = new DateTimeToStringTransformer();
85
86 $this->assertSame('', $transformer->transform(null));
87 }
88
89 public function testTransformWithDifferentTimezones()
90 {
91 $transformer = new DateTimeToStringTransformer('Asia/Hong_Kong', 'America/New_York', 'Y-m-d H:i:s');
92
93 $input = new \DateTime('2010-02-03 12:05:06 America/New_York');
94 $output = $input->format('Y-m-d H:i:s');
95 $input->setTimezone(new \DateTimeZone('Asia/Hong_Kong'));
96
97 $this->assertEquals($output, $transformer->transform($input));
98 }
99
100 public function testTransformExpectsDateTime()
101 {
102 $transformer = new DateTimeToStringTransformer();
103
104 $this->setExpectedException('Symfony\Component\Form\Exception\TransformationFailedException');
105
106 $transformer->transform('1234');
107 }
108
109 /**
110 * @dataProvider dataProvider
111 */
112 public function testReverseTransformUsingPipe($format, $input, $output)
113 {
114 if (version_compare(phpversion(), '5.3.7', '<')) {
115 $this->markTestSkipped('Pipe usage requires PHP 5.3.7 or newer.');
116 }
117
118 $reverseTransformer = new DateTimeToStringTransformer('UTC', 'UTC', $format, true);
119
120 $output = new \DateTime($output);
121
122 $this->assertDateTimeEquals($output, $reverseTransformer->reverseTransform($input));
123 }
124
125 /**
126 * @dataProvider dataProvider
127 */
128 public function testReverseTransformWithoutUsingPipe($format, $input, $output)
129 {
130 $reverseTransformer = new DateTimeToStringTransformer('UTC', 'UTC', $format, false);
131
132 $output = new \DateTime($output);
133
134 $this->assertDateTimeEquals($output, $reverseTransformer->reverseTransform($input));
135 }
136
137 public function testReverseTransformEmpty()
138 {
139 $reverseTransformer = new DateTimeToStringTransformer();
140
141 $this->assertNull($reverseTransformer->reverseTransform(''));
142 }
143
144 public function testReverseTransformWithDifferentTimezones()
145 {
146 $reverseTransformer = new DateTimeToStringTransformer('America/New_York', 'Asia/Hong_Kong', 'Y-m-d H:i:s');
147
148 $output = new \DateTime('2010-02-03 16:05:06 Asia/Hong_Kong');
149 $input = $output->format('Y-m-d H:i:s');
150 $output->setTimeZone(new \DateTimeZone('America/New_York'));
151
152 $this->assertDateTimeEquals($output, $reverseTransformer->reverseTransform($input));
153 }
154
155 public function testReverseTransformExpectsString()
156 {
157 $reverseTransformer = new DateTimeToStringTransformer();
158
159 $this->setExpectedException('Symfony\Component\Form\Exception\TransformationFailedException');
160
161 $reverseTransformer->reverseTransform(1234);
162 }
163
164 public function testReverseTransformExpectsValidDateString()
165 {
166 $reverseTransformer = new DateTimeToStringTransformer();
167
168 $this->setExpectedException('Symfony\Component\Form\Exception\TransformationFailedException');
169
170 $reverseTransformer->reverseTransform('2010-2010-2010');
171 }
172
173 public function testReverseTransformWithNonExistingDate()
174 {
175 $reverseTransformer = new DateTimeToStringTransformer();
176
177 $this->setExpectedException('Symfony\Component\Form\Exception\TransformationFailedException');
178
179 $reverseTransformer->reverseTransform('2010-04-31');
180 }
181}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToTimestampTransformerTest.php b/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToTimestampTransformerTest.php
deleted file mode 100644
index b54f0c4c..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/DateTimeToTimestampTransformerTest.php
+++ /dev/null
@@ -1,104 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Tests\Extension\Core\DataTransformer;
13
14use Symfony\Component\Form\Extension\Core\DataTransformer\DateTimeToTimestampTransformer;
15
16class DateTimeToTimestampTransformerTest extends DateTimeTestCase
17{
18 public function testTransform()
19 {
20 $transformer = new DateTimeToTimestampTransformer('UTC', 'UTC');
21
22 $input = new \DateTime('2010-02-03 04:05:06 UTC');
23 $output = $input->format('U');
24
25 $this->assertEquals($output, $transformer->transform($input));
26 }
27
28 public function testTransformEmpty()
29 {
30 $transformer = new DateTimeToTimestampTransformer();
31
32 $this->assertNull($transformer->transform(null));
33 }
34
35 public function testTransformWithDifferentTimezones()
36 {
37 $transformer = new DateTimeToTimestampTransformer('Asia/Hong_Kong', 'America/New_York');
38
39 $input = new \DateTime('2010-02-03 04:05:06 America/New_York');
40 $output = $input->format('U');
41 $input->setTimezone(new \DateTimeZone('Asia/Hong_Kong'));
42
43 $this->assertEquals($output, $transformer->transform($input));
44 }
45
46 public function testTransformFromDifferentTimezone()
47 {
48 $transformer = new DateTimeToTimestampTransformer('Asia/Hong_Kong', 'UTC');
49
50 $input = new \DateTime('2010-02-03 04:05:06 Asia/Hong_Kong');
51
52 $dateTime = clone $input;
53 $dateTime->setTimezone(new \DateTimeZone('UTC'));
54 $output = $dateTime->format('U');
55
56 $this->assertEquals($output, $transformer->transform($input));
57 }
58
59 public function testTransformExpectsDateTime()
60 {
61 $transformer = new DateTimeToTimestampTransformer();
62
63 $this->setExpectedException('Symfony\Component\Form\Exception\TransformationFailedException');
64
65 $transformer->transform('1234');
66 }
67
68 public function testReverseTransform()
69 {
70 $reverseTransformer = new DateTimeToTimestampTransformer('UTC', 'UTC');
71
72 $output = new \DateTime('2010-02-03 04:05:06 UTC');
73 $input = $output->format('U');
74
75 $this->assertDateTimeEquals($output, $reverseTransformer->reverseTransform($input));
76 }
77
78 public function testReverseTransformEmpty()
79 {
80 $reverseTransformer = new DateTimeToTimestampTransformer();
81
82 $this->assertNull($reverseTransformer->reverseTransform(null));
83 }
84
85 public function testReverseTransformWithDifferentTimezones()
86 {
87 $reverseTransformer = new DateTimeToTimestampTransformer('Asia/Hong_Kong', 'America/New_York');
88
89 $output = new \DateTime('2010-02-03 04:05:06 America/New_York');
90 $input = $output->format('U');
91 $output->setTimezone(new \DateTimeZone('Asia/Hong_Kong'));
92
93 $this->assertDateTimeEquals($output, $reverseTransformer->reverseTransform($input));
94 }
95
96 public function testReverseTransformExpectsValidTimestamp()
97 {
98 $reverseTransformer = new DateTimeToTimestampTransformer();
99
100 $this->setExpectedException('Symfony\Component\Form\Exception\TransformationFailedException');
101
102 $reverseTransformer->reverseTransform('2010-2010-2010');
103 }
104}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/IntegerToLocalizedStringTransformerTest.php b/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/IntegerToLocalizedStringTransformerTest.php
deleted file mode 100644
index a90fa91b..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/IntegerToLocalizedStringTransformerTest.php
+++ /dev/null
@@ -1,115 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Tests\Extension\Core\DataTransformer;
13
14use Symfony\Component\Form\Extension\Core\DataTransformer\IntegerToLocalizedStringTransformer;
15use Symfony\Component\Intl\Util\IntlTestHelper;
16
17class IntegerToLocalizedStringTransformerTest extends \PHPUnit_Framework_TestCase
18{
19 protected function setUp()
20 {
21 parent::setUp();
22
23 // Since we test against "de_AT", we need the full implementation
24 IntlTestHelper::requireFullIntl($this);
25
26 \Locale::setDefault('de_AT');
27 }
28
29 public function testReverseTransform()
30 {
31 $transformer = new IntegerToLocalizedStringTransformer();
32
33 $this->assertEquals(1, $transformer->reverseTransform('1'));
34 $this->assertEquals(1, $transformer->reverseTransform('1,5'));
35 $this->assertEquals(1234, $transformer->reverseTransform('1234,5'));
36 $this->assertEquals(12345, $transformer->reverseTransform('12345,912'));
37 }
38
39 public function testReverseTransformEmpty()
40 {
41 $transformer = new IntegerToLocalizedStringTransformer();
42
43 $this->assertNull($transformer->reverseTransform(''));
44 }
45
46 public function testReverseTransformWithGrouping()
47 {
48 $transformer = new IntegerToLocalizedStringTransformer(null, true);
49
50 $this->assertEquals(1234, $transformer->reverseTransform('1.234,5'));
51 $this->assertEquals(12345, $transformer->reverseTransform('12.345,912'));
52 $this->assertEquals(1234, $transformer->reverseTransform('1234,5'));
53 $this->assertEquals(12345, $transformer->reverseTransform('12345,912'));
54 }
55
56 /**
57 * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
58 */
59 public function testReverseTransformExpectsString()
60 {
61 $transformer = new IntegerToLocalizedStringTransformer();
62
63 $transformer->reverseTransform(1);
64 }
65
66 /**
67 * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
68 */
69 public function testReverseTransformExpectsValidNumber()
70 {
71 $transformer = new IntegerToLocalizedStringTransformer();
72
73 $transformer->reverseTransform('foo');
74 }
75
76 /**
77 * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
78 */
79 public function testReverseTransformDisallowsNaN()
80 {
81 $transformer = new IntegerToLocalizedStringTransformer();
82
83 $transformer->reverseTransform('NaN');
84 }
85
86 /**
87 * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
88 */
89 public function testReverseTransformDisallowsNaN2()
90 {
91 $transformer = new IntegerToLocalizedStringTransformer();
92
93 $transformer->reverseTransform('nan');
94 }
95
96 /**
97 * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
98 */
99 public function testReverseTransformDisallowsInfinity()
100 {
101 $transformer = new IntegerToLocalizedStringTransformer();
102
103 $transformer->reverseTransform('∞');
104 }
105
106 /**
107 * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
108 */
109 public function testReverseTransformDisallowsNegativeInfinity()
110 {
111 $transformer = new IntegerToLocalizedStringTransformer();
112
113 $transformer->reverseTransform('-∞');
114 }
115}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/MoneyToLocalizedStringTransformerTest.php b/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/MoneyToLocalizedStringTransformerTest.php
deleted file mode 100644
index 8b91fe10..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/MoneyToLocalizedStringTransformerTest.php
+++ /dev/null
@@ -1,74 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Tests\Extension\Core\DataTransformer;
13
14use Symfony\Component\Form\Extension\Core\DataTransformer\MoneyToLocalizedStringTransformer;
15use Symfony\Component\Intl\Util\IntlTestHelper;
16
17class MoneyToLocalizedStringTransformerTest extends \PHPUnit_Framework_TestCase
18{
19 protected function setUp()
20 {
21 parent::setUp();
22
23 // Since we test against "de_AT", we need the full implementation
24 IntlTestHelper::requireFullIntl($this);
25
26 \Locale::setDefault('de_AT');
27 }
28
29 public function testTransform()
30 {
31 $transformer = new MoneyToLocalizedStringTransformer(null, null, null, 100);
32
33 $this->assertEquals('1,23', $transformer->transform(123));
34 }
35
36 public function testTransformExpectsNumeric()
37 {
38 $transformer = new MoneyToLocalizedStringTransformer(null, null, null, 100);
39
40 $this->setExpectedException('Symfony\Component\Form\Exception\TransformationFailedException');
41
42 $transformer->transform('abcd');
43 }
44
45 public function testTransformEmpty()
46 {
47 $transformer = new MoneyToLocalizedStringTransformer();
48
49 $this->assertSame('', $transformer->transform(null));
50 }
51
52 public function testReverseTransform()
53 {
54 $transformer = new MoneyToLocalizedStringTransformer(null, null, null, 100);
55
56 $this->assertEquals(123, $transformer->reverseTransform('1,23'));
57 }
58
59 public function testReverseTransformExpectsString()
60 {
61 $transformer = new MoneyToLocalizedStringTransformer(null, null, null, 100);
62
63 $this->setExpectedException('Symfony\Component\Form\Exception\TransformationFailedException');
64
65 $transformer->reverseTransform(12345);
66 }
67
68 public function testReverseTransformEmpty()
69 {
70 $transformer = new MoneyToLocalizedStringTransformer();
71
72 $this->assertNull($transformer->reverseTransform(''));
73 }
74}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/NumberToLocalizedStringTransformerTest.php b/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/NumberToLocalizedStringTransformerTest.php
deleted file mode 100644
index c58e3f60..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/NumberToLocalizedStringTransformerTest.php
+++ /dev/null
@@ -1,393 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Tests\Extension\Core\DataTransformer;
13
14use Symfony\Component\Form\Extension\Core\DataTransformer\NumberToLocalizedStringTransformer;
15use Symfony\Component\Intl\Util\IntlTestHelper;
16
17class NumberToLocalizedStringTransformerTest extends \PHPUnit_Framework_TestCase
18{
19 protected function setUp()
20 {
21 parent::setUp();
22
23 // Since we test against "de_AT", we need the full implementation
24 IntlTestHelper::requireFullIntl($this);
25
26 \Locale::setDefault('de_AT');
27 }
28
29 public function provideTransformations()
30 {
31 return array(
32 array(null, '', 'de_AT'),
33 array(1, '1', 'de_AT'),
34 array(1.5, '1,5', 'de_AT'),
35 array(1234.5, '1234,5', 'de_AT'),
36 array(12345.912, '12345,912', 'de_AT'),
37 array(1234.5, '1234,5', 'ru'),
38 array(1234.5, '1234,5', 'fi'),
39 );
40 }
41
42 /**
43 * @dataProvider provideTransformations
44 */
45 public function testTransform($from, $to, $locale)
46 {
47 \Locale::setDefault($locale);
48
49 $transformer = new NumberToLocalizedStringTransformer();
50
51 $this->assertSame($to, $transformer->transform($from));
52 }
53
54 public function provideTransformationsWithGrouping()
55 {
56 return array(
57 array(1234.5, '1.234,5', 'de_AT'),
58 array(12345.912, '12.345,912', 'de_AT'),
59 array(1234.5, '1 234,5', 'fr'),
60 array(1234.5, '1 234,5', 'ru'),
61 array(1234.5, '1 234,5', 'fi'),
62 );
63 }
64
65 /**
66 * @dataProvider provideTransformationsWithGrouping
67 */
68 public function testTransformWithGrouping($from, $to, $locale)
69 {
70 \Locale::setDefault($locale);
71
72 $transformer = new NumberToLocalizedStringTransformer(null, true);
73
74 $this->assertSame($to, $transformer->transform($from));
75 }
76
77 public function testTransformWithPrecision()
78 {
79 $transformer = new NumberToLocalizedStringTransformer(2);
80
81 $this->assertEquals('1234,50', $transformer->transform(1234.5));
82 $this->assertEquals('678,92', $transformer->transform(678.916));
83 }
84
85 public function testTransformWithRoundingMode()
86 {
87 $transformer = new NumberToLocalizedStringTransformer(null, null, NumberToLocalizedStringTransformer::ROUND_DOWN);
88 $this->assertEquals('1234,547', $transformer->transform(1234.547), '->transform() only applies rounding mode if precision set');
89
90 $transformer = new NumberToLocalizedStringTransformer(2, null, NumberToLocalizedStringTransformer::ROUND_DOWN);
91 $this->assertEquals('1234,54', $transformer->transform(1234.547), '->transform() rounding-mode works');
92
93 }
94
95 /**
96 * @dataProvider provideTransformations
97 */
98 public function testReverseTransform($to, $from, $locale)
99 {
100 \Locale::setDefault($locale);
101
102 $transformer = new NumberToLocalizedStringTransformer();
103
104 $this->assertEquals($to, $transformer->reverseTransform($from));
105 }
106
107 /**
108 * @dataProvider provideTransformationsWithGrouping
109 */
110 public function testReverseTransformWithGrouping($to, $from, $locale)
111 {
112 \Locale::setDefault($locale);
113
114 $transformer = new NumberToLocalizedStringTransformer(null, true);
115
116 $this->assertEquals($to, $transformer->reverseTransform($from));
117 }
118
119 // https://github.com/symfony/symfony/issues/7609
120 public function testReverseTransformWithGroupingAndFixedSpaces()
121 {
122 if (!extension_loaded('mbstring')) {
123 $this->markTestSkipped('The "mbstring" extension is required for this test.');
124 }
125
126 \Locale::setDefault('ru');
127
128 $transformer = new NumberToLocalizedStringTransformer(null, true);
129
130 $this->assertEquals(1234.5, $transformer->reverseTransform("1\xc2\xa0234,5"));
131 }
132
133 public function testReverseTransformWithGroupingButWithoutGroupSeparator()
134 {
135 $transformer = new NumberToLocalizedStringTransformer(null, true);
136
137 // omit group separator
138 $this->assertEquals(1234.5, $transformer->reverseTransform('1234,5'));
139 $this->assertEquals(12345.912, $transformer->reverseTransform('12345,912'));
140 }
141
142 public function testDecimalSeparatorMayBeDotIfGroupingSeparatorIsNotDot()
143 {
144 \Locale::setDefault('fr');
145 $transformer = new NumberToLocalizedStringTransformer(null, true);
146
147 // completely valid format
148 $this->assertEquals(1234.5, $transformer->reverseTransform('1 234,5'));
149 // accept dots
150 $this->assertEquals(1234.5, $transformer->reverseTransform('1 234.5'));
151 // omit group separator
152 $this->assertEquals(1234.5, $transformer->reverseTransform('1234,5'));
153 $this->assertEquals(1234.5, $transformer->reverseTransform('1234.5'));
154 }
155
156 /**
157 * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
158 */
159 public function testDecimalSeparatorMayNotBeDotIfGroupingSeparatorIsDot()
160 {
161 $transformer = new NumberToLocalizedStringTransformer(null, true);
162
163 $transformer->reverseTransform('1.234.5');
164 }
165
166 /**
167 * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
168 */
169 public function testDecimalSeparatorMayNotBeDotIfGroupingSeparatorIsDotWithNoGroupSep()
170 {
171 $transformer = new NumberToLocalizedStringTransformer(null, true);
172
173 $transformer->reverseTransform('1234.5');
174 }
175
176 public function testDecimalSeparatorMayBeDotIfGroupingSeparatorIsDotButNoGroupingUsed()
177 {
178 \Locale::setDefault('fr');
179 $transformer = new NumberToLocalizedStringTransformer();
180
181 $this->assertEquals(1234.5, $transformer->reverseTransform('1234,5'));
182 $this->assertEquals(1234.5, $transformer->reverseTransform('1234.5'));
183 }
184
185 public function testDecimalSeparatorMayBeCommaIfGroupingSeparatorIsNotComma()
186 {
187 \Locale::setDefault('bg');
188 $transformer = new NumberToLocalizedStringTransformer(null, true);
189
190 // completely valid format
191 $this->assertEquals(1234.5, $transformer->reverseTransform('1 234.5'));
192 // accept commas
193 $this->assertEquals(1234.5, $transformer->reverseTransform('1 234,5'));
194 // omit group separator
195 $this->assertEquals(1234.5, $transformer->reverseTransform('1234.5'));
196 $this->assertEquals(1234.5, $transformer->reverseTransform('1234,5'));
197 }
198
199 /**
200 * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
201 */
202 public function testDecimalSeparatorMayNotBeCommaIfGroupingSeparatorIsComma()
203 {
204 \Locale::setDefault('en');
205 $transformer = new NumberToLocalizedStringTransformer(null, true);
206
207 $transformer->reverseTransform('1,234,5');
208 }
209
210 /**
211 * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
212 */
213 public function testDecimalSeparatorMayNotBeCommaIfGroupingSeparatorIsCommaWithNoGroupSep()
214 {
215 \Locale::setDefault('en');
216 $transformer = new NumberToLocalizedStringTransformer(null, true);
217
218 $transformer->reverseTransform('1234,5');
219 }
220
221 public function testDecimalSeparatorMayBeCommaIfGroupingSeparatorIsCommaButNoGroupingUsed()
222 {
223 \Locale::setDefault('en');
224 $transformer = new NumberToLocalizedStringTransformer();
225
226 $this->assertEquals(1234.5, $transformer->reverseTransform('1234,5'));
227 $this->assertEquals(1234.5, $transformer->reverseTransform('1234.5'));
228 }
229
230 /**
231 * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
232 */
233 public function testTransformExpectsNumeric()
234 {
235 $transformer = new NumberToLocalizedStringTransformer();
236
237 $transformer->transform('foo');
238 }
239
240 /**
241 * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
242 */
243 public function testReverseTransformExpectsString()
244 {
245 $transformer = new NumberToLocalizedStringTransformer();
246
247 $transformer->reverseTransform(1);
248 }
249
250 /**
251 * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
252 */
253 public function testReverseTransformExpectsValidNumber()
254 {
255 $transformer = new NumberToLocalizedStringTransformer();
256
257 $transformer->reverseTransform('foo');
258 }
259
260 /**
261 * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
262 * @link https://github.com/symfony/symfony/issues/3161
263 */
264 public function testReverseTransformDisallowsNaN()
265 {
266 $transformer = new NumberToLocalizedStringTransformer();
267
268 $transformer->reverseTransform('NaN');
269 }
270
271 /**
272 * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
273 */
274 public function testReverseTransformDisallowsNaN2()
275 {
276 $transformer = new NumberToLocalizedStringTransformer();
277
278 $transformer->reverseTransform('nan');
279 }
280
281 /**
282 * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
283 */
284 public function testReverseTransformDisallowsInfinity()
285 {
286 $transformer = new NumberToLocalizedStringTransformer();
287
288 $transformer->reverseTransform('∞');
289 }
290
291 /**
292 * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
293 */
294 public function testReverseTransformDisallowsInfinity2()
295 {
296 $transformer = new NumberToLocalizedStringTransformer();
297
298 $transformer->reverseTransform('∞,123');
299 }
300
301 /**
302 * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
303 */
304 public function testReverseTransformDisallowsNegativeInfinity()
305 {
306 $transformer = new NumberToLocalizedStringTransformer();
307
308 $transformer->reverseTransform('-∞');
309 }
310
311 /**
312 * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
313 */
314 public function testReverseTransformDisallowsLeadingExtraCharacters()
315 {
316 $transformer = new NumberToLocalizedStringTransformer();
317
318 $transformer->reverseTransform('foo123');
319 }
320
321 /**
322 * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
323 * @expectedExceptionMessage The number contains unrecognized characters: "foo3"
324 */
325 public function testReverseTransformDisallowsCenteredExtraCharacters()
326 {
327 $transformer = new NumberToLocalizedStringTransformer();
328
329 $transformer->reverseTransform('12foo3');
330 }
331
332 /**
333 * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
334 * @expectedExceptionMessage The number contains unrecognized characters: "foo8"
335 */
336 public function testReverseTransformDisallowsCenteredExtraCharactersMultibyte()
337 {
338 if (!extension_loaded('mbstring')) {
339 $this->markTestSkipped('The "mbstring" extension is required for this test.');
340 }
341
342 \Locale::setDefault('ru');
343
344 $transformer = new NumberToLocalizedStringTransformer(null, true);
345
346 $transformer->reverseTransform("12\xc2\xa0345,67foo8");
347 }
348
349 /**
350 * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
351 * @expectedExceptionMessage The number contains unrecognized characters: "foo8"
352 */
353 public function testReverseTransformIgnoresTrailingSpacesInExceptionMessage()
354 {
355 if (!extension_loaded('mbstring')) {
356 $this->markTestSkipped('The "mbstring" extension is required for this test.');
357 }
358
359 \Locale::setDefault('ru');
360
361 $transformer = new NumberToLocalizedStringTransformer(null, true);
362
363 $transformer->reverseTransform("12\xc2\xa0345,67foo8 \xc2\xa0\t");
364 }
365
366 /**
367 * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
368 * @expectedExceptionMessage The number contains unrecognized characters: "foo"
369 */
370 public function testReverseTransformDisallowsTrailingExtraCharacters()
371 {
372 $transformer = new NumberToLocalizedStringTransformer();
373
374 $transformer->reverseTransform('123foo');
375 }
376
377 /**
378 * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
379 * @expectedExceptionMessage The number contains unrecognized characters: "foo"
380 */
381 public function testReverseTransformDisallowsTrailingExtraCharactersMultibyte()
382 {
383 if (!extension_loaded('mbstring')) {
384 $this->markTestSkipped('The "mbstring" extension is required for this test.');
385 }
386
387 \Locale::setDefault('ru');
388
389 $transformer = new NumberToLocalizedStringTransformer(null, true);
390
391 $transformer->reverseTransform("12\xc2\xa0345,678foo");
392 }
393}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/PercentToLocalizedStringTransformerTest.php b/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/PercentToLocalizedStringTransformerTest.php
deleted file mode 100644
index 104941c9..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/PercentToLocalizedStringTransformerTest.php
+++ /dev/null
@@ -1,114 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Tests\Extension\Core\DataTransformer;
13
14use Symfony\Component\Form\Extension\Core\DataTransformer\PercentToLocalizedStringTransformer;
15use Symfony\Component\Intl\Util\IntlTestHelper;
16
17class PercentToLocalizedStringTransformerTest extends \PHPUnit_Framework_TestCase
18{
19 protected function setUp()
20 {
21 parent::setUp();
22
23 // Since we test against "de_AT", we need the full implementation
24 IntlTestHelper::requireFullIntl($this);
25
26 \Locale::setDefault('de_AT');
27 }
28
29 public function testTransform()
30 {
31 $transformer = new PercentToLocalizedStringTransformer();
32
33 $this->assertEquals('10', $transformer->transform(0.1));
34 $this->assertEquals('15', $transformer->transform(0.15));
35 $this->assertEquals('12', $transformer->transform(0.1234));
36 $this->assertEquals('200', $transformer->transform(2));
37 }
38
39 public function testTransformEmpty()
40 {
41 $transformer = new PercentToLocalizedStringTransformer();
42
43 $this->assertEquals('', $transformer->transform(null));
44 }
45
46 public function testTransformWithInteger()
47 {
48 $transformer = new PercentToLocalizedStringTransformer(null, 'integer');
49
50 $this->assertEquals('0', $transformer->transform(0.1));
51 $this->assertEquals('1', $transformer->transform(1));
52 $this->assertEquals('15', $transformer->transform(15));
53 $this->assertEquals('16', $transformer->transform(15.9));
54 }
55
56 public function testTransformWithPrecision()
57 {
58 $transformer = new PercentToLocalizedStringTransformer(2);
59
60 $this->assertEquals('12,34', $transformer->transform(0.1234));
61 }
62
63 public function testReverseTransform()
64 {
65 $transformer = new PercentToLocalizedStringTransformer();
66
67 $this->assertEquals(0.1, $transformer->reverseTransform('10'));
68 $this->assertEquals(0.15, $transformer->reverseTransform('15'));
69 $this->assertEquals(0.12, $transformer->reverseTransform('12'));
70 $this->assertEquals(2, $transformer->reverseTransform('200'));
71 }
72
73 public function testReverseTransformEmpty()
74 {
75 $transformer = new PercentToLocalizedStringTransformer();
76
77 $this->assertNull($transformer->reverseTransform(''));
78 }
79
80 public function testReverseTransformWithInteger()
81 {
82 $transformer = new PercentToLocalizedStringTransformer(null, 'integer');
83
84 $this->assertEquals(10, $transformer->reverseTransform('10'));
85 $this->assertEquals(15, $transformer->reverseTransform('15'));
86 $this->assertEquals(12, $transformer->reverseTransform('12'));
87 $this->assertEquals(200, $transformer->reverseTransform('200'));
88 }
89
90 public function testReverseTransformWithPrecision()
91 {
92 $transformer = new PercentToLocalizedStringTransformer(2);
93
94 $this->assertEquals(0.1234, $transformer->reverseTransform('12,34'));
95 }
96
97 public function testTransformExpectsNumeric()
98 {
99 $transformer = new PercentToLocalizedStringTransformer();
100
101 $this->setExpectedException('Symfony\Component\Form\Exception\TransformationFailedException');
102
103 $transformer->transform('foo');
104 }
105
106 public function testReverseTransformExpectsString()
107 {
108 $transformer = new PercentToLocalizedStringTransformer();
109
110 $this->setExpectedException('Symfony\Component\Form\Exception\TransformationFailedException');
111
112 $transformer->reverseTransform(1);
113 }
114}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/ValueToDuplicatesTransformerTest.php b/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/ValueToDuplicatesTransformerTest.php
deleted file mode 100644
index 2c5298da..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/DataTransformer/ValueToDuplicatesTransformerTest.php
+++ /dev/null
@@ -1,120 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien.potencier@symfony-project.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Tests\Extension\Core\DataTransformer;
13
14use Symfony\Component\Form\Extension\Core\DataTransformer\ValueToDuplicatesTransformer;
15
16class ValueToDuplicatesTransformerTest extends \PHPUnit_Framework_TestCase
17{
18 private $transformer;
19
20 protected function setUp()
21 {
22 $this->transformer = new ValueToDuplicatesTransformer(array('a', 'b', 'c'));
23 }
24
25 protected function tearDown()
26 {
27 $this->transformer = null;
28 }
29
30 public function testTransform()
31 {
32 $output = array(
33 'a' => 'Foo',
34 'b' => 'Foo',
35 'c' => 'Foo',
36 );
37
38 $this->assertSame($output, $this->transformer->transform('Foo'));
39 }
40
41 public function testTransformEmpty()
42 {
43 $output = array(
44 'a' => null,
45 'b' => null,
46 'c' => null,
47 );
48
49 $this->assertSame($output, $this->transformer->transform(null));
50 }
51
52 public function testReverseTransform()
53 {
54 $input = array(
55 'a' => 'Foo',
56 'b' => 'Foo',
57 'c' => 'Foo',
58 );
59
60 $this->assertSame('Foo', $this->transformer->reverseTransform($input));
61 }
62
63 public function testReverseTransformCompletelyEmpty()
64 {
65 $input = array(
66 'a' => '',
67 'b' => '',
68 'c' => '',
69 );
70
71 $this->assertNull($this->transformer->reverseTransform($input));
72 }
73
74 public function testReverseTransformCompletelyNull()
75 {
76 $input = array(
77 'a' => null,
78 'b' => null,
79 'c' => null,
80 );
81
82 $this->assertNull($this->transformer->reverseTransform($input));
83 }
84
85 /**
86 * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
87 */
88 public function testReverseTransformPartiallyNull()
89 {
90 $input = array(
91 'a' => 'Foo',
92 'b' => 'Foo',
93 'c' => null,
94 );
95
96 $this->transformer->reverseTransform($input);
97 }
98
99 /**
100 * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
101 */
102 public function testReverseTransformDifferences()
103 {
104 $input = array(
105 'a' => 'Foo',
106 'b' => 'Bar',
107 'c' => 'Foo',
108 );
109
110 $this->transformer->reverseTransform($input);
111 }
112
113 /**
114 * @expectedException \Symfony\Component\Form\Exception\TransformationFailedException
115 */
116 public function testReverseTransformRequiresArray()
117 {
118 $this->transformer->reverseTransform('12345');
119 }
120}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/EventListener/FixRadioInputListenerTest.php b/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/EventListener/FixRadioInputListenerTest.php
deleted file mode 100644
index a5d5c78a..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/EventListener/FixRadioInputListenerTest.php
+++ /dev/null
@@ -1,106 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Tests\Extension\Core\EventListener;
13
14use Symfony\Component\Form\FormEvent;
15use Symfony\Component\Form\Extension\Core\EventListener\FixRadioInputListener;
16use Symfony\Component\Form\Extension\Core\ChoiceList\SimpleChoiceList;
17
18class FixRadioInputListenerTest extends \PHPUnit_Framework_TestCase
19{
20 private $choiceList;
21
22 protected function setUp()
23 {
24 if (!class_exists('Symfony\Component\EventDispatcher\EventDispatcher')) {
25 $this->markTestSkipped('The "EventDispatcher" component is not available');
26 }
27
28 parent::setUp();
29
30 $this->choiceList = new SimpleChoiceList(array('' => 'Empty', 0 => 'A', 1 => 'B'));
31 }
32
33 protected function tearDown()
34 {
35 parent::tearDown();
36
37 $listener = null;
38 }
39
40 public function testFixRadio()
41 {
42 $data = '1';
43 $form = $this->getMock('Symfony\Component\Form\Test\FormInterface');
44 $event = new FormEvent($form, $data);
45
46 $listener = new FixRadioInputListener($this->choiceList, true);
47 $listener->preSubmit($event);
48
49 // Indices in SimpleChoiceList are zero-based generated integers
50 $this->assertEquals(array(2 => '1'), $event->getData());
51 }
52
53 public function testFixZero()
54 {
55 $data = '0';
56 $form = $this->getMock('Symfony\Component\Form\Test\FormInterface');
57 $event = new FormEvent($form, $data);
58
59 $listener = new FixRadioInputListener($this->choiceList, true);
60 $listener->preSubmit($event);
61
62 // Indices in SimpleChoiceList are zero-based generated integers
63 $this->assertEquals(array(1 => '0'), $event->getData());
64 }
65
66 public function testFixEmptyString()
67 {
68 $data = '';
69 $form = $this->getMock('Symfony\Component\Form\Test\FormInterface');
70 $event = new FormEvent($form, $data);
71
72 $listener = new FixRadioInputListener($this->choiceList, true);
73 $listener->preSubmit($event);
74
75 // Indices in SimpleChoiceList are zero-based generated integers
76 $this->assertEquals(array(0 => ''), $event->getData());
77 }
78
79 public function testConvertEmptyStringToPlaceholderIfNotFound()
80 {
81 $list = new SimpleChoiceList(array(0 => 'A', 1 => 'B'));
82
83 $data = '';
84 $form = $this->getMock('Symfony\Component\Form\Test\FormInterface');
85 $event = new FormEvent($form, $data);
86
87 $listener = new FixRadioInputListener($list, true);
88 $listener->preSubmit($event);
89
90 $this->assertEquals(array('placeholder' => ''), $event->getData());
91 }
92
93 public function testDontConvertEmptyStringToPlaceholderIfNoPlaceholderUsed()
94 {
95 $list = new SimpleChoiceList(array(0 => 'A', 1 => 'B'));
96
97 $data = '';
98 $form = $this->getMock('Symfony\Component\Form\Test\FormInterface');
99 $event = new FormEvent($form, $data);
100
101 $listener = new FixRadioInputListener($list, false);
102 $listener->preSubmit($event);
103
104 $this->assertEquals(array(), $event->getData());
105 }
106}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/EventListener/FixUrlProtocolListenerTest.php b/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/EventListener/FixUrlProtocolListenerTest.php
deleted file mode 100644
index 2b84e4fd..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/EventListener/FixUrlProtocolListenerTest.php
+++ /dev/null
@@ -1,61 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Tests\Extension\Core\EventListener;
13
14use Symfony\Component\Form\FormEvent;
15use Symfony\Component\Form\Extension\Core\EventListener\FixUrlProtocolListener;
16
17class FixUrlProtocolListenerTest extends \PHPUnit_Framework_TestCase
18{
19 protected function setUp()
20 {
21 if (!class_exists('Symfony\Component\EventDispatcher\EventDispatcher')) {
22 $this->markTestSkipped('The "EventDispatcher" component is not available');
23 }
24 }
25
26 public function testFixHttpUrl()
27 {
28 $data = "www.symfony.com";
29 $form = $this->getMock('Symfony\Component\Form\Test\FormInterface');
30 $event = new FormEvent($form, $data);
31
32 $filter = new FixUrlProtocolListener('http');
33 $filter->onSubmit($event);
34
35 $this->assertEquals('http://www.symfony.com', $event->getData());
36 }
37
38 public function testSkipKnownUrl()
39 {
40 $data = "http://www.symfony.com";
41 $form = $this->getMock('Symfony\Component\Form\Test\FormInterface');
42 $event = new FormEvent($form, $data);
43
44 $filter = new FixUrlProtocolListener('http');
45 $filter->onSubmit($event);
46
47 $this->assertEquals('http://www.symfony.com', $event->getData());
48 }
49
50 public function testSkipOtherProtocol()
51 {
52 $data = "ftp://www.symfony.com";
53 $form = $this->getMock('Symfony\Component\Form\Test\FormInterface');
54 $event = new FormEvent($form, $data);
55
56 $filter = new FixUrlProtocolListener('http');
57 $filter->onSubmit($event);
58
59 $this->assertEquals('ftp://www.symfony.com', $event->getData());
60 }
61}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/EventListener/Fixtures/randomhash b/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/EventListener/Fixtures/randomhash
deleted file mode 100644
index b636f4b8..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/EventListener/Fixtures/randomhash
+++ /dev/null
Binary files differ
diff --git a/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/EventListener/MergeCollectionListenerArrayObjectTest.php b/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/EventListener/MergeCollectionListenerArrayObjectTest.php
deleted file mode 100644
index 6f46c9d7..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/EventListener/MergeCollectionListenerArrayObjectTest.php
+++ /dev/null
@@ -1,27 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Tests\Extension\Core\EventListener;
13
14use Symfony\Component\Form\FormBuilder;
15
16class MergeCollectionListenerArrayObjectTest extends MergeCollectionListenerTest
17{
18 protected function getData(array $data)
19 {
20 return new \ArrayObject($data);
21 }
22
23 protected function getBuilder($name = 'name')
24 {
25 return new FormBuilder($name, '\ArrayObject', $this->dispatcher, $this->factory);
26 }
27}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/EventListener/MergeCollectionListenerArrayTest.php b/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/EventListener/MergeCollectionListenerArrayTest.php
deleted file mode 100644
index c0f3d597..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/EventListener/MergeCollectionListenerArrayTest.php
+++ /dev/null
@@ -1,27 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Tests\Extension\Core\EventListener;
13
14use Symfony\Component\Form\FormBuilder;
15
16class MergeCollectionListenerArrayTest extends MergeCollectionListenerTest
17{
18 protected function getData(array $data)
19 {
20 return $data;
21 }
22
23 protected function getBuilder($name = 'name')
24 {
25 return new FormBuilder($name, null, $this->dispatcher, $this->factory);
26 }
27}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/EventListener/MergeCollectionListenerCustomArrayObjectTest.php b/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/EventListener/MergeCollectionListenerCustomArrayObjectTest.php
deleted file mode 100644
index 5eb6c7b9..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/EventListener/MergeCollectionListenerCustomArrayObjectTest.php
+++ /dev/null
@@ -1,28 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Tests\Extension\Core\EventListener;
13
14use Symfony\Component\Form\Tests\Fixtures\CustomArrayObject;
15use Symfony\Component\Form\FormBuilder;
16
17class MergeCollectionListenerCustomArrayObjectTest extends MergeCollectionListenerTest
18{
19 protected function getData(array $data)
20 {
21 return new CustomArrayObject($data);
22 }
23
24 protected function getBuilder($name = 'name')
25 {
26 return new FormBuilder($name, 'Symfony\Component\Form\Tests\Fixtures\CustomArrayObject', $this->dispatcher, $this->factory);
27 }
28}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/EventListener/MergeCollectionListenerTest.php b/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/EventListener/MergeCollectionListenerTest.php
deleted file mode 100644
index dbd28c6b..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/EventListener/MergeCollectionListenerTest.php
+++ /dev/null
@@ -1,259 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Tests\Extension\Core\EventListener;
13
14use Symfony\Component\Form\FormEvent;
15use Symfony\Component\Form\Extension\Core\EventListener\MergeCollectionListener;
16
17abstract class MergeCollectionListenerTest extends \PHPUnit_Framework_TestCase
18{
19 protected $dispatcher;
20 protected $factory;
21 protected $form;
22
23 protected function setUp()
24 {
25 if (!class_exists('Symfony\Component\EventDispatcher\EventDispatcher')) {
26 $this->markTestSkipped('The "EventDispatcher" component is not available');
27 }
28
29 $this->dispatcher = $this->getMock('Symfony\Component\EventDispatcher\EventDispatcherInterface');
30 $this->factory = $this->getMock('Symfony\Component\Form\FormFactoryInterface');
31 $this->form = $this->getForm('axes');
32 }
33
34 protected function tearDown()
35 {
36 $this->dispatcher = null;
37 $this->factory = null;
38 $this->form = null;
39 }
40
41 abstract protected function getBuilder($name = 'name');
42
43 protected function getForm($name = 'name', $propertyPath = null)
44 {
45 $propertyPath = $propertyPath ?: $name;
46
47 return $this->getBuilder($name)->setAttribute('property_path', $propertyPath)->getForm();
48 }
49
50 protected function getMockForm()
51 {
52 return $this->getMock('Symfony\Component\Form\Test\FormInterface');
53 }
54
55 public function getBooleanMatrix1()
56 {
57 return array(
58 array(true),
59 array(false),
60 );
61 }
62
63 public function getBooleanMatrix2()
64 {
65 return array(
66 array(true, true),
67 array(true, false),
68 array(false, true),
69 array(false, false),
70 );
71 }
72
73 abstract protected function getData(array $data);
74
75 /**
76 * @dataProvider getBooleanMatrix1
77 */
78 public function testAddExtraEntriesIfAllowAdd($allowDelete)
79 {
80 $originalData = $this->getData(array(1 => 'second'));
81 $newData = $this->getData(array(0 => 'first', 1 => 'second', 2 => 'third'));
82
83 $listener = new MergeCollectionListener(true, $allowDelete);
84
85 $this->form->setData($originalData);
86
87 $event = new FormEvent($this->form, $newData);
88 $listener->onSubmit($event);
89
90 // The original object was modified
91 if (is_object($originalData)) {
92 $this->assertSame($originalData, $event->getData());
93 }
94
95 // The original object matches the new object
96 $this->assertEquals($newData, $event->getData());
97 }
98
99 /**
100 * @dataProvider getBooleanMatrix1
101 */
102 public function testAddExtraEntriesIfAllowAddDontOverwriteExistingIndices($allowDelete)
103 {
104 $originalData = $this->getData(array(1 => 'first'));
105 $newData = $this->getData(array(0 => 'first', 1 => 'second'));
106
107 $listener = new MergeCollectionListener(true, $allowDelete);
108
109 $this->form->setData($originalData);
110
111 $event = new FormEvent($this->form, $newData);
112 $listener->onSubmit($event);
113
114 // The original object was modified
115 if (is_object($originalData)) {
116 $this->assertSame($originalData, $event->getData());
117 }
118
119 // The original object matches the new object
120 $this->assertEquals($this->getData(array(1 => 'first', 2 => 'second')), $event->getData());
121 }
122
123 /**
124 * @dataProvider getBooleanMatrix1
125 */
126 public function testDoNothingIfNotAllowAdd($allowDelete)
127 {
128 $originalDataArray = array(1 => 'second');
129 $originalData = $this->getData($originalDataArray);
130 $newData = $this->getData(array(0 => 'first', 1 => 'second', 2 => 'third'));
131
132 $listener = new MergeCollectionListener(false, $allowDelete);
133
134 $this->form->setData($originalData);
135
136 $event = new FormEvent($this->form, $newData);
137 $listener->onSubmit($event);
138
139 // We still have the original object
140 if (is_object($originalData)) {
141 $this->assertSame($originalData, $event->getData());
142 }
143
144 // Nothing was removed
145 $this->assertEquals($this->getData($originalDataArray), $event->getData());
146 }
147
148 /**
149 * @dataProvider getBooleanMatrix1
150 */
151 public function testRemoveMissingEntriesIfAllowDelete($allowAdd)
152 {
153 $originalData = $this->getData(array(0 => 'first', 1 => 'second', 2 => 'third'));
154 $newData = $this->getData(array(1 => 'second'));
155
156 $listener = new MergeCollectionListener($allowAdd, true);
157
158 $this->form->setData($originalData);
159
160 $event = new FormEvent($this->form, $newData);
161 $listener->onSubmit($event);
162
163 // The original object was modified
164 if (is_object($originalData)) {
165 $this->assertSame($originalData, $event->getData());
166 }
167
168 // The original object matches the new object
169 $this->assertEquals($newData, $event->getData());
170 }
171
172 /**
173 * @dataProvider getBooleanMatrix1
174 */
175 public function testDoNothingIfNotAllowDelete($allowAdd)
176 {
177 $originalDataArray = array(0 => 'first', 1 => 'second', 2 => 'third');
178 $originalData = $this->getData($originalDataArray);
179 $newData = $this->getData(array(1 => 'second'));
180
181 $listener = new MergeCollectionListener($allowAdd, false);
182
183 $this->form->setData($originalData);
184
185 $event = new FormEvent($this->form, $newData);
186 $listener->onSubmit($event);
187
188 // We still have the original object
189 if (is_object($originalData)) {
190 $this->assertSame($originalData, $event->getData());
191 }
192
193 // Nothing was removed
194 $this->assertEquals($this->getData($originalDataArray), $event->getData());
195 }
196
197 /**
198 * @dataProvider getBooleanMatrix2
199 * @expectedException \Symfony\Component\Form\Exception\UnexpectedTypeException
200 */
201 public function testRequireArrayOrTraversable($allowAdd, $allowDelete)
202 {
203 $newData = 'no array or traversable';
204 $event = new FormEvent($this->form, $newData);
205 $listener = new MergeCollectionListener($allowAdd, $allowDelete);
206 $listener->onSubmit($event);
207 }
208
209 public function testDealWithNullData()
210 {
211 $originalData = $this->getData(array(0 => 'first', 1 => 'second', 2 => 'third'));
212 $newData = null;
213
214 $listener = new MergeCollectionListener(false, false);
215
216 $this->form->setData($originalData);
217
218 $event = new FormEvent($this->form, $newData);
219 $listener->onSubmit($event);
220
221 $this->assertSame($originalData, $event->getData());
222 }
223
224 /**
225 * @dataProvider getBooleanMatrix1
226 */
227 public function testDealWithNullOriginalDataIfAllowAdd($allowDelete)
228 {
229 $originalData = null;
230 $newData = $this->getData(array(0 => 'first', 1 => 'second', 2 => 'third'));
231
232 $listener = new MergeCollectionListener(true, $allowDelete);
233
234 $this->form->setData($originalData);
235
236 $event = new FormEvent($this->form, $newData);
237 $listener->onSubmit($event);
238
239 $this->assertSame($newData, $event->getData());
240 }
241
242 /**
243 * @dataProvider getBooleanMatrix1
244 */
245 public function testDontDealWithNullOriginalDataIfNotAllowAdd($allowDelete)
246 {
247 $originalData = null;
248 $newData = $this->getData(array(0 => 'first', 1 => 'second', 2 => 'third'));
249
250 $listener = new MergeCollectionListener(false, $allowDelete);
251
252 $this->form->setData($originalData);
253
254 $event = new FormEvent($this->form, $newData);
255 $listener->onSubmit($event);
256
257 $this->assertNull($event->getData());
258 }
259}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/EventListener/ResizeFormListenerTest.php b/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/EventListener/ResizeFormListenerTest.php
deleted file mode 100644
index 1367b3ef..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/EventListener/ResizeFormListenerTest.php
+++ /dev/null
@@ -1,255 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Tests\Extension\Core\EventListener;
13
14use Symfony\Component\Form\Extension\Core\EventListener\ResizeFormListener;
15use Symfony\Component\Form\FormBuilder;
16use Symfony\Component\Form\FormEvent;
17
18class ResizeFormListenerTest extends \PHPUnit_Framework_TestCase
19{
20 private $dispatcher;
21 private $factory;
22 private $form;
23
24 protected function setUp()
25 {
26 if (!class_exists('Symfony\Component\EventDispatcher\EventDispatcher')) {
27 $this->markTestSkipped('The "EventDispatcher" component is not available');
28 }
29
30 $this->dispatcher = $this->getMock('Symfony\Component\EventDispatcher\EventDispatcherInterface');
31 $this->factory = $this->getMock('Symfony\Component\Form\FormFactoryInterface');
32 $this->form = $this->getBuilder()
33 ->setCompound(true)
34 ->setDataMapper($this->getDataMapper())
35 ->getForm();
36 }
37
38 protected function tearDown()
39 {
40 $this->dispatcher = null;
41 $this->factory = null;
42 $this->form = null;
43 }
44
45 protected function getBuilder($name = 'name')
46 {
47 return new FormBuilder($name, null, $this->dispatcher, $this->factory);
48 }
49
50 protected function getForm($name = 'name')
51 {
52 return $this->getBuilder($name)->getForm();
53 }
54
55 /**
56 * @return \PHPUnit_Framework_MockObject_MockObject
57 */
58 private function getDataMapper()
59 {
60 return $this->getMock('Symfony\Component\Form\DataMapperInterface');
61 }
62
63 protected function getMockForm()
64 {
65 return $this->getMock('Symfony\Component\Form\Test\FormInterface');
66 }
67
68 public function testPreSetDataResizesForm()
69 {
70 $this->form->add($this->getForm('0'));
71 $this->form->add($this->getForm('1'));
72
73 $this->factory->expects($this->at(0))
74 ->method('createNamed')
75 ->with(1, 'text', null, array('property_path' => '[1]', 'max_length' => 10, 'auto_initialize' => false))
76 ->will($this->returnValue($this->getForm('1')));
77 $this->factory->expects($this->at(1))
78 ->method('createNamed')
79 ->with(2, 'text', null, array('property_path' => '[2]', 'max_length' => 10, 'auto_initialize' => false))
80 ->will($this->returnValue($this->getForm('2')));
81
82 $data = array(1 => 'string', 2 => 'string');
83 $event = new FormEvent($this->form, $data);
84 $listener = new ResizeFormListener('text', array('max_length' => '10'), false, false);
85 $listener->preSetData($event);
86
87 $this->assertFalse($this->form->has('0'));
88 $this->assertTrue($this->form->has('1'));
89 $this->assertTrue($this->form->has('2'));
90 }
91
92 /**
93 * @expectedException \Symfony\Component\Form\Exception\UnexpectedTypeException
94 */
95 public function testPreSetDataRequiresArrayOrTraversable()
96 {
97 $data = 'no array or traversable';
98 $event = new FormEvent($this->form, $data);
99 $listener = new ResizeFormListener('text', array(), false, false);
100 $listener->preSetData($event);
101 }
102
103 public function testPreSetDataDealsWithNullData()
104 {
105 $this->factory->expects($this->never())->method('createNamed');
106
107 $data = null;
108 $event = new FormEvent($this->form, $data);
109 $listener = new ResizeFormListener('text', array(), false, false);
110 $listener->preSetData($event);
111 }
112
113 public function testPreSubmitResizesUpIfAllowAdd()
114 {
115 $this->form->add($this->getForm('0'));
116
117 $this->factory->expects($this->once())
118 ->method('createNamed')
119 ->with(1, 'text', null, array('property_path' => '[1]', 'max_length' => 10, 'auto_initialize' => false))
120 ->will($this->returnValue($this->getForm('1')));
121
122 $data = array(0 => 'string', 1 => 'string');
123 $event = new FormEvent($this->form, $data);
124 $listener = new ResizeFormListener('text', array('max_length' => 10), true, false);
125 $listener->preSubmit($event);
126
127 $this->assertTrue($this->form->has('0'));
128 $this->assertTrue($this->form->has('1'));
129 }
130
131 public function testPreSubmitResizesDownIfAllowDelete()
132 {
133 $this->form->add($this->getForm('0'));
134 $this->form->add($this->getForm('1'));
135
136 $data = array(0 => 'string');
137 $event = new FormEvent($this->form, $data);
138 $listener = new ResizeFormListener('text', array(), false, true);
139 $listener->preSubmit($event);
140
141 $this->assertTrue($this->form->has('0'));
142 $this->assertFalse($this->form->has('1'));
143 }
144
145 // fix for https://github.com/symfony/symfony/pull/493
146 public function testPreSubmitRemovesZeroKeys()
147 {
148 $this->form->add($this->getForm('0'));
149
150 $data = array();
151 $event = new FormEvent($this->form, $data);
152 $listener = new ResizeFormListener('text', array(), false, true);
153 $listener->preSubmit($event);
154
155 $this->assertFalse($this->form->has('0'));
156 }
157
158 public function testPreSubmitDoesNothingIfNotAllowAddNorAllowDelete()
159 {
160 $this->form->add($this->getForm('0'));
161 $this->form->add($this->getForm('1'));
162
163 $data = array(0 => 'string', 2 => 'string');
164 $event = new FormEvent($this->form, $data);
165 $listener = new ResizeFormListener('text', array(), false, false);
166 $listener->preSubmit($event);
167
168 $this->assertTrue($this->form->has('0'));
169 $this->assertTrue($this->form->has('1'));
170 $this->assertFalse($this->form->has('2'));
171 }
172
173 /**
174 * @expectedException \Symfony\Component\Form\Exception\UnexpectedTypeException
175 */
176 public function testPreSubmitRequiresArrayOrTraversable()
177 {
178 $data = 'no array or traversable';
179 $event = new FormEvent($this->form, $data);
180 $listener = new ResizeFormListener('text', array(), false, false);
181 $listener->preSubmit($event);
182 }
183
184 public function testPreSubmitDealsWithNullData()
185 {
186 $this->form->add($this->getForm('1'));
187
188 $data = null;
189 $event = new FormEvent($this->form, $data);
190 $listener = new ResizeFormListener('text', array(), false, true);
191 $listener->preSubmit($event);
192
193 $this->assertFalse($this->form->has('1'));
194 }
195
196 // fixes https://github.com/symfony/symfony/pull/40
197 public function testPreSubmitDealsWithEmptyData()
198 {
199 $this->form->add($this->getForm('1'));
200
201 $data = '';
202 $event = new FormEvent($this->form, $data);
203 $listener = new ResizeFormListener('text', array(), false, true);
204 $listener->preSubmit($event);
205
206 $this->assertFalse($this->form->has('1'));
207 }
208
209 public function testOnSubmitNormDataRemovesEntriesMissingInTheFormIfAllowDelete()
210 {
211 $this->form->add($this->getForm('1'));
212
213 $data = array(0 => 'first', 1 => 'second', 2 => 'third');
214 $event = new FormEvent($this->form, $data);
215 $listener = new ResizeFormListener('text', array(), false, true);
216 $listener->onSubmit($event);
217
218 $this->assertEquals(array(1 => 'second'), $event->getData());
219 }
220
221 public function testOnSubmitNormDataDoesNothingIfNotAllowDelete()
222 {
223 $this->form->add($this->getForm('1'));
224
225 $data = array(0 => 'first', 1 => 'second', 2 => 'third');
226 $event = new FormEvent($this->form, $data);
227 $listener = new ResizeFormListener('text', array(), false, false);
228 $listener->onSubmit($event);
229
230 $this->assertEquals($data, $event->getData());
231 }
232
233 /**
234 * @expectedException \Symfony\Component\Form\Exception\UnexpectedTypeException
235 */
236 public function testOnSubmitNormDataRequiresArrayOrTraversable()
237 {
238 $data = 'no array or traversable';
239 $event = new FormEvent($this->form, $data);
240 $listener = new ResizeFormListener('text', array(), false, false);
241 $listener->onSubmit($event);
242 }
243
244 public function testOnSubmitNormDataDealsWithNullData()
245 {
246 $this->form->add($this->getForm('1'));
247
248 $data = null;
249 $event = new FormEvent($this->form, $data);
250 $listener = new ResizeFormListener('text', array(), false, true);
251 $listener->onSubmit($event);
252
253 $this->assertEquals(array(), $event->getData());
254 }
255}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/EventListener/TrimListenerTest.php b/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/EventListener/TrimListenerTest.php
deleted file mode 100644
index 4e368933..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/EventListener/TrimListenerTest.php
+++ /dev/null
@@ -1,79 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Tests\Extension\Core\EventListener;
13
14use Symfony\Component\Form\FormEvent;
15use Symfony\Component\Form\Extension\Core\EventListener\TrimListener;
16
17class TrimListenerTest extends \PHPUnit_Framework_TestCase
18{
19 protected function setUp()
20 {
21 if (!class_exists('Symfony\Component\EventDispatcher\EventDispatcher')) {
22 $this->markTestSkipped('The "EventDispatcher" component is not available');
23 }
24 }
25
26 public function testTrim()
27 {
28 $data = " Foo! ";
29 $form = $this->getMock('Symfony\Component\Form\Test\FormInterface');
30 $event = new FormEvent($form, $data);
31
32 $filter = new TrimListener();
33 $filter->preSubmit($event);
34
35 $this->assertEquals('Foo!', $event->getData());
36 }
37
38 public function testTrimSkipNonStrings()
39 {
40 $data = 1234;
41 $form = $this->getMock('Symfony\Component\Form\Test\FormInterface');
42 $event = new FormEvent($form, $data);
43
44 $filter = new TrimListener();
45 $filter->preSubmit($event);
46
47 $this->assertSame(1234, $event->getData());
48 }
49
50 /**
51 * @dataProvider codePointProvider
52 */
53 public function testTrimUtf8($chars)
54 {
55 if (!function_exists('mb_check_encoding')) {
56 $this->markTestSkipped('The "mb_check_encoding" function is not available');
57 }
58
59 $data = mb_convert_encoding(pack('H*', implode('', $chars)), 'UTF-8', 'UCS-2BE');
60 $data = $data."ab\ncd".$data;
61
62 $form = $this->getMock('Symfony\Component\Form\Test\FormInterface');
63 $event = new FormEvent($form, $data);
64
65 $filter = new TrimListener();
66 $filter->preSubmit($event);
67
68 $this->assertSame("ab\ncd", $event->getData(), 'TrimListener should trim character(s): '.implode(', ', $chars));
69 }
70
71 public function codePointProvider()
72 {
73 return array(
74 'General category: Separator' => array(array('0020', '00A0', '1680', '180E', '2000', '2001', '2002', '2003', '2004', '2005', '2006', '2007', '2008', '2009', '200A', '2028', '2029', '202F', '205F', '3000')),
75 'General category: Other, control' => array(array('0009', '000A', '000B', '000C', '000D', '0085')),
76 //'General category: Other, format. ZERO WIDTH SPACE' => array(array('200B')),
77 );
78 }
79}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/Type/BaseTypeTest.php b/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/Type/BaseTypeTest.php
deleted file mode 100644
index bfa1e218..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/Type/BaseTypeTest.php
+++ /dev/null
@@ -1,135 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Tests\Extension\Core\Type;
13
14/**
15 * @author Bernhard Schussek <bschussek@gmail.com>
16 */
17abstract class BaseTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
18{
19 public function testPassDisabledAsOption()
20 {
21 $form = $this->factory->create($this->getTestedType(), null, array('disabled' => true));
22
23 $this->assertTrue($form->isDisabled());
24 }
25
26 public function testPassIdAndNameToView()
27 {
28 $view = $this->factory->createNamed('name', $this->getTestedType())
29 ->createView();
30
31 $this->assertEquals('name', $view->vars['id']);
32 $this->assertEquals('name', $view->vars['name']);
33 $this->assertEquals('name', $view->vars['full_name']);
34 }
35
36 public function testStripLeadingUnderscoresAndDigitsFromId()
37 {
38 $view = $this->factory->createNamed('_09name', $this->getTestedType())
39 ->createView();
40
41 $this->assertEquals('name', $view->vars['id']);
42 $this->assertEquals('_09name', $view->vars['name']);
43 $this->assertEquals('_09name', $view->vars['full_name']);
44 }
45
46 public function testPassIdAndNameToViewWithParent()
47 {
48 $view = $this->factory->createNamedBuilder('parent', 'form')
49 ->add('child', $this->getTestedType())
50 ->getForm()
51 ->createView();
52
53 $this->assertEquals('parent_child', $view['child']->vars['id']);
54 $this->assertEquals('child', $view['child']->vars['name']);
55 $this->assertEquals('parent[child]', $view['child']->vars['full_name']);
56 }
57
58 public function testPassIdAndNameToViewWithGrandParent()
59 {
60 $builder = $this->factory->createNamedBuilder('parent', 'form')
61 ->add('child', 'form');
62 $builder->get('child')->add('grand_child', $this->getTestedType());
63 $view = $builder->getForm()->createView();
64
65 $this->assertEquals('parent_child_grand_child', $view['child']['grand_child']->vars['id']);
66 $this->assertEquals('grand_child', $view['child']['grand_child']->vars['name']);
67 $this->assertEquals('parent[child][grand_child]', $view['child']['grand_child']->vars['full_name']);
68 }
69
70 public function testPassTranslationDomainToView()
71 {
72 $form = $this->factory->create($this->getTestedType(), null, array(
73 'translation_domain' => 'domain',
74 ));
75 $view = $form->createView();
76
77 $this->assertSame('domain', $view->vars['translation_domain']);
78 }
79
80 public function testInheritTranslationDomainFromParent()
81 {
82 $view = $this->factory
83 ->createNamedBuilder('parent', 'form', null, array(
84 'translation_domain' => 'domain',
85 ))
86 ->add('child', $this->getTestedType())
87 ->getForm()
88 ->createView();
89
90 $this->assertEquals('domain', $view['child']->vars['translation_domain']);
91 }
92
93 public function testPreferOwnTranslationDomain()
94 {
95 $view = $this->factory
96 ->createNamedBuilder('parent', 'form', null, array(
97 'translation_domain' => 'parent_domain',
98 ))
99 ->add('child', $this->getTestedType(), array(
100 'translation_domain' => 'domain',
101 ))
102 ->getForm()
103 ->createView();
104
105 $this->assertEquals('domain', $view['child']->vars['translation_domain']);
106 }
107
108 public function testDefaultTranslationDomain()
109 {
110 $view = $this->factory->createNamedBuilder('parent', 'form')
111 ->add('child', $this->getTestedType())
112 ->getForm()
113 ->createView();
114
115 $this->assertEquals('messages', $view['child']->vars['translation_domain']);
116 }
117
118 public function testPassLabelToView()
119 {
120 $form = $this->factory->createNamed('__test___field', $this->getTestedType(), null, array('label' => 'My label'));
121 $view = $form->createView();
122
123 $this->assertSame('My label', $view->vars['label']);
124 }
125
126 public function testPassMultipartFalseToView()
127 {
128 $form = $this->factory->create($this->getTestedType());
129 $view = $form->createView();
130
131 $this->assertFalse($view->vars['multipart']);
132 }
133
134 abstract protected function getTestedType();
135}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/Type/ButtonTypeTest.php b/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/Type/ButtonTypeTest.php
deleted file mode 100644
index 55835e77..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/Type/ButtonTypeTest.php
+++ /dev/null
@@ -1,28 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Tests\Extension\Core\Type;
13
14/**
15 * @author Bernhard Schussek <bschussek@gmail.com>
16 */
17class ButtonTypeTest extends BaseTypeTest
18{
19 public function testCreateButtonInstances()
20 {
21 $this->assertInstanceOf('Symfony\Component\Form\Button', $this->factory->create('button'));
22 }
23
24 protected function getTestedType()
25 {
26 return 'button';
27 }
28}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/Type/CheckboxTypeTest.php b/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/Type/CheckboxTypeTest.php
deleted file mode 100644
index c782adab..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/Type/CheckboxTypeTest.php
+++ /dev/null
@@ -1,162 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Tests\Extension\Core\Type;
13
14use Symfony\Component\Form\CallbackTransformer;
15
16class CheckboxTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
17{
18 public function testPassValueToView()
19 {
20 $form = $this->factory->create('checkbox', null, array('value' => 'foobar'));
21 $view = $form->createView();
22
23 $this->assertEquals('foobar', $view->vars['value']);
24 }
25
26 public function testCheckedIfDataTrue()
27 {
28 $form = $this->factory->create('checkbox');
29 $form->setData(true);
30 $view = $form->createView();
31
32 $this->assertTrue($view->vars['checked']);
33 }
34
35 public function testCheckedIfDataTrueWithEmptyValue()
36 {
37 $form = $this->factory->create('checkbox', null, array('value' => ''));
38 $form->setData(true);
39 $view = $form->createView();
40
41 $this->assertTrue($view->vars['checked']);
42 }
43
44 public function testNotCheckedIfDataFalse()
45 {
46 $form = $this->factory->create('checkbox');
47 $form->setData(false);
48 $view = $form->createView();
49
50 $this->assertFalse($view->vars['checked']);
51 }
52
53 public function testSubmitWithValueChecked()
54 {
55 $form = $this->factory->create('checkbox', null, array(
56 'value' => 'foobar',
57 ));
58 $form->submit('foobar');
59
60 $this->assertTrue($form->getData());
61 $this->assertEquals('foobar', $form->getViewData());
62 }
63
64 public function testSubmitWithRandomValueChecked()
65 {
66 $form = $this->factory->create('checkbox', null, array(
67 'value' => 'foobar',
68 ));
69 $form->submit('krixikraxi');
70
71 $this->assertTrue($form->getData());
72 $this->assertEquals('foobar', $form->getViewData());
73 }
74
75 public function testSubmitWithValueUnchecked()
76 {
77 $form = $this->factory->create('checkbox', null, array(
78 'value' => 'foobar',
79 ));
80 $form->submit(null);
81
82 $this->assertFalse($form->getData());
83 $this->assertNull($form->getViewData());
84 }
85
86 public function testSubmitWithEmptyValueChecked()
87 {
88 $form = $this->factory->create('checkbox', null, array(
89 'value' => '',
90 ));
91 $form->submit('');
92
93 $this->assertTrue($form->getData());
94 $this->assertSame('', $form->getViewData());
95 }
96
97 public function testSubmitWithEmptyValueUnchecked()
98 {
99 $form = $this->factory->create('checkbox', null, array(
100 'value' => '',
101 ));
102 $form->submit(null);
103
104 $this->assertFalse($form->getData());
105 $this->assertNull($form->getViewData());
106 }
107
108 public function testBindWithEmptyValueAndFalseUnchecked()
109 {
110 $form = $this->factory->create('checkbox', null, array(
111 'value' => '',
112 ));
113 $form->bind(false);
114
115 $this->assertFalse($form->getData());
116 $this->assertNull($form->getViewData());
117 }
118
119 public function testBindWithEmptyValueAndTrueChecked()
120 {
121 $form = $this->factory->create('checkbox', null, array(
122 'value' => '',
123 ));
124 $form->bind(true);
125
126 $this->assertTrue($form->getData());
127 $this->assertSame('', $form->getViewData());
128 }
129
130 /**
131 * @dataProvider provideTransformedData
132 */
133 public function testTransformedData($data, $expected)
134 {
135 // present a binary status field as a checkbox
136 $transformer = new CallbackTransformer(
137 function ($value) {
138 return 'expedited' == $value;
139 },
140 function ($value) {
141 return $value ? 'expedited' : 'standard';
142 }
143 );
144
145 $form = $this->builder
146 ->create('expedited_shipping', 'checkbox')
147 ->addModelTransformer($transformer)
148 ->getForm();
149 $form->setData($data);
150 $view = $form->createView();
151
152 $this->assertEquals($expected, $view->vars['checked']);
153 }
154
155 public function provideTransformedData()
156 {
157 return array(
158 array('expedited', true),
159 array('standard', false),
160 );
161 }
162}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/Type/ChoiceTypePerformanceTest.php b/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/Type/ChoiceTypePerformanceTest.php
deleted file mode 100644
index 0685946f..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/Type/ChoiceTypePerformanceTest.php
+++ /dev/null
@@ -1,38 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Tests\Extension\Core\Type;
13
14use Symfony\Component\Form\Test\FormPerformanceTestCase;
15
16/**
17 * @author Bernhard Schussek <bschussek@gmail.com>
18 */
19class ChoiceTypePerformanceTest extends FormPerformanceTestCase
20{
21 /**
22 * This test case is realistic in collection forms where each
23 * row contains the same choice field.
24 *
25 * @group benchmark
26 */
27 public function testSameChoiceFieldCreatedMultipleTimes()
28 {
29 $this->setMaxRunningTime(1);
30 $choices = range(1, 300);
31
32 for ($i = 0; $i < 100; ++$i) {
33 $this->factory->create('choice', rand(1, 400), array(
34 'choices' => $choices,
35 ));
36 }
37 }
38}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/Type/ChoiceTypeTest.php b/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/Type/ChoiceTypeTest.php
deleted file mode 100644
index 219e8181..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/Type/ChoiceTypeTest.php
+++ /dev/null
@@ -1,949 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Tests\Extension\Core\Type;
13
14use Symfony\Component\Form\Extension\Core\ChoiceList\ObjectChoiceList;
15use Symfony\Component\Form\Extension\Core\View\ChoiceView;
16
17class ChoiceTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
18{
19 private $choices = array(
20 'a' => 'Bernhard',
21 'b' => 'Fabien',
22 'c' => 'Kris',
23 'd' => 'Jon',
24 'e' => 'Roman',
25 );
26
27 private $numericChoices = array(
28 0 => 'Bernhard',
29 1 => 'Fabien',
30 2 => 'Kris',
31 3 => 'Jon',
32 4 => 'Roman',
33 );
34
35 private $objectChoices;
36
37 protected $groupedChoices = array(
38 'Symfony' => array(
39 'a' => 'Bernhard',
40 'b' => 'Fabien',
41 'c' => 'Kris',
42 ),
43 'Doctrine' => array(
44 'd' => 'Jon',
45 'e' => 'Roman',
46 )
47 );
48
49 protected function setUp()
50 {
51 parent::setUp();
52
53 $this->objectChoices = array(
54 (object) array('id' => 1, 'name' => 'Bernhard'),
55 (object) array('id' => 2, 'name' => 'Fabien'),
56 (object) array('id' => 3, 'name' => 'Kris'),
57 (object) array('id' => 4, 'name' => 'Jon'),
58 (object) array('id' => 5, 'name' => 'Roman'),
59 );
60 }
61
62 protected function tearDown()
63 {
64 parent::tearDown();
65
66 $this->objectChoices = null;
67 }
68
69 /**
70 * @expectedException \PHPUnit_Framework_Error
71 */
72 public function testChoicesOptionExpectsArray()
73 {
74 $this->factory->create('choice', null, array(
75 'choices' => new \ArrayObject(),
76 ));
77 }
78
79 /**
80 * @expectedException \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException
81 */
82 public function testChoiceListOptionExpectsChoiceListInterface()
83 {
84 $this->factory->create('choice', null, array(
85 'choice_list' => array('foo' => 'foo'),
86 ));
87 }
88
89 public function testChoiceListAndChoicesCanBeEmpty()
90 {
91 $this->factory->create('choice');
92 }
93
94 public function testExpandedChoicesOptionsTurnIntoChildren()
95 {
96 $form = $this->factory->create('choice', null, array(
97 'expanded' => true,
98 'choices' => $this->choices,
99 ));
100
101 $this->assertCount(count($this->choices), $form, 'Each choice should become a new field');
102 }
103
104 public function testPlaceholderPresentOnNonRequiredExpandedSingleChoice()
105 {
106 $form = $this->factory->create('choice', null, array(
107 'multiple' => false,
108 'expanded' => true,
109 'required' => false,
110 'choices' => $this->choices,
111 ));
112
113 $this->assertTrue(isset($form['placeholder']));
114 $this->assertCount(count($this->choices) + 1, $form, 'Each choice should become a new field');
115 }
116
117 public function testPlaceholderNotPresentIfRequired()
118 {
119 $form = $this->factory->create('choice', null, array(
120 'multiple' => false,
121 'expanded' => true,
122 'required' => true,
123 'choices' => $this->choices,
124 ));
125
126 $this->assertFalse(isset($form['placeholder']));
127 $this->assertCount(count($this->choices), $form, 'Each choice should become a new field');
128 }
129
130 public function testPlaceholderNotPresentIfMultiple()
131 {
132 $form = $this->factory->create('choice', null, array(
133 'multiple' => true,
134 'expanded' => true,
135 'required' => false,
136 'choices' => $this->choices,
137 ));
138
139 $this->assertFalse(isset($form['placeholder']));
140 $this->assertCount(count($this->choices), $form, 'Each choice should become a new field');
141 }
142
143 public function testPlaceholderNotPresentIfEmptyChoice()
144 {
145 $form = $this->factory->create('choice', null, array(
146 'multiple' => false,
147 'expanded' => true,
148 'required' => false,
149 'choices' => array(
150 '' => 'Empty',
151 1 => 'Not empty',
152 ),
153 ));
154
155 $this->assertFalse(isset($form['placeholder']));
156 $this->assertCount(2, $form, 'Each choice should become a new field');
157 }
158
159 public function testExpandedChoicesOptionsAreFlattened()
160 {
161 $form = $this->factory->create('choice', null, array(
162 'expanded' => true,
163 'choices' => $this->groupedChoices,
164 ));
165
166 $flattened = array();
167 foreach ($this->groupedChoices as $choices) {
168 $flattened = array_merge($flattened, array_keys($choices));
169 }
170
171 $this->assertCount($form->count(), $flattened, 'Each nested choice should become a new field, not the groups');
172
173 foreach ($flattened as $value => $choice) {
174 $this->assertTrue($form->has($value), 'Flattened choice is named after it\'s value');
175 }
176 }
177
178 public function testExpandedCheckboxesAreNeverRequired()
179 {
180 $form = $this->factory->create('choice', null, array(
181 'multiple' => true,
182 'expanded' => true,
183 'required' => true,
184 'choices' => $this->choices,
185 ));
186
187 foreach ($form as $child) {
188 $this->assertFalse($child->isRequired());
189 }
190 }
191
192 public function testExpandedRadiosAreRequiredIfChoiceChildIsRequired()
193 {
194 $form = $this->factory->create('choice', null, array(
195 'multiple' => false,
196 'expanded' => true,
197 'required' => true,
198 'choices' => $this->choices,
199 ));
200
201 foreach ($form as $child) {
202 $this->assertTrue($child->isRequired());
203 }
204 }
205
206 public function testExpandedRadiosAreNotRequiredIfChoiceChildIsNotRequired()
207 {
208 $form = $this->factory->create('choice', null, array(
209 'multiple' => false,
210 'expanded' => true,
211 'required' => false,
212 'choices' => $this->choices,
213 ));
214
215 foreach ($form as $child) {
216 $this->assertFalse($child->isRequired());
217 }
218 }
219
220 public function testSubmitSingleNonExpanded()
221 {
222 $form = $this->factory->create('choice', null, array(
223 'multiple' => false,
224 'expanded' => false,
225 'choices' => $this->choices,
226 ));
227
228 $form->submit('b');
229
230 $this->assertEquals('b', $form->getData());
231 $this->assertEquals('b', $form->getViewData());
232 }
233
234 public function testSubmitSingleNonExpandedObjectChoices()
235 {
236 $form = $this->factory->create('choice', null, array(
237 'multiple' => false,
238 'expanded' => false,
239 'choice_list' => new ObjectChoiceList(
240 $this->objectChoices,
241 // label path
242 'name',
243 array(),
244 null,
245 // value path
246 'id'
247 ),
248 ));
249
250 // "id" value of the second entry
251 $form->submit('2');
252
253 $this->assertEquals($this->objectChoices[1], $form->getData());
254 $this->assertEquals('2', $form->getViewData());
255 }
256
257 public function testSubmitMultipleNonExpanded()
258 {
259 $form = $this->factory->create('choice', null, array(
260 'multiple' => true,
261 'expanded' => false,
262 'choices' => $this->choices,
263 ));
264
265 $form->submit(array('a', 'b'));
266
267 $this->assertEquals(array('a', 'b'), $form->getData());
268 $this->assertEquals(array('a', 'b'), $form->getViewData());
269 }
270
271 public function testSubmitMultipleNonExpandedObjectChoices()
272 {
273 $form = $this->factory->create('choice', null, array(
274 'multiple' => true,
275 'expanded' => false,
276 'choice_list' => new ObjectChoiceList(
277 $this->objectChoices,
278 // label path
279 'name',
280 array(),
281 null,
282 // value path
283 'id'
284 ),
285 ));
286
287 $form->submit(array('2', '3'));
288
289 $this->assertEquals(array($this->objectChoices[1], $this->objectChoices[2]), $form->getData());
290 $this->assertEquals(array('2', '3'), $form->getViewData());
291 }
292
293 public function testSubmitSingleExpandedRequired()
294 {
295 $form = $this->factory->create('choice', null, array(
296 'multiple' => false,
297 'expanded' => true,
298 'required' => true,
299 'choices' => $this->choices,
300 ));
301
302 $form->submit('b');
303
304 $this->assertSame('b', $form->getData());
305 $this->assertSame(array(
306 0 => false,
307 1 => true,
308 2 => false,
309 3 => false,
310 4 => false,
311 ), $form->getViewData());
312
313 $this->assertFalse($form[0]->getData());
314 $this->assertTrue($form[1]->getData());
315 $this->assertFalse($form[2]->getData());
316 $this->assertFalse($form[3]->getData());
317 $this->assertFalse($form[4]->getData());
318 $this->assertNull($form[0]->getViewData());
319 $this->assertSame('b', $form[1]->getViewData());
320 $this->assertNull($form[2]->getViewData());
321 $this->assertNull($form[3]->getViewData());
322 $this->assertNull($form[4]->getViewData());
323 }
324
325 public function testSubmitSingleExpandedNonRequired()
326 {
327 $form = $this->factory->create('choice', null, array(
328 'multiple' => false,
329 'expanded' => true,
330 'required' => false,
331 'choices' => $this->choices,
332 ));
333
334 $form->submit('b');
335
336 $this->assertSame('b', $form->getData());
337 $this->assertSame(array(
338 0 => false,
339 1 => true,
340 2 => false,
341 3 => false,
342 4 => false,
343 'placeholder' => false,
344 ), $form->getViewData());
345
346 $this->assertFalse($form['placeholder']->getData());
347 $this->assertFalse($form[0]->getData());
348 $this->assertTrue($form[1]->getData());
349 $this->assertFalse($form[2]->getData());
350 $this->assertFalse($form[3]->getData());
351 $this->assertFalse($form[4]->getData());
352 $this->assertNull($form['placeholder']->getViewData());
353 $this->assertNull($form[0]->getViewData());
354 $this->assertSame('b', $form[1]->getViewData());
355 $this->assertNull($form[2]->getViewData());
356 $this->assertNull($form[3]->getViewData());
357 $this->assertNull($form[4]->getViewData());
358 }
359
360 public function testSubmitSingleExpandedRequiredNothingChecked()
361 {
362 $form = $this->factory->create('choice', null, array(
363 'multiple' => false,
364 'expanded' => true,
365 'required' => true,
366 'choices' => $this->choices,
367 ));
368
369 $form->submit(null);
370
371 $this->assertNull($form->getData());
372 $this->assertSame(array(
373 0 => false,
374 1 => false,
375 2 => false,
376 3 => false,
377 4 => false,
378 ), $form->getViewData());
379
380 $this->assertFalse($form[0]->getData());
381 $this->assertFalse($form[1]->getData());
382 $this->assertFalse($form[2]->getData());
383 $this->assertFalse($form[3]->getData());
384 $this->assertFalse($form[4]->getData());
385 $this->assertNull($form[0]->getViewData());
386 $this->assertNull($form[1]->getViewData());
387 $this->assertNull($form[2]->getViewData());
388 $this->assertNull($form[3]->getViewData());
389 $this->assertNull($form[4]->getViewData());
390 }
391
392 public function testSubmitSingleExpandedNonRequiredNothingChecked()
393 {
394 $form = $this->factory->create('choice', null, array(
395 'multiple' => false,
396 'expanded' => true,
397 'required' => false,
398 'choices' => $this->choices,
399 ));
400
401 $form->submit(null);
402
403 $this->assertNull($form->getData());
404 $this->assertSame(array(
405 0 => false,
406 1 => false,
407 2 => false,
408 3 => false,
409 4 => false,
410 'placeholder' => true,
411 ), $form->getViewData());
412
413 $this->assertTrue($form['placeholder']->getData());
414 $this->assertFalse($form[0]->getData());
415 $this->assertFalse($form[1]->getData());
416 $this->assertFalse($form[2]->getData());
417 $this->assertFalse($form[3]->getData());
418 $this->assertFalse($form[4]->getData());
419 $this->assertSame('', $form['placeholder']->getViewData());
420 $this->assertNull($form[0]->getViewData());
421 $this->assertNull($form[1]->getViewData());
422 $this->assertNull($form[2]->getViewData());
423 $this->assertNull($form[3]->getViewData());
424 $this->assertNull($form[4]->getViewData());
425 }
426
427 public function testSubmitFalseToSingleExpandedRequiredDoesNotProduceExtraChildrenError()
428 {
429 $form = $this->factory->create('choice', null, array(
430 'multiple' => false,
431 'expanded' => true,
432 'required' => true,
433 'choices' => $this->choices,
434 ));
435
436 $form->submit(false);
437
438 $this->assertEmpty($form->getExtraData());
439 $this->assertNull($form->getData());
440 }
441
442 public function testSubmitFalseToSingleExpandedNonRequiredDoesNotProduceExtraChildrenError()
443 {
444 $form = $this->factory->create('choice', null, array(
445 'multiple' => false,
446 'expanded' => true,
447 'required' => false,
448 'choices' => $this->choices,
449 ));
450
451 $form->submit(false);
452
453 $this->assertEmpty($form->getExtraData());
454 $this->assertNull($form->getData());
455 }
456
457 public function testSubmitSingleExpandedWithEmptyChild()
458 {
459 $form = $this->factory->create('choice', null, array(
460 'multiple' => false,
461 'expanded' => true,
462 'choices' => array(
463 '' => 'Empty',
464 1 => 'Not empty',
465 ),
466 ));
467
468 $form->submit('');
469
470 $this->assertNull($form->getData());
471 $this->assertTrue($form[0]->getData());
472 $this->assertFalse($form[1]->getData());
473 $this->assertSame('', $form[0]->getViewData());
474 $this->assertNull($form[1]->getViewData());
475 }
476
477 public function testSubmitSingleExpandedObjectChoices()
478 {
479 $form = $this->factory->create('choice', null, array(
480 'multiple' => false,
481 'expanded' => true,
482 'choice_list' => new ObjectChoiceList(
483 $this->objectChoices,
484 // label path
485 'name',
486 array(),
487 null,
488 // value path
489 'id'
490 ),
491 ));
492
493 $form->submit('2');
494
495 $this->assertSame($this->objectChoices[1], $form->getData());
496 $this->assertFalse($form[0]->getData());
497 $this->assertTrue($form[1]->getData());
498 $this->assertFalse($form[2]->getData());
499 $this->assertFalse($form[3]->getData());
500 $this->assertFalse($form[4]->getData());
501 $this->assertNull($form[0]->getViewData());
502 $this->assertSame('2', $form[1]->getViewData());
503 $this->assertNull($form[2]->getViewData());
504 $this->assertNull($form[3]->getViewData());
505 $this->assertNull($form[4]->getViewData());
506 }
507
508 public function testSubmitSingleExpandedNumericChoices()
509 {
510 $form = $this->factory->create('choice', null, array(
511 'multiple' => false,
512 'expanded' => true,
513 'choices' => $this->numericChoices,
514 ));
515
516 $form->submit('1');
517
518 $this->assertSame(1, $form->getData());
519 $this->assertFalse($form[0]->getData());
520 $this->assertTrue($form[1]->getData());
521 $this->assertFalse($form[2]->getData());
522 $this->assertFalse($form[3]->getData());
523 $this->assertFalse($form[4]->getData());
524 $this->assertNull($form[0]->getViewData());
525 $this->assertSame('1', $form[1]->getViewData());
526 $this->assertNull($form[2]->getViewData());
527 $this->assertNull($form[3]->getViewData());
528 $this->assertNull($form[4]->getViewData());
529 }
530
531 public function testSubmitMultipleExpanded()
532 {
533 $form = $this->factory->create('choice', null, array(
534 'multiple' => true,
535 'expanded' => true,
536 'choices' => $this->choices,
537 ));
538
539 $form->submit(array('a', 'c'));
540
541 $this->assertSame(array('a', 'c'), $form->getData());
542 $this->assertTrue($form[0]->getData());
543 $this->assertFalse($form[1]->getData());
544 $this->assertTrue($form[2]->getData());
545 $this->assertFalse($form[3]->getData());
546 $this->assertFalse($form[4]->getData());
547 $this->assertSame('a', $form[0]->getViewData());
548 $this->assertNull($form[1]->getViewData());
549 $this->assertSame('c', $form[2]->getViewData());
550 $this->assertNull($form[3]->getViewData());
551 $this->assertNull($form[4]->getViewData());
552 }
553
554 public function testSubmitMultipleExpandedEmpty()
555 {
556 $form = $this->factory->create('choice', null, array(
557 'multiple' => true,
558 'expanded' => true,
559 'choices' => $this->choices,
560 ));
561
562 $form->submit(array());
563
564 $this->assertSame(array(), $form->getData());
565 $this->assertFalse($form[0]->getData());
566 $this->assertFalse($form[1]->getData());
567 $this->assertFalse($form[2]->getData());
568 $this->assertFalse($form[3]->getData());
569 $this->assertFalse($form[4]->getData());
570 $this->assertNull($form[0]->getViewData());
571 $this->assertNull($form[1]->getViewData());
572 $this->assertNull($form[2]->getViewData());
573 $this->assertNull($form[3]->getViewData());
574 $this->assertNull($form[4]->getViewData());
575 }
576
577 public function testSubmitMultipleExpandedWithEmptyChild()
578 {
579 $form = $this->factory->create('choice', null, array(
580 'multiple' => true,
581 'expanded' => true,
582 'choices' => array(
583 '' => 'Empty',
584 1 => 'Not Empty',
585 2 => 'Not Empty 2',
586 )
587 ));
588
589 $form->submit(array('', '2'));
590
591 $this->assertSame(array('', 2), $form->getData());
592 $this->assertTrue($form[0]->getData());
593 $this->assertFalse($form[1]->getData());
594 $this->assertTrue($form[2]->getData());
595 $this->assertSame('', $form[0]->getViewData());
596 $this->assertNull($form[1]->getViewData());
597 $this->assertSame('2', $form[2]->getViewData());
598 }
599
600 public function testSubmitMultipleExpandedObjectChoices()
601 {
602 $form = $this->factory->create('choice', null, array(
603 'multiple' => true,
604 'expanded' => true,
605 'choice_list' => new ObjectChoiceList(
606 $this->objectChoices,
607 // label path
608 'name',
609 array(),
610 null,
611 // value path
612 'id'
613 ),
614 ));
615
616 $form->submit(array('1', '2'));
617
618 $this->assertSame(array($this->objectChoices[0], $this->objectChoices[1]), $form->getData());
619 $this->assertTrue($form[0]->getData());
620 $this->assertTrue($form[1]->getData());
621 $this->assertFalse($form[2]->getData());
622 $this->assertFalse($form[3]->getData());
623 $this->assertFalse($form[4]->getData());
624 $this->assertSame('1', $form[0]->getViewData());
625 $this->assertSame('2', $form[1]->getViewData());
626 $this->assertNull($form[2]->getViewData());
627 $this->assertNull($form[3]->getViewData());
628 $this->assertNull($form[4]->getViewData());
629 }
630
631 public function testSubmitMultipleExpandedNumericChoices()
632 {
633 $form = $this->factory->create('choice', null, array(
634 'multiple' => true,
635 'expanded' => true,
636 'choices' => $this->numericChoices,
637 ));
638
639 $form->submit(array('1', '2'));
640
641 $this->assertSame(array(1, 2), $form->getData());
642 $this->assertFalse($form[0]->getData());
643 $this->assertTrue($form[1]->getData());
644 $this->assertTrue($form[2]->getData());
645 $this->assertFalse($form[3]->getData());
646 $this->assertFalse($form[4]->getData());
647 $this->assertNull($form[0]->getViewData());
648 $this->assertSame('1', $form[1]->getViewData());
649 $this->assertSame('2', $form[2]->getViewData());
650 $this->assertNull($form[3]->getViewData());
651 $this->assertNull($form[4]->getViewData());
652 }
653
654 /*
655 * We need this functionality to create choice fields for Boolean types,
656 * e.g. false => 'No', true => 'Yes'
657 */
658 public function testSetDataSingleNonExpandedAcceptsBoolean()
659 {
660 $form = $this->factory->create('choice', null, array(
661 'multiple' => false,
662 'expanded' => false,
663 'choices' => $this->numericChoices,
664 ));
665
666 $form->setData(false);
667
668 $this->assertFalse($form->getData());
669 $this->assertEquals('0', $form->getViewData());
670 }
671
672 public function testSetDataMultipleNonExpandedAcceptsBoolean()
673 {
674 $form = $this->factory->create('choice', null, array(
675 'multiple' => true,
676 'expanded' => false,
677 'choices' => $this->numericChoices,
678 ));
679
680 $form->setData(array(false, true));
681
682 $this->assertEquals(array(false, true), $form->getData());
683 $this->assertEquals(array('0', '1'), $form->getViewData());
684 }
685
686 public function testPassRequiredToView()
687 {
688 $form = $this->factory->create('choice', null, array(
689 'choices' => $this->choices,
690 ));
691 $view = $form->createView();
692
693 $this->assertTrue($view->vars['required']);
694 }
695
696 public function testPassNonRequiredToView()
697 {
698 $form = $this->factory->create('choice', null, array(
699 'required' => false,
700 'choices' => $this->choices,
701 ));
702 $view = $form->createView();
703
704 $this->assertFalse($view->vars['required']);
705 }
706
707 public function testPassMultipleToView()
708 {
709 $form = $this->factory->create('choice', null, array(
710 'multiple' => true,
711 'choices' => $this->choices,
712 ));
713 $view = $form->createView();
714
715 $this->assertTrue($view->vars['multiple']);
716 }
717
718 public function testPassExpandedToView()
719 {
720 $form = $this->factory->create('choice', null, array(
721 'expanded' => true,
722 'choices' => $this->choices,
723 ));
724 $view = $form->createView();
725
726 $this->assertTrue($view->vars['expanded']);
727 }
728
729 public function testEmptyValueIsNullByDefaultIfRequired()
730 {
731 $form = $this->factory->create('choice', null, array(
732 'multiple' => false,
733 'required' => true,
734 'choices' => $this->choices,
735 ));
736 $view = $form->createView();
737
738 $this->assertNull($view->vars['empty_value']);
739 }
740
741 public function testEmptyValueIsEmptyStringByDefaultIfNotRequired()
742 {
743 $form = $this->factory->create('choice', null, array(
744 'multiple' => false,
745 'required' => false,
746 'choices' => $this->choices,
747 ));
748 $view = $form->createView();
749
750 $this->assertSame('', $view->vars['empty_value']);
751 }
752
753 /**
754 * @dataProvider getOptionsWithEmptyValue
755 */
756 public function testPassEmptyValueToView($multiple, $expanded, $required, $emptyValue, $viewValue)
757 {
758 $form = $this->factory->create('choice', null, array(
759 'multiple' => $multiple,
760 'expanded' => $expanded,
761 'required' => $required,
762 'empty_value' => $emptyValue,
763 'choices' => $this->choices,
764 ));
765 $view = $form->createView();
766
767 $this->assertEquals($viewValue, $view->vars['empty_value']);
768 }
769
770 /**
771 * @dataProvider getOptionsWithEmptyValue
772 */
773 public function testDontPassEmptyValueIfContainedInChoices($multiple, $expanded, $required, $emptyValue, $viewValue)
774 {
775 $form = $this->factory->create('choice', null, array(
776 'multiple' => $multiple,
777 'expanded' => $expanded,
778 'required' => $required,
779 'empty_value' => $emptyValue,
780 'choices' => array('a' => 'A', '' => 'Empty'),
781 ));
782 $view = $form->createView();
783
784 $this->assertNull($view->vars['empty_value']);
785 }
786
787 public function getOptionsWithEmptyValue()
788 {
789 return array(
790 // single non-expanded
791 array(false, false, false, 'foobar', 'foobar'),
792 array(false, false, false, '', ''),
793 array(false, false, false, null, null),
794 array(false, false, false, false, null),
795 array(false, false, true, 'foobar', 'foobar'),
796 array(false, false, true, '', ''),
797 array(false, false, true, null, null),
798 array(false, false, true, false, null),
799 // single expanded
800 array(false, true, false, 'foobar', 'foobar'),
801 // radios should never have an empty label
802 array(false, true, false, '', 'None'),
803 array(false, true, false, null, null),
804 array(false, true, false, false, null),
805 array(false, true, true, 'foobar', 'foobar'),
806 // radios should never have an empty label
807 array(false, true, true, '', 'None'),
808 array(false, true, true, null, null),
809 array(false, true, true, false, null),
810 // multiple non-expanded
811 array(true, false, false, 'foobar', null),
812 array(true, false, false, '', null),
813 array(true, false, false, null, null),
814 array(true, false, false, false, null),
815 array(true, false, true, 'foobar', null),
816 array(true, false, true, '', null),
817 array(true, false, true, null, null),
818 array(true, false, true, false, null),
819 // multiple expanded
820 array(true, true, false, 'foobar', null),
821 array(true, true, false, '', null),
822 array(true, true, false, null, null),
823 array(true, true, false, false, null),
824 array(true, true, true, 'foobar', null),
825 array(true, true, true, '', null),
826 array(true, true, true, null, null),
827 array(true, true, true, false, null),
828 );
829 }
830
831 public function testPassChoicesToView()
832 {
833 $choices = array('a' => 'A', 'b' => 'B', 'c' => 'C', 'd' => 'D');
834 $form = $this->factory->create('choice', null, array(
835 'choices' => $choices,
836 ));
837 $view = $form->createView();
838
839 $this->assertEquals(array(
840 new ChoiceView('a', 'a', 'A'),
841 new ChoiceView('b', 'b', 'B'),
842 new ChoiceView('c', 'c', 'C'),
843 new ChoiceView('d', 'd', 'D'),
844 ), $view->vars['choices']);
845 }
846
847 public function testPassPreferredChoicesToView()
848 {
849 $choices = array('a' => 'A', 'b' => 'B', 'c' => 'C', 'd' => 'D');
850 $form = $this->factory->create('choice', null, array(
851 'choices' => $choices,
852 'preferred_choices' => array('b', 'd'),
853 ));
854 $view = $form->createView();
855
856 $this->assertEquals(array(
857 0 => new ChoiceView('a', 'a', 'A'),
858 2 => new ChoiceView('c', 'c', 'C'),
859 ), $view->vars['choices']);
860 $this->assertEquals(array(
861 1 => new ChoiceView('b', 'b', 'B'),
862 3 => new ChoiceView('d', 'd', 'D'),
863 ), $view->vars['preferred_choices']);
864 }
865
866 public function testPassHierarchicalChoicesToView()
867 {
868 $form = $this->factory->create('choice', null, array(
869 'choices' => $this->groupedChoices,
870 'preferred_choices' => array('b', 'd'),
871 ));
872 $view = $form->createView();
873
874 $this->assertEquals(array(
875 'Symfony' => array(
876 0 => new ChoiceView('a', 'a', 'Bernhard'),
877 2 => new ChoiceView('c', 'c', 'Kris'),
878 ),
879 'Doctrine' => array(
880 4 => new ChoiceView('e', 'e', 'Roman'),
881 ),
882 ), $view->vars['choices']);
883 $this->assertEquals(array(
884 'Symfony' => array(
885 1 => new ChoiceView('b', 'b', 'Fabien'),
886 ),
887 'Doctrine' => array(
888 3 => new ChoiceView('d', 'd', 'Jon'),
889 ),
890 ), $view->vars['preferred_choices']);
891 }
892
893 public function testPassChoiceDataToView()
894 {
895 $obj1 = (object) array('value' => 'a', 'label' => 'A');
896 $obj2 = (object) array('value' => 'b', 'label' => 'B');
897 $obj3 = (object) array('value' => 'c', 'label' => 'C');
898 $obj4 = (object) array('value' => 'd', 'label' => 'D');
899 $form = $this->factory->create('choice', null, array(
900 'choice_list' => new ObjectChoiceList(array($obj1, $obj2, $obj3, $obj4), 'label', array(), null, 'value'),
901 ));
902 $view = $form->createView();
903
904 $this->assertEquals(array(
905 new ChoiceView($obj1, 'a', 'A'),
906 new ChoiceView($obj2, 'b', 'B'),
907 new ChoiceView($obj3, 'c', 'C'),
908 new ChoiceView($obj4, 'd', 'D'),
909 ), $view->vars['choices']);
910 }
911
912 public function testAdjustFullNameForMultipleNonExpanded()
913 {
914 $form = $this->factory->createNamed('name', 'choice', null, array(
915 'multiple' => true,
916 'expanded' => false,
917 'choices' => $this->choices,
918 ));
919 $view = $form->createView();
920
921 $this->assertSame('name[]', $view->vars['full_name']);
922 }
923
924 // https://github.com/symfony/symfony/issues/3298
925 public function testInitializeWithEmptyChoices()
926 {
927 $this->factory->createNamed('name', 'choice', null, array(
928 'choices' => array(),
929 ));
930 }
931
932 public function testInitializeWithDefaultObjectChoice()
933 {
934 $obj1 = (object) array('value' => 'a', 'label' => 'A');
935 $obj2 = (object) array('value' => 'b', 'label' => 'B');
936 $obj3 = (object) array('value' => 'c', 'label' => 'C');
937 $obj4 = (object) array('value' => 'd', 'label' => 'D');
938
939 $form = $this->factory->create('choice', null, array(
940 'choice_list' => new ObjectChoiceList(array($obj1, $obj2, $obj3, $obj4), 'label', array(), null, 'value'),
941 // Used to break because "data_class" was inferred, which needs to
942 // remain null in every case (because it refers to the view format)
943 'data' => $obj3,
944 ));
945
946 // Trigger data initialization
947 $form->getViewData();
948 }
949}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/Type/CollectionTypeTest.php b/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/Type/CollectionTypeTest.php
deleted file mode 100644
index be3ad9db..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/Type/CollectionTypeTest.php
+++ /dev/null
@@ -1,200 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Tests\Extension\Core\Type;
13
14use Symfony\Component\Form\Form;
15
16class CollectionTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
17{
18 public function testContainsNoChildByDefault()
19 {
20 $form = $this->factory->create('collection', null, array(
21 'type' => 'text',
22 ));
23
24 $this->assertCount(0, $form);
25 }
26
27 public function testSetDataAdjustsSize()
28 {
29 $form = $this->factory->create('collection', null, array(
30 'type' => 'text',
31 'options' => array(
32 'max_length' => 20,
33 ),
34 ));
35 $form->setData(array('foo@foo.com', 'foo@bar.com'));
36
37 $this->assertInstanceOf('Symfony\Component\Form\Form', $form[0]);
38 $this->assertInstanceOf('Symfony\Component\Form\Form', $form[1]);
39 $this->assertCount(2, $form);
40 $this->assertEquals('foo@foo.com', $form[0]->getData());
41 $this->assertEquals('foo@bar.com', $form[1]->getData());
42 $this->assertEquals(20, $form[0]->getConfig()->getOption('max_length'));
43 $this->assertEquals(20, $form[1]->getConfig()->getOption('max_length'));
44
45 $form->setData(array('foo@baz.com'));
46 $this->assertInstanceOf('Symfony\Component\Form\Form', $form[0]);
47 $this->assertFalse(isset($form[1]));
48 $this->assertCount(1, $form);
49 $this->assertEquals('foo@baz.com', $form[0]->getData());
50 $this->assertEquals(20, $form[0]->getConfig()->getOption('max_length'));
51 }
52
53 public function testThrowsExceptionIfObjectIsNotTraversable()
54 {
55 $form = $this->factory->create('collection', null, array(
56 'type' => 'text',
57 ));
58 $this->setExpectedException('Symfony\Component\Form\Exception\UnexpectedTypeException');
59 $form->setData(new \stdClass());
60 }
61
62 public function testNotResizedIfSubmittedWithMissingData()
63 {
64 $form = $this->factory->create('collection', null, array(
65 'type' => 'text',
66 ));
67 $form->setData(array('foo@foo.com', 'bar@bar.com'));
68 $form->submit(array('foo@bar.com'));
69
70 $this->assertTrue($form->has('0'));
71 $this->assertTrue($form->has('1'));
72 $this->assertEquals('foo@bar.com', $form[0]->getData());
73 $this->assertEquals('', $form[1]->getData());
74 }
75
76 public function testResizedDownIfSubmittedWithMissingDataAndAllowDelete()
77 {
78 $form = $this->factory->create('collection', null, array(
79 'type' => 'text',
80 'allow_delete' => true,
81 ));
82 $form->setData(array('foo@foo.com', 'bar@bar.com'));
83 $form->submit(array('foo@foo.com'));
84
85 $this->assertTrue($form->has('0'));
86 $this->assertFalse($form->has('1'));
87 $this->assertEquals('foo@foo.com', $form[0]->getData());
88 $this->assertEquals(array('foo@foo.com'), $form->getData());
89 }
90
91 public function testNotResizedIfSubmittedWithExtraData()
92 {
93 $form = $this->factory->create('collection', null, array(
94 'type' => 'text',
95 ));
96 $form->setData(array('foo@bar.com'));
97 $form->submit(array('foo@foo.com', 'bar@bar.com'));
98
99 $this->assertTrue($form->has('0'));
100 $this->assertFalse($form->has('1'));
101 $this->assertEquals('foo@foo.com', $form[0]->getData());
102 }
103
104 public function testResizedUpIfSubmittedWithExtraDataAndAllowAdd()
105 {
106 $form = $this->factory->create('collection', null, array(
107 'type' => 'text',
108 'allow_add' => true,
109 ));
110 $form->setData(array('foo@bar.com'));
111 $form->submit(array('foo@bar.com', 'bar@bar.com'));
112
113 $this->assertTrue($form->has('0'));
114 $this->assertTrue($form->has('1'));
115 $this->assertEquals('foo@bar.com', $form[0]->getData());
116 $this->assertEquals('bar@bar.com', $form[1]->getData());
117 $this->assertEquals(array('foo@bar.com', 'bar@bar.com'), $form->getData());
118 }
119
120 public function testAllowAddButNoPrototype()
121 {
122 $form = $this->factory->create('collection', null, array(
123 'type' => 'form',
124 'allow_add' => true,
125 'prototype' => false,
126 ));
127
128 $this->assertFalse($form->has('__name__'));
129 }
130
131 public function testPrototypeMultipartPropagation()
132 {
133 $form = $this->factory
134 ->create('collection', null, array(
135 'type' => 'file',
136 'allow_add' => true,
137 'prototype' => true,
138 ))
139 ;
140
141 $this->assertTrue($form->createView()->vars['multipart']);
142 }
143
144 public function testGetDataDoesNotContainsPrototypeNameBeforeDataAreSet()
145 {
146 $form = $this->factory->create('collection', array(), array(
147 'type' => 'file',
148 'prototype' => true,
149 'allow_add' => true,
150 ));
151
152 $data = $form->getData();
153 $this->assertFalse(isset($data['__name__']));
154 }
155
156 public function testGetDataDoesNotContainsPrototypeNameAfterDataAreSet()
157 {
158 $form = $this->factory->create('collection', array(), array(
159 'type' => 'file',
160 'allow_add' => true,
161 'prototype' => true,
162 ));
163
164 $form->setData(array('foobar.png'));
165 $data = $form->getData();
166 $this->assertFalse(isset($data['__name__']));
167 }
168
169 public function testPrototypeNameOption()
170 {
171 $form = $this->factory->create('collection', null, array(
172 'type' => 'form',
173 'prototype' => true,
174 'allow_add' => true,
175 ));
176
177 $this->assertSame('__name__', $form->getConfig()->getAttribute('prototype')->getName(), '__name__ is the default');
178
179 $form = $this->factory->create('collection', null, array(
180 'type' => 'form',
181 'prototype' => true,
182 'allow_add' => true,
183 'prototype_name' => '__test__',
184 ));
185
186 $this->assertSame('__test__', $form->getConfig()->getAttribute('prototype')->getName());
187 }
188
189 public function testPrototypeDefaultLabel()
190 {
191 $form = $this->factory->create('collection', array(), array(
192 'type' => 'file',
193 'allow_add' => true,
194 'prototype' => true,
195 'prototype_name' => '__test__',
196 ));
197
198 $this->assertSame('__test__label__', $form->createView()->vars['prototype']->vars['label']);
199 }
200}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/Type/CountryTypeTest.php b/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/Type/CountryTypeTest.php
deleted file mode 100644
index 1d56e2a0..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/Type/CountryTypeTest.php
+++ /dev/null
@@ -1,52 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Tests\Extension\Core\Type;
13
14use Symfony\Component\Form\Extension\Core\View\ChoiceView;
15use Symfony\Component\Intl\Util\IntlTestHelper;
16
17class CountryTypeTest extends TypeTestCase
18{
19 protected function setUp()
20 {
21 IntlTestHelper::requireIntl($this);
22
23 parent::setUp();
24 }
25
26 public function testCountriesAreSelectable()
27 {
28 $form = $this->factory->create('country');
29 $view = $form->createView();
30 $choices = $view->vars['choices'];
31
32 // Don't check objects for identity
33 $this->assertContains(new ChoiceView('DE', 'DE', 'Germany'), $choices, '', false, false);
34 $this->assertContains(new ChoiceView('GB', 'GB', 'United Kingdom'), $choices, '', false, false);
35 $this->assertContains(new ChoiceView('US', 'US', 'United States'), $choices, '', false, false);
36 $this->assertContains(new ChoiceView('FR', 'FR', 'France'), $choices, '', false, false);
37 $this->assertContains(new ChoiceView('MY', 'MY', 'Malaysia'), $choices, '', false, false);
38 }
39
40 public function testUnknownCountryIsNotIncluded()
41 {
42 $form = $this->factory->create('country', 'country');
43 $view = $form->createView();
44 $choices = $view->vars['choices'];
45
46 foreach ($choices as $choice) {
47 if ('ZZ' === $choice->value) {
48 $this->fail('Should not contain choice "ZZ"');
49 }
50 }
51 }
52}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/Type/CurrencyTypeTest.php b/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/Type/CurrencyTypeTest.php
deleted file mode 100644
index b0eb6dc0..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/Type/CurrencyTypeTest.php
+++ /dev/null
@@ -1,37 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Tests\Extension\Core\Type;
13
14use Symfony\Component\Form\Extension\Core\View\ChoiceView;
15use Symfony\Component\Intl\Util\IntlTestHelper;
16
17class CurrencyTypeTest extends TypeTestCase
18{
19 protected function setUp()
20 {
21 IntlTestHelper::requireIntl($this);
22
23 parent::setUp();
24 }
25
26 public function testCurrenciesAreSelectable()
27 {
28 $form = $this->factory->create('currency');
29 $view = $form->createView();
30 $choices = $view->vars['choices'];
31
32 $this->assertContains(new ChoiceView('EUR', 'EUR', 'Euro'), $choices, '', false, false);
33 $this->assertContains(new ChoiceView('USD', 'USD', 'US Dollar'), $choices, '', false, false);
34 $this->assertContains(new ChoiceView('SIT', 'SIT', 'Slovenian Tolar'), $choices, '', false, false);
35 }
36
37}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/Type/DateTimeTypeTest.php b/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/Type/DateTimeTypeTest.php
deleted file mode 100644
index b9c1ebad..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/Type/DateTimeTypeTest.php
+++ /dev/null
@@ -1,477 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Tests\Extension\Core\Type;
13
14use Symfony\Component\Form\FormError;
15use Symfony\Component\Intl\Util\IntlTestHelper;
16
17class DateTimeTypeTest extends TypeTestCase
18{
19 protected function setUp()
20 {
21 IntlTestHelper::requireIntl($this);
22
23 parent::setUp();
24 }
25
26 public function testSubmitDateTime()
27 {
28 $form = $this->factory->create('datetime', null, array(
29 'model_timezone' => 'UTC',
30 'view_timezone' => 'UTC',
31 'date_widget' => 'choice',
32 'time_widget' => 'choice',
33 'input' => 'datetime',
34 ));
35
36 $form->submit(array(
37 'date' => array(
38 'day' => '2',
39 'month' => '6',
40 'year' => '2010',
41 ),
42 'time' => array(
43 'hour' => '3',
44 'minute' => '4',
45 ),
46 ));
47
48 $dateTime = new \DateTime('2010-06-02 03:04:00 UTC');
49
50 $this->assertDateTimeEquals($dateTime, $form->getData());
51 }
52
53 public function testSubmitString()
54 {
55 $form = $this->factory->create('datetime', null, array(
56 'model_timezone' => 'UTC',
57 'view_timezone' => 'UTC',
58 'input' => 'string',
59 'date_widget' => 'choice',
60 'time_widget' => 'choice',
61 ));
62
63 $form->submit(array(
64 'date' => array(
65 'day' => '2',
66 'month' => '6',
67 'year' => '2010',
68 ),
69 'time' => array(
70 'hour' => '3',
71 'minute' => '4',
72 ),
73 ));
74
75 $this->assertEquals('2010-06-02 03:04:00', $form->getData());
76 }
77
78 public function testSubmitTimestamp()
79 {
80 $form = $this->factory->create('datetime', null, array(
81 'model_timezone' => 'UTC',
82 'view_timezone' => 'UTC',
83 'input' => 'timestamp',
84 'date_widget' => 'choice',
85 'time_widget' => 'choice',
86 ));
87
88 $form->submit(array(
89 'date' => array(
90 'day' => '2',
91 'month' => '6',
92 'year' => '2010',
93 ),
94 'time' => array(
95 'hour' => '3',
96 'minute' => '4',
97 ),
98 ));
99
100 $dateTime = new \DateTime('2010-06-02 03:04:00 UTC');
101
102 $this->assertEquals($dateTime->format('U'), $form->getData());
103 }
104
105 public function testSubmitWithoutMinutes()
106 {
107 $form = $this->factory->create('datetime', null, array(
108 'model_timezone' => 'UTC',
109 'view_timezone' => 'UTC',
110 'date_widget' => 'choice',
111 'time_widget' => 'choice',
112 'input' => 'datetime',
113 'with_minutes' => false,
114 ));
115
116 $form->setData(new \DateTime('2010-06-02 03:04:05 UTC'));
117
118 $input = array(
119 'date' => array(
120 'day' => '2',
121 'month' => '6',
122 'year' => '2010',
123 ),
124 'time' => array(
125 'hour' => '3',
126 ),
127 );
128
129 $form->submit($input);
130
131 $this->assertDateTimeEquals(new \DateTime('2010-06-02 03:00:00 UTC'), $form->getData());
132 }
133
134 public function testSubmitWithSeconds()
135 {
136 $form = $this->factory->create('datetime', null, array(
137 'model_timezone' => 'UTC',
138 'view_timezone' => 'UTC',
139 'date_widget' => 'choice',
140 'time_widget' => 'choice',
141 'input' => 'datetime',
142 'with_seconds' => true,
143 ));
144
145 $form->setData(new \DateTime('2010-06-02 03:04:05 UTC'));
146
147 $input = array(
148 'date' => array(
149 'day' => '2',
150 'month' => '6',
151 'year' => '2010',
152 ),
153 'time' => array(
154 'hour' => '3',
155 'minute' => '4',
156 'second' => '5',
157 ),
158 );
159
160 $form->submit($input);
161
162 $this->assertDateTimeEquals(new \DateTime('2010-06-02 03:04:05 UTC'), $form->getData());
163 }
164
165 public function testSubmitDifferentTimezones()
166 {
167 $form = $this->factory->create('datetime', null, array(
168 'model_timezone' => 'America/New_York',
169 'view_timezone' => 'Pacific/Tahiti',
170 'date_widget' => 'choice',
171 'time_widget' => 'choice',
172 'input' => 'string',
173 'with_seconds' => true,
174 ));
175
176 $dateTime = new \DateTime('2010-06-02 03:04:05 Pacific/Tahiti');
177
178 $form->submit(array(
179 'date' => array(
180 'day' => (int) $dateTime->format('d'),
181 'month' => (int) $dateTime->format('m'),
182 'year' => (int) $dateTime->format('Y'),
183 ),
184 'time' => array(
185 'hour' => (int) $dateTime->format('H'),
186 'minute' => (int) $dateTime->format('i'),
187 'second' => (int) $dateTime->format('s'),
188 ),
189 ));
190
191 $dateTime->setTimezone(new \DateTimeZone('America/New_York'));
192
193 $this->assertEquals($dateTime->format('Y-m-d H:i:s'), $form->getData());
194 }
195
196 public function testSubmitDifferentTimezonesDateTime()
197 {
198 $form = $this->factory->create('datetime', null, array(
199 'model_timezone' => 'America/New_York',
200 'view_timezone' => 'Pacific/Tahiti',
201 'widget' => 'single_text',
202 'input' => 'datetime',
203 ));
204
205 $outputTime = new \DateTime('2010-06-02 03:04:00 Pacific/Tahiti');
206
207 $form->submit('2010-06-02T03:04:00-10:00');
208
209 $outputTime->setTimezone(new \DateTimeZone('America/New_York'));
210
211 $this->assertDateTimeEquals($outputTime, $form->getData());
212 $this->assertEquals('2010-06-02T03:04:00-10:00', $form->getViewData());
213 }
214
215 public function testSubmitStringSingleText()
216 {
217 $form = $this->factory->create('datetime', null, array(
218 'model_timezone' => 'UTC',
219 'view_timezone' => 'UTC',
220 'input' => 'string',
221 'widget' => 'single_text',
222 ));
223
224 $form->submit('2010-06-02T03:04:00Z');
225
226 $this->assertEquals('2010-06-02 03:04:00', $form->getData());
227 $this->assertEquals('2010-06-02T03:04:00Z', $form->getViewData());
228 }
229
230 public function testSubmitStringSingleTextWithSeconds()
231 {
232 $form = $this->factory->create('datetime', null, array(
233 'model_timezone' => 'UTC',
234 'view_timezone' => 'UTC',
235 'input' => 'string',
236 'widget' => 'single_text',
237 'with_seconds' => true,
238 ));
239
240 $form->submit('2010-06-02T03:04:05Z');
241
242 $this->assertEquals('2010-06-02 03:04:05', $form->getData());
243 $this->assertEquals('2010-06-02T03:04:05Z', $form->getViewData());
244 }
245
246 public function testSubmitDifferentPattern()
247 {
248 $form = $this->factory->create('datetime', null, array(
249 'date_format' => 'MM*yyyy*dd',
250 'date_widget' => 'single_text',
251 'time_widget' => 'single_text',
252 'input' => 'datetime',
253 ));
254
255 $dateTime = new \DateTime('2010-06-02 03:04');
256
257 $form->submit(array(
258 'date' => '06*2010*02',
259 'time' => '03:04',
260 ));
261
262 $this->assertDateTimeEquals($dateTime, $form->getData());
263 }
264
265 // Bug fix
266 public function testInitializeWithDateTime()
267 {
268 // Throws an exception if "data_class" option is not explicitly set
269 // to null in the type
270 $this->factory->create('datetime', new \DateTime());
271 }
272
273 public function testSingleTextWidgetShouldUseTheRightInputType()
274 {
275 $form = $this->factory->create('datetime', null, array(
276 'widget' => 'single_text',
277 ));
278
279 $view = $form->createView();
280 $this->assertEquals('datetime', $view->vars['type']);
281 }
282
283 public function testPassDefaultEmptyValueToViewIfNotRequired()
284 {
285 $form = $this->factory->create('datetime', null, array(
286 'required' => false,
287 'with_seconds' => true,
288 ));
289
290 $view = $form->createView();
291 $this->assertSame('', $view['date']['year']->vars['empty_value']);
292 $this->assertSame('', $view['date']['month']->vars['empty_value']);
293 $this->assertSame('', $view['date']['day']->vars['empty_value']);
294 $this->assertSame('', $view['time']['hour']->vars['empty_value']);
295 $this->assertSame('', $view['time']['minute']->vars['empty_value']);
296 $this->assertSame('', $view['time']['second']->vars['empty_value']);
297 }
298
299 public function testPassNoEmptyValueToViewIfRequired()
300 {
301 $form = $this->factory->create('datetime', null, array(
302 'required' => true,
303 'with_seconds' => true,
304 ));
305
306 $view = $form->createView();
307 $this->assertNull($view['date']['year']->vars['empty_value']);
308 $this->assertNull($view['date']['month']->vars['empty_value']);
309 $this->assertNull($view['date']['day']->vars['empty_value']);
310 $this->assertNull($view['time']['hour']->vars['empty_value']);
311 $this->assertNull($view['time']['minute']->vars['empty_value']);
312 $this->assertNull($view['time']['second']->vars['empty_value']);
313 }
314
315 public function testPassEmptyValueAsString()
316 {
317 $form = $this->factory->create('datetime', null, array(
318 'empty_value' => 'Empty',
319 'with_seconds' => true,
320 ));
321
322 $view = $form->createView();
323 $this->assertSame('Empty', $view['date']['year']->vars['empty_value']);
324 $this->assertSame('Empty', $view['date']['month']->vars['empty_value']);
325 $this->assertSame('Empty', $view['date']['day']->vars['empty_value']);
326 $this->assertSame('Empty', $view['time']['hour']->vars['empty_value']);
327 $this->assertSame('Empty', $view['time']['minute']->vars['empty_value']);
328 $this->assertSame('Empty', $view['time']['second']->vars['empty_value']);
329 }
330
331 public function testPassEmptyValueAsArray()
332 {
333 $form = $this->factory->create('datetime', null, array(
334 'empty_value' => array(
335 'year' => 'Empty year',
336 'month' => 'Empty month',
337 'day' => 'Empty day',
338 'hour' => 'Empty hour',
339 'minute' => 'Empty minute',
340 'second' => 'Empty second',
341 ),
342 'with_seconds' => true,
343 ));
344
345 $view = $form->createView();
346 $this->assertSame('Empty year', $view['date']['year']->vars['empty_value']);
347 $this->assertSame('Empty month', $view['date']['month']->vars['empty_value']);
348 $this->assertSame('Empty day', $view['date']['day']->vars['empty_value']);
349 $this->assertSame('Empty hour', $view['time']['hour']->vars['empty_value']);
350 $this->assertSame('Empty minute', $view['time']['minute']->vars['empty_value']);
351 $this->assertSame('Empty second', $view['time']['second']->vars['empty_value']);
352 }
353
354 public function testPassEmptyValueAsPartialArrayAddEmptyIfNotRequired()
355 {
356 $form = $this->factory->create('datetime', null, array(
357 'required' => false,
358 'empty_value' => array(
359 'year' => 'Empty year',
360 'day' => 'Empty day',
361 'hour' => 'Empty hour',
362 'second' => 'Empty second',
363 ),
364 'with_seconds' => true,
365 ));
366
367 $view = $form->createView();
368 $this->assertSame('Empty year', $view['date']['year']->vars['empty_value']);
369 $this->assertSame('', $view['date']['month']->vars['empty_value']);
370 $this->assertSame('Empty day', $view['date']['day']->vars['empty_value']);
371 $this->assertSame('Empty hour', $view['time']['hour']->vars['empty_value']);
372 $this->assertSame('', $view['time']['minute']->vars['empty_value']);
373 $this->assertSame('Empty second', $view['time']['second']->vars['empty_value']);
374 }
375
376 public function testPassEmptyValueAsPartialArrayAddNullIfRequired()
377 {
378 $form = $this->factory->create('datetime', null, array(
379 'required' => true,
380 'empty_value' => array(
381 'year' => 'Empty year',
382 'day' => 'Empty day',
383 'hour' => 'Empty hour',
384 'second' => 'Empty second',
385 ),
386 'with_seconds' => true,
387 ));
388
389 $view = $form->createView();
390 $this->assertSame('Empty year', $view['date']['year']->vars['empty_value']);
391 $this->assertNull($view['date']['month']->vars['empty_value']);
392 $this->assertSame('Empty day', $view['date']['day']->vars['empty_value']);
393 $this->assertSame('Empty hour', $view['time']['hour']->vars['empty_value']);
394 $this->assertNull($view['time']['minute']->vars['empty_value']);
395 $this->assertSame('Empty second', $view['time']['second']->vars['empty_value']);
396 }
397
398 public function testPassHtml5TypeIfSingleTextAndHtml5Format()
399 {
400 $form = $this->factory->create('datetime', null, array(
401 'widget' => 'single_text',
402 ));
403
404 $view = $form->createView();
405 $this->assertSame('datetime', $view->vars['type']);
406 }
407
408 public function testDontPassHtml5TypeIfNotHtml5Format()
409 {
410 $form = $this->factory->create('datetime', null, array(
411 'widget' => 'single_text',
412 'format' => 'yyyy-MM-dd HH:mm',
413 ));
414
415 $view = $form->createView();
416 $this->assertFalse(isset($view->vars['type']));
417 }
418
419 public function testDontPassHtml5TypeIfNotSingleText()
420 {
421 $form = $this->factory->create('datetime', null, array(
422 'widget' => 'text',
423 ));
424
425 $view = $form->createView();
426 $this->assertFalse(isset($view->vars['type']));
427 }
428
429 public function testDateTypeChoiceErrorsBubbleUp()
430 {
431 $error = new FormError('Invalid!');
432 $form = $this->factory->create('datetime', null);
433
434 $form['date']->addError($error);
435
436 $this->assertSame(array(), $form['date']->getErrors());
437 $this->assertSame(array($error), $form->getErrors());
438 }
439
440 public function testDateTypeSingleTextErrorsBubbleUp()
441 {
442 $error = new FormError('Invalid!');
443 $form = $this->factory->create('datetime', null, array(
444 'date_widget' => 'single_text'
445 ));
446
447 $form['date']->addError($error);
448
449 $this->assertSame(array(), $form['date']->getErrors());
450 $this->assertSame(array($error), $form->getErrors());
451 }
452
453 public function testTimeTypeChoiceErrorsBubbleUp()
454 {
455 $error = new FormError('Invalid!');
456 $form = $this->factory->create('datetime', null);
457
458 $form['time']->addError($error);
459
460 $this->assertSame(array(), $form['time']->getErrors());
461 $this->assertSame(array($error), $form->getErrors());
462 }
463
464 public function testTimeTypeSingleTextErrorsBubbleUp()
465 {
466 $error = new FormError('Invalid!');
467 $form = $this->factory->create('datetime', null, array(
468 'time_widget' => 'single_text'
469 ));
470
471 $form['time']->addError($error);
472
473 $this->assertSame(array(), $form['time']->getErrors());
474 $this->assertSame(array($error), $form->getErrors());
475 }
476
477}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/Type/DateTypeTest.php b/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/Type/DateTypeTest.php
deleted file mode 100644
index 2aa155e7..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/Type/DateTypeTest.php
+++ /dev/null
@@ -1,781 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Tests\Extension\Core\Type;
13
14use Symfony\Component\Form\Extension\Core\View\ChoiceView;
15use Symfony\Component\Form\FormError;
16use Symfony\Component\Intl\Util\IntlTestHelper;
17
18class DateTypeTest extends TypeTestCase
19{
20 protected function setUp()
21 {
22 parent::setUp();
23
24 // we test against "de_AT", so we need the full implementation
25 IntlTestHelper::requireFullIntl($this);
26
27 \Locale::setDefault('de_AT');
28 }
29
30 /**
31 * @expectedException \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException
32 */
33 public function testInvalidWidgetOption()
34 {
35 $this->factory->create('date', null, array(
36 'widget' => 'fake_widget',
37 ));
38 }
39
40 /**
41 * @expectedException \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException
42 */
43 public function testInvalidInputOption()
44 {
45 $this->factory->create('date', null, array(
46 'input' => 'fake_input',
47 ));
48 }
49
50 public function testSubmitFromSingleTextDateTimeWithDefaultFormat()
51 {
52 $form = $this->factory->create('date', null, array(
53 'model_timezone' => 'UTC',
54 'view_timezone' => 'UTC',
55 'widget' => 'single_text',
56 'input' => 'datetime',
57 ));
58
59 $form->submit('2010-06-02');
60
61 $this->assertDateTimeEquals(new \DateTime('2010-06-02 UTC'), $form->getData());
62 $this->assertEquals('2010-06-02', $form->getViewData());
63 }
64
65 public function testSubmitFromSingleTextDateTime()
66 {
67 $form = $this->factory->create('date', null, array(
68 'format' => \IntlDateFormatter::MEDIUM,
69 'model_timezone' => 'UTC',
70 'view_timezone' => 'UTC',
71 'widget' => 'single_text',
72 'input' => 'datetime',
73 ));
74
75 $form->submit('2.6.2010');
76
77 $this->assertDateTimeEquals(new \DateTime('2010-06-02 UTC'), $form->getData());
78 $this->assertEquals('02.06.2010', $form->getViewData());
79 }
80
81 public function testSubmitFromSingleTextString()
82 {
83 $form = $this->factory->create('date', null, array(
84 'format' => \IntlDateFormatter::MEDIUM,
85 'model_timezone' => 'UTC',
86 'view_timezone' => 'UTC',
87 'widget' => 'single_text',
88 'input' => 'string',
89 ));
90
91 $form->submit('2.6.2010');
92
93 $this->assertEquals('2010-06-02', $form->getData());
94 $this->assertEquals('02.06.2010', $form->getViewData());
95 }
96
97 public function testSubmitFromSingleTextTimestamp()
98 {
99 $form = $this->factory->create('date', null, array(
100 'format' => \IntlDateFormatter::MEDIUM,
101 'model_timezone' => 'UTC',
102 'view_timezone' => 'UTC',
103 'widget' => 'single_text',
104 'input' => 'timestamp',
105 ));
106
107 $form->submit('2.6.2010');
108
109 $dateTime = new \DateTime('2010-06-02 UTC');
110
111 $this->assertEquals($dateTime->format('U'), $form->getData());
112 $this->assertEquals('02.06.2010', $form->getViewData());
113 }
114
115 public function testSubmitFromSingleTextRaw()
116 {
117 $form = $this->factory->create('date', null, array(
118 'format' => \IntlDateFormatter::MEDIUM,
119 'model_timezone' => 'UTC',
120 'view_timezone' => 'UTC',
121 'widget' => 'single_text',
122 'input' => 'array',
123 ));
124
125 $form->submit('2.6.2010');
126
127 $output = array(
128 'day' => '2',
129 'month' => '6',
130 'year' => '2010',
131 );
132
133 $this->assertEquals($output, $form->getData());
134 $this->assertEquals('02.06.2010', $form->getViewData());
135 }
136
137 public function testSubmitFromText()
138 {
139 $form = $this->factory->create('date', null, array(
140 'model_timezone' => 'UTC',
141 'view_timezone' => 'UTC',
142 'widget' => 'text',
143 ));
144
145 $text = array(
146 'day' => '2',
147 'month' => '6',
148 'year' => '2010',
149 );
150
151 $form->submit($text);
152
153 $dateTime = new \DateTime('2010-06-02 UTC');
154
155 $this->assertDateTimeEquals($dateTime, $form->getData());
156 $this->assertEquals($text, $form->getViewData());
157 }
158
159 public function testSubmitFromChoice()
160 {
161 $form = $this->factory->create('date', null, array(
162 'model_timezone' => 'UTC',
163 'view_timezone' => 'UTC',
164 'widget' => 'choice',
165 ));
166
167 $text = array(
168 'day' => '2',
169 'month' => '6',
170 'year' => '2010',
171 );
172
173 $form->submit($text);
174
175 $dateTime = new \DateTime('2010-06-02 UTC');
176
177 $this->assertDateTimeEquals($dateTime, $form->getData());
178 $this->assertEquals($text, $form->getViewData());
179 }
180
181 public function testSubmitFromChoiceEmpty()
182 {
183 $form = $this->factory->create('date', null, array(
184 'model_timezone' => 'UTC',
185 'view_timezone' => 'UTC',
186 'widget' => 'choice',
187 'required' => false,
188 ));
189
190 $text = array(
191 'day' => '',
192 'month' => '',
193 'year' => '',
194 );
195
196 $form->submit($text);
197
198 $this->assertNull($form->getData());
199 $this->assertEquals($text, $form->getViewData());
200 }
201
202 public function testSubmitFromInputDateTimeDifferentPattern()
203 {
204 $form = $this->factory->create('date', null, array(
205 'model_timezone' => 'UTC',
206 'view_timezone' => 'UTC',
207 'format' => 'MM*yyyy*dd',
208 'widget' => 'single_text',
209 'input' => 'datetime',
210 ));
211
212 $form->submit('06*2010*02');
213
214 $this->assertDateTimeEquals(new \DateTime('2010-06-02 UTC'), $form->getData());
215 $this->assertEquals('06*2010*02', $form->getViewData());
216 }
217
218 public function testSubmitFromInputStringDifferentPattern()
219 {
220 $form = $this->factory->create('date', null, array(
221 'model_timezone' => 'UTC',
222 'view_timezone' => 'UTC',
223 'format' => 'MM*yyyy*dd',
224 'widget' => 'single_text',
225 'input' => 'string',
226 ));
227
228 $form->submit('06*2010*02');
229
230 $this->assertEquals('2010-06-02', $form->getData());
231 $this->assertEquals('06*2010*02', $form->getViewData());
232 }
233
234 public function testSubmitFromInputTimestampDifferentPattern()
235 {
236 $form = $this->factory->create('date', null, array(
237 'model_timezone' => 'UTC',
238 'view_timezone' => 'UTC',
239 'format' => 'MM*yyyy*dd',
240 'widget' => 'single_text',
241 'input' => 'timestamp',
242 ));
243
244 $form->submit('06*2010*02');
245
246 $dateTime = new \DateTime('2010-06-02 UTC');
247
248 $this->assertEquals($dateTime->format('U'), $form->getData());
249 $this->assertEquals('06*2010*02', $form->getViewData());
250 }
251
252 public function testSubmitFromInputRawDifferentPattern()
253 {
254 $form = $this->factory->create('date', null, array(
255 'model_timezone' => 'UTC',
256 'view_timezone' => 'UTC',
257 'format' => 'MM*yyyy*dd',
258 'widget' => 'single_text',
259 'input' => 'array',
260 ));
261
262 $form->submit('06*2010*02');
263
264 $output = array(
265 'day' => '2',
266 'month' => '6',
267 'year' => '2010',
268 );
269
270 $this->assertEquals($output, $form->getData());
271 $this->assertEquals('06*2010*02', $form->getViewData());
272 }
273
274 /**
275 * @dataProvider provideDateFormats
276 */
277 public function testDatePatternWithFormatOption($format, $pattern)
278 {
279 $form = $this->factory->create('date', null, array(
280 'format' => $format,
281 ));
282
283 $view = $form->createView();
284
285 $this->assertEquals($pattern, $view->vars['date_pattern']);
286 }
287
288 public function provideDateFormats()
289 {
290 return array(
291 array('dMy', '{{ day }}{{ month }}{{ year }}'),
292 array('d-M-yyyy', '{{ day }}-{{ month }}-{{ year }}'),
293 array('M d y', '{{ month }} {{ day }} {{ year }}'),
294 );
295 }
296
297 /**
298 * This test is to check that the strings '0', '1', '2', '3' are no accepted
299 * as valid IntlDateFormatter constants for FULL, LONG, MEDIUM or SHORT respectively.
300 *
301 * @expectedException \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException
302 */
303 public function testThrowExceptionIfFormatIsNoPattern()
304 {
305 $this->factory->create('date', null, array(
306 'format' => '0',
307 'widget' => 'single_text',
308 'input' => 'string',
309 ));
310 }
311
312 /**
313 * @expectedException \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException
314 */
315 public function testThrowExceptionIfFormatDoesNotContainYearMonthAndDay()
316 {
317 $this->factory->create('date', null, array(
318 'months' => array(6, 7),
319 'format' => 'yy',
320 ));
321 }
322
323 /**
324 * @expectedException \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException
325 */
326 public function testThrowExceptionIfFormatIsNoConstant()
327 {
328 $this->factory->create('date', null, array(
329 'format' => 105,
330 ));
331 }
332
333 /**
334 * @expectedException \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException
335 */
336 public function testThrowExceptionIfFormatIsInvalid()
337 {
338 $this->factory->create('date', null, array(
339 'format' => array(),
340 ));
341 }
342
343 public function testSetDataWithDifferentTimezones()
344 {
345 $form = $this->factory->create('date', null, array(
346 'format' => \IntlDateFormatter::MEDIUM,
347 'model_timezone' => 'America/New_York',
348 'view_timezone' => 'Pacific/Tahiti',
349 'input' => 'string',
350 'widget' => 'single_text',
351 ));
352
353 $form->setData('2010-06-02');
354
355 $this->assertEquals('01.06.2010', $form->getViewData());
356 }
357
358 public function testSetDataWithDifferentTimezonesDateTime()
359 {
360 $form = $this->factory->create('date', null, array(
361 'format' => \IntlDateFormatter::MEDIUM,
362 'model_timezone' => 'America/New_York',
363 'view_timezone' => 'Pacific/Tahiti',
364 'input' => 'datetime',
365 'widget' => 'single_text',
366 ));
367
368 $dateTime = new \DateTime('2010-06-02 America/New_York');
369
370 $form->setData($dateTime);
371
372 $this->assertDateTimeEquals($dateTime, $form->getData());
373 $this->assertEquals('01.06.2010', $form->getViewData());
374 }
375
376 public function testYearsOption()
377 {
378 $form = $this->factory->create('date', null, array(
379 'years' => array(2010, 2011),
380 ));
381
382 $view = $form->createView();
383
384 $this->assertEquals(array(
385 new ChoiceView('2010', '2010', '2010'),
386 new ChoiceView('2011', '2011', '2011'),
387 ), $view['year']->vars['choices']);
388 }
389
390 public function testMonthsOption()
391 {
392 $form = $this->factory->create('date', null, array(
393 'months' => array(6, 7),
394 ));
395
396 $view = $form->createView();
397
398 $this->assertEquals(array(
399 new ChoiceView('6', '6', '06'),
400 new ChoiceView('7', '7', '07'),
401 ), $view['month']->vars['choices']);
402 }
403
404 public function testMonthsOptionShortFormat()
405 {
406 $form = $this->factory->create('date', null, array(
407 'months' => array(1, 4),
408 'format' => 'dd.MMM.yy',
409 ));
410
411 $view = $form->createView();
412
413 $this->assertEquals(array(
414 new ChoiceView('1', '1', 'Jän'),
415 new ChoiceView('4', '4', 'Apr.')
416 ), $view['month']->vars['choices']);
417 }
418
419 public function testMonthsOptionLongFormat()
420 {
421 $form = $this->factory->create('date', null, array(
422 'months' => array(1, 4),
423 'format' => 'dd.MMMM.yy',
424 ));
425
426 $view = $form->createView();
427
428 $this->assertEquals(array(
429 new ChoiceView('1', '1', 'Jänner'),
430 new ChoiceView('4', '4', 'April'),
431 ), $view['month']->vars['choices']);
432 }
433
434 public function testMonthsOptionLongFormatWithDifferentTimezone()
435 {
436 $form = $this->factory->create('date', null, array(
437 'months' => array(1, 4),
438 'format' => 'dd.MMMM.yy',
439 ));
440
441 $view = $form->createView();
442
443 $this->assertEquals(array(
444 new ChoiceView('1', '1', 'Jänner'),
445 new ChoiceView('4', '4', 'April'),
446 ), $view['month']->vars['choices']);
447 }
448
449 public function testIsDayWithinRangeReturnsTrueIfWithin()
450 {
451 $form = $this->factory->create('date', null, array(
452 'days' => array(6, 7),
453 ));
454
455 $view = $form->createView();
456
457 $this->assertEquals(array(
458 new ChoiceView('6', '6', '06'),
459 new ChoiceView('7', '7', '07'),
460 ), $view['day']->vars['choices']);
461 }
462
463 public function testIsPartiallyFilledReturnsFalseIfSingleText()
464 {
465 $this->markTestIncomplete('Needs to be reimplemented using validators');
466
467 $form = $this->factory->create('date', null, array(
468 'model_timezone' => 'UTC',
469 'view_timezone' => 'UTC',
470 'widget' => 'single_text',
471 ));
472
473 $form->submit('7.6.2010');
474
475 $this->assertFalse($form->isPartiallyFilled());
476 }
477
478 public function testIsPartiallyFilledReturnsFalseIfChoiceAndCompletelyEmpty()
479 {
480 $this->markTestIncomplete('Needs to be reimplemented using validators');
481
482 $form = $this->factory->create('date', null, array(
483 'model_timezone' => 'UTC',
484 'view_timezone' => 'UTC',
485 'widget' => 'choice',
486 ));
487
488 $form->submit(array(
489 'day' => '',
490 'month' => '',
491 'year' => '',
492 ));
493
494 $this->assertFalse($form->isPartiallyFilled());
495 }
496
497 public function testIsPartiallyFilledReturnsFalseIfChoiceAndCompletelyFilled()
498 {
499 $this->markTestIncomplete('Needs to be reimplemented using validators');
500
501 $form = $this->factory->create('date', null, array(
502 'model_timezone' => 'UTC',
503 'view_timezone' => 'UTC',
504 'widget' => 'choice',
505 ));
506
507 $form->submit(array(
508 'day' => '2',
509 'month' => '6',
510 'year' => '2010',
511 ));
512
513 $this->assertFalse($form->isPartiallyFilled());
514 }
515
516 public function testIsPartiallyFilledReturnsTrueIfChoiceAndDayEmpty()
517 {
518 $this->markTestIncomplete('Needs to be reimplemented using validators');
519
520 $form = $this->factory->create('date', null, array(
521 'model_timezone' => 'UTC',
522 'view_timezone' => 'UTC',
523 'widget' => 'choice',
524 ));
525
526 $form->submit(array(
527 'day' => '',
528 'month' => '6',
529 'year' => '2010',
530 ));
531
532 $this->assertTrue($form->isPartiallyFilled());
533 }
534
535 public function testPassDatePatternToView()
536 {
537 $form = $this->factory->create('date');
538 $view = $form->createView();
539
540 $this->assertSame('{{ day }}{{ month }}{{ year }}', $view->vars['date_pattern']);
541 }
542
543 public function testPassDatePatternToViewDifferentFormat()
544 {
545 $form = $this->factory->create('date', null, array(
546 'format' => \IntlDateFormatter::LONG,
547 ));
548
549 $view = $form->createView();
550
551 $this->assertSame('{{ day }}{{ month }}{{ year }}', $view->vars['date_pattern']);
552 }
553
554 public function testPassDatePatternToViewDifferentPattern()
555 {
556 $form = $this->factory->create('date', null, array(
557 'format' => 'MMyyyydd'
558 ));
559
560 $view = $form->createView();
561
562 $this->assertSame('{{ month }}{{ year }}{{ day }}', $view->vars['date_pattern']);
563 }
564
565 public function testPassDatePatternToViewDifferentPatternWithSeparators()
566 {
567 $form = $this->factory->create('date', null, array(
568 'format' => 'MM*yyyy*dd'
569 ));
570
571 $view = $form->createView();
572
573 $this->assertSame('{{ month }}*{{ year }}*{{ day }}', $view->vars['date_pattern']);
574 }
575
576 public function testDontPassDatePatternIfText()
577 {
578 $form = $this->factory->create('date', null, array(
579 'widget' => 'single_text',
580 ));
581 $view = $form->createView();
582
583 $this->assertFalse(isset($view->vars['date_pattern']));
584 }
585
586 public function testPassWidgetToView()
587 {
588 $form = $this->factory->create('date', null, array(
589 'widget' => 'single_text',
590 ));
591 $view = $form->createView();
592
593 $this->assertSame('single_text', $view->vars['widget']);
594 }
595
596 // Bug fix
597 public function testInitializeWithDateTime()
598 {
599 // Throws an exception if "data_class" option is not explicitly set
600 // to null in the type
601 $this->factory->create('date', new \DateTime());
602 }
603
604 public function testSingleTextWidgetShouldUseTheRightInputType()
605 {
606 $form = $this->factory->create('date', null, array(
607 'widget' => 'single_text',
608 ));
609
610 $view = $form->createView();
611 $this->assertEquals('date', $view->vars['type']);
612 }
613
614 public function testPassDefaultEmptyValueToViewIfNotRequired()
615 {
616 $form = $this->factory->create('date', null, array(
617 'required' => false,
618 ));
619
620 $view = $form->createView();
621 $this->assertSame('', $view['year']->vars['empty_value']);
622 $this->assertSame('', $view['month']->vars['empty_value']);
623 $this->assertSame('', $view['day']->vars['empty_value']);
624 }
625
626 public function testPassNoEmptyValueToViewIfRequired()
627 {
628 $form = $this->factory->create('date', null, array(
629 'required' => true,
630 ));
631
632 $view = $form->createView();
633 $this->assertNull($view['year']->vars['empty_value']);
634 $this->assertNull($view['month']->vars['empty_value']);
635 $this->assertNull($view['day']->vars['empty_value']);
636 }
637
638 public function testPassEmptyValueAsString()
639 {
640 $form = $this->factory->create('date', null, array(
641 'empty_value' => 'Empty',
642 ));
643
644 $view = $form->createView();
645 $this->assertSame('Empty', $view['year']->vars['empty_value']);
646 $this->assertSame('Empty', $view['month']->vars['empty_value']);
647 $this->assertSame('Empty', $view['day']->vars['empty_value']);
648 }
649
650 public function testPassEmptyValueAsArray()
651 {
652 $form = $this->factory->create('date', null, array(
653 'empty_value' => array(
654 'year' => 'Empty year',
655 'month' => 'Empty month',
656 'day' => 'Empty day',
657 ),
658 ));
659
660 $view = $form->createView();
661 $this->assertSame('Empty year', $view['year']->vars['empty_value']);
662 $this->assertSame('Empty month', $view['month']->vars['empty_value']);
663 $this->assertSame('Empty day', $view['day']->vars['empty_value']);
664 }
665
666 public function testPassEmptyValueAsPartialArrayAddEmptyIfNotRequired()
667 {
668 $form = $this->factory->create('date', null, array(
669 'required' => false,
670 'empty_value' => array(
671 'year' => 'Empty year',
672 'day' => 'Empty day',
673 ),
674 ));
675
676 $view = $form->createView();
677 $this->assertSame('Empty year', $view['year']->vars['empty_value']);
678 $this->assertSame('', $view['month']->vars['empty_value']);
679 $this->assertSame('Empty day', $view['day']->vars['empty_value']);
680 }
681
682 public function testPassEmptyValueAsPartialArrayAddNullIfRequired()
683 {
684 $form = $this->factory->create('date', null, array(
685 'required' => true,
686 'empty_value' => array(
687 'year' => 'Empty year',
688 'day' => 'Empty day',
689 ),
690 ));
691
692 $view = $form->createView();
693 $this->assertSame('Empty year', $view['year']->vars['empty_value']);
694 $this->assertNull($view['month']->vars['empty_value']);
695 $this->assertSame('Empty day', $view['day']->vars['empty_value']);
696 }
697
698 public function testPassHtml5TypeIfSingleTextAndHtml5Format()
699 {
700 $form = $this->factory->create('date', null, array(
701 'widget' => 'single_text',
702 ));
703
704 $view = $form->createView();
705 $this->assertSame('date', $view->vars['type']);
706 }
707
708 public function testDontPassHtml5TypeIfNotHtml5Format()
709 {
710 $form = $this->factory->create('date', null, array(
711 'widget' => 'single_text',
712 'format' => \IntlDateFormatter::MEDIUM,
713 ));
714
715 $view = $form->createView();
716 $this->assertFalse(isset($view->vars['type']));
717 }
718
719 public function testDontPassHtml5TypeIfNotSingleText()
720 {
721 $form = $this->factory->create('date', null, array(
722 'widget' => 'text',
723 ));
724
725 $view = $form->createView();
726 $this->assertFalse(isset($view->vars['type']));
727 }
728
729 public function provideCompoundWidgets()
730 {
731 return array(
732 array('text'),
733 array('choice'),
734 );
735 }
736
737 /**
738 * @dataProvider provideCompoundWidgets
739 */
740 public function testYearErrorsBubbleUp($widget)
741 {
742 $error = new FormError('Invalid!');
743 $form = $this->factory->create('date', null, array(
744 'widget' => $widget,
745 ));
746 $form['year']->addError($error);
747
748 $this->assertSame(array(), $form['year']->getErrors());
749 $this->assertSame(array($error), $form->getErrors());
750 }
751
752 /**
753 * @dataProvider provideCompoundWidgets
754 */
755 public function testMonthErrorsBubbleUp($widget)
756 {
757 $error = new FormError('Invalid!');
758 $form = $this->factory->create('date', null, array(
759 'widget' => $widget,
760 ));
761 $form['month']->addError($error);
762
763 $this->assertSame(array(), $form['month']->getErrors());
764 $this->assertSame(array($error), $form->getErrors());
765 }
766
767 /**
768 * @dataProvider provideCompoundWidgets
769 */
770 public function testDayErrorsBubbleUp($widget)
771 {
772 $error = new FormError('Invalid!');
773 $form = $this->factory->create('date', null, array(
774 'widget' => $widget,
775 ));
776 $form['day']->addError($error);
777
778 $this->assertSame(array(), $form['day']->getErrors());
779 $this->assertSame(array($error), $form->getErrors());
780 }
781}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/Type/FileTypeTest.php b/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/Type/FileTypeTest.php
deleted file mode 100644
index 63556eb5..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/Type/FileTypeTest.php
+++ /dev/null
@@ -1,83 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Tests\Extension\Core\Type;
13
14class FileTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
15{
16 // https://github.com/symfony/symfony/pull/5028
17 public function testSetData()
18 {
19 $form = $this->factory->createBuilder('file')->getForm();
20 $data = $this->createUploadedFileMock('abcdef', 'original.jpg', true);
21
22 $form->setData($data);
23
24 $this->assertSame($data, $form->getData());
25 }
26
27 public function testSubmit()
28 {
29 $form = $this->factory->createBuilder('file')->getForm();
30 $data = $this->createUploadedFileMock('abcdef', 'original.jpg', true);
31
32 $form->submit($data);
33
34 $this->assertSame($data, $form->getData());
35 }
36
37 // https://github.com/symfony/symfony/issues/6134
38 public function testSubmitEmpty()
39 {
40 $form = $this->factory->createBuilder('file')->getForm();
41
42 $form->submit(null);
43
44 $this->assertNull($form->getData());
45 }
46
47 public function testDontPassValueToView()
48 {
49 $form = $this->factory->create('file');
50 $form->submit(array(
51 'file' => $this->createUploadedFileMock('abcdef', 'original.jpg', true),
52 ));
53 $view = $form->createView();
54
55 $this->assertEquals('', $view->vars['value']);
56 }
57
58 private function createUploadedFileMock($name, $originalName, $valid)
59 {
60 $file = $this
61 ->getMockBuilder('Symfony\Component\HttpFoundation\File\UploadedFile')
62 ->disableOriginalConstructor()
63 ->getMock()
64 ;
65 $file
66 ->expects($this->any())
67 ->method('getBasename')
68 ->will($this->returnValue($name))
69 ;
70 $file
71 ->expects($this->any())
72 ->method('getClientOriginalName')
73 ->will($this->returnValue($originalName))
74 ;
75 $file
76 ->expects($this->any())
77 ->method('isValid')
78 ->will($this->returnValue($valid))
79 ;
80
81 return $file;
82 }
83}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/Type/FormTypeTest.php b/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/Type/FormTypeTest.php
deleted file mode 100644
index cced82f4..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/Type/FormTypeTest.php
+++ /dev/null
@@ -1,578 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Tests\Extension\Core\Type;
13
14use Symfony\Component\PropertyAccess\PropertyPath;
15use Symfony\Component\Form\Form;
16use Symfony\Component\Form\CallbackTransformer;
17use Symfony\Component\Form\Tests\Fixtures\Author;
18use Symfony\Component\Form\Tests\Fixtures\FixedDataTransformer;
19use Symfony\Component\Form\FormError;
20
21class FormTest_AuthorWithoutRefSetter
22{
23 protected $reference;
24
25 protected $referenceCopy;
26
27 public function __construct($reference)
28 {
29 $this->reference = $reference;
30 $this->referenceCopy = $reference;
31 }
32
33 // The returned object should be modified by reference without having
34 // to provide a setReference() method
35 public function getReference()
36 {
37 return $this->reference;
38 }
39
40 // The returned object is a copy, so setReferenceCopy() must be used
41 // to update it
42 public function getReferenceCopy()
43 {
44 return is_object($this->referenceCopy) ? clone $this->referenceCopy : $this->referenceCopy;
45 }
46
47 public function setReferenceCopy($reference)
48 {
49 $this->referenceCopy = $reference;
50 }
51}
52
53class FormTypeTest extends BaseTypeTest
54{
55 public function testCreateFormInstances()
56 {
57 $this->assertInstanceOf('Symfony\Component\Form\Form', $this->factory->create('form'));
58 }
59
60 public function testPassRequiredAsOption()
61 {
62 $form = $this->factory->create('form', null, array('required' => false));
63
64 $this->assertFalse($form->isRequired());
65
66 $form = $this->factory->create('form', null, array('required' => true));
67
68 $this->assertTrue($form->isRequired());
69 }
70
71 public function testSubmittedDataIsTrimmedBeforeTransforming()
72 {
73 $form = $this->factory->createBuilder('form')
74 ->addViewTransformer(new FixedDataTransformer(array(
75 null => '',
76 'reverse[a]' => 'a',
77 )))
78 ->setCompound(false)
79 ->getForm();
80
81 $form->submit(' a ');
82
83 $this->assertEquals('a', $form->getViewData());
84 $this->assertEquals('reverse[a]', $form->getData());
85 }
86
87 public function testSubmittedDataIsNotTrimmedBeforeTransformingIfNoTrimming()
88 {
89 $form = $this->factory->createBuilder('form', null, array('trim' => false))
90 ->addViewTransformer(new FixedDataTransformer(array(
91 null => '',
92 'reverse[ a ]' => ' a ',
93 )))
94 ->setCompound(false)
95 ->getForm();
96
97 $form->submit(' a ');
98
99 $this->assertEquals(' a ', $form->getViewData());
100 $this->assertEquals('reverse[ a ]', $form->getData());
101 }
102
103 public function testNonReadOnlyFormWithReadOnlyParentIsReadOnly()
104 {
105 $view = $this->factory->createNamedBuilder('parent', 'form', null, array('read_only' => true))
106 ->add('child', 'form')
107 ->getForm()
108 ->createView();
109
110 $this->assertTrue($view['child']->vars['read_only']);
111 }
112
113 public function testReadOnlyFormWithNonReadOnlyParentIsReadOnly()
114 {
115 $view = $this->factory->createNamedBuilder('parent', 'form')
116 ->add('child', 'form', array('read_only' => true))
117 ->getForm()
118 ->createView();
119
120 $this->assertTrue($view['child']->vars['read_only']);
121 }
122
123 public function testNonReadOnlyFormWithNonReadOnlyParentIsNotReadOnly()
124 {
125 $view = $this->factory->createNamedBuilder('parent', 'form')
126 ->add('child', 'form')
127 ->getForm()
128 ->createView();
129
130 $this->assertFalse($view['child']->vars['read_only']);
131 }
132
133 public function testPassMaxLengthToView()
134 {
135 $form = $this->factory->create('form', null, array('max_length' => 10));
136 $view = $form->createView();
137
138 $this->assertSame(10, $view->vars['max_length']);
139 }
140
141 public function testSubmitWithEmptyDataCreatesObjectIfClassAvailable()
142 {
143 $builder = $this->factory->createBuilder('form', null, array(
144 'data_class' => 'Symfony\Component\Form\Tests\Fixtures\Author',
145 'required' => false,
146 ));
147 $builder->add('firstName', 'text');
148 $builder->add('lastName', 'text');
149 $form = $builder->getForm();
150
151 $form->setData(null);
152 // partially empty, still an object is created
153 $form->submit(array('firstName' => 'Bernhard', 'lastName' => ''));
154
155 $author = new Author();
156 $author->firstName = 'Bernhard';
157 $author->setLastName('');
158
159 $this->assertEquals($author, $form->getData());
160 }
161
162 public function testSubmitWithEmptyDataCreatesObjectIfInitiallySubmittedWithObject()
163 {
164 $builder = $this->factory->createBuilder('form', null, array(
165 // data class is inferred from the passed object
166 'data' => new Author(),
167 'required' => false,
168 ));
169 $builder->add('firstName', 'text');
170 $builder->add('lastName', 'text');
171 $form = $builder->getForm();
172
173 $form->setData(null);
174 // partially empty, still an object is created
175 $form->submit(array('firstName' => 'Bernhard', 'lastName' => ''));
176
177 $author = new Author();
178 $author->firstName = 'Bernhard';
179 $author->setLastName('');
180
181 $this->assertEquals($author, $form->getData());
182 }
183
184 public function testSubmitWithEmptyDataCreatesArrayIfDataClassIsNull()
185 {
186 $builder = $this->factory->createBuilder('form', null, array(
187 'data_class' => null,
188 'required' => false,
189 ));
190 $builder->add('firstName', 'text');
191 $form = $builder->getForm();
192
193 $form->setData(null);
194 $form->submit(array('firstName' => 'Bernhard'));
195
196 $this->assertSame(array('firstName' => 'Bernhard'), $form->getData());
197 }
198
199 public function testSubmitEmptyWithEmptyDataCreatesNoObjectIfNotRequired()
200 {
201 $builder = $this->factory->createBuilder('form', null, array(
202 'data_class' => 'Symfony\Component\Form\Tests\Fixtures\Author',
203 'required' => false,
204 ));
205 $builder->add('firstName', 'text');
206 $builder->add('lastName', 'text');
207 $form = $builder->getForm();
208
209 $form->setData(null);
210 $form->submit(array('firstName' => '', 'lastName' => ''));
211
212 $this->assertNull($form->getData());
213 }
214
215 public function testSubmitEmptyWithEmptyDataCreatesObjectIfRequired()
216 {
217 $builder = $this->factory->createBuilder('form', null, array(
218 'data_class' => 'Symfony\Component\Form\Tests\Fixtures\Author',
219 'required' => true,
220 ));
221 $builder->add('firstName', 'text');
222 $builder->add('lastName', 'text');
223 $form = $builder->getForm();
224
225 $form->setData(null);
226 $form->submit(array('firstName' => '', 'lastName' => ''));
227
228 $this->assertEquals(new Author(), $form->getData());
229 }
230
231 /*
232 * We need something to write the field values into
233 */
234 public function testSubmitWithEmptyDataStoresArrayIfNoClassAvailable()
235 {
236 $form = $this->factory->createBuilder('form')
237 ->add('firstName', 'text')
238 ->getForm();
239
240 $form->setData(null);
241 $form->submit(array('firstName' => 'Bernhard'));
242
243 $this->assertSame(array('firstName' => 'Bernhard'), $form->getData());
244 }
245
246 public function testSubmitWithEmptyDataPassesEmptyStringToTransformerIfNotCompound()
247 {
248 $form = $this->factory->createBuilder('form')
249 ->addViewTransformer(new FixedDataTransformer(array(
250 // required for the initial, internal setData(null)
251 null => 'null',
252 // required to test that submit(null) is converted to ''
253 'empty' => '',
254 )))
255 ->setCompound(false)
256 ->getForm();
257
258 $form->submit(null);
259
260 $this->assertSame('empty', $form->getData());
261 }
262
263 public function testSubmitWithEmptyDataUsesEmptyDataOption()
264 {
265 $author = new Author();
266
267 $builder = $this->factory->createBuilder('form', null, array(
268 'data_class' => 'Symfony\Component\Form\Tests\Fixtures\Author',
269 'empty_data' => $author,
270 ));
271 $builder->add('firstName', 'text');
272 $form = $builder->getForm();
273
274 $form->submit(array('firstName' => 'Bernhard'));
275
276 $this->assertSame($author, $form->getData());
277 $this->assertEquals('Bernhard', $author->firstName);
278 }
279
280 public function provideZeros()
281 {
282 return array(
283 array(0, '0'),
284 array('0', '0'),
285 array('00000', '00000'),
286 );
287 }
288
289 /**
290 * @dataProvider provideZeros
291 * @see https://github.com/symfony/symfony/issues/1986
292 */
293 public function testSetDataThroughParamsWithZero($data, $dataAsString)
294 {
295 $form = $this->factory->create('form', null, array(
296 'data' => $data,
297 'compound' => false,
298 ));
299 $view = $form->createView();
300
301 $this->assertFalse($form->isEmpty());
302
303 $this->assertSame($dataAsString, $view->vars['value']);
304 $this->assertSame($dataAsString, $form->getData());
305 }
306
307 /**
308 * @expectedException \Symfony\Component\OptionsResolver\Exception\InvalidOptionsException
309 */
310 public function testAttributesException()
311 {
312 $this->factory->create('form', null, array('attr' => ''));
313 }
314
315 public function testNameCanBeEmptyString()
316 {
317 $form = $this->factory->createNamed('', 'form');
318
319 $this->assertEquals('', $form->getName());
320 }
321
322 public function testSubformDoesntCallSetters()
323 {
324 $author = new FormTest_AuthorWithoutRefSetter(new Author());
325
326 $builder = $this->factory->createBuilder('form', $author);
327 $builder->add('reference', 'form', array(
328 'data_class' => 'Symfony\Component\Form\Tests\Fixtures\Author',
329 ));
330 $builder->get('reference')->add('firstName', 'text');
331 $form = $builder->getForm();
332
333 $form->submit(array(
334 // reference has a getter, but not setter
335 'reference' => array(
336 'firstName' => 'Foo',
337 )
338 ));
339
340 $this->assertEquals('Foo', $author->getReference()->firstName);
341 }
342
343 public function testSubformCallsSettersIfTheObjectChanged()
344 {
345 // no reference
346 $author = new FormTest_AuthorWithoutRefSetter(null);
347 $newReference = new Author();
348
349 $builder = $this->factory->createBuilder('form', $author);
350 $builder->add('referenceCopy', 'form', array(
351 'data_class' => 'Symfony\Component\Form\Tests\Fixtures\Author',
352 ));
353 $builder->get('referenceCopy')->add('firstName', 'text');
354 $form = $builder->getForm();
355
356 $form['referenceCopy']->setData($newReference); // new author object
357
358 $form->submit(array(
359 // referenceCopy has a getter that returns a copy
360 'referenceCopy' => array(
361 'firstName' => 'Foo',
362 )
363 ));
364
365 $this->assertEquals('Foo', $author->getReferenceCopy()->firstName);
366 }
367
368 public function testSubformCallsSettersIfByReferenceIsFalse()
369 {
370 $author = new FormTest_AuthorWithoutRefSetter(new Author());
371
372 $builder = $this->factory->createBuilder('form', $author);
373 $builder->add('referenceCopy', 'form', array(
374 'data_class' => 'Symfony\Component\Form\Tests\Fixtures\Author',
375 'by_reference' => false
376 ));
377 $builder->get('referenceCopy')->add('firstName', 'text');
378 $form = $builder->getForm();
379
380 $form->submit(array(
381 // referenceCopy has a getter that returns a copy
382 'referenceCopy' => array(
383 'firstName' => 'Foo',
384 )
385 ));
386
387 // firstName can only be updated if setReferenceCopy() was called
388 $this->assertEquals('Foo', $author->getReferenceCopy()->firstName);
389 }
390
391 public function testSubformCallsSettersIfReferenceIsScalar()
392 {
393 $author = new FormTest_AuthorWithoutRefSetter('scalar');
394
395 $builder = $this->factory->createBuilder('form', $author);
396 $builder->add('referenceCopy', 'form');
397 $builder->get('referenceCopy')->addViewTransformer(new CallbackTransformer(
398 function () {},
399 function ($value) { // reverseTransform
400
401 return 'foobar';
402 }
403 ));
404 $form = $builder->getForm();
405
406 $form->submit(array(
407 'referenceCopy' => array(), // doesn't matter actually
408 ));
409
410 // firstName can only be updated if setReferenceCopy() was called
411 $this->assertEquals('foobar', $author->getReferenceCopy());
412 }
413
414 public function testSubformAlwaysInsertsIntoArrays()
415 {
416 $ref1 = new Author();
417 $ref2 = new Author();
418 $author = array('referenceCopy' => $ref1);
419
420 $builder = $this->factory->createBuilder('form');
421 $builder->setData($author);
422 $builder->add('referenceCopy', 'form');
423 $builder->get('referenceCopy')->addViewTransformer(new CallbackTransformer(
424 function () {},
425 function ($value) use ($ref2) { // reverseTransform
426
427 return $ref2;
428 }
429 ));
430 $form = $builder->getForm();
431
432 $form->submit(array(
433 'referenceCopy' => array('a' => 'b'), // doesn't matter actually
434 ));
435
436 // the new reference was inserted into the array
437 $author = $form->getData();
438 $this->assertSame($ref2, $author['referenceCopy']);
439 }
440
441 public function testPassMultipartTrueIfAnyChildIsMultipartToView()
442 {
443 $view = $this->factory->createBuilder('form')
444 ->add('foo', 'text')
445 ->add('bar', 'file')
446 ->getForm()
447 ->createView();
448
449 $this->assertTrue($view->vars['multipart']);
450 }
451
452 public function testViewIsNotRenderedByDefault()
453 {
454 $view = $this->factory->createBuilder('form')
455 ->add('foo', 'form')
456 ->getForm()
457 ->createView();
458
459 $this->assertFalse($view->isRendered());
460 }
461
462 public function testErrorBubblingIfCompound()
463 {
464 $form = $this->factory->create('form', null, array(
465 'compound' => true,
466 ));
467
468 $this->assertTrue($form->getConfig()->getErrorBubbling());
469 }
470
471 public function testNoErrorBubblingIfNotCompound()
472 {
473 $form = $this->factory->create('form', null, array(
474 'compound' => false,
475 ));
476
477 $this->assertFalse($form->getConfig()->getErrorBubbling());
478 }
479
480 public function testOverrideErrorBubbling()
481 {
482 $form = $this->factory->create('form', null, array(
483 'compound' => false,
484 'error_bubbling' => true,
485 ));
486
487 $this->assertTrue($form->getConfig()->getErrorBubbling());
488 }
489
490 public function testPropertyPath()
491 {
492 $form = $this->factory->create('form', null, array(
493 'property_path' => 'foo',
494 ));
495
496 $this->assertEquals(new PropertyPath('foo'), $form->getPropertyPath());
497 $this->assertTrue($form->getConfig()->getMapped());
498 }
499
500 public function testPropertyPathNullImpliesDefault()
501 {
502 $form = $this->factory->createNamed('name', 'form', null, array(
503 'property_path' => null,
504 ));
505
506 $this->assertEquals(new PropertyPath('name'), $form->getPropertyPath());
507 $this->assertTrue($form->getConfig()->getMapped());
508 }
509
510 public function testNotMapped()
511 {
512 $form = $this->factory->create('form', null, array(
513 'property_path' => 'foo',
514 'mapped' => false,
515 ));
516
517 $this->assertEquals(new PropertyPath('foo'), $form->getPropertyPath());
518 $this->assertFalse($form->getConfig()->getMapped());
519 }
520
521 public function testViewValidNotSubmitted()
522 {
523 $form = $this->factory->create('form');
524 $view = $form->createView();
525 $this->assertTrue($view->vars['valid']);
526 }
527
528 public function testViewNotValidSubmitted()
529 {
530 $form = $this->factory->create('form');
531 $form->submit(array());
532 $form->addError(new FormError('An error'));
533 $view = $form->createView();
534 $this->assertFalse($view->vars['valid']);
535 }
536
537 public function testDataOptionSupersedesSetDataCalls()
538 {
539 $form = $this->factory->create('form', null, array(
540 'data' => 'default',
541 'compound' => false,
542 ));
543
544 $form->setData('foobar');
545
546 $this->assertSame('default', $form->getData());
547 }
548
549 public function testNormDataIsPassedToView()
550 {
551 $view = $this->factory->createBuilder('form')
552 ->addViewTransformer(new FixedDataTransformer(array(
553 'foo' => 'bar',
554 )))
555 ->setData('foo')
556 ->getForm()
557 ->createView();
558
559 $this->assertSame('foo', $view->vars['data']);
560 $this->assertSame('bar', $view->vars['value']);
561 }
562
563 // https://github.com/symfony/symfony/issues/6862
564 public function testPassZeroLabelToView()
565 {
566 $view = $this->factory->create('form', null, array(
567 'label' => '0'
568 ))
569 ->createView();
570
571 $this->assertSame('0', $view->vars['label']);
572 }
573
574 protected function getTestedType()
575 {
576 return 'form';
577 }
578}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/Type/IntegerTypeTest.php b/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/Type/IntegerTypeTest.php
deleted file mode 100644
index 998bbe01..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/Type/IntegerTypeTest.php
+++ /dev/null
@@ -1,34 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Tests\Extension\Core\Type;
13
14use Symfony\Component\Intl\Util\IntlTestHelper;
15
16class IntegerTypeTest extends TypeTestCase
17{
18 protected function setUp()
19 {
20 IntlTestHelper::requireIntl($this);
21
22 parent::setUp();
23 }
24
25 public function testSubmitCastsToInteger()
26 {
27 $form = $this->factory->create('integer');
28
29 $form->submit('1.678');
30
31 $this->assertSame(1, $form->getData());
32 $this->assertSame('1', $form->getViewData());
33 }
34}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/Type/LanguageTypeTest.php b/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/Type/LanguageTypeTest.php
deleted file mode 100644
index 24434b21..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/Type/LanguageTypeTest.php
+++ /dev/null
@@ -1,47 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Tests\Extension\Core\Type;
13
14use Symfony\Component\Form\Extension\Core\View\ChoiceView;
15use Symfony\Component\Intl\Util\IntlTestHelper;
16
17class LanguageTypeTest extends TypeTestCase
18{
19 protected function setUp()
20 {
21 IntlTestHelper::requireIntl($this);
22
23 parent::setUp();
24 }
25
26 public function testCountriesAreSelectable()
27 {
28 $form = $this->factory->create('language');
29 $view = $form->createView();
30 $choices = $view->vars['choices'];
31
32 $this->assertContains(new ChoiceView('en', 'en', 'English'), $choices, '', false, false);
33 $this->assertContains(new ChoiceView('en_GB', 'en_GB', 'British English'), $choices, '', false, false);
34 $this->assertContains(new ChoiceView('en_US', 'en_US', 'U.S. English'), $choices, '', false, false);
35 $this->assertContains(new ChoiceView('fr', 'fr', 'French'), $choices, '', false, false);
36 $this->assertContains(new ChoiceView('my', 'my', 'Burmese'), $choices, '', false, false);
37 }
38
39 public function testMultipleLanguagesIsNotIncluded()
40 {
41 $form = $this->factory->create('language', 'language');
42 $view = $form->createView();
43 $choices = $view->vars['choices'];
44
45 $this->assertNotContains(new ChoiceView('mul', 'mul', 'Mehrsprachig'), $choices, '', false, false);
46 }
47}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/Type/LocaleTypeTest.php b/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/Type/LocaleTypeTest.php
deleted file mode 100644
index e402cb4b..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/Type/LocaleTypeTest.php
+++ /dev/null
@@ -1,36 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Tests\Extension\Core\Type;
13
14use Symfony\Component\Form\Extension\Core\View\ChoiceView;
15use Symfony\Component\Intl\Util\IntlTestHelper;
16
17class LocaleTypeTest extends TypeTestCase
18{
19 protected function setUp()
20 {
21 IntlTestHelper::requireIntl($this);
22
23 parent::setUp();
24 }
25
26 public function testLocalesAreSelectable()
27 {
28 $form = $this->factory->create('locale');
29 $view = $form->createView();
30 $choices = $view->vars['choices'];
31
32 $this->assertContains(new ChoiceView('en', 'en', 'English'), $choices, '', false, false);
33 $this->assertContains(new ChoiceView('en_GB', 'en_GB', 'English (United Kingdom)'), $choices, '', false, false);
34 $this->assertContains(new ChoiceView('zh_Hant_MO', 'zh_Hant_MO', 'Chinese (Traditional, Macau SAR China)'), $choices, '', false, false);
35 }
36}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/Type/MoneyTypeTest.php b/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/Type/MoneyTypeTest.php
deleted file mode 100644
index 97fc37fa..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/Type/MoneyTypeTest.php
+++ /dev/null
@@ -1,59 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Tests\Extension\Core\Type;
13
14use Symfony\Component\Intl\Util\IntlTestHelper;
15
16class MoneyTypeTest extends TypeTestCase
17{
18 protected function setUp()
19 {
20 // we test against different locales, so we need the full
21 // implementation
22 IntlTestHelper::requireFullIntl($this);
23
24 parent::setUp();
25 }
26
27 public function testPassMoneyPatternToView()
28 {
29 \Locale::setDefault('de_DE');
30
31 $form = $this->factory->create('money');
32 $view = $form->createView();
33
34 $this->assertSame('{{ widget }} €', $view->vars['money_pattern']);
35 }
36
37 public function testMoneyPatternWorksForYen()
38 {
39 \Locale::setDefault('en_US');
40
41 $form = $this->factory->create('money', null, array('currency' => 'JPY'));
42 $view = $form->createView();
43 $this->assertTrue((Boolean) strstr($view->vars['money_pattern'], '¥'));
44 }
45
46 // https://github.com/symfony/symfony/issues/5458
47 public function testPassDifferentPatternsForDifferentCurrencies()
48 {
49 \Locale::setDefault('de_DE');
50
51 $form1 = $this->factory->create('money', null, array('currency' => 'GBP'));
52 $form2 = $this->factory->create('money', null, array('currency' => 'EUR'));
53 $view1 = $form1->createView();
54 $view2 = $form2->createView();
55
56 $this->assertSame('{{ widget }} £', $view1->vars['money_pattern']);
57 $this->assertSame('{{ widget }} €', $view2->vars['money_pattern']);
58 }
59}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/Type/NumberTypeTest.php b/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/Type/NumberTypeTest.php
deleted file mode 100644
index e5b3dd74..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/Type/NumberTypeTest.php
+++ /dev/null
@@ -1,63 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Tests\Extension\Core\Type;
13
14use Symfony\Component\Intl\Util\IntlTestHelper;
15
16class NumberTypeTest extends TypeTestCase
17{
18 protected function setUp()
19 {
20 parent::setUp();
21
22 // we test against "de_DE", so we need the full implementation
23 IntlTestHelper::requireFullIntl($this);
24
25 \Locale::setDefault('de_DE');
26 }
27
28 public function testDefaultFormatting()
29 {
30 $form = $this->factory->create('number');
31 $form->setData('12345.67890');
32 $view = $form->createView();
33
34 $this->assertSame('12345,679', $view->vars['value']);
35 }
36
37 public function testDefaultFormattingWithGrouping()
38 {
39 $form = $this->factory->create('number', null, array('grouping' => true));
40 $form->setData('12345.67890');
41 $view = $form->createView();
42
43 $this->assertSame('12.345,679', $view->vars['value']);
44 }
45
46 public function testDefaultFormattingWithPrecision()
47 {
48 $form = $this->factory->create('number', null, array('precision' => 2));
49 $form->setData('12345.67890');
50 $view = $form->createView();
51
52 $this->assertSame('12345,68', $view->vars['value']);
53 }
54
55 public function testDefaultFormattingWithRounding()
56 {
57 $form = $this->factory->create('number', null, array('precision' => 0, 'rounding_mode' => \NumberFormatter::ROUND_UP));
58 $form->setData('12345.54321');
59 $view = $form->createView();
60
61 $this->assertSame('12346', $view->vars['value']);
62 }
63}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/Type/PasswordTypeTest.php b/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/Type/PasswordTypeTest.php
deleted file mode 100644
index bccb6f7b..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/Type/PasswordTypeTest.php
+++ /dev/null
@@ -1,51 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Tests\Extension\Core\Type;
13
14class PasswordTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
15{
16 public function testEmptyIfNotSubmitted()
17 {
18 $form = $this->factory->create('password');
19 $form->setData('pAs5w0rd');
20 $view = $form->createView();
21
22 $this->assertSame('', $view->vars['value']);
23 }
24
25 public function testEmptyIfSubmitted()
26 {
27 $form = $this->factory->create('password');
28 $form->submit('pAs5w0rd');
29 $view = $form->createView();
30
31 $this->assertSame('', $view->vars['value']);
32 }
33
34 public function testNotEmptyIfSubmittedAndNotAlwaysEmpty()
35 {
36 $form = $this->factory->create('password', null, array('always_empty' => false));
37 $form->submit('pAs5w0rd');
38 $view = $form->createView();
39
40 $this->assertSame('pAs5w0rd', $view->vars['value']);
41 }
42
43 public function testNotTrimmed()
44 {
45 $form = $this->factory->create('password', null);
46 $form->submit(' pAs5w0rd ');
47 $data = $form->getData();
48
49 $this->assertSame(' pAs5w0rd ', $data);
50 }
51}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/Type/RepeatedTypeTest.php b/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/Type/RepeatedTypeTest.php
deleted file mode 100644
index 9e125d78..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/Type/RepeatedTypeTest.php
+++ /dev/null
@@ -1,149 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Tests\Extension\Core\Type;
13
14class RepeatedTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
15{
16 protected $form;
17
18 protected function setUp()
19 {
20 parent::setUp();
21
22 $this->form = $this->factory->create('repeated', null, array(
23 'type' => 'text',
24 ));
25 $this->form->setData(null);
26 }
27
28 public function testSetData()
29 {
30 $this->form->setData('foobar');
31
32 $this->assertEquals('foobar', $this->form['first']->getData());
33 $this->assertEquals('foobar', $this->form['second']->getData());
34 }
35
36 public function testSetOptions()
37 {
38 $form = $this->factory->create('repeated', null, array(
39 'type' => 'text',
40 'options' => array('label' => 'Global'),
41 ));
42
43 $this->assertEquals('Global', $form['first']->getConfig()->getOption('label'));
44 $this->assertEquals('Global', $form['second']->getConfig()->getOption('label'));
45 $this->assertTrue($form['first']->isRequired());
46 $this->assertTrue($form['second']->isRequired());
47 }
48
49 public function testSetOptionsPerChild()
50 {
51 $form = $this->factory->create('repeated', null, array(
52 // the global required value cannot be overridden
53 'type' => 'text',
54 'first_options' => array('label' => 'Test', 'required' => false),
55 'second_options' => array('label' => 'Test2')
56 ));
57
58 $this->assertEquals('Test', $form['first']->getConfig()->getOption('label'));
59 $this->assertEquals('Test2', $form['second']->getConfig()->getOption('label'));
60 $this->assertTrue($form['first']->isRequired());
61 $this->assertTrue($form['second']->isRequired());
62 }
63
64 public function testSetRequired()
65 {
66 $form = $this->factory->create('repeated', null, array(
67 'required' => false,
68 'type' => 'text',
69 ));
70
71 $this->assertFalse($form['first']->isRequired());
72 $this->assertFalse($form['second']->isRequired());
73 }
74
75 public function testSetErrorBubblingToTrue()
76 {
77 $form = $this->factory->create('repeated', null, array(
78 'error_bubbling' => true,
79 ));
80
81 $this->assertTrue($form->getConfig()->getOption('error_bubbling'));
82 $this->assertTrue($form['first']->getConfig()->getOption('error_bubbling'));
83 $this->assertTrue($form['second']->getConfig()->getOption('error_bubbling'));
84 }
85
86 public function testSetErrorBubblingToFalse()
87 {
88 $form = $this->factory->create('repeated', null, array(
89 'error_bubbling' => false,
90 ));
91
92 $this->assertFalse($form->getConfig()->getOption('error_bubbling'));
93 $this->assertFalse($form['first']->getConfig()->getOption('error_bubbling'));
94 $this->assertFalse($form['second']->getConfig()->getOption('error_bubbling'));
95 }
96
97 public function testSetErrorBubblingIndividually()
98 {
99 $form = $this->factory->create('repeated', null, array(
100 'error_bubbling' => true,
101 'options' => array('error_bubbling' => false),
102 'second_options' => array('error_bubbling' => true),
103 ));
104
105 $this->assertTrue($form->getConfig()->getOption('error_bubbling'));
106 $this->assertFalse($form['first']->getConfig()->getOption('error_bubbling'));
107 $this->assertTrue($form['second']->getConfig()->getOption('error_bubbling'));
108 }
109
110 public function testSetOptionsPerChildAndOverwrite()
111 {
112 $form = $this->factory->create('repeated', null, array(
113 'type' => 'text',
114 'options' => array('label' => 'Label'),
115 'second_options' => array('label' => 'Second label')
116 ));
117
118 $this->assertEquals('Label', $form['first']->getConfig()->getOption('label'));
119 $this->assertEquals('Second label', $form['second']->getConfig()->getOption('label'));
120 $this->assertTrue($form['first']->isRequired());
121 $this->assertTrue($form['second']->isRequired());
122 }
123
124 public function testSubmitUnequal()
125 {
126 $input = array('first' => 'foo', 'second' => 'bar');
127
128 $this->form->submit($input);
129
130 $this->assertEquals('foo', $this->form['first']->getViewData());
131 $this->assertEquals('bar', $this->form['second']->getViewData());
132 $this->assertFalse($this->form->isSynchronized());
133 $this->assertEquals($input, $this->form->getViewData());
134 $this->assertNull($this->form->getData());
135 }
136
137 public function testSubmitEqual()
138 {
139 $input = array('first' => 'foo', 'second' => 'foo');
140
141 $this->form->submit($input);
142
143 $this->assertEquals('foo', $this->form['first']->getViewData());
144 $this->assertEquals('foo', $this->form['second']->getViewData());
145 $this->assertTrue($this->form->isSynchronized());
146 $this->assertEquals($input, $this->form->getViewData());
147 $this->assertEquals('foo', $this->form->getData());
148 }
149}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/Type/SubmitTypeTest.php b/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/Type/SubmitTypeTest.php
deleted file mode 100644
index 8cc72281..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/Type/SubmitTypeTest.php
+++ /dev/null
@@ -1,54 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Tests\Extension\Core\Type;
13
14/**
15 * @author Bernhard Schussek <bschussek@gmail.com>
16 */
17class SubmitTypeTest extends TypeTestCase
18{
19 public function testCreateSubmitButtonInstances()
20 {
21 $this->assertInstanceOf('Symfony\Component\Form\SubmitButton', $this->factory->create('submit'));
22 }
23
24 public function testNotClickedByDefault()
25 {
26 $button = $this->factory->create('submit');
27
28 $this->assertFalse($button->isClicked());
29 }
30
31 public function testNotClickedIfSubmittedWithNull()
32 {
33 $button = $this->factory->create('submit');
34 $button->submit(null);
35
36 $this->assertFalse($button->isClicked());
37 }
38
39 public function testClickedIfSubmittedWithEmptyString()
40 {
41 $button = $this->factory->create('submit');
42 $button->submit('');
43
44 $this->assertTrue($button->isClicked());
45 }
46
47 public function testClickedIfSubmittedWithUnemptyString()
48 {
49 $button = $this->factory->create('submit');
50 $button->submit('foo');
51
52 $this->assertTrue($button->isClicked());
53 }
54}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/Type/TimeTypeTest.php b/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/Type/TimeTypeTest.php
deleted file mode 100644
index 9bdfe156..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/Type/TimeTypeTest.php
+++ /dev/null
@@ -1,649 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Tests\Extension\Core\Type;
13
14use Symfony\Component\Form\Extension\Core\View\ChoiceView;
15use Symfony\Component\Form\FormError;
16use Symfony\Component\Intl\Util\IntlTestHelper;
17
18class TimeTypeTest extends TypeTestCase
19{
20 protected function setUp()
21 {
22 IntlTestHelper::requireIntl($this);
23
24 parent::setUp();
25 }
26
27 public function testSubmitDateTime()
28 {
29 $form = $this->factory->create('time', null, array(
30 'model_timezone' => 'UTC',
31 'view_timezone' => 'UTC',
32 'input' => 'datetime',
33 ));
34
35 $input = array(
36 'hour' => '3',
37 'minute' => '4',
38 );
39
40 $form->submit($input);
41
42 $dateTime = new \DateTime('1970-01-01 03:04:00 UTC');
43
44 $this->assertEquals($dateTime, $form->getData());
45 $this->assertEquals($input, $form->getViewData());
46 }
47
48 public function testSubmitString()
49 {
50 $form = $this->factory->create('time', null, array(
51 'model_timezone' => 'UTC',
52 'view_timezone' => 'UTC',
53 'input' => 'string',
54 ));
55
56 $input = array(
57 'hour' => '3',
58 'minute' => '4',
59 );
60
61 $form->submit($input);
62
63 $this->assertEquals('03:04:00', $form->getData());
64 $this->assertEquals($input, $form->getViewData());
65 }
66
67 public function testSubmitTimestamp()
68 {
69 $form = $this->factory->create('time', null, array(
70 'model_timezone' => 'UTC',
71 'view_timezone' => 'UTC',
72 'input' => 'timestamp',
73 ));
74
75 $input = array(
76 'hour' => '3',
77 'minute' => '4',
78 );
79
80 $form->submit($input);
81
82 $dateTime = new \DateTime('1970-01-01 03:04:00 UTC');
83
84 $this->assertEquals($dateTime->format('U'), $form->getData());
85 $this->assertEquals($input, $form->getViewData());
86 }
87
88 public function testSubmitArray()
89 {
90 $form = $this->factory->create('time', null, array(
91 'model_timezone' => 'UTC',
92 'view_timezone' => 'UTC',
93 'input' => 'array',
94 ));
95
96 $input = array(
97 'hour' => '3',
98 'minute' => '4',
99 );
100
101 $form->submit($input);
102
103 $this->assertEquals($input, $form->getData());
104 $this->assertEquals($input, $form->getViewData());
105 }
106
107 public function testSubmitDatetimeSingleText()
108 {
109 $form = $this->factory->create('time', null, array(
110 'model_timezone' => 'UTC',
111 'view_timezone' => 'UTC',
112 'input' => 'datetime',
113 'widget' => 'single_text',
114 ));
115
116 $form->submit('03:04');
117
118 $this->assertEquals(new \DateTime('1970-01-01 03:04:00 UTC'), $form->getData());
119 $this->assertEquals('03:04', $form->getViewData());
120 }
121
122 public function testSubmitDatetimeSingleTextWithoutMinutes()
123 {
124 $form = $this->factory->create('time', null, array(
125 'model_timezone' => 'UTC',
126 'view_timezone' => 'UTC',
127 'input' => 'datetime',
128 'widget' => 'single_text',
129 'with_minutes' => false,
130 ));
131
132 $form->submit('03');
133
134 $this->assertEquals(new \DateTime('1970-01-01 03:00:00 UTC'), $form->getData());
135 $this->assertEquals('03', $form->getViewData());
136 }
137
138 public function testSubmitArraySingleText()
139 {
140 $form = $this->factory->create('time', null, array(
141 'model_timezone' => 'UTC',
142 'view_timezone' => 'UTC',
143 'input' => 'array',
144 'widget' => 'single_text',
145 ));
146
147 $data = array(
148 'hour' => '3',
149 'minute' => '4',
150 );
151
152 $form->submit('03:04');
153
154 $this->assertEquals($data, $form->getData());
155 $this->assertEquals('03:04', $form->getViewData());
156 }
157
158 public function testSubmitArraySingleTextWithoutMinutes()
159 {
160 $form = $this->factory->create('time', null, array(
161 'model_timezone' => 'UTC',
162 'view_timezone' => 'UTC',
163 'input' => 'array',
164 'widget' => 'single_text',
165 'with_minutes' => false,
166 ));
167
168 $data = array(
169 'hour' => '3',
170 );
171
172 $form->submit('03');
173
174 $this->assertEquals($data, $form->getData());
175 $this->assertEquals('03', $form->getViewData());
176 }
177
178 public function testSubmitArraySingleTextWithSeconds()
179 {
180 $form = $this->factory->create('time', null, array(
181 'model_timezone' => 'UTC',
182 'view_timezone' => 'UTC',
183 'input' => 'array',
184 'widget' => 'single_text',
185 'with_seconds' => true,
186 ));
187
188 $data = array(
189 'hour' => '3',
190 'minute' => '4',
191 'second' => '5',
192 );
193
194 $form->submit('03:04:05');
195
196 $this->assertEquals($data, $form->getData());
197 $this->assertEquals('03:04:05', $form->getViewData());
198 }
199
200 public function testSubmitStringSingleText()
201 {
202 $form = $this->factory->create('time', null, array(
203 'model_timezone' => 'UTC',
204 'view_timezone' => 'UTC',
205 'input' => 'string',
206 'widget' => 'single_text',
207 ));
208
209 $form->submit('03:04');
210
211 $this->assertEquals('03:04:00', $form->getData());
212 $this->assertEquals('03:04', $form->getViewData());
213 }
214
215 public function testSubmitStringSingleTextWithoutMinutes()
216 {
217 $form = $this->factory->create('time', null, array(
218 'model_timezone' => 'UTC',
219 'view_timezone' => 'UTC',
220 'input' => 'string',
221 'widget' => 'single_text',
222 'with_minutes' => false,
223 ));
224
225 $form->submit('03');
226
227 $this->assertEquals('03:00:00', $form->getData());
228 $this->assertEquals('03', $form->getViewData());
229 }
230
231 public function testSetDataWithoutMinutes()
232 {
233 $form = $this->factory->create('time', null, array(
234 'model_timezone' => 'UTC',
235 'view_timezone' => 'UTC',
236 'input' => 'datetime',
237 'with_minutes' => false,
238 ));
239
240 $form->setData(new \DateTime('03:04:05 UTC'));
241
242 $this->assertEquals(array('hour' => 3), $form->getViewData());
243 }
244
245 public function testSetDataWithSeconds()
246 {
247 $form = $this->factory->create('time', null, array(
248 'model_timezone' => 'UTC',
249 'view_timezone' => 'UTC',
250 'input' => 'datetime',
251 'with_seconds' => true,
252 ));
253
254 $form->setData(new \DateTime('03:04:05 UTC'));
255
256 $this->assertEquals(array('hour' => 3, 'minute' => 4, 'second' => 5), $form->getViewData());
257 }
258
259 public function testSetDataDifferentTimezones()
260 {
261 $form = $this->factory->create('time', null, array(
262 'model_timezone' => 'America/New_York',
263 'view_timezone' => 'Asia/Hong_Kong',
264 'input' => 'string',
265 'with_seconds' => true,
266 ));
267
268 $dateTime = new \DateTime('2013-01-01 12:04:05');
269 $dateTime->setTimezone(new \DateTimeZone('America/New_York'));
270
271 $form->setData($dateTime->format('H:i:s'));
272
273 $outputTime = clone $dateTime;
274 $outputTime->setTimezone(new \DateTimeZone('Asia/Hong_Kong'));
275
276 $displayedData = array(
277 'hour' => (int) $outputTime->format('H'),
278 'minute' => (int) $outputTime->format('i'),
279 'second' => (int) $outputTime->format('s')
280 );
281
282 $this->assertEquals($displayedData, $form->getViewData());
283 }
284
285 public function testSetDataDifferentTimezonesDateTime()
286 {
287 $form = $this->factory->create('time', null, array(
288 'model_timezone' => 'America/New_York',
289 'view_timezone' => 'Asia/Hong_Kong',
290 'input' => 'datetime',
291 'with_seconds' => true,
292 ));
293
294 $dateTime = new \DateTime('12:04:05');
295 $dateTime->setTimezone(new \DateTimeZone('America/New_York'));
296
297 $form->setData($dateTime);
298
299 $outputTime = clone $dateTime;
300 $outputTime->setTimezone(new \DateTimeZone('Asia/Hong_Kong'));
301
302 $displayedData = array(
303 'hour' => (int) $outputTime->format('H'),
304 'minute' => (int) $outputTime->format('i'),
305 'second' => (int) $outputTime->format('s')
306 );
307
308 $this->assertDateTimeEquals($dateTime, $form->getData());
309 $this->assertEquals($displayedData, $form->getViewData());
310 }
311
312 public function testHoursOption()
313 {
314 $form = $this->factory->create('time', null, array(
315 'hours' => array(6, 7),
316 ));
317
318 $view = $form->createView();
319
320 $this->assertEquals(array(
321 new ChoiceView('6', '6', '06'),
322 new ChoiceView('7', '7', '07'),
323 ), $view['hour']->vars['choices']);
324 }
325
326 public function testIsMinuteWithinRangeReturnsTrueIfWithin()
327 {
328 $form = $this->factory->create('time', null, array(
329 'minutes' => array(6, 7),
330 ));
331
332 $view = $form->createView();
333
334 $this->assertEquals(array(
335 new ChoiceView('6', '6', '06'),
336 new ChoiceView('7', '7', '07'),
337 ), $view['minute']->vars['choices']);
338 }
339
340 public function testIsSecondWithinRangeReturnsTrueIfWithin()
341 {
342 $form = $this->factory->create('time', null, array(
343 'seconds' => array(6, 7),
344 'with_seconds' => true,
345 ));
346
347 $view = $form->createView();
348
349 $this->assertEquals(array(
350 new ChoiceView('6', '6', '06'),
351 new ChoiceView('7', '7', '07'),
352 ), $view['second']->vars['choices']);
353 }
354
355 public function testIsPartiallyFilledReturnsFalseIfCompletelyEmpty()
356 {
357 $this->markTestIncomplete('Needs to be reimplemented using validators');
358
359 $form = $this->factory->create('time', null, array(
360 'widget' => 'choice',
361 ));
362
363 $form->submit(array(
364 'hour' => '',
365 'minute' => '',
366 ));
367
368 $this->assertFalse($form->isPartiallyFilled());
369 }
370
371 public function testIsPartiallyFilledReturnsFalseIfCompletelyEmptyWithSeconds()
372 {
373 $this->markTestIncomplete('Needs to be reimplemented using validators');
374
375 $form = $this->factory->create('time', null, array(
376 'widget' => 'choice',
377 'with_seconds' => true,
378 ));
379
380 $form->submit(array(
381 'hour' => '',
382 'minute' => '',
383 'second' => '',
384 ));
385
386 $this->assertFalse($form->isPartiallyFilled());
387 }
388
389 public function testIsPartiallyFilledReturnsFalseIfCompletelyFilled()
390 {
391 $this->markTestIncomplete('Needs to be reimplemented using validators');
392
393 $form = $this->factory->create('time', null, array(
394 'widget' => 'choice',
395 ));
396
397 $form->submit(array(
398 'hour' => '0',
399 'minute' => '0',
400 ));
401
402 $this->assertFalse($form->isPartiallyFilled());
403 }
404
405 public function testIsPartiallyFilledReturnsFalseIfCompletelyFilledWithSeconds()
406 {
407 $this->markTestIncomplete('Needs to be reimplemented using validators');
408
409 $form = $this->factory->create('time', null, array(
410 'widget' => 'choice',
411 'with_seconds' => true,
412 ));
413
414 $form->submit(array(
415 'hour' => '0',
416 'minute' => '0',
417 'second' => '0',
418 ));
419
420 $this->assertFalse($form->isPartiallyFilled());
421 }
422
423 public function testIsPartiallyFilledReturnsTrueIfChoiceAndHourEmpty()
424 {
425 $this->markTestIncomplete('Needs to be reimplemented using validators');
426
427 $form = $this->factory->create('time', null, array(
428 'widget' => 'choice',
429 'with_seconds' => true,
430 ));
431
432 $form->submit(array(
433 'hour' => '',
434 'minute' => '0',
435 'second' => '0',
436 ));
437
438 $this->assertTrue($form->isPartiallyFilled());
439 }
440
441 public function testIsPartiallyFilledReturnsTrueIfChoiceAndMinuteEmpty()
442 {
443 $this->markTestIncomplete('Needs to be reimplemented using validators');
444
445 $form = $this->factory->create('time', null, array(
446 'widget' => 'choice',
447 'with_seconds' => true,
448 ));
449
450 $form->submit(array(
451 'hour' => '0',
452 'minute' => '',
453 'second' => '0',
454 ));
455
456 $this->assertTrue($form->isPartiallyFilled());
457 }
458
459 public function testIsPartiallyFilledReturnsTrueIfChoiceAndSecondsEmpty()
460 {
461 $this->markTestIncomplete('Needs to be reimplemented using validators');
462
463 $form = $this->factory->create('time', null, array(
464 'widget' => 'choice',
465 'with_seconds' => true,
466 ));
467
468 $form->submit(array(
469 'hour' => '0',
470 'minute' => '0',
471 'second' => '',
472 ));
473
474 $this->assertTrue($form->isPartiallyFilled());
475 }
476
477 // Bug fix
478 public function testInitializeWithDateTime()
479 {
480 // Throws an exception if "data_class" option is not explicitly set
481 // to null in the type
482 $this->factory->create('time', new \DateTime());
483 }
484
485 public function testSingleTextWidgetShouldUseTheRightInputType()
486 {
487 $form = $this->factory->create('time', null, array(
488 'widget' => 'single_text',
489 ));
490
491 $view = $form->createView();
492 $this->assertEquals('time', $view->vars['type']);
493 }
494
495 public function testPassDefaultEmptyValueToViewIfNotRequired()
496 {
497 $form = $this->factory->create('time', null, array(
498 'required' => false,
499 'with_seconds' => true,
500 ));
501
502 $view = $form->createView();
503 $this->assertSame('', $view['hour']->vars['empty_value']);
504 $this->assertSame('', $view['minute']->vars['empty_value']);
505 $this->assertSame('', $view['second']->vars['empty_value']);
506 }
507
508 public function testPassNoEmptyValueToViewIfRequired()
509 {
510 $form = $this->factory->create('time', null, array(
511 'required' => true,
512 'with_seconds' => true,
513 ));
514
515 $view = $form->createView();
516 $this->assertNull($view['hour']->vars['empty_value']);
517 $this->assertNull($view['minute']->vars['empty_value']);
518 $this->assertNull($view['second']->vars['empty_value']);
519 }
520
521 public function testPassEmptyValueAsString()
522 {
523 $form = $this->factory->create('time', null, array(
524 'empty_value' => 'Empty',
525 'with_seconds' => true,
526 ));
527
528 $view = $form->createView();
529 $this->assertSame('Empty', $view['hour']->vars['empty_value']);
530 $this->assertSame('Empty', $view['minute']->vars['empty_value']);
531 $this->assertSame('Empty', $view['second']->vars['empty_value']);
532 }
533
534 public function testPassEmptyValueAsArray()
535 {
536 $form = $this->factory->create('time', null, array(
537 'empty_value' => array(
538 'hour' => 'Empty hour',
539 'minute' => 'Empty minute',
540 'second' => 'Empty second',
541 ),
542 'with_seconds' => true,
543 ));
544
545 $view = $form->createView();
546 $this->assertSame('Empty hour', $view['hour']->vars['empty_value']);
547 $this->assertSame('Empty minute', $view['minute']->vars['empty_value']);
548 $this->assertSame('Empty second', $view['second']->vars['empty_value']);
549 }
550
551 public function testPassEmptyValueAsPartialArrayAddEmptyIfNotRequired()
552 {
553 $form = $this->factory->create('time', null, array(
554 'required' => false,
555 'empty_value' => array(
556 'hour' => 'Empty hour',
557 'second' => 'Empty second',
558 ),
559 'with_seconds' => true,
560 ));
561
562 $view = $form->createView();
563 $this->assertSame('Empty hour', $view['hour']->vars['empty_value']);
564 $this->assertSame('', $view['minute']->vars['empty_value']);
565 $this->assertSame('Empty second', $view['second']->vars['empty_value']);
566 }
567
568 public function testPassEmptyValueAsPartialArrayAddNullIfRequired()
569 {
570 $form = $this->factory->create('time', null, array(
571 'required' => true,
572 'empty_value' => array(
573 'hour' => 'Empty hour',
574 'second' => 'Empty second',
575 ),
576 'with_seconds' => true,
577 ));
578
579 $view = $form->createView();
580 $this->assertSame('Empty hour', $view['hour']->vars['empty_value']);
581 $this->assertNull($view['minute']->vars['empty_value']);
582 $this->assertSame('Empty second', $view['second']->vars['empty_value']);
583 }
584
585 public function provideCompoundWidgets()
586 {
587 return array(
588 array('text'),
589 array('choice'),
590 );
591 }
592
593 /**
594 * @dataProvider provideCompoundWidgets
595 */
596 public function testHourErrorsBubbleUp($widget)
597 {
598 $error = new FormError('Invalid!');
599 $form = $this->factory->create('time', null, array(
600 'widget' => $widget,
601 ));
602 $form['hour']->addError($error);
603
604 $this->assertSame(array(), $form['hour']->getErrors());
605 $this->assertSame(array($error), $form->getErrors());
606 }
607
608 /**
609 * @dataProvider provideCompoundWidgets
610 */
611 public function testMinuteErrorsBubbleUp($widget)
612 {
613 $error = new FormError('Invalid!');
614 $form = $this->factory->create('time', null, array(
615 'widget' => $widget,
616 ));
617 $form['minute']->addError($error);
618
619 $this->assertSame(array(), $form['minute']->getErrors());
620 $this->assertSame(array($error), $form->getErrors());
621 }
622
623 /**
624 * @dataProvider provideCompoundWidgets
625 */
626 public function testSecondErrorsBubbleUp($widget)
627 {
628 $error = new FormError('Invalid!');
629 $form = $this->factory->create('time', null, array(
630 'widget' => $widget,
631 'with_seconds' => true,
632 ));
633 $form['second']->addError($error);
634
635 $this->assertSame(array(), $form['second']->getErrors());
636 $this->assertSame(array($error), $form->getErrors());
637 }
638
639 /**
640 * @expectedException \Symfony\Component\Form\Exception\InvalidConfigurationException
641 */
642 public function testInitializeWithSecondsAndWithoutMinutes()
643 {
644 $this->factory->create('time', null, array(
645 'with_minutes' => false,
646 'with_seconds' => true,
647 ));
648 }
649}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/Type/TimezoneTypeTest.php b/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/Type/TimezoneTypeTest.php
deleted file mode 100644
index 81df20cb..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/Type/TimezoneTypeTest.php
+++ /dev/null
@@ -1,30 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Tests\Extension\Core\Type;
13
14use Symfony\Component\Form\Extension\Core\View\ChoiceView;
15
16class TimezoneTypeTest extends \Symfony\Component\Form\Test\TypeTestCase
17{
18 public function testTimezonesAreSelectable()
19 {
20 $form = $this->factory->create('timezone');
21 $view = $form->createView();
22 $choices = $view->vars['choices'];
23
24 $this->assertArrayHasKey('Africa', $choices);
25 $this->assertContains(new ChoiceView('Africa/Kinshasa', 'Africa/Kinshasa', 'Kinshasa'), $choices['Africa'], '', false, false);
26
27 $this->assertArrayHasKey('America', $choices);
28 $this->assertContains(new ChoiceView('America/New_York', 'America/New_York', 'New York'), $choices['America'], '', false, false);
29 }
30}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/Type/TypeTestCase.php b/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/Type/TypeTestCase.php
deleted file mode 100644
index 733546e3..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/Type/TypeTestCase.php
+++ /dev/null
@@ -1,21 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien.potencier@symfony-project.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Tests\Extension\Core\Type;
13
14use Symfony\Component\Form\Test\TypeTestCase as BaseTypeTestCase;
15
16/**
17 * @deprecated Deprecated since version 2.3, to be removed in 3.0. Use Symfony\Component\Form\Test\TypeTestCase instead.
18 */
19abstract class TypeTestCase extends BaseTypeTestCase
20{
21}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/Type/UrlTypeTest.php b/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/Type/UrlTypeTest.php
deleted file mode 100644
index 254b2a8e..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Core/Type/UrlTypeTest.php
+++ /dev/null
@@ -1,61 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Tests\Extension\Core\Type;
13
14class UrlTypeTest extends TypeTestCase
15{
16 public function testSubmitAddsDefaultProtocolIfNoneIsIncluded()
17 {
18 $form = $this->factory->create('url', 'name');
19
20 $form->submit('www.domain.com');
21
22 $this->assertSame('http://www.domain.com', $form->getData());
23 $this->assertSame('http://www.domain.com', $form->getViewData());
24 }
25
26 public function testSubmitAddsNoDefaultProtocolIfAlreadyIncluded()
27 {
28 $form = $this->factory->create('url', null, array(
29 'default_protocol' => 'http',
30 ));
31
32 $form->submit('ftp://www.domain.com');
33
34 $this->assertSame('ftp://www.domain.com', $form->getData());
35 $this->assertSame('ftp://www.domain.com', $form->getViewData());
36 }
37
38 public function testSubmitAddsNoDefaultProtocolIfEmpty()
39 {
40 $form = $this->factory->create('url', null, array(
41 'default_protocol' => 'http',
42 ));
43
44 $form->submit('');
45
46 $this->assertNull($form->getData());
47 $this->assertSame('', $form->getViewData());
48 }
49
50 public function testSubmitAddsNoDefaultProtocolIfSetToNull()
51 {
52 $form = $this->factory->create('url', null, array(
53 'default_protocol' => null,
54 ));
55
56 $form->submit('www.domain.com');
57
58 $this->assertSame('www.domain.com', $form->getData());
59 $this->assertSame('www.domain.com', $form->getViewData());
60 }
61}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Csrf/CsrfProvider/DefaultCsrfProviderTest.php b/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Csrf/CsrfProvider/DefaultCsrfProviderTest.php
deleted file mode 100644
index a99b5444..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Csrf/CsrfProvider/DefaultCsrfProviderTest.php
+++ /dev/null
@@ -1,81 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Tests\Extension\Csrf\CsrfProvider;
13
14use Symfony\Component\Form\Extension\Csrf\CsrfProvider\DefaultCsrfProvider;
15
16/**
17 * @runTestsInSeparateProcesses
18 */
19class DefaultCsrfProviderTest extends \PHPUnit_Framework_TestCase
20{
21 protected $provider;
22
23 public static function setUpBeforeClass()
24 {
25 ini_set('session.save_handler', 'files');
26 ini_set('session.save_path', sys_get_temp_dir());
27 }
28
29 protected function setUp()
30 {
31 $this->provider = new DefaultCsrfProvider('SECRET');
32 }
33
34 protected function tearDown()
35 {
36 $this->provider = null;
37 }
38
39 public function testGenerateCsrfToken()
40 {
41 session_start();
42
43 $token = $this->provider->generateCsrfToken('foo');
44
45 $this->assertEquals(sha1('SECRET'.'foo'.session_id()), $token);
46 }
47
48 public function testGenerateCsrfTokenOnUnstartedSession()
49 {
50 session_id('touti');
51
52 if (!version_compare(PHP_VERSION, '5.4', '>=')) {
53 $this->markTestSkipped('This test requires PHP >= 5.4');
54 }
55
56 $this->assertSame(PHP_SESSION_NONE, session_status());
57
58 $token = $this->provider->generateCsrfToken('foo');
59
60 $this->assertEquals(sha1('SECRET'.'foo'.session_id()), $token);
61 $this->assertSame(PHP_SESSION_ACTIVE, session_status());
62 }
63
64 public function testIsCsrfTokenValidSucceeds()
65 {
66 session_start();
67
68 $token = sha1('SECRET'.'foo'.session_id());
69
70 $this->assertTrue($this->provider->isCsrfTokenValid('foo', $token));
71 }
72
73 public function testIsCsrfTokenValidFails()
74 {
75 session_start();
76
77 $token = sha1('SECRET'.'bar'.session_id());
78
79 $this->assertFalse($this->provider->isCsrfTokenValid('foo', $token));
80 }
81}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Csrf/CsrfProvider/SessionCsrfProviderTest.php b/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Csrf/CsrfProvider/SessionCsrfProviderTest.php
deleted file mode 100644
index 1dcc6b4c..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Csrf/CsrfProvider/SessionCsrfProviderTest.php
+++ /dev/null
@@ -1,75 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Tests\Extension\Csrf\CsrfProvider;
13
14use Symfony\Component\Form\Extension\Csrf\CsrfProvider\SessionCsrfProvider;
15
16class SessionCsrfProviderTest extends \PHPUnit_Framework_TestCase
17{
18 protected $provider;
19 protected $session;
20
21 protected function setUp()
22 {
23 if (!class_exists('Symfony\Component\HttpFoundation\Session\Session')) {
24 $this->markTestSkipped('The "HttpFoundation" component is not available');
25 }
26
27 $this->session = $this->getMock(
28 'Symfony\Component\HttpFoundation\Session\Session',
29 array(),
30 array(),
31 '',
32 false // don't call constructor
33 );
34 $this->provider = new SessionCsrfProvider($this->session, 'SECRET');
35 }
36
37 protected function tearDown()
38 {
39 $this->provider = null;
40 $this->session = null;
41 }
42
43 public function testGenerateCsrfToken()
44 {
45 $this->session->expects($this->once())
46 ->method('getId')
47 ->will($this->returnValue('ABCDEF'));
48
49 $token = $this->provider->generateCsrfToken('foo');
50
51 $this->assertEquals(sha1('SECRET'.'foo'.'ABCDEF'), $token);
52 }
53
54 public function testIsCsrfTokenValidSucceeds()
55 {
56 $this->session->expects($this->once())
57 ->method('getId')
58 ->will($this->returnValue('ABCDEF'));
59
60 $token = sha1('SECRET'.'foo'.'ABCDEF');
61
62 $this->assertTrue($this->provider->isCsrfTokenValid('foo', $token));
63 }
64
65 public function testIsCsrfTokenValidFails()
66 {
67 $this->session->expects($this->once())
68 ->method('getId')
69 ->will($this->returnValue('ABCDEF'));
70
71 $token = sha1('SECRET'.'bar'.'ABCDEF');
72
73 $this->assertFalse($this->provider->isCsrfTokenValid('foo', $token));
74 }
75}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Csrf/EventListener/CsrfValidationListenerTest.php b/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Csrf/EventListener/CsrfValidationListenerTest.php
deleted file mode 100644
index 0bcfe74e..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Csrf/EventListener/CsrfValidationListenerTest.php
+++ /dev/null
@@ -1,78 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Tests\Extension\Csrf\EventListener;
13
14use Symfony\Component\Form\FormBuilder;
15use Symfony\Component\Form\FormEvent;
16use Symfony\Component\Form\Extension\Csrf\EventListener\CsrfValidationListener;
17
18class CsrfValidationListenerTest extends \PHPUnit_Framework_TestCase
19{
20 protected $dispatcher;
21 protected $factory;
22 protected $csrfProvider;
23
24 protected function setUp()
25 {
26 if (!class_exists('Symfony\Component\EventDispatcher\EventDispatcher')) {
27 $this->markTestSkipped('The "EventDispatcher" component is not available');
28 }
29
30 $this->dispatcher = $this->getMock('Symfony\Component\EventDispatcher\EventDispatcherInterface');
31 $this->factory = $this->getMock('Symfony\Component\Form\FormFactoryInterface');
32 $this->csrfProvider = $this->getMock('Symfony\Component\Form\Extension\Csrf\CsrfProvider\CsrfProviderInterface');
33 $this->form = $this->getBuilder('post')
34 ->setDataMapper($this->getDataMapper())
35 ->getForm();
36 }
37
38 protected function tearDown()
39 {
40 $this->dispatcher = null;
41 $this->factory = null;
42 $this->csrfProvider = null;
43 $this->form = null;
44 }
45
46 protected function getBuilder($name = 'name')
47 {
48 return new FormBuilder($name, null, $this->dispatcher, $this->factory, array('compound' => true));
49 }
50
51 protected function getForm($name = 'name')
52 {
53 return $this->getBuilder($name)->getForm();
54 }
55
56 protected function getDataMapper()
57 {
58 return $this->getMock('Symfony\Component\Form\DataMapperInterface');
59 }
60
61 protected function getMockForm()
62 {
63 return $this->getMock('Symfony\Component\Form\Test\FormInterface');
64 }
65
66 // https://github.com/symfony/symfony/pull/5838
67 public function testStringFormData()
68 {
69 $data = "XP4HUzmHPi";
70 $event = new FormEvent($this->form, $data);
71
72 $validation = new CsrfValidationListener('csrf', $this->csrfProvider, 'unknown', 'Invalid.');
73 $validation->preSubmit($event);
74
75 // Validate accordingly
76 $this->assertSame($data, $event->getData());
77 }
78}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Csrf/Type/FormTypeCsrfExtensionTest.php b/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Csrf/Type/FormTypeCsrfExtensionTest.php
deleted file mode 100644
index 0a1f0dc4..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Csrf/Type/FormTypeCsrfExtensionTest.php
+++ /dev/null
@@ -1,301 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Tests\Extension\Csrf\Type;
13
14use Symfony\Component\Form\AbstractType;
15use Symfony\Component\Form\FormBuilderInterface;
16use Symfony\Component\Form\FormError;
17use Symfony\Component\Form\Test\TypeTestCase;
18use Symfony\Component\Form\Extension\Csrf\CsrfExtension;
19
20class FormTypeCsrfExtensionTest_ChildType extends AbstractType
21{
22 public function buildForm(FormBuilderInterface $builder, array $options)
23 {
24 // The form needs a child in order to trigger CSRF protection by
25 // default
26 $builder->add('name', 'text');
27 }
28
29 public function getName()
30 {
31 return 'csrf_collection_test';
32 }
33}
34
35class FormTypeCsrfExtensionTest extends TypeTestCase
36{
37 /**
38 * @var \PHPUnit_Framework_MockObject_MockObject
39 */
40 protected $csrfProvider;
41
42 /**
43 * @var \PHPUnit_Framework_MockObject_MockObject
44 */
45 protected $translator;
46
47 protected function setUp()
48 {
49 $this->csrfProvider = $this->getMock('Symfony\Component\Form\Extension\Csrf\CsrfProvider\CsrfProviderInterface');
50 $this->translator = $this->getMock('Symfony\Component\Translation\TranslatorInterface');
51
52 parent::setUp();
53 }
54
55 protected function tearDown()
56 {
57 $this->csrfProvider = null;
58 $this->translator = null;
59
60 parent::tearDown();
61 }
62
63 protected function getExtensions()
64 {
65 return array_merge(parent::getExtensions(), array(
66 new CsrfExtension($this->csrfProvider, $this->translator),
67 ));
68 }
69
70 public function testCsrfProtectionByDefaultIfRootAndCompound()
71 {
72 $view = $this->factory
73 ->create('form', null, array(
74 'csrf_field_name' => 'csrf',
75 'compound' => true,
76 ))
77 ->createView();
78
79 $this->assertTrue(isset($view['csrf']));
80 }
81
82 public function testNoCsrfProtectionByDefaultIfCompoundButNotRoot()
83 {
84 $view = $this->factory
85 ->createNamedBuilder('root', 'form')
86 ->add($this->factory
87 ->createNamedBuilder('form', 'form', null, array(
88 'csrf_field_name' => 'csrf',
89 'compound' => true,
90 ))
91 )
92 ->getForm()
93 ->get('form')
94 ->createView();
95
96 $this->assertFalse(isset($view['csrf']));
97 }
98
99 public function testNoCsrfProtectionByDefaultIfRootButNotCompound()
100 {
101 $view = $this->factory
102 ->create('form', null, array(
103 'csrf_field_name' => 'csrf',
104 'compound' => false,
105 ))
106 ->createView();
107
108 $this->assertFalse(isset($view['csrf']));
109 }
110
111 public function testCsrfProtectionCanBeDisabled()
112 {
113 $view = $this->factory
114 ->create('form', null, array(
115 'csrf_field_name' => 'csrf',
116 'csrf_protection' => false,
117 'compound' => true,
118 ))
119 ->createView();
120
121 $this->assertFalse(isset($view['csrf']));
122 }
123
124 public function testGenerateCsrfToken()
125 {
126 $this->csrfProvider->expects($this->once())
127 ->method('generateCsrfToken')
128 ->with('%INTENTION%')
129 ->will($this->returnValue('token'));
130
131 $view = $this->factory
132 ->create('form', null, array(
133 'csrf_field_name' => 'csrf',
134 'csrf_provider' => $this->csrfProvider,
135 'intention' => '%INTENTION%',
136 'compound' => true,
137 ))
138 ->createView();
139
140 $this->assertEquals('token', $view['csrf']->vars['value']);
141 }
142
143 public function provideBoolean()
144 {
145 return array(
146 array(true),
147 array(false),
148 );
149 }
150
151 /**
152 * @dataProvider provideBoolean
153 */
154 public function testValidateTokenOnSubmitIfRootAndCompound($valid)
155 {
156 $this->csrfProvider->expects($this->once())
157 ->method('isCsrfTokenValid')
158 ->with('%INTENTION%', 'token')
159 ->will($this->returnValue($valid));
160
161 $form = $this->factory
162 ->createBuilder('form', null, array(
163 'csrf_field_name' => 'csrf',
164 'csrf_provider' => $this->csrfProvider,
165 'intention' => '%INTENTION%',
166 'compound' => true,
167 ))
168 ->add('child', 'text')
169 ->getForm();
170
171 $form->submit(array(
172 'child' => 'foobar',
173 'csrf' => 'token',
174 ));
175
176 // Remove token from data
177 $this->assertSame(array('child' => 'foobar'), $form->getData());
178
179 // Validate accordingly
180 $this->assertSame($valid, $form->isValid());
181 }
182
183 public function testFailIfRootAndCompoundAndTokenMissing()
184 {
185 $this->csrfProvider->expects($this->never())
186 ->method('isCsrfTokenValid');
187
188 $form = $this->factory
189 ->createBuilder('form', null, array(
190 'csrf_field_name' => 'csrf',
191 'csrf_provider' => $this->csrfProvider,
192 'intention' => '%INTENTION%',
193 'compound' => true,
194 ))
195 ->add('child', 'text')
196 ->getForm();
197
198 $form->submit(array(
199 'child' => 'foobar',
200 // token is missing
201 ));
202
203 // Remove token from data
204 $this->assertSame(array('child' => 'foobar'), $form->getData());
205
206 // Validate accordingly
207 $this->assertFalse($form->isValid());
208 }
209
210 public function testDontValidateTokenIfCompoundButNoRoot()
211 {
212 $this->csrfProvider->expects($this->never())
213 ->method('isCsrfTokenValid');
214
215 $form = $this->factory
216 ->createNamedBuilder('root', 'form')
217 ->add($this->factory
218 ->createNamedBuilder('form', 'form', null, array(
219 'csrf_field_name' => 'csrf',
220 'csrf_provider' => $this->csrfProvider,
221 'intention' => '%INTENTION%',
222 'compound' => true,
223 ))
224 )
225 ->getForm()
226 ->get('form');
227
228 $form->submit(array(
229 'child' => 'foobar',
230 'csrf' => 'token',
231 ));
232 }
233
234 public function testDontValidateTokenIfRootButNotCompound()
235 {
236 $this->csrfProvider->expects($this->never())
237 ->method('isCsrfTokenValid');
238
239 $form = $this->factory
240 ->create('form', null, array(
241 'csrf_field_name' => 'csrf',
242 'csrf_provider' => $this->csrfProvider,
243 'intention' => '%INTENTION%',
244 'compound' => false,
245 ));
246
247 $form->submit(array(
248 'csrf' => 'token',
249 ));
250 }
251
252 public function testNoCsrfProtectionOnPrototype()
253 {
254 $prototypeView = $this->factory
255 ->create('collection', null, array(
256 'type' => new FormTypeCsrfExtensionTest_ChildType(),
257 'options' => array(
258 'csrf_field_name' => 'csrf',
259 ),
260 'prototype' => true,
261 'allow_add' => true,
262 ))
263 ->createView()
264 ->vars['prototype'];
265
266 $this->assertFalse(isset($prototypeView['csrf']));
267 $this->assertCount(1, $prototypeView);
268 }
269
270 public function testsTranslateCustomErrorMessage()
271 {
272 $this->csrfProvider->expects($this->once())
273 ->method('isCsrfTokenValid')
274 ->with('%INTENTION%', 'token')
275 ->will($this->returnValue(false));
276
277 $this->translator->expects($this->once())
278 ->method('trans')
279 ->with('Foobar')
280 ->will($this->returnValue('[trans]Foobar[/trans]'));
281
282 $form = $this->factory
283 ->createBuilder('form', null, array(
284 'csrf_field_name' => 'csrf',
285 'csrf_provider' => $this->csrfProvider,
286 'csrf_message' => 'Foobar',
287 'intention' => '%INTENTION%',
288 'compound' => true,
289 ))
290 ->getForm();
291
292 $form->submit(array(
293 'csrf' => 'token',
294 ));
295
296 $errors = $form->getErrors();
297
298 $this->assertGreaterThan(0, count($errors));
299 $this->assertEquals(new FormError('[trans]Foobar[/trans]'), $errors[0]);
300 }
301}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/HttpFoundation/EventListener/BindRequestListenerTest.php b/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/HttpFoundation/EventListener/BindRequestListenerTest.php
deleted file mode 100644
index 2ff072b2..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/HttpFoundation/EventListener/BindRequestListenerTest.php
+++ /dev/null
@@ -1,286 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Tests\Extension\HttpFoundation\EventListener;
13
14use Symfony\Component\Form\Extension\HttpFoundation\EventListener\BindRequestListener;
15use Symfony\Component\Form\Form;
16use Symfony\Component\Form\FormConfigBuilder;
17use Symfony\Component\Form\FormEvent;
18use Symfony\Component\Form\Test\DeprecationErrorHandler;
19use Symfony\Component\HttpFoundation\Request;
20use Symfony\Component\HttpFoundation\File\UploadedFile;
21
22/**
23 * @author Bernhard Schussek <bschussek@gmail.com>
24 */
25class BindRequestListenerTest extends \PHPUnit_Framework_TestCase
26{
27 private $values;
28
29 private $filesPlain;
30
31 private $filesNested;
32
33 /**
34 * @var UploadedFile
35 */
36 private $uploadedFile;
37
38 protected function setUp()
39 {
40 $path = tempnam(sys_get_temp_dir(), 'sf2');
41 touch($path);
42
43 $this->values = array(
44 'name' => 'Bernhard',
45 'image' => array('filename' => 'foobar.png'),
46 );
47
48 $this->filesPlain = array(
49 'image' => array(
50 'error' => UPLOAD_ERR_OK,
51 'name' => 'upload.png',
52 'size' => 123,
53 'tmp_name' => $path,
54 'type' => 'image/png'
55 ),
56 );
57
58 $this->filesNested = array(
59 'error' => array('image' => UPLOAD_ERR_OK),
60 'name' => array('image' => 'upload.png'),
61 'size' => array('image' => 123),
62 'tmp_name' => array('image' => $path),
63 'type' => array('image' => 'image/png'),
64 );
65
66 $this->uploadedFile = new UploadedFile($path, 'upload.png', 'image/png', 123, UPLOAD_ERR_OK);
67 }
68
69 protected function tearDown()
70 {
71 unlink($this->uploadedFile->getRealPath());
72 }
73
74 public function requestMethodProvider()
75 {
76 return array(
77 array('POST'),
78 array('PUT'),
79 array('DELETE'),
80 array('PATCH'),
81 );
82 }
83
84 /**
85 * @dataProvider requestMethodProvider
86 */
87 public function testSubmitRequest($method)
88 {
89 if (!class_exists('Symfony\Component\HttpFoundation\Request')) {
90 $this->markTestSkipped('The "HttpFoundation" component is not available');
91 }
92
93 $values = array('author' => $this->values);
94 $files = array('author' => $this->filesNested);
95 $request = new Request(array(), $values, array(), array(), $files, array(
96 'REQUEST_METHOD' => $method,
97 ));
98
99 $dispatcher = $this->getMock('Symfony\Component\EventDispatcher\EventDispatcherInterface');
100 $config = new FormConfigBuilder('author', null, $dispatcher);
101 $form = new Form($config);
102 $event = new FormEvent($form, $request);
103
104 $listener = new BindRequestListener();
105 DeprecationErrorHandler::preBind($listener, $event);
106
107 $this->assertEquals(array(
108 'name' => 'Bernhard',
109 'image' => $this->uploadedFile,
110 ), $event->getData());
111 }
112
113 /**
114 * @dataProvider requestMethodProvider
115 */
116 public function testSubmitRequestWithEmptyName($method)
117 {
118 if (!class_exists('Symfony\Component\HttpFoundation\Request')) {
119 $this->markTestSkipped('The "HttpFoundation" component is not available');
120 }
121
122 $request = new Request(array(), $this->values, array(), array(), $this->filesPlain, array(
123 'REQUEST_METHOD' => $method,
124 ));
125
126 $dispatcher = $this->getMock('Symfony\Component\EventDispatcher\EventDispatcherInterface');
127 $config = new FormConfigBuilder('', null, $dispatcher);
128 $form = new Form($config);
129 $event = new FormEvent($form, $request);
130
131 $listener = new BindRequestListener();
132 DeprecationErrorHandler::preBind($listener, $event);
133
134 $this->assertEquals(array(
135 'name' => 'Bernhard',
136 'image' => $this->uploadedFile,
137 ), $event->getData());
138 }
139
140 /**
141 * @dataProvider requestMethodProvider
142 */
143 public function testSubmitEmptyRequestToCompoundForm($method)
144 {
145 if (!class_exists('Symfony\Component\HttpFoundation\Request')) {
146 $this->markTestSkipped('The "HttpFoundation" component is not available');
147 }
148
149 $request = new Request(array(), array(), array(), array(), array(), array(
150 'REQUEST_METHOD' => $method,
151 ));
152
153 $dispatcher = $this->getMock('Symfony\Component\EventDispatcher\EventDispatcherInterface');
154 $config = new FormConfigBuilder('author', null, $dispatcher);
155 $config->setCompound(true);
156 $config->setDataMapper($this->getMock('Symfony\Component\Form\DataMapperInterface'));
157 $form = new Form($config);
158 $event = new FormEvent($form, $request);
159
160 $listener = new BindRequestListener();
161 DeprecationErrorHandler::preBind($listener, $event);
162
163 // Default to empty array
164 $this->assertEquals(array(), $event->getData());
165 }
166
167 /**
168 * @dataProvider requestMethodProvider
169 */
170 public function testSubmitEmptyRequestToSimpleForm($method)
171 {
172 if (!class_exists('Symfony\Component\HttpFoundation\Request')) {
173 $this->markTestSkipped('The "HttpFoundation" component is not available');
174 }
175
176 $request = new Request(array(), array(), array(), array(), array(), array(
177 'REQUEST_METHOD' => $method,
178 ));
179
180 $dispatcher = $this->getMock('Symfony\Component\EventDispatcher\EventDispatcherInterface');
181 $config = new FormConfigBuilder('author', null, $dispatcher);
182 $config->setCompound(false);
183 $form = new Form($config);
184 $event = new FormEvent($form, $request);
185
186 $listener = new BindRequestListener();
187 DeprecationErrorHandler::preBind($listener, $event);
188
189 // Default to null
190 $this->assertNull($event->getData());
191 }
192
193 public function testSubmitGetRequest()
194 {
195 if (!class_exists('Symfony\Component\HttpFoundation\Request')) {
196 $this->markTestSkipped('The "HttpFoundation" component is not available');
197 }
198
199 $values = array('author' => $this->values);
200 $request = new Request($values, array(), array(), array(), array(), array(
201 'REQUEST_METHOD' => 'GET',
202 ));
203
204 $dispatcher = $this->getMock('Symfony\Component\EventDispatcher\EventDispatcherInterface');
205 $config = new FormConfigBuilder('author', null, $dispatcher);
206 $form = new Form($config);
207 $event = new FormEvent($form, $request);
208
209 $listener = new BindRequestListener();
210 DeprecationErrorHandler::preBind($listener, $event);
211
212 $this->assertEquals(array(
213 'name' => 'Bernhard',
214 'image' => array('filename' => 'foobar.png'),
215 ), $event->getData());
216 }
217
218 public function testSubmitGetRequestWithEmptyName()
219 {
220 if (!class_exists('Symfony\Component\HttpFoundation\Request')) {
221 $this->markTestSkipped('The "HttpFoundation" component is not available');
222 }
223
224 $request = new Request($this->values, array(), array(), array(), array(), array(
225 'REQUEST_METHOD' => 'GET',
226 ));
227
228 $dispatcher = $this->getMock('Symfony\Component\EventDispatcher\EventDispatcherInterface');
229 $config = new FormConfigBuilder('', null, $dispatcher);
230 $form = new Form($config);
231 $event = new FormEvent($form, $request);
232
233 $listener = new BindRequestListener();
234 DeprecationErrorHandler::preBind($listener, $event);
235
236 $this->assertEquals(array(
237 'name' => 'Bernhard',
238 'image' => array('filename' => 'foobar.png'),
239 ), $event->getData());
240 }
241
242 public function testSubmitEmptyGetRequestToCompoundForm()
243 {
244 if (!class_exists('Symfony\Component\HttpFoundation\Request')) {
245 $this->markTestSkipped('The "HttpFoundation" component is not available');
246 }
247
248 $request = new Request(array(), array(), array(), array(), array(), array(
249 'REQUEST_METHOD' => 'GET',
250 ));
251
252 $dispatcher = $this->getMock('Symfony\Component\EventDispatcher\EventDispatcherInterface');
253 $config = new FormConfigBuilder('author', null, $dispatcher);
254 $config->setCompound(true);
255 $config->setDataMapper($this->getMock('Symfony\Component\Form\DataMapperInterface'));
256 $form = new Form($config);
257 $event = new FormEvent($form, $request);
258
259 $listener = new BindRequestListener();
260 DeprecationErrorHandler::preBind($listener, $event);
261
262 $this->assertEquals(array(), $event->getData());
263 }
264
265 public function testSubmitEmptyGetRequestToSimpleForm()
266 {
267 if (!class_exists('Symfony\Component\HttpFoundation\Request')) {
268 $this->markTestSkipped('The "HttpFoundation" component is not available');
269 }
270
271 $request = new Request(array(), array(), array(), array(), array(), array(
272 'REQUEST_METHOD' => 'GET',
273 ));
274
275 $dispatcher = $this->getMock('Symfony\Component\EventDispatcher\EventDispatcherInterface');
276 $config = new FormConfigBuilder('author', null, $dispatcher);
277 $config->setCompound(false);
278 $form = new Form($config);
279 $event = new FormEvent($form, $request);
280
281 $listener = new BindRequestListener();
282 DeprecationErrorHandler::preBind($listener, $event);
283
284 $this->assertNull($event->getData());
285 }
286}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/HttpFoundation/HttpFoundationRequestHandlerTest.php b/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/HttpFoundation/HttpFoundationRequestHandlerTest.php
deleted file mode 100644
index 2d5cf776..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/HttpFoundation/HttpFoundationRequestHandlerTest.php
+++ /dev/null
@@ -1,54 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Tests\Extension\HttpFoundation;
13
14use Symfony\Component\Form\Extension\HttpFoundation\HttpFoundationRequestHandler;
15use Symfony\Component\Form\Tests\AbstractRequestHandlerTest;
16use Symfony\Component\HttpFoundation\Request;
17
18/**
19 * @author Bernhard Schussek <bschussek@gmail.com>
20 */
21class HttpFoundationRequestHandlerTest extends AbstractRequestHandlerTest
22{
23 /**
24 * @expectedException \Symfony\Component\Form\Exception\UnexpectedTypeException
25 */
26 public function testRequestShouldNotBeNull()
27 {
28 $this->requestHandler->handleRequest($this->getMockForm('name', 'GET'));
29 }
30 /**
31 * @expectedException \Symfony\Component\Form\Exception\UnexpectedTypeException
32 */
33 public function testRequestShouldBeInstanceOfRequest()
34 {
35 $this->requestHandler->handleRequest($this->getMockForm('name', 'GET'), new \stdClass());
36 }
37
38 protected function setRequestData($method, $data, $files = array())
39 {
40 $this->request = Request::create('http://localhost', $method, $data, array(), $files);
41 }
42
43 protected function getRequestHandler()
44 {
45 return new HttpFoundationRequestHandler();
46 }
47
48 protected function getMockFile()
49 {
50 return $this->getMockBuilder('Symfony\Component\HttpFoundation\File\UploadedFile')
51 ->disableOriginalConstructor()
52 ->getMock();
53 }
54}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Validator/Constraints/FormValidatorTest.php b/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Validator/Constraints/FormValidatorTest.php
deleted file mode 100644
index a8bdde8a..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Validator/Constraints/FormValidatorTest.php
+++ /dev/null
@@ -1,748 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Tests\Extension\Validator\Constraints;
13
14use Symfony\Component\Form\FormBuilder;
15use Symfony\Component\Form\Exception\TransformationFailedException;
16use Symfony\Component\Form\CallbackTransformer;
17use Symfony\Component\Form\FormInterface;
18use Symfony\Component\Form\Extension\Validator\Constraints\Form;
19use Symfony\Component\Form\Extension\Validator\Constraints\FormValidator;
20use Symfony\Component\Form\SubmitButtonBuilder;
21use Symfony\Component\Validator\Constraint;
22use Symfony\Component\Validator\Constraints\NotNull;
23use Symfony\Component\Validator\Constraints\NotBlank;
24
25/**
26 * @author Bernhard Schussek <bschussek@gmail.com>
27 */
28class FormValidatorTest extends \PHPUnit_Framework_TestCase
29{
30 /**
31 * @var \PHPUnit_Framework_MockObject_MockObject
32 */
33 private $dispatcher;
34
35 /**
36 * @var \PHPUnit_Framework_MockObject_MockObject
37 */
38 private $factory;
39
40 /**
41 * @var \PHPUnit_Framework_MockObject_MockObject
42 */
43 private $serverParams;
44
45 /**
46 * @var FormValidator
47 */
48 private $validator;
49
50 protected function setUp()
51 {
52 if (!class_exists('Symfony\Component\EventDispatcher\Event')) {
53 $this->markTestSkipped('The "EventDispatcher" component is not available');
54 }
55
56 $this->dispatcher = $this->getMock('Symfony\Component\EventDispatcher\EventDispatcherInterface');
57 $this->factory = $this->getMock('Symfony\Component\Form\FormFactoryInterface');
58 $this->serverParams = $this->getMock(
59 'Symfony\Component\Form\Extension\Validator\Util\ServerParams',
60 array('getNormalizedIniPostMaxSize', 'getContentLength')
61 );
62 $this->validator = new FormValidator($this->serverParams);
63 }
64
65 public function testValidate()
66 {
67 $context = $this->getMockExecutionContext();
68 $object = $this->getMock('\stdClass');
69 $options = array('validation_groups' => array('group1', 'group2'));
70 $form = $this->getBuilder('name', '\stdClass', $options)
71 ->setData($object)
72 ->getForm();
73
74 $context->expects($this->at(0))
75 ->method('validate')
76 ->with($object, 'data', 'group1', true);
77 $context->expects($this->at(1))
78 ->method('validate')
79 ->with($object, 'data', 'group2', true);
80
81 $this->validator->initialize($context);
82 $this->validator->validate($form, new Form());
83 }
84
85 public function testValidateConstraints()
86 {
87 $context = $this->getMockExecutionContext();
88 $object = $this->getMock('\stdClass');
89 $constraint1 = new NotNull(array('groups' => array('group1', 'group2')));
90 $constraint2 = new NotBlank(array('groups' => 'group2'));
91
92 $options = array(
93 'validation_groups' => array('group1', 'group2'),
94 'constraints' => array($constraint1, $constraint2),
95 );
96 $form = $this->getBuilder('name', '\stdClass', $options)
97 ->setData($object)
98 ->getForm();
99
100 // First default constraints
101 $context->expects($this->at(0))
102 ->method('validate')
103 ->with($object, 'data', 'group1', true);
104 $context->expects($this->at(1))
105 ->method('validate')
106 ->with($object, 'data', 'group2', true);
107
108 // Then custom constraints
109 $context->expects($this->at(2))
110 ->method('validateValue')
111 ->with($object, $constraint1, 'data', 'group1');
112 $context->expects($this->at(3))
113 ->method('validateValue')
114 ->with($object, $constraint2, 'data', 'group2');
115
116 $this->validator->initialize($context);
117 $this->validator->validate($form, new Form());
118 }
119
120 public function testDontValidateIfParentWithoutCascadeValidation()
121 {
122 $context = $this->getMockExecutionContext();
123 $object = $this->getMock('\stdClass');
124
125 $parent = $this->getBuilder('parent', null, array('cascade_validation' => false))
126 ->setCompound(true)
127 ->setDataMapper($this->getDataMapper())
128 ->getForm();
129 $options = array('validation_groups' => array('group1', 'group2'));
130 $form = $this->getBuilder('name', '\stdClass', $options)->getForm();
131 $parent->add($form);
132
133 $form->setData($object);
134
135 $context->expects($this->never())
136 ->method('validate');
137
138 $this->validator->initialize($context);
139 $this->validator->validate($form, new Form());
140 }
141
142 public function testValidateConstraintsEvenIfNoCascadeValidation()
143 {
144 $context = $this->getMockExecutionContext();
145 $object = $this->getMock('\stdClass');
146 $constraint1 = new NotNull(array('groups' => array('group1', 'group2')));
147 $constraint2 = new NotBlank(array('groups' => 'group2'));
148
149 $parent = $this->getBuilder('parent', null, array('cascade_validation' => false))
150 ->setCompound(true)
151 ->setDataMapper($this->getDataMapper())
152 ->getForm();
153 $options = array(
154 'validation_groups' => array('group1', 'group2'),
155 'constraints' => array($constraint1, $constraint2),
156 );
157 $form = $this->getBuilder('name', '\stdClass', $options)
158 ->setData($object)
159 ->getForm();
160 $parent->add($form);
161
162 $context->expects($this->at(0))
163 ->method('validateValue')
164 ->with($object, $constraint1, 'data', 'group1');
165 $context->expects($this->at(1))
166 ->method('validateValue')
167 ->with($object, $constraint2, 'data', 'group2');
168
169 $this->validator->initialize($context);
170 $this->validator->validate($form, new Form());
171 }
172
173 public function testDontValidateIfNoValidationGroups()
174 {
175 $context = $this->getMockExecutionContext();
176 $object = $this->getMock('\stdClass');
177
178 $form = $this->getBuilder('name', '\stdClass', array(
179 'validation_groups' => array(),
180 ))
181 ->setData($object)
182 ->getForm();
183
184 $form->setData($object);
185
186 $context->expects($this->never())
187 ->method('validate');
188
189 $this->validator->initialize($context);
190 $this->validator->validate($form, new Form());
191 }
192
193 public function testDontValidateConstraintsIfNoValidationGroups()
194 {
195 $context = $this->getMockExecutionContext();
196 $object = $this->getMock('\stdClass');
197 $constraint1 = $this->getMock('Symfony\Component\Validator\Constraint');
198 $constraint2 = $this->getMock('Symfony\Component\Validator\Constraint');
199
200 $options = array(
201 'validation_groups' => array(),
202 'constraints' => array($constraint1, $constraint2),
203 );
204 $form = $this->getBuilder('name', '\stdClass', $options)
205 ->setData($object)
206 ->getForm();
207
208 // Launch transformer
209 $form->submit(array());
210
211 $context->expects($this->never())
212 ->method('validate');
213
214 $this->validator->initialize($context);
215 $this->validator->validate($form, new Form());
216 }
217
218 public function testDontValidateIfNotSynchronized()
219 {
220 $context = $this->getMockExecutionContext();
221 $object = $this->getMock('\stdClass');
222
223 $form = $this->getBuilder('name', '\stdClass', array(
224 'invalid_message' => 'invalid_message_key',
225 // Invalid message parameters must be supported, because the
226 // invalid message can be a translation key
227 // see https://github.com/symfony/symfony/issues/5144
228 'invalid_message_parameters' => array('{{ foo }}' => 'bar'),
229 ))
230 ->setData($object)
231 ->addViewTransformer(new CallbackTransformer(
232 function ($data) { return $data; },
233 function () { throw new TransformationFailedException(); }
234 ))
235 ->getForm();
236
237 // Launch transformer
238 $form->submit('foo');
239
240 $context->expects($this->never())
241 ->method('validate');
242
243 $context->expects($this->once())
244 ->method('addViolation')
245 ->with(
246 'invalid_message_key',
247 array('{{ value }}' => 'foo', '{{ foo }}' => 'bar'),
248 'foo'
249 );
250 $context->expects($this->never())
251 ->method('addViolationAt');
252
253 $this->validator->initialize($context);
254 $this->validator->validate($form, new Form());
255 }
256
257 public function testAddInvalidErrorEvenIfNoValidationGroups()
258 {
259 $context = $this->getMockExecutionContext();
260 $object = $this->getMock('\stdClass');
261
262 $form = $this->getBuilder('name', '\stdClass', array(
263 'invalid_message' => 'invalid_message_key',
264 // Invalid message parameters must be supported, because the
265 // invalid message can be a translation key
266 // see https://github.com/symfony/symfony/issues/5144
267 'invalid_message_parameters' => array('{{ foo }}' => 'bar'),
268 'validation_groups' => array(),
269 ))
270 ->setData($object)
271 ->addViewTransformer(new CallbackTransformer(
272 function ($data) { return $data; },
273 function () { throw new TransformationFailedException(); }
274 ))
275 ->getForm();
276
277 // Launch transformer
278 $form->submit('foo');
279
280 $context->expects($this->never())
281 ->method('validate');
282
283 $context->expects($this->once())
284 ->method('addViolation')
285 ->with(
286 'invalid_message_key',
287 array('{{ value }}' => 'foo', '{{ foo }}' => 'bar'),
288 'foo'
289 );
290 $context->expects($this->never())
291 ->method('addViolationAt');
292
293 $this->validator->initialize($context);
294 $this->validator->validate($form, new Form());
295 }
296
297 public function testDontValidateConstraintsIfNotSynchronized()
298 {
299 $context = $this->getMockExecutionContext();
300 $object = $this->getMock('\stdClass');
301 $constraint1 = $this->getMock('Symfony\Component\Validator\Constraint');
302 $constraint2 = $this->getMock('Symfony\Component\Validator\Constraint');
303
304 $options = array(
305 'validation_groups' => array('group1', 'group2'),
306 'constraints' => array($constraint1, $constraint2),
307 );
308 $form = $this->getBuilder('name', '\stdClass', $options)
309 ->setData($object)
310 ->addViewTransformer(new CallbackTransformer(
311 function ($data) { return $data; },
312 function () { throw new TransformationFailedException(); }
313 ))
314 ->getForm();
315
316 // Launch transformer
317 $form->submit(array());
318
319 $context->expects($this->never())
320 ->method('validate');
321
322 $this->validator->initialize($context);
323 $this->validator->validate($form, new Form());
324 }
325
326 // https://github.com/symfony/symfony/issues/4359
327 public function testDontMarkInvalidIfAnyChildIsNotSynchronized()
328 {
329 $context = $this->getMockExecutionContext();
330 $object = $this->getMock('\stdClass');
331
332 $failingTransformer = new CallbackTransformer(
333 function ($data) { return $data; },
334 function () { throw new TransformationFailedException(); }
335 );
336
337 $form = $this->getBuilder('name', '\stdClass')
338 ->setData($object)
339 ->addViewTransformer($failingTransformer)
340 ->setCompound(true)
341 ->setDataMapper($this->getDataMapper())
342 ->add(
343 $this->getBuilder('child')
344 ->addViewTransformer($failingTransformer)
345 )
346 ->getForm();
347
348 // Launch transformer
349 $form->submit(array('child' => 'foo'));
350
351 $context->expects($this->never())
352 ->method('addViolation');
353 $context->expects($this->never())
354 ->method('addViolationAt');
355
356 $this->validator->initialize($context);
357 $this->validator->validate($form, new Form());
358 }
359
360 public function testHandleCallbackValidationGroups()
361 {
362 $context = $this->getMockExecutionContext();
363 $object = $this->getMock('\stdClass');
364 $options = array('validation_groups' => array($this, 'getValidationGroups'));
365 $form = $this->getBuilder('name', '\stdClass', $options)
366 ->setData($object)
367 ->getForm();
368
369 $context->expects($this->at(0))
370 ->method('validate')
371 ->with($object, 'data', 'group1', true);
372 $context->expects($this->at(1))
373 ->method('validate')
374 ->with($object, 'data', 'group2', true);
375
376 $this->validator->initialize($context);
377 $this->validator->validate($form, new Form());
378 }
379
380 public function testDontExecuteFunctionNames()
381 {
382 $context = $this->getMockExecutionContext();
383 $object = $this->getMock('\stdClass');
384 $options = array('validation_groups' => 'header');
385 $form = $this->getBuilder('name', '\stdClass', $options)
386 ->setData($object)
387 ->getForm();
388
389 $context->expects($this->once())
390 ->method('validate')
391 ->with($object, 'data', 'header', true);
392
393 $this->validator->initialize($context);
394 $this->validator->validate($form, new Form());
395 }
396
397 public function testHandleClosureValidationGroups()
398 {
399 $context = $this->getMockExecutionContext();
400 $object = $this->getMock('\stdClass');
401 $options = array('validation_groups' => function(FormInterface $form){
402 return array('group1', 'group2');
403 });
404 $form = $this->getBuilder('name', '\stdClass', $options)
405 ->setData($object)
406 ->getForm();
407
408 $context->expects($this->at(0))
409 ->method('validate')
410 ->with($object, 'data', 'group1', true);
411 $context->expects($this->at(1))
412 ->method('validate')
413 ->with($object, 'data', 'group2', true);
414
415 $this->validator->initialize($context);
416 $this->validator->validate($form, new Form());
417 }
418
419 public function testUseValidationGroupOfClickedButton()
420 {
421 $context = $this->getMockExecutionContext();
422 $object = $this->getMock('\stdClass');
423
424 $parent = $this->getBuilder('parent', null, array('cascade_validation' => true))
425 ->setCompound(true)
426 ->setDataMapper($this->getDataMapper())
427 ->getForm();
428 $form = $this->getForm('name', '\stdClass', array(
429 'validation_groups' => 'form_group',
430 ));
431
432 $parent->add($form);
433 $parent->add($this->getClickedSubmitButton('submit', array(
434 'validation_groups' => 'button_group',
435 )));
436
437 $form->setData($object);
438
439 $context->expects($this->once())
440 ->method('validate')
441 ->with($object, 'data', 'button_group', true);
442
443 $this->validator->initialize($context);
444 $this->validator->validate($form, new Form());
445 }
446
447 public function testDontUseValidationGroupOfUnclickedButton()
448 {
449 $context = $this->getMockExecutionContext();
450 $object = $this->getMock('\stdClass');
451
452 $parent = $this->getBuilder('parent', null, array('cascade_validation' => true))
453 ->setCompound(true)
454 ->setDataMapper($this->getDataMapper())
455 ->getForm();
456 $form = $this->getForm('name', '\stdClass', array(
457 'validation_groups' => 'form_group',
458 ));
459
460 $parent->add($form);
461 $parent->add($this->getSubmitButton('submit', array(
462 'validation_groups' => 'button_group',
463 )));
464
465 $form->setData($object);
466
467 $context->expects($this->once())
468 ->method('validate')
469 ->with($object, 'data', 'form_group', true);
470
471 $this->validator->initialize($context);
472 $this->validator->validate($form, new Form());
473 }
474
475 public function testUseInheritedValidationGroup()
476 {
477 $context = $this->getMockExecutionContext();
478 $object = $this->getMock('\stdClass');
479
480 $parentOptions = array(
481 'validation_groups' => 'group',
482 'cascade_validation' => true,
483 );
484 $parent = $this->getBuilder('parent', null, $parentOptions)
485 ->setCompound(true)
486 ->setDataMapper($this->getDataMapper())
487 ->getForm();
488 $form = $this->getBuilder('name', '\stdClass')->getForm();
489 $parent->add($form);
490
491 $form->setData($object);
492
493 $context->expects($this->once())
494 ->method('validate')
495 ->with($object, 'data', 'group', true);
496
497 $this->validator->initialize($context);
498 $this->validator->validate($form, new Form());
499 }
500
501 public function testUseInheritedCallbackValidationGroup()
502 {
503 $context = $this->getMockExecutionContext();
504 $object = $this->getMock('\stdClass');
505
506 $parentOptions = array(
507 'validation_groups' => array($this, 'getValidationGroups'),
508 'cascade_validation' => true,
509 );
510 $parent = $this->getBuilder('parent', null, $parentOptions)
511 ->setCompound(true)
512 ->setDataMapper($this->getDataMapper())
513 ->getForm();
514 $form = $this->getBuilder('name', '\stdClass')->getForm();
515 $parent->add($form);
516
517 $form->setData($object);
518
519 $context->expects($this->at(0))
520 ->method('validate')
521 ->with($object, 'data', 'group1', true);
522 $context->expects($this->at(1))
523 ->method('validate')
524 ->with($object, 'data', 'group2', true);
525
526 $this->validator->initialize($context);
527 $this->validator->validate($form, new Form());
528 }
529
530 public function testUseInheritedClosureValidationGroup()
531 {
532 $context = $this->getMockExecutionContext();
533 $object = $this->getMock('\stdClass');
534
535 $parentOptions = array(
536 'validation_groups' => function(FormInterface $form){
537 return array('group1', 'group2');
538 },
539 'cascade_validation' => true,
540 );
541 $parent = $this->getBuilder('parent', null, $parentOptions)
542 ->setCompound(true)
543 ->setDataMapper($this->getDataMapper())
544 ->getForm();
545 $form = $this->getBuilder('name', '\stdClass')->getForm();
546 $parent->add($form);
547
548 $form->setData($object);
549
550 $context->expects($this->at(0))
551 ->method('validate')
552 ->with($object, 'data', 'group1', true);
553 $context->expects($this->at(1))
554 ->method('validate')
555 ->with($object, 'data', 'group2', true);
556
557 $this->validator->initialize($context);
558 $this->validator->validate($form, new Form());
559 }
560
561 public function testAppendPropertyPath()
562 {
563 $context = $this->getMockExecutionContext();
564 $object = $this->getMock('\stdClass');
565 $form = $this->getBuilder('name', '\stdClass')
566 ->setData($object)
567 ->getForm();
568
569 $context->expects($this->once())
570 ->method('validate')
571 ->with($object, 'data', 'Default', true);
572
573 $this->validator->initialize($context);
574 $this->validator->validate($form, new Form());
575 }
576
577 public function testDontWalkScalars()
578 {
579 $context = $this->getMockExecutionContext();
580
581 $form = $this->getBuilder()
582 ->setData('scalar')
583 ->getForm();
584
585 $context->expects($this->never())
586 ->method('validate');
587
588 $this->validator->initialize($context);
589 $this->validator->validate($form, new Form());
590 }
591
592 public function testViolationIfExtraData()
593 {
594 $context = $this->getMockExecutionContext();
595
596 $form = $this->getBuilder('parent', null, array('extra_fields_message' => 'Extra!'))
597 ->setCompound(true)
598 ->setDataMapper($this->getDataMapper())
599 ->add($this->getBuilder('child'))
600 ->getForm();
601
602 $form->submit(array('foo' => 'bar'));
603
604 $context->expects($this->once())
605 ->method('addViolation')
606 ->with(
607 'Extra!',
608 array('{{ extra_fields }}' => 'foo'),
609 array('foo' => 'bar')
610 );
611 $context->expects($this->never())
612 ->method('addViolationAt');
613
614 $this->validator->initialize($context);
615 $this->validator->validate($form, new Form());
616 }
617
618 /**
619 * @dataProvider getPostMaxSizeFixtures
620 */
621 public function testPostMaxSizeViolation($contentLength, $iniMax, $nbViolation, array $params = array())
622 {
623 $this->serverParams->expects($this->once())
624 ->method('getContentLength')
625 ->will($this->returnValue($contentLength));
626 $this->serverParams->expects($this->any())
627 ->method('getNormalizedIniPostMaxSize')
628 ->will($this->returnValue($iniMax));
629
630 $context = $this->getMockExecutionContext();
631 $options = array('post_max_size_message' => 'Max {{ max }}!');
632 $form = $this->getBuilder('name', null, $options)->getForm();
633
634 for ($i = 0; $i < $nbViolation; ++$i) {
635 if (0 === $i && count($params) > 0) {
636 $context->expects($this->at($i))
637 ->method('addViolation')
638 ->with($options['post_max_size_message'], $params);
639 } else {
640 $context->expects($this->at($i))
641 ->method('addViolation');
642 }
643 }
644
645 $context->expects($this->never())
646 ->method('addViolationAt');
647
648 $this->validator->initialize($context);
649 $this->validator->validate($form, new Form());
650 }
651
652 public function getPostMaxSizeFixtures()
653 {
654 return array(
655 array(pow(1024, 3) + 1, '1G', 1, array('{{ max }}' => '1G')),
656 array(pow(1024, 3), '1G', 0),
657 array(pow(1024, 2) + 1, '1M', 1, array('{{ max }}' => '1M')),
658 array(pow(1024, 2), '1M', 0),
659 array(1024 + 1, '1K', 1, array('{{ max }}' => '1K')),
660 array(1024, '1K', 0),
661 array(null, '1K', 0),
662 array(1024, '', 0),
663 array(1024, 0, 0),
664 );
665 }
666
667 public function testNoViolationIfNotRoot()
668 {
669 $this->serverParams->expects($this->once())
670 ->method('getContentLength')
671 ->will($this->returnValue(1025));
672 $this->serverParams->expects($this->never())
673 ->method('getNormalizedIniPostMaxSize');
674
675 $context = $this->getMockExecutionContext();
676 $parent = $this->getBuilder()
677 ->setCompound(true)
678 ->setDataMapper($this->getDataMapper())
679 ->getForm();
680 $form = $this->getForm();
681 $parent->add($form);
682
683 $context->expects($this->never())
684 ->method('addViolation');
685 $context->expects($this->never())
686 ->method('addViolationAt');
687
688 $this->validator->initialize($context);
689 $this->validator->validate($form, new Form());
690 }
691
692 /**
693 * Access has to be public, as this method is called via callback array
694 * in {@link testValidateFormDataCanHandleCallbackValidationGroups()}
695 * and {@link testValidateFormDataUsesInheritedCallbackValidationGroup()}
696 */
697 public function getValidationGroups(FormInterface $form)
698 {
699 return array('group1', 'group2');
700 }
701
702 private function getMockExecutionContext()
703 {
704 return $this->getMock('Symfony\Component\Validator\ExecutionContextInterface');
705 }
706
707 /**
708 * @param string $name
709 * @param string $dataClass
710 * @param array $options
711 *
712 * @return FormBuilder
713 */
714 private function getBuilder($name = 'name', $dataClass = null, array $options = array())
715 {
716 $options = array_replace(array(
717 'constraints' => array(),
718 'invalid_message_parameters' => array(),
719 ), $options);
720
721 return new FormBuilder($name, $dataClass, $this->dispatcher, $this->factory, $options);
722 }
723
724 private function getForm($name = 'name', $dataClass = null, array $options = array())
725 {
726 return $this->getBuilder($name, $dataClass, $options)->getForm();
727 }
728
729 private function getSubmitButton($name = 'name', array $options = array())
730 {
731 $builder = new SubmitButtonBuilder($name, $options);
732
733 return $builder->getForm();
734 }
735
736 private function getClickedSubmitButton($name = 'name', array $options = array())
737 {
738 return $this->getSubmitButton($name, $options)->submit('');
739 }
740
741 /**
742 * @return \PHPUnit_Framework_MockObject_MockObject
743 */
744 private function getDataMapper()
745 {
746 return $this->getMock('Symfony\Component\Form\DataMapperInterface');
747 }
748}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Validator/EventListener/ValidationListenerTest.php b/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Validator/EventListener/ValidationListenerTest.php
deleted file mode 100644
index 528f9463..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Validator/EventListener/ValidationListenerTest.php
+++ /dev/null
@@ -1,145 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Tests\Extension\Validator\EventListener;
13
14use Symfony\Component\Form\FormBuilder;
15use Symfony\Component\Form\FormEvent;
16use Symfony\Component\Form\Extension\Validator\Constraints\Form;
17use Symfony\Component\Form\Extension\Validator\EventListener\ValidationListener;
18use Symfony\Component\PropertyAccess\PropertyPath;
19use Symfony\Component\Validator\ConstraintViolation;
20
21class ValidationListenerTest extends \PHPUnit_Framework_TestCase
22{
23 /**
24 * @var \PHPUnit_Framework_MockObject_MockObject
25 */
26 private $dispatcher;
27
28 /**
29 * @var \PHPUnit_Framework_MockObject_MockObject
30 */
31 private $factory;
32
33 /**
34 * @var \PHPUnit_Framework_MockObject_MockObject
35 */
36 private $validator;
37
38 /**
39 * @var \PHPUnit_Framework_MockObject_MockObject
40 */
41 private $violationMapper;
42
43 /**
44 * @var ValidationListener
45 */
46 private $listener;
47
48 private $message;
49
50 private $messageTemplate;
51
52 private $params;
53
54 protected function setUp()
55 {
56 if (!class_exists('Symfony\Component\EventDispatcher\Event')) {
57 $this->markTestSkipped('The "EventDispatcher" component is not available');
58 }
59
60 $this->dispatcher = $this->getMock('Symfony\Component\EventDispatcher\EventDispatcherInterface');
61 $this->factory = $this->getMock('Symfony\Component\Form\FormFactoryInterface');
62 $this->validator = $this->getMock('Symfony\Component\Validator\ValidatorInterface');
63 $this->violationMapper = $this->getMock('Symfony\Component\Form\Extension\Validator\ViolationMapper\ViolationMapperInterface');
64 $this->listener = new ValidationListener($this->validator, $this->violationMapper);
65 $this->message = 'Message';
66 $this->messageTemplate = 'Message template';
67 $this->params = array('foo' => 'bar');
68 }
69
70 private function getConstraintViolation($code = null)
71 {
72 return new ConstraintViolation($this->message, $this->messageTemplate, $this->params, null, 'prop.path', null, null, $code);
73 }
74
75 private function getBuilder($name = 'name', $propertyPath = null, $dataClass = null)
76 {
77 $builder = new FormBuilder($name, $dataClass, $this->dispatcher, $this->factory);
78 $builder->setPropertyPath(new PropertyPath($propertyPath ?: $name));
79 $builder->setAttribute('error_mapping', array());
80 $builder->setErrorBubbling(false);
81 $builder->setMapped(true);
82
83 return $builder;
84 }
85
86 private function getForm($name = 'name', $propertyPath = null, $dataClass = null)
87 {
88 return $this->getBuilder($name, $propertyPath, $dataClass)->getForm();
89 }
90
91 private function getMockForm()
92 {
93 return $this->getMock('Symfony\Component\Form\Test\FormInterface');
94 }
95
96 // More specific mapping tests can be found in ViolationMapperTest
97 public function testMapViolation()
98 {
99 $violation = $this->getConstraintViolation();
100 $form = $this->getForm('street');
101
102 $this->validator->expects($this->once())
103 ->method('validate')
104 ->will($this->returnValue(array($violation)));
105
106 $this->violationMapper->expects($this->once())
107 ->method('mapViolation')
108 ->with($violation, $form, false);
109
110 $this->listener->validateForm(new FormEvent($form, null));
111 }
112
113 public function testMapViolationAllowsNonSyncIfInvalid()
114 {
115 $violation = $this->getConstraintViolation(Form::ERR_INVALID);
116 $form = $this->getForm('street');
117
118 $this->validator->expects($this->once())
119 ->method('validate')
120 ->will($this->returnValue(array($violation)));
121
122 $this->violationMapper->expects($this->once())
123 ->method('mapViolation')
124 // pass true now
125 ->with($violation, $form, true);
126
127 $this->listener->validateForm(new FormEvent($form, null));
128 }
129
130 public function testValidateIgnoresNonRoot()
131 {
132 $form = $this->getMockForm();
133 $form->expects($this->once())
134 ->method('isRoot')
135 ->will($this->returnValue(false));
136
137 $this->validator->expects($this->never())
138 ->method('validate');
139
140 $this->violationMapper->expects($this->never())
141 ->method('mapViolation');
142
143 $this->listener->validateForm(new FormEvent($form, null));
144 }
145}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Validator/Type/FormTypeValidatorExtensionTest.php b/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Validator/Type/FormTypeValidatorExtensionTest.php
deleted file mode 100644
index 66194105..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Validator/Type/FormTypeValidatorExtensionTest.php
+++ /dev/null
@@ -1,85 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Tests\Extension\Validator\Type;
13
14use Symfony\Component\Form\FormInterface;
15
16class FormTypeValidatorExtensionTest extends TypeTestCase
17{
18 public function testValidationGroupNullByDefault()
19 {
20 $form = $this->factory->create('form');
21
22 $this->assertNull($form->getConfig()->getOption('validation_groups'));
23 }
24
25 public function testValidationGroupsTransformedToArray()
26 {
27 $form = $this->factory->create('form', null, array(
28 'validation_groups' => 'group',
29 ));
30
31 $this->assertEquals(array('group'), $form->getConfig()->getOption('validation_groups'));
32 }
33
34 public function testValidationGroupsCanBeSetToArray()
35 {
36 $form = $this->factory->create('form', null, array(
37 'validation_groups' => array('group1', 'group2'),
38 ));
39
40 $this->assertEquals(array('group1', 'group2'), $form->getConfig()->getOption('validation_groups'));
41 }
42
43 public function testValidationGroupsCanBeSetToFalse()
44 {
45 $form = $this->factory->create('form', null, array(
46 'validation_groups' => false,
47 ));
48
49 $this->assertEquals(array(), $form->getConfig()->getOption('validation_groups'));
50 }
51
52 public function testValidationGroupsCanBeSetToCallback()
53 {
54 $form = $this->factory->create('form', null, array(
55 'validation_groups' => array($this, 'testValidationGroupsCanBeSetToCallback'),
56 ));
57
58 $this->assertTrue(is_callable($form->getConfig()->getOption('validation_groups')));
59 }
60
61 public function testValidationGroupsCanBeSetToClosure()
62 {
63 $form = $this->factory->create('form', null, array(
64 'validation_groups' => function(FormInterface $form){ return null; },
65 ));
66
67 $this->assertTrue(is_callable($form->getConfig()->getOption('validation_groups')));
68 }
69
70 public function testSubmitValidatesData()
71 {
72 $builder = $this->factory->createBuilder('form', null, array(
73 'validation_groups' => 'group',
74 ));
75 $builder->add('firstName', 'form');
76 $form = $builder->getForm();
77
78 $this->validator->expects($this->once())
79 ->method('validate')
80 ->with($this->equalTo($form));
81
82 // specific data is irrelevant
83 $form->submit(array());
84 }
85}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Validator/Type/TypeTestCase.php b/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Validator/Type/TypeTestCase.php
deleted file mode 100644
index d94d896a..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Validator/Type/TypeTestCase.php
+++ /dev/null
@@ -1,49 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien.potencier@symfony-project.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Tests\Extension\Validator\Type;
13
14use Symfony\Component\Form\Test\TypeTestCase as BaseTypeTestCase;
15use Symfony\Component\Form\Extension\Validator\ValidatorExtension;
16
17abstract class TypeTestCase extends BaseTypeTestCase
18{
19 protected $validator;
20
21 protected function setUp()
22 {
23 if (!class_exists('Symfony\Component\Validator\Constraint')) {
24 $this->markTestSkipped('The "Validator" component is not available');
25 }
26
27 $this->validator = $this->getMock('Symfony\Component\Validator\ValidatorInterface');
28 $metadataFactory = $this->getMock('Symfony\Component\Validator\MetadataFactoryInterface');
29 $this->validator->expects($this->once())->method('getMetadataFactory')->will($this->returnValue($metadataFactory));
30 $metadata = $this->getMockBuilder('Symfony\Component\Validator\Mapping\ClassMetadata')->disableOriginalConstructor()->getMock();
31 $metadataFactory->expects($this->once())->method('getMetadataFor')->will($this->returnValue($metadata));
32
33 parent::setUp();
34 }
35
36 protected function tearDown()
37 {
38 $this->validator = null;
39
40 parent::tearDown();
41 }
42
43 protected function getExtensions()
44 {
45 return array_merge(parent::getExtensions(), array(
46 new ValidatorExtension($this->validator),
47 ));
48 }
49}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Validator/Util/ServerParamsTest.php b/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Validator/Util/ServerParamsTest.php
deleted file mode 100644
index 7ad5b771..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Validator/Util/ServerParamsTest.php
+++ /dev/null
@@ -1,46 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Tests\Extension\Validator\Util;
13
14class ServerParamsTest extends \PHPUnit_Framework_TestCase
15{
16 /** @dataProvider getGetPostMaxSizeTestData */
17 public function testGetPostMaxSize($size, $bytes)
18 {
19 $serverParams = $this->getMock('Symfony\Component\Form\Extension\Validator\Util\ServerParams', array('getNormalizedIniPostMaxSize'));
20 $serverParams
21 ->expects($this->any())
22 ->method('getNormalizedIniPostMaxSize')
23 ->will($this->returnValue(strtoupper($size)));
24
25 $this->assertEquals($bytes, $serverParams->getPostMaxSize());
26 }
27
28 public function getGetPostMaxSizeTestData()
29 {
30 return array(
31 array('2k', 2048),
32 array('2 k', 2048),
33 array('8m', 8 * 1024 * 1024),
34 array('+2 k', 2048),
35 array('+2???k', 2048),
36 array('0x10', 16),
37 array('0xf', 15),
38 array('010', 8),
39 array('+0x10 k', 16 * 1024),
40 array('1g', 1024 * 1024 * 1024),
41 array('-1', -1),
42 array('0', 0),
43 array('2mk', 2048), // the unit must be the last char, so in this case 'k', not 'm'
44 );
45 }
46}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Validator/ViolationMapper/ViolationMapperTest.php b/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Validator/ViolationMapper/ViolationMapperTest.php
deleted file mode 100644
index c802ea7e..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Validator/ViolationMapper/ViolationMapperTest.php
+++ /dev/null
@@ -1,1481 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Tests\Extension\Validator\ViolationMapper;
13
14use Symfony\Component\Form\Extension\Validator\ViolationMapper\ViolationMapper;
15use Symfony\Component\Form\Exception\TransformationFailedException;
16use Symfony\Component\Form\CallbackTransformer;
17use Symfony\Component\Form\Form;
18use Symfony\Component\Form\FormConfigBuilder;
19use Symfony\Component\Form\FormError;
20use Symfony\Component\PropertyAccess\PropertyPath;
21use Symfony\Component\Validator\ConstraintViolation;
22
23/**
24 * @author Bernhard Schussek <bschussek@gmail.com>
25 */
26class ViolationMapperTest extends \PHPUnit_Framework_TestCase
27{
28 const LEVEL_0 = 0;
29
30 const LEVEL_1 = 1;
31
32 const LEVEL_1B = 2;
33
34 const LEVEL_2 = 3;
35
36 /**
37 * @var \PHPUnit_Framework_MockObject_MockObject
38 */
39 private $dispatcher;
40
41 /**
42 * @var ViolationMapper
43 */
44 private $mapper;
45
46 /**
47 * @var string
48 */
49 private $message;
50
51 /**
52 * @var string
53 */
54 private $messageTemplate;
55
56 /**
57 * @var array
58 */
59 private $params;
60
61 protected function setUp()
62 {
63 if (!class_exists('Symfony\Component\EventDispatcher\Event')) {
64 $this->markTestSkipped('The "EventDispatcher" component is not available');
65 }
66
67 $this->dispatcher = $this->getMock('Symfony\Component\EventDispatcher\EventDispatcherInterface');
68 $this->mapper = new ViolationMapper();
69 $this->message = 'Message';
70 $this->messageTemplate = 'Message template';
71 $this->params = array('foo' => 'bar');
72 }
73
74 protected function getForm($name = 'name', $propertyPath = null, $dataClass = null, $errorMapping = array(), $inheritData = false, $synchronized = true)
75 {
76 $config = new FormConfigBuilder($name, $dataClass, $this->dispatcher, array(
77 'error_mapping' => $errorMapping,
78 ));
79 $config->setMapped(true);
80 $config->setInheritData($inheritData);
81 $config->setPropertyPath($propertyPath);
82 $config->setCompound(true);
83 $config->setDataMapper($this->getDataMapper());
84
85 if (!$synchronized) {
86 $config->addViewTransformer(new CallbackTransformer(
87 function ($normData) { return $normData; },
88 function () { throw new TransformationFailedException(); }
89 ));
90 }
91
92 return new Form($config);
93 }
94
95 /**
96 * @return \PHPUnit_Framework_MockObject_MockObject
97 */
98 private function getDataMapper()
99 {
100 return $this->getMock('Symfony\Component\Form\DataMapperInterface');
101 }
102
103 /**
104 * @param $propertyPath
105 *
106 * @return ConstraintViolation
107 */
108 protected function getConstraintViolation($propertyPath)
109 {
110 return new ConstraintViolation($this->message, $this->messageTemplate, $this->params, null, $propertyPath, null);
111 }
112
113 /**
114 * @return FormError
115 */
116 protected function getFormError()
117 {
118 return new FormError($this->message, $this->messageTemplate, $this->params);
119 }
120
121 public function testMapToFormInheritingParentDataIfDataDoesNotMatch()
122 {
123 $violation = $this->getConstraintViolation('children[address].data.foo');
124 $parent = $this->getForm('parent');
125 $child = $this->getForm('address', 'address', null, array(), true);
126 $grandChild = $this->getForm('street');
127
128 $parent->add($child);
129 $child->add($grandChild);
130
131 $this->mapper->mapViolation($violation, $parent);
132
133 $this->assertCount(0, $parent->getErrors(), $parent->getName().' should not have an error, but has one');
134 $this->assertEquals(array($this->getFormError()), $child->getErrors(), $child->getName().' should have an error, but has none');
135 $this->assertCount(0, $grandChild->getErrors(), $grandChild->getName().' should not have an error, but has one');
136 }
137
138 public function testFollowDotRules()
139 {
140 $violation = $this->getConstraintViolation('data.foo');
141 $parent = $this->getForm('parent', null, null, array(
142 'foo' => 'address',
143 ));
144 $child = $this->getForm('address', null, null, array(
145 '.' => 'street',
146 ));
147 $grandChild = $this->getForm('street', null, null, array(
148 '.' => 'name',
149 ));
150 $grandGrandChild = $this->getForm('name');
151
152 $parent->add($child);
153 $child->add($grandChild);
154 $grandChild->add($grandGrandChild);
155
156 $this->mapper->mapViolation($violation, $parent);
157
158 $this->assertCount(0, $parent->getErrors(), $parent->getName().' should not have an error, but has one');
159 $this->assertCount(0, $child->getErrors(), $child->getName().' should not have an error, but has one');
160 $this->assertCount(0, $grandChild->getErrors(), $grandChild->getName().' should not have an error, but has one');
161 $this->assertEquals(array($this->getFormError()), $grandGrandChild->getErrors(), $grandGrandChild->getName().' should have an error, but has none');
162 }
163
164 public function testAbortMappingIfNotSynchronized()
165 {
166 $violation = $this->getConstraintViolation('children[address].data.street');
167 $parent = $this->getForm('parent');
168 $child = $this->getForm('address', 'address', null, array(), false, false);
169 // even though "street" is synchronized, it should not have any errors
170 // due to its parent not being synchronized
171 $grandChild = $this->getForm('street' , 'street');
172
173 $parent->add($child);
174 $child->add($grandChild);
175
176 // submit to invoke the transformer and mark the form unsynchronized
177 $parent->submit(array());
178
179 $this->mapper->mapViolation($violation, $parent);
180
181 $this->assertCount(0, $parent->getErrors(), $parent->getName().' should not have an error, but has one');
182 $this->assertCount(0, $child->getErrors(), $child->getName().' should not have an error, but has one');
183 $this->assertCount(0, $grandChild->getErrors(), $grandChild->getName().' should not have an error, but has one');
184 }
185
186 public function testAbortDotRuleMappingIfNotSynchronized()
187 {
188 $violation = $this->getConstraintViolation('data.address');
189 $parent = $this->getForm('parent');
190 $child = $this->getForm('address', 'address', null, array(
191 '.' => 'street',
192 ), false, false);
193 // even though "street" is synchronized, it should not have any errors
194 // due to its parent not being synchronized
195 $grandChild = $this->getForm('street');
196
197 $parent->add($child);
198 $child->add($grandChild);
199
200 // submit to invoke the transformer and mark the form unsynchronized
201 $parent->submit(array());
202
203 $this->mapper->mapViolation($violation, $parent);
204
205 $this->assertCount(0, $parent->getErrors(), $parent->getName().' should not have an error, but has one');
206 $this->assertCount(0, $child->getErrors(), $child->getName().' should not have an error, but has one');
207 $this->assertCount(0, $grandChild->getErrors(), $grandChild->getName().' should not have an error, but has one');
208 }
209
210 public function provideDefaultTests()
211 {
212 // The mapping must be deterministic! If a child has the property path "[street]",
213 // "data[street]" should be mapped, but "data.street" should not!
214 return array(
215 // mapping target, child name, its property path, grand child name, its property path, violation path
216 array(self::LEVEL_0, 'address', 'address', 'street', 'street', ''),
217 array(self::LEVEL_0, 'address', 'address', 'street', 'street', 'data'),
218
219 array(self::LEVEL_2, 'address', 'address', 'street', 'street', 'children[address].children[street].data'),
220 array(self::LEVEL_2, 'address', 'address', 'street', 'street', 'children[address].children[street].data.prop'),
221 array(self::LEVEL_1, 'address', 'address', 'street', 'street', 'children[address].data'),
222 array(self::LEVEL_2, 'address', 'address', 'street', 'street', 'children[address].data.street'),
223 array(self::LEVEL_2, 'address', 'address', 'street', 'street', 'children[address].data.street.prop'),
224 array(self::LEVEL_1, 'address', 'address', 'street', 'street', 'children[address].data[street]'),
225 array(self::LEVEL_1, 'address', 'address', 'street', 'street', 'children[address].data[street].prop'),
226 array(self::LEVEL_2, 'address', 'address', 'street', 'street', 'data.address.street'),
227 array(self::LEVEL_2, 'address', 'address', 'street', 'street', 'data.address.street.prop'),
228 array(self::LEVEL_1, 'address', 'address', 'street', 'street', 'data.address[street]'),
229 array(self::LEVEL_1, 'address', 'address', 'street', 'street', 'data.address[street].prop'),
230 array(self::LEVEL_0, 'address', 'address', 'street', 'street', 'data[address].street'),
231 array(self::LEVEL_0, 'address', 'address', 'street', 'street', 'data[address].street.prop'),
232 array(self::LEVEL_0, 'address', 'address', 'street', 'street', 'data[address][street]'),
233 array(self::LEVEL_0, 'address', 'address', 'street', 'street', 'data[address][street].prop'),
234
235 array(self::LEVEL_2, 'address', 'address', 'street', '[street]', 'children[address].children[street].data'),
236 array(self::LEVEL_2, 'address', 'address', 'street', '[street]', 'children[address].children[street].data.prop'),
237 array(self::LEVEL_1, 'address', 'address', 'street', '[street]', 'children[address].data'),
238 array(self::LEVEL_1, 'address', 'address', 'street', '[street]', 'children[address].data.street'),
239 array(self::LEVEL_1, 'address', 'address', 'street', '[street]', 'children[address].data.street.prop'),
240 array(self::LEVEL_2, 'address', 'address', 'street', '[street]', 'children[address].data[street]'),
241 array(self::LEVEL_2, 'address', 'address', 'street', '[street]', 'children[address].data[street].prop'),
242 array(self::LEVEL_1, 'address', 'address', 'street', '[street]', 'data.address.street'),
243 array(self::LEVEL_1, 'address', 'address', 'street', '[street]', 'data.address.street.prop'),
244 array(self::LEVEL_2, 'address', 'address', 'street', '[street]', 'data.address[street]'),
245 array(self::LEVEL_2, 'address', 'address', 'street', '[street]', 'data.address[street].prop'),
246 array(self::LEVEL_0, 'address', 'address', 'street', '[street]', 'data[address].street'),
247 array(self::LEVEL_0, 'address', 'address', 'street', '[street]', 'data[address].street.prop'),
248 array(self::LEVEL_0, 'address', 'address', 'street', '[street]', 'data[address][street]'),
249 array(self::LEVEL_0, 'address', 'address', 'street', '[street]', 'data[address][street].prop'),
250
251 array(self::LEVEL_2, 'address', '[address]', 'street', 'street', 'children[address].children[street].data'),
252 array(self::LEVEL_2, 'address', '[address]', 'street', 'street', 'children[address].children[street].data.prop'),
253 array(self::LEVEL_1, 'address', '[address]', 'street', 'street', 'children[address].data'),
254 array(self::LEVEL_2, 'address', '[address]', 'street', 'street', 'children[address].data.street'),
255 array(self::LEVEL_2, 'address', '[address]', 'street', 'street', 'children[address].data.street.prop'),
256 array(self::LEVEL_1, 'address', '[address]', 'street', 'street', 'children[address].data[street]'),
257 array(self::LEVEL_1, 'address', '[address]', 'street', 'street', 'children[address].data[street].prop'),
258 array(self::LEVEL_0, 'address', '[address]', 'street', 'street', 'data.address.street'),
259 array(self::LEVEL_0, 'address', '[address]', 'street', 'street', 'data.address.street.prop'),
260 array(self::LEVEL_0, 'address', '[address]', 'street', 'street', 'data.address[street]'),
261 array(self::LEVEL_0, 'address', '[address]', 'street', 'street', 'data.address[street].prop'),
262 array(self::LEVEL_2, 'address', '[address]', 'street', 'street', 'data[address].street'),
263 array(self::LEVEL_2, 'address', '[address]', 'street', 'street', 'data[address].street.prop'),
264 array(self::LEVEL_1, 'address', '[address]', 'street', 'street', 'data[address][street]'),
265 array(self::LEVEL_1, 'address', '[address]', 'street', 'street', 'data[address][street].prop'),
266
267 array(self::LEVEL_2, 'address', '[address]', 'street', '[street]', 'children[address].children[street].data'),
268 array(self::LEVEL_2, 'address', '[address]', 'street', '[street]', 'children[address].children[street].data.prop'),
269 array(self::LEVEL_1, 'address', '[address]', 'street', '[street]', 'children[address].data'),
270 array(self::LEVEL_1, 'address', '[address]', 'street', '[street]', 'children[address].data.street'),
271 array(self::LEVEL_1, 'address', '[address]', 'street', '[street]', 'children[address].data.street.prop'),
272 array(self::LEVEL_2, 'address', '[address]', 'street', '[street]', 'children[address].data[street]'),
273 array(self::LEVEL_2, 'address', '[address]', 'street', '[street]', 'children[address].data[street].prop'),
274 array(self::LEVEL_0, 'address', '[address]', 'street', '[street]', 'data.address.street'),
275 array(self::LEVEL_0, 'address', '[address]', 'street', '[street]', 'data.address.street.prop'),
276 array(self::LEVEL_0, 'address', '[address]', 'street', '[street]', 'data.address[street]'),
277 array(self::LEVEL_0, 'address', '[address]', 'street', '[street]', 'data.address[street].prop'),
278 array(self::LEVEL_1, 'address', '[address]', 'street', '[street]', 'data[address].street'),
279 array(self::LEVEL_1, 'address', '[address]', 'street', '[street]', 'data[address].street.prop'),
280 array(self::LEVEL_2, 'address', '[address]', 'street', '[street]', 'data[address][street]'),
281 array(self::LEVEL_2, 'address', '[address]', 'street', '[street]', 'data[address][street].prop'),
282
283 array(self::LEVEL_2, 'address', 'person.address', 'street', 'street', 'children[address].children[street].data'),
284 array(self::LEVEL_2, 'address', 'person.address', 'street', 'street', 'children[address].children[street].data.prop'),
285 array(self::LEVEL_1, 'address', 'person.address', 'street', 'street', 'children[address].data'),
286 array(self::LEVEL_2, 'address', 'person.address', 'street', 'street', 'children[address].data.street'),
287 array(self::LEVEL_2, 'address', 'person.address', 'street', 'street', 'children[address].data.street.prop'),
288 array(self::LEVEL_1, 'address', 'person.address', 'street', 'street', 'children[address].data[street]'),
289 array(self::LEVEL_1, 'address', 'person.address', 'street', 'street', 'children[address].data[street].prop'),
290 array(self::LEVEL_2, 'address', 'person.address', 'street', 'street', 'data.person.address.street'),
291 array(self::LEVEL_2, 'address', 'person.address', 'street', 'street', 'data.person.address.street.prop'),
292 array(self::LEVEL_1, 'address', 'person.address', 'street', 'street', 'data.person.address[street]'),
293 array(self::LEVEL_1, 'address', 'person.address', 'street', 'street', 'data.person.address[street].prop'),
294 array(self::LEVEL_0, 'address', 'person.address', 'street', 'street', 'data.person[address].street'),
295 array(self::LEVEL_0, 'address', 'person.address', 'street', 'street', 'data.person[address].street.prop'),
296 array(self::LEVEL_0, 'address', 'person.address', 'street', 'street', 'data.person[address][street]'),
297 array(self::LEVEL_0, 'address', 'person.address', 'street', 'street', 'data.person[address][street].prop'),
298 array(self::LEVEL_0, 'address', 'person.address', 'street', 'street', 'data[person].address.street'),
299 array(self::LEVEL_0, 'address', 'person.address', 'street', 'street', 'data[person].address.street.prop'),
300 array(self::LEVEL_0, 'address', 'person.address', 'street', 'street', 'data[person].address[street]'),
301 array(self::LEVEL_0, 'address', 'person.address', 'street', 'street', 'data[person].address[street].prop'),
302 array(self::LEVEL_0, 'address', 'person.address', 'street', 'street', 'data[person][address].street'),
303 array(self::LEVEL_0, 'address', 'person.address', 'street', 'street', 'data[person][address].street.prop'),
304 array(self::LEVEL_0, 'address', 'person.address', 'street', 'street', 'data[person][address][street]'),
305 array(self::LEVEL_0, 'address', 'person.address', 'street', 'street', 'data[person][address][street].prop'),
306
307 array(self::LEVEL_2, 'address', 'person.address', 'street', '[street]', 'children[address].children[street].data'),
308 array(self::LEVEL_2, 'address', 'person.address', 'street', '[street]', 'children[address].children[street].data.prop'),
309 array(self::LEVEL_1, 'address', 'person.address', 'street', '[street]', 'children[address].data'),
310 array(self::LEVEL_1, 'address', 'person.address', 'street', '[street]', 'children[address].data.street'),
311 array(self::LEVEL_1, 'address', 'person.address', 'street', '[street]', 'children[address].data.street.prop'),
312 array(self::LEVEL_2, 'address', 'person.address', 'street', '[street]', 'children[address].data[street]'),
313 array(self::LEVEL_2, 'address', 'person.address', 'street', '[street]', 'children[address].data[street].prop'),
314 array(self::LEVEL_1, 'address', 'person.address', 'street', '[street]', 'data.person.address.street'),
315 array(self::LEVEL_1, 'address', 'person.address', 'street', '[street]', 'data.person.address.street.prop'),
316 array(self::LEVEL_2, 'address', 'person.address', 'street', '[street]', 'data.person.address[street]'),
317 array(self::LEVEL_2, 'address', 'person.address', 'street', '[street]', 'data.person.address[street].prop'),
318 array(self::LEVEL_0, 'address', 'person.address', 'street', '[street]', 'data.person[address].street'),
319 array(self::LEVEL_0, 'address', 'person.address', 'street', '[street]', 'data.person[address].street.prop'),
320 array(self::LEVEL_0, 'address', 'person.address', 'street', '[street]', 'data.person[address][street]'),
321 array(self::LEVEL_0, 'address', 'person.address', 'street', '[street]', 'data.person[address][street].prop'),
322 array(self::LEVEL_0, 'address', 'person.address', 'street', '[street]', 'data[person].address.street'),
323 array(self::LEVEL_0, 'address', 'person.address', 'street', '[street]', 'data[person].address.street.prop'),
324 array(self::LEVEL_0, 'address', 'person.address', 'street', '[street]', 'data[person].address[street]'),
325 array(self::LEVEL_0, 'address', 'person.address', 'street', '[street]', 'data[person].address[street].prop'),
326 array(self::LEVEL_0, 'address', 'person.address', 'street', '[street]', 'data[person][address].street'),
327 array(self::LEVEL_0, 'address', 'person.address', 'street', '[street]', 'data[person][address].street.prop'),
328 array(self::LEVEL_0, 'address', 'person.address', 'street', '[street]', 'data[person][address][street]'),
329 array(self::LEVEL_0, 'address', 'person.address', 'street', '[street]', 'data[person][address][street].prop'),
330
331 array(self::LEVEL_2, 'address', 'person[address]', 'street', 'street', 'children[address].children[street].data'),
332 array(self::LEVEL_2, 'address', 'person[address]', 'street', 'street', 'children[address].children[street].data.prop'),
333 array(self::LEVEL_1, 'address', 'person[address]', 'street', 'street', 'children[address].data'),
334 array(self::LEVEL_2, 'address', 'person[address]', 'street', 'street', 'children[address].data.street'),
335 array(self::LEVEL_2, 'address', 'person[address]', 'street', 'street', 'children[address].data.street.prop'),
336 array(self::LEVEL_1, 'address', 'person[address]', 'street', 'street', 'children[address].data[street]'),
337 array(self::LEVEL_1, 'address', 'person[address]', 'street', 'street', 'children[address].data[street].prop'),
338 array(self::LEVEL_0, 'address', 'person[address]', 'street', 'street', 'data.person.address.street'),
339 array(self::LEVEL_0, 'address', 'person[address]', 'street', 'street', 'data.person.address.street.prop'),
340 array(self::LEVEL_0, 'address', 'person[address]', 'street', 'street', 'data.person.address[street]'),
341 array(self::LEVEL_0, 'address', 'person[address]', 'street', 'street', 'data.person.address[street].prop'),
342 array(self::LEVEL_2, 'address', 'person[address]', 'street', 'street', 'data.person[address].street'),
343 array(self::LEVEL_2, 'address', 'person[address]', 'street', 'street', 'data.person[address].street.prop'),
344 array(self::LEVEL_1, 'address', 'person[address]', 'street', 'street', 'data.person[address][street]'),
345 array(self::LEVEL_1, 'address', 'person[address]', 'street', 'street', 'data.person[address][street].prop'),
346 array(self::LEVEL_0, 'address', 'person[address]', 'street', 'street', 'data[person].address.street'),
347 array(self::LEVEL_0, 'address', 'person[address]', 'street', 'street', 'data[person].address.street.prop'),
348 array(self::LEVEL_0, 'address', 'person[address]', 'street', 'street', 'data[person].address[street]'),
349 array(self::LEVEL_0, 'address', 'person[address]', 'street', 'street', 'data[person].address[street].prop'),
350 array(self::LEVEL_0, 'address', 'person[address]', 'street', 'street', 'data[person][address].street'),
351 array(self::LEVEL_0, 'address', 'person[address]', 'street', 'street', 'data[person][address].street.prop'),
352 array(self::LEVEL_0, 'address', 'person[address]', 'street', 'street', 'data[person][address][street]'),
353 array(self::LEVEL_0, 'address', 'person[address]', 'street', 'street', 'data[person][address][street].prop'),
354
355 array(self::LEVEL_2, 'address', 'person[address]', 'street', '[street]', 'children[address].children[street].data'),
356 array(self::LEVEL_2, 'address', 'person[address]', 'street', '[street]', 'children[address].children[street].data.prop'),
357 array(self::LEVEL_1, 'address', 'person[address]', 'street', '[street]', 'children[address].data'),
358 array(self::LEVEL_1, 'address', 'person[address]', 'street', '[street]', 'children[address].data.street'),
359 array(self::LEVEL_1, 'address', 'person[address]', 'street', '[street]', 'children[address].data.street.prop'),
360 array(self::LEVEL_2, 'address', 'person[address]', 'street', '[street]', 'children[address].data[street]'),
361 array(self::LEVEL_2, 'address', 'person[address]', 'street', '[street]', 'children[address].data[street].prop'),
362 array(self::LEVEL_0, 'address', 'person[address]', 'street', '[street]', 'data.person.address.street'),
363 array(self::LEVEL_0, 'address', 'person[address]', 'street', '[street]', 'data.person.address.street.prop'),
364 array(self::LEVEL_0, 'address', 'person[address]', 'street', '[street]', 'data.person.address[street]'),
365 array(self::LEVEL_0, 'address', 'person[address]', 'street', '[street]', 'data.person.address[street].prop'),
366 array(self::LEVEL_1, 'address', 'person[address]', 'street', '[street]', 'data.person[address].street'),
367 array(self::LEVEL_1, 'address', 'person[address]', 'street', '[street]', 'data.person[address].street.prop'),
368 array(self::LEVEL_2, 'address', 'person[address]', 'street', '[street]', 'data.person[address][street]'),
369 array(self::LEVEL_2, 'address', 'person[address]', 'street', '[street]', 'data.person[address][street].prop'),
370 array(self::LEVEL_0, 'address', 'person[address]', 'street', '[street]', 'data[person].address.street'),
371 array(self::LEVEL_0, 'address', 'person[address]', 'street', '[street]', 'data[person].address.street.prop'),
372 array(self::LEVEL_0, 'address', 'person[address]', 'street', '[street]', 'data[person].address[street]'),
373 array(self::LEVEL_0, 'address', 'person[address]', 'street', '[street]', 'data[person].address[street].prop'),
374 array(self::LEVEL_0, 'address', 'person[address]', 'street', '[street]', 'data[person][address].street'),
375 array(self::LEVEL_0, 'address', 'person[address]', 'street', '[street]', 'data[person][address].street.prop'),
376 array(self::LEVEL_0, 'address', 'person[address]', 'street', '[street]', 'data[person][address][street]'),
377 array(self::LEVEL_0, 'address', 'person[address]', 'street', '[street]', 'data[person][address][street].prop'),
378
379 array(self::LEVEL_2, 'address', '[person].address', 'street', 'street', 'children[address].children[street].data'),
380 array(self::LEVEL_2, 'address', '[person].address', 'street', 'street', 'children[address].children[street].data.prop'),
381 array(self::LEVEL_1, 'address', '[person].address', 'street', 'street', 'children[address].data'),
382 array(self::LEVEL_2, 'address', '[person].address', 'street', 'street', 'children[address].data.street'),
383 array(self::LEVEL_2, 'address', '[person].address', 'street', 'street', 'children[address].data.street.prop'),
384 array(self::LEVEL_1, 'address', '[person].address', 'street', 'street', 'children[address].data[street]'),
385 array(self::LEVEL_1, 'address', '[person].address', 'street', 'street', 'children[address].data[street].prop'),
386 array(self::LEVEL_0, 'address', '[person].address', 'street', 'street', 'data.person.address.street'),
387 array(self::LEVEL_0, 'address', '[person].address', 'street', 'street', 'data.person.address.street.prop'),
388 array(self::LEVEL_0, 'address', '[person].address', 'street', 'street', 'data.person.address[street]'),
389 array(self::LEVEL_0, 'address', '[person].address', 'street', 'street', 'data.person.address[street].prop'),
390 array(self::LEVEL_0, 'address', '[person].address', 'street', 'street', 'data.person[address].street'),
391 array(self::LEVEL_0, 'address', '[person].address', 'street', 'street', 'data.person[address].street.prop'),
392 array(self::LEVEL_0, 'address', '[person].address', 'street', 'street', 'data.person[address][street]'),
393 array(self::LEVEL_0, 'address', '[person].address', 'street', 'street', 'data.person[address][street].prop'),
394 array(self::LEVEL_2, 'address', '[person].address', 'street', 'street', 'data[person].address.street'),
395 array(self::LEVEL_2, 'address', '[person].address', 'street', 'street', 'data[person].address.street.prop'),
396 array(self::LEVEL_1, 'address', '[person].address', 'street', 'street', 'data[person].address[street]'),
397 array(self::LEVEL_1, 'address', '[person].address', 'street', 'street', 'data[person].address[street].prop'),
398 array(self::LEVEL_0, 'address', '[person].address', 'street', 'street', 'data[person][address].street'),
399 array(self::LEVEL_0, 'address', '[person].address', 'street', 'street', 'data[person][address].street.prop'),
400 array(self::LEVEL_0, 'address', '[person].address', 'street', 'street', 'data[person][address][street]'),
401 array(self::LEVEL_0, 'address', '[person].address', 'street', 'street', 'data[person][address][street].prop'),
402
403 array(self::LEVEL_2, 'address', '[person].address', 'street', '[street]', 'children[address].children[street].data'),
404 array(self::LEVEL_2, 'address', '[person].address', 'street', '[street]', 'children[address].children[street].data.prop'),
405 array(self::LEVEL_1, 'address', '[person].address', 'street', '[street]', 'children[address].data'),
406 array(self::LEVEL_1, 'address', '[person].address', 'street', '[street]', 'children[address].data.street'),
407 array(self::LEVEL_1, 'address', '[person].address', 'street', '[street]', 'children[address].data.street.prop'),
408 array(self::LEVEL_2, 'address', '[person].address', 'street', '[street]', 'children[address].data[street]'),
409 array(self::LEVEL_2, 'address', '[person].address', 'street', '[street]', 'children[address].data[street].prop'),
410 array(self::LEVEL_0, 'address', '[person].address', 'street', '[street]', 'data.person.address.street'),
411 array(self::LEVEL_0, 'address', '[person].address', 'street', '[street]', 'data.person.address.street.prop'),
412 array(self::LEVEL_0, 'address', '[person].address', 'street', '[street]', 'data.person.address[street]'),
413 array(self::LEVEL_0, 'address', '[person].address', 'street', '[street]', 'data.person.address[street].prop'),
414 array(self::LEVEL_0, 'address', '[person].address', 'street', '[street]', 'data.person[address].street'),
415 array(self::LEVEL_0, 'address', '[person].address', 'street', '[street]', 'data.person[address].street.prop'),
416 array(self::LEVEL_0, 'address', '[person].address', 'street', '[street]', 'data.person[address][street]'),
417 array(self::LEVEL_0, 'address', '[person].address', 'street', '[street]', 'data.person[address][street].prop'),
418 array(self::LEVEL_1, 'address', '[person].address', 'street', '[street]', 'data[person].address.street'),
419 array(self::LEVEL_1, 'address', '[person].address', 'street', '[street]', 'data[person].address.street.prop'),
420 array(self::LEVEL_2, 'address', '[person].address', 'street', '[street]', 'data[person].address[street]'),
421 array(self::LEVEL_2, 'address', '[person].address', 'street', '[street]', 'data[person].address[street].prop'),
422 array(self::LEVEL_0, 'address', '[person].address', 'street', '[street]', 'data[person][address].street'),
423 array(self::LEVEL_0, 'address', '[person].address', 'street', '[street]', 'data[person][address].street.prop'),
424 array(self::LEVEL_0, 'address', '[person].address', 'street', '[street]', 'data[person][address][street]'),
425 array(self::LEVEL_0, 'address', '[person].address', 'street', '[street]', 'data[person][address][street].prop'),
426
427 array(self::LEVEL_2, 'address', '[person][address]', 'street', 'street', 'children[address].children[street].data'),
428 array(self::LEVEL_2, 'address', '[person][address]', 'street', 'street', 'children[address].children[street].data.prop'),
429 array(self::LEVEL_1, 'address', '[person][address]', 'street', 'street', 'children[address]'),
430 array(self::LEVEL_1, 'address', '[person][address]', 'street', 'street', 'children[address].data'),
431 array(self::LEVEL_2, 'address', '[person][address]', 'street', 'street', 'children[address].data.street'),
432 array(self::LEVEL_2, 'address', '[person][address]', 'street', 'street', 'children[address].data.street.prop'),
433 array(self::LEVEL_1, 'address', '[person][address]', 'street', 'street', 'children[address].data[street]'),
434 array(self::LEVEL_1, 'address', '[person][address]', 'street', 'street', 'children[address].data[street].prop'),
435 array(self::LEVEL_0, 'address', '[person][address]', 'street', 'street', 'data.person.address.street'),
436 array(self::LEVEL_0, 'address', '[person][address]', 'street', 'street', 'data.person.address.street.prop'),
437 array(self::LEVEL_0, 'address', '[person][address]', 'street', 'street', 'data.person.address[street]'),
438 array(self::LEVEL_0, 'address', '[person][address]', 'street', 'street', 'data.person.address[street].prop'),
439 array(self::LEVEL_0, 'address', '[person][address]', 'street', 'street', 'data.person[address].street'),
440 array(self::LEVEL_0, 'address', '[person][address]', 'street', 'street', 'data.person[address].street.prop'),
441 array(self::LEVEL_0, 'address', '[person][address]', 'street', 'street', 'data.person[address][street]'),
442 array(self::LEVEL_0, 'address', '[person][address]', 'street', 'street', 'data.person[address][street].prop'),
443 array(self::LEVEL_0, 'address', '[person][address]', 'street', 'street', 'data[person].address.street'),
444 array(self::LEVEL_0, 'address', '[person][address]', 'street', 'street', 'data[person].address.street.prop'),
445 array(self::LEVEL_0, 'address', '[person][address]', 'street', 'street', 'data[person].address[street]'),
446 array(self::LEVEL_0, 'address', '[person][address]', 'street', 'street', 'data[person].address[street].prop'),
447 array(self::LEVEL_2, 'address', '[person][address]', 'street', 'street', 'data[person][address].street'),
448 array(self::LEVEL_2, 'address', '[person][address]', 'street', 'street', 'data[person][address].street.prop'),
449 array(self::LEVEL_1, 'address', '[person][address]', 'street', 'street', 'data[person][address][street]'),
450 array(self::LEVEL_1, 'address', '[person][address]', 'street', 'street', 'data[person][address][street].prop'),
451
452 array(self::LEVEL_2, 'address', '[person][address]', 'street', '[street]', 'children[address].children[street].data'),
453 array(self::LEVEL_2, 'address', '[person][address]', 'street', '[street]', 'children[address].children[street].data.prop'),
454 array(self::LEVEL_1, 'address', '[person][address]', 'street', '[street]', 'children[address].data'),
455 array(self::LEVEL_1, 'address', '[person][address]', 'street', '[street]', 'children[address].data.street'),
456 array(self::LEVEL_1, 'address', '[person][address]', 'street', '[street]', 'children[address].data.street.prop'),
457 array(self::LEVEL_2, 'address', '[person][address]', 'street', '[street]', 'children[address].data[street]'),
458 array(self::LEVEL_2, 'address', '[person][address]', 'street', '[street]', 'children[address].data[street].prop'),
459 array(self::LEVEL_0, 'address', '[person][address]', 'street', '[street]', 'data.person.address.street'),
460 array(self::LEVEL_0, 'address', '[person][address]', 'street', '[street]', 'data.person.address.street.prop'),
461 array(self::LEVEL_0, 'address', '[person][address]', 'street', '[street]', 'data.person.address[street]'),
462 array(self::LEVEL_0, 'address', '[person][address]', 'street', '[street]', 'data.person.address[street].prop'),
463 array(self::LEVEL_0, 'address', '[person][address]', 'street', '[street]', 'data.person[address].street'),
464 array(self::LEVEL_0, 'address', '[person][address]', 'street', '[street]', 'data.person[address].street.prop'),
465 array(self::LEVEL_0, 'address', '[person][address]', 'street', '[street]', 'data.person[address][street]'),
466 array(self::LEVEL_0, 'address', '[person][address]', 'street', '[street]', 'data.person[address][street].prop'),
467 array(self::LEVEL_0, 'address', '[person][address]', 'street', '[street]', 'data[person].address.street'),
468 array(self::LEVEL_0, 'address', '[person][address]', 'street', '[street]', 'data[person].address.street.prop'),
469 array(self::LEVEL_0, 'address', '[person][address]', 'street', '[street]', 'data[person].address[street]'),
470 array(self::LEVEL_0, 'address', '[person][address]', 'street', '[street]', 'data[person].address[street].prop'),
471 array(self::LEVEL_1, 'address', '[person][address]', 'street', '[street]', 'data[person][address].street'),
472 array(self::LEVEL_1, 'address', '[person][address]', 'street', '[street]', 'data[person][address].street.prop'),
473 array(self::LEVEL_2, 'address', '[person][address]', 'street', '[street]', 'data[person][address][street]'),
474 array(self::LEVEL_2, 'address', '[person][address]', 'street', '[street]', 'data[person][address][street].prop'),
475
476 array(self::LEVEL_2, 'address', 'address', 'street', 'office.street', 'children[address].children[street].data'),
477 array(self::LEVEL_2, 'address', 'address', 'street', 'office.street', 'children[address].children[street].data.prop'),
478 array(self::LEVEL_1, 'address', 'address', 'street', 'office.street', 'children[address].data'),
479 array(self::LEVEL_1, 'address', 'address', 'street', 'office.street', 'children[address].data.office'),
480 array(self::LEVEL_2, 'address', 'address', 'street', 'office.street', 'children[address].data.office.street'),
481 array(self::LEVEL_2, 'address', 'address', 'street', 'office.street', 'children[address].data.office.street.prop'),
482 array(self::LEVEL_1, 'address', 'address', 'street', 'office.street', 'children[address].data.office[street]'),
483 array(self::LEVEL_1, 'address', 'address', 'street', 'office.street', 'children[address].data.office[street].prop'),
484 array(self::LEVEL_1, 'address', 'address', 'street', 'office.street', 'children[address].data[office]'),
485 array(self::LEVEL_1, 'address', 'address', 'street', 'office.street', 'children[address].data[office].street'),
486 array(self::LEVEL_1, 'address', 'address', 'street', 'office.street', 'children[address].data[office].street.prop'),
487 array(self::LEVEL_1, 'address', 'address', 'street', 'office.street', 'children[address].data[office][street]'),
488 array(self::LEVEL_1, 'address', 'address', 'street', 'office.street', 'children[address].data[office][street].prop'),
489 array(self::LEVEL_2, 'address', 'address', 'street', 'office.street', 'data.address.office.street'),
490 array(self::LEVEL_2, 'address', 'address', 'street', 'office.street', 'data.address.office.street.prop'),
491 array(self::LEVEL_1, 'address', 'address', 'street', 'office.street', 'data.address.office[street]'),
492 array(self::LEVEL_1, 'address', 'address', 'street', 'office.street', 'data.address.office[street].prop'),
493 array(self::LEVEL_1, 'address', 'address', 'street', 'office.street', 'data.address[office].street'),
494 array(self::LEVEL_1, 'address', 'address', 'street', 'office.street', 'data.address[office].street.prop'),
495 array(self::LEVEL_1, 'address', 'address', 'street', 'office.street', 'data.address[office][street]'),
496 array(self::LEVEL_1, 'address', 'address', 'street', 'office.street', 'data.address[office][street].prop'),
497 array(self::LEVEL_0, 'address', 'address', 'street', 'office.street', 'data[address].office.street'),
498 array(self::LEVEL_0, 'address', 'address', 'street', 'office.street', 'data[address].office.street.prop'),
499 array(self::LEVEL_0, 'address', 'address', 'street', 'office.street', 'data[address].office[street]'),
500 array(self::LEVEL_0, 'address', 'address', 'street', 'office.street', 'data[address].office[street].prop'),
501 array(self::LEVEL_0, 'address', 'address', 'street', 'office.street', 'data[address][office].street'),
502 array(self::LEVEL_0, 'address', 'address', 'street', 'office.street', 'data[address][office].street.prop'),
503 array(self::LEVEL_0, 'address', 'address', 'street', 'office.street', 'data[address][office][street]'),
504 array(self::LEVEL_0, 'address', 'address', 'street', 'office.street', 'data[address][office][street].prop'),
505
506 array(self::LEVEL_2, 'address', '[address]', 'street', 'office.street', 'children[address].children[street].data'),
507 array(self::LEVEL_2, 'address', '[address]', 'street', 'office.street', 'children[address].children[street].data.prop'),
508 array(self::LEVEL_1, 'address', '[address]', 'street', 'office.street', 'children[address].data'),
509 array(self::LEVEL_1, 'address', '[address]', 'street', 'office.street', 'children[address].data.office'),
510 array(self::LEVEL_2, 'address', '[address]', 'street', 'office.street', 'children[address].data.office.street'),
511 array(self::LEVEL_2, 'address', '[address]', 'street', 'office.street', 'children[address].data.office.street.prop'),
512 array(self::LEVEL_1, 'address', '[address]', 'street', 'office.street', 'children[address].data.office[street]'),
513 array(self::LEVEL_1, 'address', '[address]', 'street', 'office.street', 'children[address].data.office[street].prop'),
514 array(self::LEVEL_1, 'address', '[address]', 'street', 'office.street', 'children[address].data[office]'),
515 array(self::LEVEL_1, 'address', '[address]', 'street', 'office.street', 'children[address].data[office].street'),
516 array(self::LEVEL_1, 'address', '[address]', 'street', 'office.street', 'children[address].data[office].street.prop'),
517 array(self::LEVEL_1, 'address', '[address]', 'street', 'office.street', 'children[address].data[office][street]'),
518 array(self::LEVEL_1, 'address', '[address]', 'street', 'office.street', 'children[address].data[office][street].prop'),
519 array(self::LEVEL_0, 'address', '[address]', 'street', 'office.street', 'data.address.office.street'),
520 array(self::LEVEL_0, 'address', '[address]', 'street', 'office.street', 'data.address.office.street.prop'),
521 array(self::LEVEL_0, 'address', '[address]', 'street', 'office.street', 'data.address.office[street]'),
522 array(self::LEVEL_0, 'address', '[address]', 'street', 'office.street', 'data.address.office[street].prop'),
523 array(self::LEVEL_0, 'address', '[address]', 'street', 'office.street', 'data.address[office].street'),
524 array(self::LEVEL_0, 'address', '[address]', 'street', 'office.street', 'data.address[office].street.prop'),
525 array(self::LEVEL_0, 'address', '[address]', 'street', 'office.street', 'data.address[office][street]'),
526 array(self::LEVEL_0, 'address', '[address]', 'street', 'office.street', 'data.address[office][street].prop'),
527 array(self::LEVEL_2, 'address', '[address]', 'street', 'office.street', 'data[address].office.street'),
528 array(self::LEVEL_2, 'address', '[address]', 'street', 'office.street', 'data[address].office.street.prop'),
529 array(self::LEVEL_1, 'address', '[address]', 'street', 'office.street', 'data[address].office[street]'),
530 array(self::LEVEL_1, 'address', '[address]', 'street', 'office.street', 'data[address].office[street].prop'),
531 array(self::LEVEL_1, 'address', '[address]', 'street', 'office.street', 'data[address][office].street'),
532 array(self::LEVEL_1, 'address', '[address]', 'street', 'office.street', 'data[address][office].street.prop'),
533 array(self::LEVEL_1, 'address', '[address]', 'street', 'office.street', 'data[address][office][street]'),
534 array(self::LEVEL_1, 'address', '[address]', 'street', 'office.street', 'data[address][office][street].prop'),
535
536 array(self::LEVEL_2, 'address', 'address', 'street', 'office[street]', 'children[address].children[street].data'),
537 array(self::LEVEL_2, 'address', 'address', 'street', 'office[street]', 'children[address].children[street].data.prop'),
538 array(self::LEVEL_1, 'address', 'address', 'street', 'office[street]', 'children[address].data'),
539 array(self::LEVEL_1, 'address', 'address', 'street', 'office[street]', 'children[address].data.office'),
540 array(self::LEVEL_1, 'address', 'address', 'street', 'office[street]', 'children[address].data.office.street'),
541 array(self::LEVEL_1, 'address', 'address', 'street', 'office[street]', 'children[address].data.office.street.prop'),
542 array(self::LEVEL_2, 'address', 'address', 'street', 'office[street]', 'children[address].data.office[street]'),
543 array(self::LEVEL_2, 'address', 'address', 'street', 'office[street]', 'children[address].data.office[street].prop'),
544 array(self::LEVEL_1, 'address', 'address', 'street', 'office[street]', 'children[address].data[office]'),
545 array(self::LEVEL_1, 'address', 'address', 'street', 'office[street]', 'children[address].data[office].street'),
546 array(self::LEVEL_1, 'address', 'address', 'street', 'office[street]', 'children[address].data[office].street.prop'),
547 array(self::LEVEL_1, 'address', 'address', 'street', 'office[street]', 'children[address].data[office][street]'),
548 array(self::LEVEL_1, 'address', 'address', 'street', 'office[street]', 'children[address].data[office][street].prop'),
549 array(self::LEVEL_1, 'address', 'address', 'street', 'office[street]', 'data.address.office.street'),
550 array(self::LEVEL_1, 'address', 'address', 'street', 'office[street]', 'data.address.office.street.prop'),
551 array(self::LEVEL_2, 'address', 'address', 'street', 'office[street]', 'data.address.office[street]'),
552 array(self::LEVEL_2, 'address', 'address', 'street', 'office[street]', 'data.address.office[street].prop'),
553 array(self::LEVEL_1, 'address', 'address', 'street', 'office[street]', 'data.address[office].street'),
554 array(self::LEVEL_1, 'address', 'address', 'street', 'office[street]', 'data.address[office].street.prop'),
555 array(self::LEVEL_1, 'address', 'address', 'street', 'office[street]', 'data.address[office][street]'),
556 array(self::LEVEL_1, 'address', 'address', 'street', 'office[street]', 'data.address[office][street].prop'),
557 array(self::LEVEL_0, 'address', 'address', 'street', 'office[street]', 'data[address].office.street'),
558 array(self::LEVEL_0, 'address', 'address', 'street', 'office[street]', 'data[address].office.street.prop'),
559 array(self::LEVEL_0, 'address', 'address', 'street', 'office[street]', 'data[address].office[street]'),
560 array(self::LEVEL_0, 'address', 'address', 'street', 'office[street]', 'data[address].office[street].prop'),
561 array(self::LEVEL_0, 'address', 'address', 'street', 'office[street]', 'data[address][office].street'),
562 array(self::LEVEL_0, 'address', 'address', 'street', 'office[street]', 'data[address][office].street.prop'),
563 array(self::LEVEL_0, 'address', 'address', 'street', 'office[street]', 'data[address][office][street]'),
564 array(self::LEVEL_0, 'address', 'address', 'street', 'office[street]', 'data[address][office][street].prop'),
565
566 array(self::LEVEL_2, 'address', '[address]', 'street', 'office[street]', 'children[address].children[street].data'),
567 array(self::LEVEL_2, 'address', '[address]', 'street', 'office[street]', 'children[address].children[street].data.prop'),
568 array(self::LEVEL_1, 'address', '[address]', 'street', 'office[street]', 'children[address].data.office.street'),
569 array(self::LEVEL_1, 'address', '[address]', 'street', 'office[street]', 'children[address].data.office.street.prop'),
570 array(self::LEVEL_2, 'address', '[address]', 'street', 'office[street]', 'children[address].data.office[street]'),
571 array(self::LEVEL_2, 'address', '[address]', 'street', 'office[street]', 'children[address].data.office[street].prop'),
572 array(self::LEVEL_1, 'address', '[address]', 'street', 'office[street]', 'children[address].data[office]'),
573 array(self::LEVEL_1, 'address', '[address]', 'street', 'office[street]', 'children[address].data[office].street'),
574 array(self::LEVEL_1, 'address', '[address]', 'street', 'office[street]', 'children[address].data[office].street.prop'),
575 array(self::LEVEL_1, 'address', '[address]', 'street', 'office[street]', 'children[address].data[office][street]'),
576 array(self::LEVEL_1, 'address', '[address]', 'street', 'office[street]', 'children[address].data[office][street].prop'),
577 array(self::LEVEL_0, 'address', '[address]', 'street', 'office[street]', 'data.address.office.street'),
578 array(self::LEVEL_0, 'address', '[address]', 'street', 'office[street]', 'data.address.office.street.prop'),
579 array(self::LEVEL_0, 'address', '[address]', 'street', 'office[street]', 'data.address.office[street]'),
580 array(self::LEVEL_0, 'address', '[address]', 'street', 'office[street]', 'data.address.office[street].prop'),
581 array(self::LEVEL_0, 'address', '[address]', 'street', 'office[street]', 'data.address[office].street'),
582 array(self::LEVEL_0, 'address', '[address]', 'street', 'office[street]', 'data.address[office].street.prop'),
583 array(self::LEVEL_0, 'address', '[address]', 'street', 'office[street]', 'data.address[office][street]'),
584 array(self::LEVEL_0, 'address', '[address]', 'street', 'office[street]', 'data.address[office][street].prop'),
585 array(self::LEVEL_1, 'address', '[address]', 'street', 'office[street]', 'data[address].office.street'),
586 array(self::LEVEL_1, 'address', '[address]', 'street', 'office[street]', 'data[address].office.street.prop'),
587 array(self::LEVEL_2, 'address', '[address]', 'street', 'office[street]', 'data[address].office[street]'),
588 array(self::LEVEL_2, 'address', '[address]', 'street', 'office[street]', 'data[address].office[street].prop'),
589 array(self::LEVEL_1, 'address', '[address]', 'street', 'office[street]', 'data[address][office].street'),
590 array(self::LEVEL_1, 'address', '[address]', 'street', 'office[street]', 'data[address][office].street.prop'),
591 array(self::LEVEL_1, 'address', '[address]', 'street', 'office[street]', 'data[address][office][street]'),
592 array(self::LEVEL_1, 'address', '[address]', 'street', 'office[street]', 'data[address][office][street].prop'),
593
594 array(self::LEVEL_2, 'address', 'address', 'street', '[office].street', 'children[address].children[street].data'),
595 array(self::LEVEL_2, 'address', 'address', 'street', '[office].street', 'children[address].children[street].data.prop'),
596 array(self::LEVEL_1, 'address', 'address', 'street', '[office].street', 'children[address].data'),
597 array(self::LEVEL_1, 'address', 'address', 'street', '[office].street', 'children[address].data.office'),
598 array(self::LEVEL_1, 'address', 'address', 'street', '[office].street', 'children[address].data.office.street'),
599 array(self::LEVEL_1, 'address', 'address', 'street', '[office].street', 'children[address].data.office.street.prop'),
600 array(self::LEVEL_1, 'address', 'address', 'street', '[office].street', 'children[address].data.office[street]'),
601 array(self::LEVEL_1, 'address', 'address', 'street', '[office].street', 'children[address].data.office[street].prop'),
602 array(self::LEVEL_1, 'address', 'address', 'street', '[office].street', 'children[address].data[office]'),
603 array(self::LEVEL_2, 'address', 'address', 'street', '[office].street', 'children[address].data[office].street'),
604 array(self::LEVEL_2, 'address', 'address', 'street', '[office].street', 'children[address].data[office].street.prop'),
605 array(self::LEVEL_1, 'address', 'address', 'street', '[office].street', 'children[address].data[office][street]'),
606 array(self::LEVEL_1, 'address', 'address', 'street', '[office].street', 'children[address].data[office][street].prop'),
607 array(self::LEVEL_1, 'address', 'address', 'street', '[office].street', 'data.address.office.street'),
608 array(self::LEVEL_1, 'address', 'address', 'street', '[office].street', 'data.address.office.street.prop'),
609 array(self::LEVEL_1, 'address', 'address', 'street', '[office].street', 'data.address.office[street]'),
610 array(self::LEVEL_1, 'address', 'address', 'street', '[office].street', 'data.address.office[street].prop'),
611 array(self::LEVEL_2, 'address', 'address', 'street', '[office].street', 'data.address[office].street'),
612 array(self::LEVEL_2, 'address', 'address', 'street', '[office].street', 'data.address[office].street.prop'),
613 array(self::LEVEL_1, 'address', 'address', 'street', '[office].street', 'data.address[office][street]'),
614 array(self::LEVEL_1, 'address', 'address', 'street', '[office].street', 'data.address[office][street].prop'),
615 array(self::LEVEL_0, 'address', 'address', 'street', '[office].street', 'data[address].office.street'),
616 array(self::LEVEL_0, 'address', 'address', 'street', '[office].street', 'data[address].office.street.prop'),
617 array(self::LEVEL_0, 'address', 'address', 'street', '[office].street', 'data[address].office[street]'),
618 array(self::LEVEL_0, 'address', 'address', 'street', '[office].street', 'data[address].office[street].prop'),
619 array(self::LEVEL_0, 'address', 'address', 'street', '[office].street', 'data[address][office].street'),
620 array(self::LEVEL_0, 'address', 'address', 'street', '[office].street', 'data[address][office].street.prop'),
621 array(self::LEVEL_0, 'address', 'address', 'street', '[office].street', 'data[address][office][street]'),
622 array(self::LEVEL_0, 'address', 'address', 'street', '[office].street', 'data[address][office][street].prop'),
623
624 array(self::LEVEL_2, 'address', '[address]', 'street', '[office].street', 'children[address].children[street].data'),
625 array(self::LEVEL_2, 'address', '[address]', 'street', '[office].street', 'children[address].children[street].data.prop'),
626 array(self::LEVEL_1, 'address', '[address]', 'street', '[office].street', 'children[address].data'),
627 array(self::LEVEL_1, 'address', '[address]', 'street', '[office].street', 'children[address].data.office'),
628 array(self::LEVEL_1, 'address', '[address]', 'street', '[office].street', 'children[address].data.office.street'),
629 array(self::LEVEL_1, 'address', '[address]', 'street', '[office].street', 'children[address].data.office.street.prop'),
630 array(self::LEVEL_1, 'address', '[address]', 'street', '[office].street', 'children[address].data.office[street]'),
631 array(self::LEVEL_1, 'address', '[address]', 'street', '[office].street', 'children[address].data.office[street].prop'),
632 array(self::LEVEL_1, 'address', '[address]', 'street', '[office].street', 'children[address].data[office]'),
633 array(self::LEVEL_2, 'address', '[address]', 'street', '[office].street', 'children[address].data[office].street'),
634 array(self::LEVEL_2, 'address', '[address]', 'street', '[office].street', 'children[address].data[office].street.prop'),
635 array(self::LEVEL_1, 'address', '[address]', 'street', '[office].street', 'children[address].data[office][street]'),
636 array(self::LEVEL_1, 'address', '[address]', 'street', '[office].street', 'children[address].data[office][street].prop'),
637 array(self::LEVEL_0, 'address', '[address]', 'street', '[office].street', 'data.address.office.street'),
638 array(self::LEVEL_0, 'address', '[address]', 'street', '[office].street', 'data.address.office.street.prop'),
639 array(self::LEVEL_0, 'address', '[address]', 'street', '[office].street', 'data.address.office[street]'),
640 array(self::LEVEL_0, 'address', '[address]', 'street', '[office].street', 'data.address.office[street].prop'),
641 array(self::LEVEL_0, 'address', '[address]', 'street', '[office].street', 'data.address[office].street'),
642 array(self::LEVEL_0, 'address', '[address]', 'street', '[office].street', 'data.address[office].street.prop'),
643 array(self::LEVEL_0, 'address', '[address]', 'street', '[office].street', 'data.address[office][street]'),
644 array(self::LEVEL_0, 'address', '[address]', 'street', '[office].street', 'data.address[office][street].prop'),
645 array(self::LEVEL_1, 'address', '[address]', 'street', '[office].street', 'data[address].office.street'),
646 array(self::LEVEL_1, 'address', '[address]', 'street', '[office].street', 'data[address].office.street.prop'),
647 array(self::LEVEL_1, 'address', '[address]', 'street', '[office].street', 'data[address].office[street]'),
648 array(self::LEVEL_1, 'address', '[address]', 'street', '[office].street', 'data[address].office[street].prop'),
649 array(self::LEVEL_2, 'address', '[address]', 'street', '[office].street', 'data[address][office].street'),
650 array(self::LEVEL_2, 'address', '[address]', 'street', '[office].street', 'data[address][office].street.prop'),
651 array(self::LEVEL_1, 'address', '[address]', 'street', '[office].street', 'data[address][office][street]'),
652 array(self::LEVEL_1, 'address', '[address]', 'street', '[office].street', 'data[address][office][street].prop'),
653
654 array(self::LEVEL_2, 'address', 'address', 'street', '[office][street]', 'children[address].children[street].data'),
655 array(self::LEVEL_2, 'address', 'address', 'street', '[office][street]', 'children[address].children[street].data.prop'),
656 array(self::LEVEL_1, 'address', 'address', 'street', '[office][street]', 'children[address].data'),
657 array(self::LEVEL_1, 'address', 'address', 'street', '[office][street]', 'children[address].data.office'),
658 array(self::LEVEL_1, 'address', 'address', 'street', '[office][street]', 'children[address].data.office.street'),
659 array(self::LEVEL_1, 'address', 'address', 'street', '[office][street]', 'children[address].data.office.street.prop'),
660 array(self::LEVEL_1, 'address', 'address', 'street', '[office][street]', 'children[address].data.office[street]'),
661 array(self::LEVEL_1, 'address', 'address', 'street', '[office][street]', 'children[address].data.office[street].prop'),
662 array(self::LEVEL_1, 'address', 'address', 'street', '[office][street]', 'children[address].data[office]'),
663 array(self::LEVEL_1, 'address', 'address', 'street', '[office][street]', 'children[address].data[office].street'),
664 array(self::LEVEL_1, 'address', 'address', 'street', '[office][street]', 'children[address].data[office].street.prop'),
665 array(self::LEVEL_2, 'address', 'address', 'street', '[office][street]', 'children[address].data[office][street]'),
666 array(self::LEVEL_2, 'address', 'address', 'street', '[office][street]', 'children[address].data[office][street].prop'),
667 array(self::LEVEL_1, 'address', 'address', 'street', '[office][street]', 'data.address.office.street'),
668 array(self::LEVEL_1, 'address', 'address', 'street', '[office][street]', 'data.address.office.street.prop'),
669 array(self::LEVEL_1, 'address', 'address', 'street', '[office][street]', 'data.address.office[street]'),
670 array(self::LEVEL_1, 'address', 'address', 'street', '[office][street]', 'data.address.office[street].prop'),
671 array(self::LEVEL_1, 'address', 'address', 'street', '[office][street]', 'data.address[office].street'),
672 array(self::LEVEL_1, 'address', 'address', 'street', '[office][street]', 'data.address[office].street.prop'),
673 array(self::LEVEL_2, 'address', 'address', 'street', '[office][street]', 'data.address[office][street]'),
674 array(self::LEVEL_2, 'address', 'address', 'street', '[office][street]', 'data.address[office][street].prop'),
675 array(self::LEVEL_0, 'address', 'address', 'street', '[office][street]', 'data[address].office.street'),
676 array(self::LEVEL_0, 'address', 'address', 'street', '[office][street]', 'data[address].office.street.prop'),
677 array(self::LEVEL_0, 'address', 'address', 'street', '[office][street]', 'data[address].office[street]'),
678 array(self::LEVEL_0, 'address', 'address', 'street', '[office][street]', 'data[address].office[street].prop'),
679 array(self::LEVEL_0, 'address', 'address', 'street', '[office][street]', 'data[address][office].street'),
680 array(self::LEVEL_0, 'address', 'address', 'street', '[office][street]', 'data[address][office].street.prop'),
681 array(self::LEVEL_0, 'address', 'address', 'street', '[office][street]', 'data[address][office][street]'),
682 array(self::LEVEL_0, 'address', 'address', 'street', '[office][street]', 'data[address][office][street].prop'),
683
684 array(self::LEVEL_2, 'address', '[address]', 'street', '[office][street]', 'children[address].children[street].data'),
685 array(self::LEVEL_2, 'address', '[address]', 'street', '[office][street]', 'children[address].children[street].data.prop'),
686 array(self::LEVEL_1, 'address', '[address]', 'street', '[office][street]', 'children[address].data'),
687 array(self::LEVEL_1, 'address', '[address]', 'street', '[office][street]', 'children[address].data.office'),
688 array(self::LEVEL_1, 'address', '[address]', 'street', '[office][street]', 'children[address].data.office.street'),
689 array(self::LEVEL_1, 'address', '[address]', 'street', '[office][street]', 'children[address].data.office.street.prop'),
690 array(self::LEVEL_1, 'address', '[address]', 'street', '[office][street]', 'children[address].data.office[street]'),
691 array(self::LEVEL_1, 'address', '[address]', 'street', '[office][street]', 'children[address].data.office[street].prop'),
692 array(self::LEVEL_1, 'address', '[address]', 'street', '[office][street]', 'children[address].data[office]'),
693 array(self::LEVEL_1, 'address', '[address]', 'street', '[office][street]', 'children[address].data[office].street'),
694 array(self::LEVEL_1, 'address', '[address]', 'street', '[office][street]', 'children[address].data[office].street.prop'),
695 array(self::LEVEL_2, 'address', '[address]', 'street', '[office][street]', 'children[address].data[office][street]'),
696 array(self::LEVEL_2, 'address', '[address]', 'street', '[office][street]', 'children[address].data[office][street].prop'),
697 array(self::LEVEL_0, 'address', '[address]', 'street', '[office][street]', 'data.address.office.street'),
698 array(self::LEVEL_0, 'address', '[address]', 'street', '[office][street]', 'data.address.office.street.prop'),
699 array(self::LEVEL_0, 'address', '[address]', 'street', '[office][street]', 'data.address.office[street]'),
700 array(self::LEVEL_0, 'address', '[address]', 'street', '[office][street]', 'data.address.office[street].prop'),
701 array(self::LEVEL_0, 'address', '[address]', 'street', '[office][street]', 'data.address[office].street'),
702 array(self::LEVEL_0, 'address', '[address]', 'street', '[office][street]', 'data.address[office].street.prop'),
703 array(self::LEVEL_0, 'address', '[address]', 'street', '[office][street]', 'data.address[office][street]'),
704 array(self::LEVEL_0, 'address', '[address]', 'street', '[office][street]', 'data.address[office][street].prop'),
705 array(self::LEVEL_1, 'address', '[address]', 'street', '[office][street]', 'data[address].office.street'),
706 array(self::LEVEL_1, 'address', '[address]', 'street', '[office][street]', 'data[address].office.street.prop'),
707 array(self::LEVEL_1, 'address', '[address]', 'street', '[office][street]', 'data[address].office[street]'),
708 array(self::LEVEL_1, 'address', '[address]', 'street', '[office][street]', 'data[address].office[street].prop'),
709 array(self::LEVEL_1, 'address', '[address]', 'street', '[office][street]', 'data[address][office].street'),
710 array(self::LEVEL_1, 'address', '[address]', 'street', '[office][street]', 'data[address][office].street.prop'),
711 array(self::LEVEL_2, 'address', '[address]', 'street', '[office][street]', 'data[address][office][street]'),
712 array(self::LEVEL_2, 'address', '[address]', 'street', '[office][street]', 'data[address][office][street].prop'),
713
714 // Edge cases which must not occur
715 array(self::LEVEL_1, 'address', 'address', 'street', 'street', 'children[address][street]'),
716 array(self::LEVEL_1, 'address', 'address', 'street', 'street', 'children[address][street].prop'),
717 array(self::LEVEL_1, 'address', 'address', 'street', '[street]', 'children[address][street]'),
718 array(self::LEVEL_1, 'address', 'address', 'street', '[street]', 'children[address][street].prop'),
719 array(self::LEVEL_1, 'address', '[address]', 'street', 'street', 'children[address][street]'),
720 array(self::LEVEL_1, 'address', '[address]', 'street', 'street', 'children[address][street].prop'),
721 array(self::LEVEL_1, 'address', '[address]', 'street', '[street]', 'children[address][street]'),
722 array(self::LEVEL_1, 'address', '[address]', 'street', '[street]', 'children[address][street].prop'),
723
724 array(self::LEVEL_0, 'address', 'person.address', 'street', 'street', 'children[person].children[address].children[street]'),
725 array(self::LEVEL_0, 'address', 'person.address', 'street', 'street', 'children[person].children[address].data.street'),
726 array(self::LEVEL_0, 'address', 'person.address', 'street', 'street', 'children[person].data.address.street'),
727 array(self::LEVEL_0, 'address', 'person.address', 'street', 'street', 'data.address.street'),
728
729 array(self::LEVEL_1, 'address', 'address', 'street', 'office.street', 'children[address].children[office].children[street]'),
730 array(self::LEVEL_1, 'address', 'address', 'street', 'office.street', 'children[address].children[office].data.street'),
731 array(self::LEVEL_1, 'address', 'address', 'street', 'office.street', 'children[address].data.street'),
732 array(self::LEVEL_1, 'address', 'address', 'street', 'office.street', 'data.address.street'),
733 );
734 }
735
736 /**
737 * @dataProvider provideDefaultTests
738 */
739 public function testDefaultErrorMapping($target, $childName, $childPath, $grandChildName, $grandChildPath, $violationPath)
740 {
741 $violation = $this->getConstraintViolation($violationPath);
742 $parent = $this->getForm('parent');
743 $child = $this->getForm($childName, $childPath);
744 $grandChild = $this->getForm($grandChildName, $grandChildPath);
745
746 $parent->add($child);
747 $child->add($grandChild);
748
749 $this->mapper->mapViolation($violation, $parent);
750
751 if (self::LEVEL_0 === $target) {
752 $this->assertEquals(array($this->getFormError()), $parent->getErrors(), $parent->getName().' should have an error, but has none');
753 $this->assertCount(0, $child->getErrors(), $childName.' should not have an error, but has one');
754 $this->assertCount(0, $grandChild->getErrors(), $grandChildName.' should not have an error, but has one');
755 } elseif (self::LEVEL_1 === $target) {
756 $this->assertCount(0, $parent->getErrors(), $parent->getName().' should not have an error, but has one');
757 $this->assertEquals(array($this->getFormError()), $child->getErrors(), $childName.' should have an error, but has none');
758 $this->assertCount(0, $grandChild->getErrors(), $grandChildName.' should not have an error, but has one');
759 } else {
760 $this->assertCount(0, $parent->getErrors(), $parent->getName().' should not have an error, but has one');
761 $this->assertCount(0, $child->getErrors(), $childName.' should not have an error, but has one');
762 $this->assertEquals(array($this->getFormError()), $grandChild->getErrors(), $grandChildName.' should have an error, but has none');
763 }
764 }
765
766 public function provideCustomDataErrorTests()
767 {
768 return array(
769 // mapping target, error mapping, child name, its property path, grand child name, its property path, violation path
770 array(self::LEVEL_1, 'foo', 'address', 'address', 'address', 'street', 'street', 'data.foo'),
771 array(self::LEVEL_1, 'foo', 'address', 'address', 'address', 'street', 'street', 'data.foo.prop'),
772 array(self::LEVEL_0, 'foo', 'address', 'address', 'address', 'street', 'street', 'data[foo]'),
773 array(self::LEVEL_0, 'foo', 'address', 'address', 'address', 'street', 'street', 'data[foo].prop'),
774
775 array(self::LEVEL_1, 'foo', 'address', 'address', 'address', 'street', 'street', 'data.address'),
776 array(self::LEVEL_1, 'foo', 'address', 'address', 'address', 'street', 'street', 'data.address.prop'),
777 array(self::LEVEL_0, 'foo', 'address', 'address', 'address', 'street', 'street', 'data[address]'),
778 array(self::LEVEL_0, 'foo', 'address', 'address', 'address', 'street', 'street', 'data[address].prop'),
779
780 array(self::LEVEL_1, 'foo', 'address', 'address', '[address]', 'street', 'street', 'data.foo'),
781 array(self::LEVEL_1, 'foo', 'address', 'address', '[address]', 'street', 'street', 'data.foo.prop'),
782 array(self::LEVEL_0, 'foo', 'address', 'address', '[address]', 'street', 'street', 'data[foo]'),
783 array(self::LEVEL_0, 'foo', 'address', 'address', '[address]', 'street', 'street', 'data[foo].prop'),
784
785 array(self::LEVEL_0, 'foo', 'address', 'address', '[address]', 'street', 'street', 'data.address'),
786 array(self::LEVEL_0, 'foo', 'address', 'address', '[address]', 'street', 'street', 'data.address.prop'),
787 array(self::LEVEL_1, 'foo', 'address', 'address', '[address]', 'street', 'street', 'data[address]'),
788 array(self::LEVEL_1, 'foo', 'address', 'address', '[address]', 'street', 'street', 'data[address].prop'),
789
790 array(self::LEVEL_0, '[foo]', 'address', 'address', 'address', 'street', 'street', 'data.foo'),
791 array(self::LEVEL_0, '[foo]', 'address', 'address', 'address', 'street', 'street', 'data.foo.prop'),
792 array(self::LEVEL_1, '[foo]', 'address', 'address', 'address', 'street', 'street', 'data[foo]'),
793 array(self::LEVEL_1, '[foo]', 'address', 'address', 'address', 'street', 'street', 'data[foo].prop'),
794
795 array(self::LEVEL_1, '[foo]', 'address', 'address', 'address', 'street', 'street', 'data.address'),
796 array(self::LEVEL_1, '[foo]', 'address', 'address', 'address', 'street', 'street', 'data.address.prop'),
797 array(self::LEVEL_0, '[foo]', 'address', 'address', 'address', 'street', 'street', 'data[address]'),
798 array(self::LEVEL_0, '[foo]', 'address', 'address', 'address', 'street', 'street', 'data[address].prop'),
799
800 array(self::LEVEL_0, '[foo]', 'address', 'address', '[address]', 'street', 'street', 'data.foo'),
801 array(self::LEVEL_0, '[foo]', 'address', 'address', '[address]', 'street', 'street', 'data.foo.prop'),
802 array(self::LEVEL_1, '[foo]', 'address', 'address', '[address]', 'street', 'street', 'data[foo]'),
803 array(self::LEVEL_1, '[foo]', 'address', 'address', '[address]', 'street', 'street', 'data[foo].prop'),
804
805 array(self::LEVEL_0, '[foo]', 'address', 'address', '[address]', 'street', 'street', 'data.address'),
806 array(self::LEVEL_0, '[foo]', 'address', 'address', '[address]', 'street', 'street', 'data.address.prop'),
807 array(self::LEVEL_1, '[foo]', 'address', 'address', '[address]', 'street', 'street', 'data[address]'),
808 array(self::LEVEL_1, '[foo]', 'address', 'address', '[address]', 'street', 'street', 'data[address].prop'),
809
810 array(self::LEVEL_2, 'foo', 'address', 'address', 'address', 'street', 'street', 'data.foo.street'),
811 array(self::LEVEL_2, 'foo', 'address', 'address', 'address', 'street', 'street', 'data.foo.street.prop'),
812 array(self::LEVEL_1, 'foo', 'address', 'address', 'address', 'street', 'street', 'data.foo[street]'),
813 array(self::LEVEL_1, 'foo', 'address', 'address', 'address', 'street', 'street', 'data.foo[street].prop'),
814 array(self::LEVEL_0, 'foo', 'address', 'address', 'address', 'street', 'street', 'data[foo].street'),
815 array(self::LEVEL_0, 'foo', 'address', 'address', 'address', 'street', 'street', 'data[foo].street.prop'),
816 array(self::LEVEL_0, 'foo', 'address', 'address', 'address', 'street', 'street', 'data[foo][street]'),
817 array(self::LEVEL_0, 'foo', 'address', 'address', 'address', 'street', 'street', 'data[foo][street].prop'),
818
819 array(self::LEVEL_2, 'foo', 'address', 'address', 'address', 'street', 'street', 'data.address.street'),
820 array(self::LEVEL_2, 'foo', 'address', 'address', 'address', 'street', 'street', 'data.address.street.prop'),
821 array(self::LEVEL_1, 'foo', 'address', 'address', 'address', 'street', 'street', 'data.address[street]'),
822 array(self::LEVEL_1, 'foo', 'address', 'address', 'address', 'street', 'street', 'data.address[street].prop'),
823 array(self::LEVEL_0, 'foo', 'address', 'address', 'address', 'street', 'street', 'data[address].street'),
824 array(self::LEVEL_0, 'foo', 'address', 'address', 'address', 'street', 'street', 'data[address].street.prop'),
825 array(self::LEVEL_0, 'foo', 'address', 'address', 'address', 'street', 'street', 'data[address][street]'),
826 array(self::LEVEL_0, 'foo', 'address', 'address', 'address', 'street', 'street', 'data[address][street].prop'),
827
828 array(self::LEVEL_1, 'foo', 'address', 'address', 'address', 'street', '[street]', 'data.foo.street'),
829 array(self::LEVEL_1, 'foo', 'address', 'address', 'address', 'street', '[street]', 'data.foo.street.prop'),
830 array(self::LEVEL_2, 'foo', 'address', 'address', 'address', 'street', '[street]', 'data.foo[street]'),
831 array(self::LEVEL_2, 'foo', 'address', 'address', 'address', 'street', '[street]', 'data.foo[street].prop'),
832 array(self::LEVEL_0, 'foo', 'address', 'address', 'address', 'street', '[street]', 'data[foo].street'),
833 array(self::LEVEL_0, 'foo', 'address', 'address', 'address', 'street', '[street]', 'data[foo].street.prop'),
834 array(self::LEVEL_0, 'foo', 'address', 'address', 'address', 'street', '[street]', 'data[foo][street]'),
835 array(self::LEVEL_0, 'foo', 'address', 'address', 'address', 'street', '[street]', 'data[foo][street].prop'),
836
837 array(self::LEVEL_1, 'foo', 'address', 'address', 'address', 'street', '[street]', 'data.address.street'),
838 array(self::LEVEL_1, 'foo', 'address', 'address', 'address', 'street', '[street]', 'data.address.street.prop'),
839 array(self::LEVEL_2, 'foo', 'address', 'address', 'address', 'street', '[street]', 'data.address[street]'),
840 array(self::LEVEL_2, 'foo', 'address', 'address', 'address', 'street', '[street]', 'data.address[street].prop'),
841 array(self::LEVEL_0, 'foo', 'address', 'address', 'address', 'street', '[street]', 'data[address].street'),
842 array(self::LEVEL_0, 'foo', 'address', 'address', 'address', 'street', '[street]', 'data[address].street.prop'),
843 array(self::LEVEL_0, 'foo', 'address', 'address', 'address', 'street', '[street]', 'data[address][street]'),
844 array(self::LEVEL_0, 'foo', 'address', 'address', 'address', 'street', '[street]', 'data[address][street].prop'),
845
846 array(self::LEVEL_2, 'foo', 'address', 'address', '[address]', 'street', 'street', 'data.foo.street'),
847 array(self::LEVEL_2, 'foo', 'address', 'address', '[address]', 'street', 'street', 'data.foo.street.prop'),
848 array(self::LEVEL_1, 'foo', 'address', 'address', '[address]', 'street', 'street', 'data.foo[street]'),
849 array(self::LEVEL_1, 'foo', 'address', 'address', '[address]', 'street', 'street', 'data.foo[street].prop'),
850 array(self::LEVEL_0, 'foo', 'address', 'address', '[address]', 'street', 'street', 'data[foo].street'),
851 array(self::LEVEL_0, 'foo', 'address', 'address', '[address]', 'street', 'street', 'data[foo].street.prop'),
852 array(self::LEVEL_0, 'foo', 'address', 'address', '[address]', 'street', 'street', 'data[foo][street]'),
853 array(self::LEVEL_0, 'foo', 'address', 'address', '[address]', 'street', 'street', 'data[foo][street].prop'),
854
855 array(self::LEVEL_0, 'foo', 'address', 'address', '[address]', 'street', 'street', 'data.address.street'),
856 array(self::LEVEL_0, 'foo', 'address', 'address', '[address]', 'street', 'street', 'data.address.street.prop'),
857 array(self::LEVEL_0, 'foo', 'address', 'address', '[address]', 'street', 'street', 'data.address[street]'),
858 array(self::LEVEL_0, 'foo', 'address', 'address', '[address]', 'street', 'street', 'data.address[street].prop'),
859 array(self::LEVEL_2, 'foo', 'address', 'address', '[address]', 'street', 'street', 'data[address].street'),
860 array(self::LEVEL_2, 'foo', 'address', 'address', '[address]', 'street', 'street', 'data[address].street.prop'),
861 array(self::LEVEL_1, 'foo', 'address', 'address', '[address]', 'street', 'street', 'data[address][street]'),
862 array(self::LEVEL_1, 'foo', 'address', 'address', '[address]', 'street', 'street', 'data[address][street].prop'),
863
864 array(self::LEVEL_1, 'foo', 'address', 'address', '[address]', 'street', '[street]', 'data.foo.street'),
865 array(self::LEVEL_1, 'foo', 'address', 'address', '[address]', 'street', '[street]', 'data.foo.street.prop'),
866 array(self::LEVEL_2, 'foo', 'address', 'address', '[address]', 'street', '[street]', 'data.foo[street]'),
867 array(self::LEVEL_2, 'foo', 'address', 'address', '[address]', 'street', '[street]', 'data.foo[street].prop'),
868 array(self::LEVEL_0, 'foo', 'address', 'address', '[address]', 'street', '[street]', 'data[foo].street'),
869 array(self::LEVEL_0, 'foo', 'address', 'address', '[address]', 'street', '[street]', 'data[foo].street.prop'),
870 array(self::LEVEL_0, 'foo', 'address', 'address', '[address]', 'street', '[street]', 'data[foo][street]'),
871 array(self::LEVEL_0, 'foo', 'address', 'address', '[address]', 'street', '[street]', 'data[foo][street].prop'),
872
873 array(self::LEVEL_0, 'foo', 'address', 'address', '[address]', 'street', '[street]', 'data.address.street'),
874 array(self::LEVEL_0, 'foo', 'address', 'address', '[address]', 'street', '[street]', 'data.address.street.prop'),
875 array(self::LEVEL_0, 'foo', 'address', 'address', '[address]', 'street', '[street]', 'data.address[street]'),
876 array(self::LEVEL_0, 'foo', 'address', 'address', '[address]', 'street', '[street]', 'data.address[street].prop'),
877 array(self::LEVEL_1, 'foo', 'address', 'address', '[address]', 'street', '[street]', 'data[address].street'),
878 array(self::LEVEL_1, 'foo', 'address', 'address', '[address]', 'street', '[street]', 'data[address].street.prop'),
879 array(self::LEVEL_2, 'foo', 'address', 'address', '[address]', 'street', '[street]', 'data[address][street]'),
880 array(self::LEVEL_2, 'foo', 'address', 'address', '[address]', 'street', '[street]', 'data[address][street].prop'),
881
882 array(self::LEVEL_0, '[foo]', 'address', 'address', 'address', 'street', 'street', 'data.foo.street'),
883 array(self::LEVEL_0, '[foo]', 'address', 'address', 'address', 'street', 'street', 'data.foo.street.prop'),
884 array(self::LEVEL_0, '[foo]', 'address', 'address', 'address', 'street', 'street', 'data.foo[street]'),
885 array(self::LEVEL_0, '[foo]', 'address', 'address', 'address', 'street', 'street', 'data.foo[street].prop'),
886 array(self::LEVEL_2, '[foo]', 'address', 'address', 'address', 'street', 'street', 'data[foo].street'),
887 array(self::LEVEL_2, '[foo]', 'address', 'address', 'address', 'street', 'street', 'data[foo].street.prop'),
888 array(self::LEVEL_1, '[foo]', 'address', 'address', 'address', 'street', 'street', 'data[foo][street]'),
889 array(self::LEVEL_1, '[foo]', 'address', 'address', 'address', 'street', 'street', 'data[foo][street].prop'),
890
891 array(self::LEVEL_2, '[foo]', 'address', 'address', 'address', 'street', 'street', 'data.address.street'),
892 array(self::LEVEL_2, '[foo]', 'address', 'address', 'address', 'street', 'street', 'data.address.street.prop'),
893 array(self::LEVEL_1, '[foo]', 'address', 'address', 'address', 'street', 'street', 'data.address[street]'),
894 array(self::LEVEL_1, '[foo]', 'address', 'address', 'address', 'street', 'street', 'data.address[street].prop'),
895 array(self::LEVEL_0, '[foo]', 'address', 'address', 'address', 'street', 'street', 'data[address].street'),
896 array(self::LEVEL_0, '[foo]', 'address', 'address', 'address', 'street', 'street', 'data[address].street.prop'),
897 array(self::LEVEL_0, '[foo]', 'address', 'address', 'address', 'street', 'street', 'data[address][street]'),
898 array(self::LEVEL_0, '[foo]', 'address', 'address', 'address', 'street', 'street', 'data[address][street].prop'),
899
900 array(self::LEVEL_0, '[foo]', 'address', 'address', 'address', 'street', '[street]', 'data.foo.street'),
901 array(self::LEVEL_0, '[foo]', 'address', 'address', 'address', 'street', '[street]', 'data.foo.street.prop'),
902 array(self::LEVEL_0, '[foo]', 'address', 'address', 'address', 'street', '[street]', 'data.foo[street]'),
903 array(self::LEVEL_0, '[foo]', 'address', 'address', 'address', 'street', '[street]', 'data.foo[street].prop'),
904 array(self::LEVEL_1, '[foo]', 'address', 'address', 'address', 'street', '[street]', 'data[foo].street'),
905 array(self::LEVEL_1, '[foo]', 'address', 'address', 'address', 'street', '[street]', 'data[foo].street.prop'),
906 array(self::LEVEL_2, '[foo]', 'address', 'address', 'address', 'street', '[street]', 'data[foo][street]'),
907 array(self::LEVEL_2, '[foo]', 'address', 'address', 'address', 'street', '[street]', 'data[foo][street].prop'),
908
909 array(self::LEVEL_1, '[foo]', 'address', 'address', 'address', 'street', '[street]', 'data.address.street'),
910 array(self::LEVEL_1, '[foo]', 'address', 'address', 'address', 'street', '[street]', 'data.address.street.prop'),
911 array(self::LEVEL_2, '[foo]', 'address', 'address', 'address', 'street', '[street]', 'data.address[street]'),
912 array(self::LEVEL_2, '[foo]', 'address', 'address', 'address', 'street', '[street]', 'data.address[street].prop'),
913 array(self::LEVEL_0, '[foo]', 'address', 'address', 'address', 'street', '[street]', 'data[address].street'),
914 array(self::LEVEL_0, '[foo]', 'address', 'address', 'address', 'street', '[street]', 'data[address].street.prop'),
915 array(self::LEVEL_0, '[foo]', 'address', 'address', 'address', 'street', '[street]', 'data[address][street]'),
916 array(self::LEVEL_0, '[foo]', 'address', 'address', 'address', 'street', '[street]', 'data[address][street].prop'),
917
918 array(self::LEVEL_0, '[foo]', 'address', 'address', '[address]', 'street', 'street', 'data.foo.street'),
919 array(self::LEVEL_0, '[foo]', 'address', 'address', '[address]', 'street', 'street', 'data.foo.street.prop'),
920 array(self::LEVEL_0, '[foo]', 'address', 'address', '[address]', 'street', 'street', 'data.foo[street]'),
921 array(self::LEVEL_0, '[foo]', 'address', 'address', '[address]', 'street', 'street', 'data.foo[street].prop'),
922 array(self::LEVEL_2, '[foo]', 'address', 'address', '[address]', 'street', 'street', 'data[foo].street'),
923 array(self::LEVEL_2, '[foo]', 'address', 'address', '[address]', 'street', 'street', 'data[foo].street.prop'),
924 array(self::LEVEL_1, '[foo]', 'address', 'address', '[address]', 'street', 'street', 'data[foo][street]'),
925 array(self::LEVEL_1, '[foo]', 'address', 'address', '[address]', 'street', 'street', 'data[foo][street].prop'),
926
927 array(self::LEVEL_0, '[foo]', 'address', 'address', '[address]', 'street', 'street', 'data.address.street'),
928 array(self::LEVEL_0, '[foo]', 'address', 'address', '[address]', 'street', 'street', 'data.address.street.prop'),
929 array(self::LEVEL_0, '[foo]', 'address', 'address', '[address]', 'street', 'street', 'data.address[street]'),
930 array(self::LEVEL_0, '[foo]', 'address', 'address', '[address]', 'street', 'street', 'data.address[street].prop'),
931 array(self::LEVEL_2, '[foo]', 'address', 'address', '[address]', 'street', 'street', 'data[address].street'),
932 array(self::LEVEL_2, '[foo]', 'address', 'address', '[address]', 'street', 'street', 'data[address].street.prop'),
933 array(self::LEVEL_1, '[foo]', 'address', 'address', '[address]', 'street', 'street', 'data[address][street]'),
934 array(self::LEVEL_1, '[foo]', 'address', 'address', '[address]', 'street', 'street', 'data[address][street].prop'),
935
936 array(self::LEVEL_0, '[foo]', 'address', 'address', '[address]', 'street', '[street]', 'data.foo.street'),
937 array(self::LEVEL_0, '[foo]', 'address', 'address', '[address]', 'street', '[street]', 'data.foo.street.prop'),
938 array(self::LEVEL_0, '[foo]', 'address', 'address', '[address]', 'street', '[street]', 'data.foo[street]'),
939 array(self::LEVEL_0, '[foo]', 'address', 'address', '[address]', 'street', '[street]', 'data.foo[street].prop'),
940 array(self::LEVEL_1, '[foo]', 'address', 'address', '[address]', 'street', '[street]', 'data[foo].street'),
941 array(self::LEVEL_1, '[foo]', 'address', 'address', '[address]', 'street', '[street]', 'data[foo].street.prop'),
942 array(self::LEVEL_2, '[foo]', 'address', 'address', '[address]', 'street', '[street]', 'data[foo][street]'),
943 array(self::LEVEL_2, '[foo]', 'address', 'address', '[address]', 'street', '[street]', 'data[foo][street].prop'),
944
945 array(self::LEVEL_0, '[foo]', 'address', 'address', '[address]', 'street', '[street]', 'data.address.street'),
946 array(self::LEVEL_0, '[foo]', 'address', 'address', '[address]', 'street', '[street]', 'data.address.street.prop'),
947 array(self::LEVEL_0, '[foo]', 'address', 'address', '[address]', 'street', '[street]', 'data.address[street]'),
948 array(self::LEVEL_0, '[foo]', 'address', 'address', '[address]', 'street', '[street]', 'data.address[street].prop'),
949 array(self::LEVEL_1, '[foo]', 'address', 'address', '[address]', 'street', '[street]', 'data[address].street'),
950 array(self::LEVEL_1, '[foo]', 'address', 'address', '[address]', 'street', '[street]', 'data[address].street.prop'),
951 array(self::LEVEL_2, '[foo]', 'address', 'address', '[address]', 'street', '[street]', 'data[address][street]'),
952 array(self::LEVEL_2, '[foo]', 'address', 'address', '[address]', 'street', '[street]', 'data[address][street].prop'),
953
954 array(self::LEVEL_1, 'foo.bar', 'address', 'address', 'address', 'street', 'street', 'data.foo.bar'),
955 array(self::LEVEL_1, 'foo.bar', 'address', 'address', 'address', 'street', 'street', 'data.foo.bar.prop'),
956 array(self::LEVEL_0, 'foo.bar', 'address', 'address', 'address', 'street', 'street', 'data.foo[bar]'),
957 array(self::LEVEL_0, 'foo.bar', 'address', 'address', 'address', 'street', 'street', 'data.foo[bar].prop'),
958 array(self::LEVEL_0, 'foo.bar', 'address', 'address', 'address', 'street', 'street', 'data[foo].bar'),
959 array(self::LEVEL_0, 'foo.bar', 'address', 'address', 'address', 'street', 'street', 'data[foo].bar.prop'),
960 array(self::LEVEL_0, 'foo.bar', 'address', 'address', 'address', 'street', 'street', 'data[foo][bar]'),
961 array(self::LEVEL_0, 'foo.bar', 'address', 'address', 'address', 'street', 'street', 'data[foo][bar].prop'),
962
963 array(self::LEVEL_0, 'foo[bar]', 'address', 'address', 'address', 'street', 'street', 'data.foo.bar'),
964 array(self::LEVEL_0, 'foo[bar]', 'address', 'address', 'address', 'street', 'street', 'data.foo.bar.prop'),
965 array(self::LEVEL_1, 'foo[bar]', 'address', 'address', 'address', 'street', 'street', 'data.foo[bar]'),
966 array(self::LEVEL_1, 'foo[bar]', 'address', 'address', 'address', 'street', 'street', 'data.foo[bar].prop'),
967 array(self::LEVEL_0, 'foo[bar]', 'address', 'address', 'address', 'street', 'street', 'data[foo].bar'),
968 array(self::LEVEL_0, 'foo[bar]', 'address', 'address', 'address', 'street', 'street', 'data[foo].bar.prop'),
969 array(self::LEVEL_0, 'foo[bar]', 'address', 'address', 'address', 'street', 'street', 'data[foo][bar]'),
970 array(self::LEVEL_0, 'foo[bar]', 'address', 'address', 'address', 'street', 'street', 'data[foo][bar].prop'),
971
972 array(self::LEVEL_0, '[foo].bar', 'address', 'address', 'address', 'street', 'street', 'data.foo.bar'),
973 array(self::LEVEL_0, '[foo].bar', 'address', 'address', 'address', 'street', 'street', 'data.foo.bar.prop'),
974 array(self::LEVEL_0, '[foo].bar', 'address', 'address', 'address', 'street', 'street', 'data.foo[bar]'),
975 array(self::LEVEL_0, '[foo].bar', 'address', 'address', 'address', 'street', 'street', 'data.foo[bar].prop'),
976 array(self::LEVEL_1, '[foo].bar', 'address', 'address', 'address', 'street', 'street', 'data[foo].bar'),
977 array(self::LEVEL_1, '[foo].bar', 'address', 'address', 'address', 'street', 'street', 'data[foo].bar.prop'),
978 array(self::LEVEL_0, '[foo].bar', 'address', 'address', 'address', 'street', 'street', 'data[foo][bar]'),
979 array(self::LEVEL_0, '[foo].bar', 'address', 'address', 'address', 'street', 'street', 'data[foo][bar].prop'),
980
981 array(self::LEVEL_0, '[foo][bar]', 'address', 'address', 'address', 'street', 'street', 'data.foo.bar'),
982 array(self::LEVEL_0, '[foo][bar]', 'address', 'address', 'address', 'street', 'street', 'data.foo.bar.prop'),
983 array(self::LEVEL_0, '[foo][bar]', 'address', 'address', 'address', 'street', 'street', 'data.foo[bar]'),
984 array(self::LEVEL_0, '[foo][bar]', 'address', 'address', 'address', 'street', 'street', 'data.foo[bar].prop'),
985 array(self::LEVEL_0, '[foo][bar]', 'address', 'address', 'address', 'street', 'street', 'data[foo].bar'),
986 array(self::LEVEL_0, '[foo][bar]', 'address', 'address', 'address', 'street', 'street', 'data[foo].bar.prop'),
987 array(self::LEVEL_1, '[foo][bar]', 'address', 'address', 'address', 'street', 'street', 'data[foo][bar]'),
988 array(self::LEVEL_1, '[foo][bar]', 'address', 'address', 'address', 'street', 'street', 'data[foo][bar].prop'),
989
990 array(self::LEVEL_2, 'foo.bar', 'address', 'address', 'address', 'street', 'street', 'data.foo.bar.street'),
991 array(self::LEVEL_2, 'foo.bar', 'address', 'address', 'address', 'street', 'street', 'data.foo.bar.street.prop'),
992 array(self::LEVEL_1, 'foo.bar', 'address', 'address', 'address', 'street', 'street', 'data.foo.bar[street]'),
993 array(self::LEVEL_1, 'foo.bar', 'address', 'address', 'address', 'street', 'street', 'data.foo.bar[street].prop'),
994 array(self::LEVEL_0, 'foo.bar', 'address', 'address', 'address', 'street', 'street', 'data.foo[bar].street'),
995 array(self::LEVEL_0, 'foo.bar', 'address', 'address', 'address', 'street', 'street', 'data.foo[bar].street.prop'),
996 array(self::LEVEL_0, 'foo.bar', 'address', 'address', 'address', 'street', 'street', 'data.foo[bar][street]'),
997 array(self::LEVEL_0, 'foo.bar', 'address', 'address', 'address', 'street', 'street', 'data.foo[bar][street].prop'),
998 array(self::LEVEL_0, 'foo.bar', 'address', 'address', 'address', 'street', 'street', 'data[foo].bar.street'),
999 array(self::LEVEL_0, 'foo.bar', 'address', 'address', 'address', 'street', 'street', 'data[foo].bar.street.prop'),
1000 array(self::LEVEL_0, 'foo.bar', 'address', 'address', 'address', 'street', 'street', 'data[foo].bar[street]'),
1001 array(self::LEVEL_0, 'foo.bar', 'address', 'address', 'address', 'street', 'street', 'data[foo].bar[street].prop'),
1002 array(self::LEVEL_0, 'foo.bar', 'address', 'address', 'address', 'street', 'street', 'data[foo][bar].street'),
1003 array(self::LEVEL_0, 'foo.bar', 'address', 'address', 'address', 'street', 'street', 'data[foo][bar].street.prop'),
1004 array(self::LEVEL_0, 'foo.bar', 'address', 'address', 'address', 'street', 'street', 'data[foo][bar][street]'),
1005 array(self::LEVEL_0, 'foo.bar', 'address', 'address', 'address', 'street', 'street', 'data[foo][bar][street].prop'),
1006
1007 array(self::LEVEL_1, 'foo.bar', 'address', 'address', 'address', 'street', '[street]', 'data.foo.bar.street'),
1008 array(self::LEVEL_1, 'foo.bar', 'address', 'address', 'address', 'street', '[street]', 'data.foo.bar.street.prop'),
1009 array(self::LEVEL_2, 'foo.bar', 'address', 'address', 'address', 'street', '[street]', 'data.foo.bar[street]'),
1010 array(self::LEVEL_2, 'foo.bar', 'address', 'address', 'address', 'street', '[street]', 'data.foo.bar[street].prop'),
1011 array(self::LEVEL_0, 'foo.bar', 'address', 'address', 'address', 'street', '[street]', 'data.foo[bar].street'),
1012 array(self::LEVEL_0, 'foo.bar', 'address', 'address', 'address', 'street', '[street]', 'data.foo[bar].street.prop'),
1013 array(self::LEVEL_0, 'foo.bar', 'address', 'address', 'address', 'street', '[street]', 'data.foo[bar][street]'),
1014 array(self::LEVEL_0, 'foo.bar', 'address', 'address', 'address', 'street', '[street]', 'data.foo[bar][street].prop'),
1015 array(self::LEVEL_0, 'foo.bar', 'address', 'address', 'address', 'street', '[street]', 'data[foo].bar.street'),
1016 array(self::LEVEL_0, 'foo.bar', 'address', 'address', 'address', 'street', '[street]', 'data[foo].bar.street.prop'),
1017 array(self::LEVEL_0, 'foo.bar', 'address', 'address', 'address', 'street', '[street]', 'data[foo].bar[street]'),
1018 array(self::LEVEL_0, 'foo.bar', 'address', 'address', 'address', 'street', '[street]', 'data[foo].bar[street].prop'),
1019 array(self::LEVEL_0, 'foo.bar', 'address', 'address', 'address', 'street', '[street]', 'data[foo][bar].street'),
1020 array(self::LEVEL_0, 'foo.bar', 'address', 'address', 'address', 'street', '[street]', 'data[foo][bar].street.prop'),
1021 array(self::LEVEL_0, 'foo.bar', 'address', 'address', 'address', 'street', '[street]', 'data[foo][bar][street]'),
1022 array(self::LEVEL_0, 'foo.bar', 'address', 'address', 'address', 'street', '[street]', 'data[foo][bar][street].prop'),
1023
1024 array(self::LEVEL_0, 'foo[bar]', 'address', 'address', 'address', 'street', 'street', 'data.foo.bar.street'),
1025 array(self::LEVEL_0, 'foo[bar]', 'address', 'address', 'address', 'street', 'street', 'data.foo.bar.street.prop'),
1026 array(self::LEVEL_0, 'foo[bar]', 'address', 'address', 'address', 'street', 'street', 'data.foo.bar[street]'),
1027 array(self::LEVEL_0, 'foo[bar]', 'address', 'address', 'address', 'street', 'street', 'data.foo.bar[street].prop'),
1028 array(self::LEVEL_2, 'foo[bar]', 'address', 'address', 'address', 'street', 'street', 'data.foo[bar].street'),
1029 array(self::LEVEL_2, 'foo[bar]', 'address', 'address', 'address', 'street', 'street', 'data.foo[bar].street.prop'),
1030 array(self::LEVEL_1, 'foo[bar]', 'address', 'address', 'address', 'street', 'street', 'data.foo[bar][street]'),
1031 array(self::LEVEL_1, 'foo[bar]', 'address', 'address', 'address', 'street', 'street', 'data.foo[bar][street].prop'),
1032 array(self::LEVEL_0, 'foo[bar]', 'address', 'address', 'address', 'street', 'street', 'data[foo].bar.street'),
1033 array(self::LEVEL_0, 'foo[bar]', 'address', 'address', 'address', 'street', 'street', 'data[foo].bar.street.prop'),
1034 array(self::LEVEL_0, 'foo[bar]', 'address', 'address', 'address', 'street', 'street', 'data[foo].bar[street]'),
1035 array(self::LEVEL_0, 'foo[bar]', 'address', 'address', 'address', 'street', 'street', 'data[foo].bar[street].prop'),
1036 array(self::LEVEL_0, 'foo[bar]', 'address', 'address', 'address', 'street', 'street', 'data[foo][bar].street'),
1037 array(self::LEVEL_0, 'foo[bar]', 'address', 'address', 'address', 'street', 'street', 'data[foo][bar].street.prop'),
1038 array(self::LEVEL_0, 'foo[bar]', 'address', 'address', 'address', 'street', 'street', 'data[foo][bar][street]'),
1039 array(self::LEVEL_0, 'foo[bar]', 'address', 'address', 'address', 'street', 'street', 'data[foo][bar][street].prop'),
1040
1041 array(self::LEVEL_0, 'foo[bar]', 'address', 'address', 'address', 'street', '[street]', 'data.foo.bar.street'),
1042 array(self::LEVEL_0, 'foo[bar]', 'address', 'address', 'address', 'street', '[street]', 'data.foo.bar.street.prop'),
1043 array(self::LEVEL_0, 'foo[bar]', 'address', 'address', 'address', 'street', '[street]', 'data.foo.bar[street]'),
1044 array(self::LEVEL_0, 'foo[bar]', 'address', 'address', 'address', 'street', '[street]', 'data.foo.bar[street].prop'),
1045 array(self::LEVEL_1, 'foo[bar]', 'address', 'address', 'address', 'street', '[street]', 'data.foo[bar].street'),
1046 array(self::LEVEL_1, 'foo[bar]', 'address', 'address', 'address', 'street', '[street]', 'data.foo[bar].street.prop'),
1047 array(self::LEVEL_2, 'foo[bar]', 'address', 'address', 'address', 'street', '[street]', 'data.foo[bar][street]'),
1048 array(self::LEVEL_2, 'foo[bar]', 'address', 'address', 'address', 'street', '[street]', 'data.foo[bar][street].prop'),
1049 array(self::LEVEL_0, 'foo[bar]', 'address', 'address', 'address', 'street', '[street]', 'data[foo].bar.street'),
1050 array(self::LEVEL_0, 'foo[bar]', 'address', 'address', 'address', 'street', '[street]', 'data[foo].bar.street.prop'),
1051 array(self::LEVEL_0, 'foo[bar]', 'address', 'address', 'address', 'street', '[street]', 'data[foo].bar[street]'),
1052 array(self::LEVEL_0, 'foo[bar]', 'address', 'address', 'address', 'street', '[street]', 'data[foo].bar[street].prop'),
1053 array(self::LEVEL_0, 'foo[bar]', 'address', 'address', 'address', 'street', '[street]', 'data[foo][bar].street'),
1054 array(self::LEVEL_0, 'foo[bar]', 'address', 'address', 'address', 'street', '[street]', 'data[foo][bar].street.prop'),
1055 array(self::LEVEL_0, 'foo[bar]', 'address', 'address', 'address', 'street', '[street]', 'data[foo][bar][street]'),
1056 array(self::LEVEL_0, 'foo[bar]', 'address', 'address', 'address', 'street', '[street]', 'data[foo][bar][street].prop'),
1057
1058 array(self::LEVEL_0, '[foo].bar', 'address', 'address', 'address', 'street', 'street', 'data.foo.bar.street'),
1059 array(self::LEVEL_0, '[foo].bar', 'address', 'address', 'address', 'street', 'street', 'data.foo.bar.street.prop'),
1060 array(self::LEVEL_0, '[foo].bar', 'address', 'address', 'address', 'street', 'street', 'data.foo.bar[street]'),
1061 array(self::LEVEL_0, '[foo].bar', 'address', 'address', 'address', 'street', 'street', 'data.foo.bar[street].prop'),
1062 array(self::LEVEL_0, '[foo].bar', 'address', 'address', 'address', 'street', 'street', 'data.foo[bar].street'),
1063 array(self::LEVEL_0, '[foo].bar', 'address', 'address', 'address', 'street', 'street', 'data.foo[bar].street.prop'),
1064 array(self::LEVEL_0, '[foo].bar', 'address', 'address', 'address', 'street', 'street', 'data.foo[bar][street]'),
1065 array(self::LEVEL_0, '[foo].bar', 'address', 'address', 'address', 'street', 'street', 'data.foo[bar][street].prop'),
1066 array(self::LEVEL_2, '[foo].bar', 'address', 'address', 'address', 'street', 'street', 'data[foo].bar.street'),
1067 array(self::LEVEL_2, '[foo].bar', 'address', 'address', 'address', 'street', 'street', 'data[foo].bar.street.prop'),
1068 array(self::LEVEL_1, '[foo].bar', 'address', 'address', 'address', 'street', 'street', 'data[foo].bar[street]'),
1069 array(self::LEVEL_1, '[foo].bar', 'address', 'address', 'address', 'street', 'street', 'data[foo].bar[street].prop'),
1070 array(self::LEVEL_0, '[foo].bar', 'address', 'address', 'address', 'street', 'street', 'data[foo][bar].street'),
1071 array(self::LEVEL_0, '[foo].bar', 'address', 'address', 'address', 'street', 'street', 'data[foo][bar].street.prop'),
1072 array(self::LEVEL_0, '[foo].bar', 'address', 'address', 'address', 'street', 'street', 'data[foo][bar][street]'),
1073 array(self::LEVEL_0, '[foo].bar', 'address', 'address', 'address', 'street', 'street', 'data[foo][bar][street].prop'),
1074
1075 array(self::LEVEL_0, '[foo].bar', 'address', 'address', 'address', 'street', '[street]', 'data.foo.bar.street'),
1076 array(self::LEVEL_0, '[foo].bar', 'address', 'address', 'address', 'street', '[street]', 'data.foo.bar.street.prop'),
1077 array(self::LEVEL_0, '[foo].bar', 'address', 'address', 'address', 'street', '[street]', 'data.foo.bar[street]'),
1078 array(self::LEVEL_0, '[foo].bar', 'address', 'address', 'address', 'street', '[street]', 'data.foo.bar[street].prop'),
1079 array(self::LEVEL_0, '[foo].bar', 'address', 'address', 'address', 'street', '[street]', 'data.foo[bar].street'),
1080 array(self::LEVEL_0, '[foo].bar', 'address', 'address', 'address', 'street', '[street]', 'data.foo[bar].street.prop'),
1081 array(self::LEVEL_0, '[foo].bar', 'address', 'address', 'address', 'street', '[street]', 'data.foo[bar][street]'),
1082 array(self::LEVEL_0, '[foo].bar', 'address', 'address', 'address', 'street', '[street]', 'data.foo[bar][street].prop'),
1083 array(self::LEVEL_1, '[foo].bar', 'address', 'address', 'address', 'street', '[street]', 'data[foo].bar.street'),
1084 array(self::LEVEL_1, '[foo].bar', 'address', 'address', 'address', 'street', '[street]', 'data[foo].bar.street.prop'),
1085 array(self::LEVEL_2, '[foo].bar', 'address', 'address', 'address', 'street', '[street]', 'data[foo].bar[street]'),
1086 array(self::LEVEL_2, '[foo].bar', 'address', 'address', 'address', 'street', '[street]', 'data[foo].bar[street].prop'),
1087 array(self::LEVEL_0, '[foo].bar', 'address', 'address', 'address', 'street', '[street]', 'data[foo][bar].street'),
1088 array(self::LEVEL_0, '[foo].bar', 'address', 'address', 'address', 'street', '[street]', 'data[foo][bar].street.prop'),
1089 array(self::LEVEL_0, '[foo].bar', 'address', 'address', 'address', 'street', '[street]', 'data[foo][bar][street]'),
1090 array(self::LEVEL_0, '[foo].bar', 'address', 'address', 'address', 'street', '[street]', 'data[foo][bar][street].prop'),
1091
1092 array(self::LEVEL_0, '[foo][bar]', 'address', 'address', 'address', 'street', 'street', 'data.foo.bar.street'),
1093 array(self::LEVEL_0, '[foo][bar]', 'address', 'address', 'address', 'street', 'street', 'data.foo.bar.street.prop'),
1094 array(self::LEVEL_0, '[foo][bar]', 'address', 'address', 'address', 'street', 'street', 'data.foo.bar[street]'),
1095 array(self::LEVEL_0, '[foo][bar]', 'address', 'address', 'address', 'street', 'street', 'data.foo.bar[street].prop'),
1096 array(self::LEVEL_0, '[foo][bar]', 'address', 'address', 'address', 'street', 'street', 'data.foo[bar].street'),
1097 array(self::LEVEL_0, '[foo][bar]', 'address', 'address', 'address', 'street', 'street', 'data.foo[bar].street.prop'),
1098 array(self::LEVEL_0, '[foo][bar]', 'address', 'address', 'address', 'street', 'street', 'data.foo[bar][street]'),
1099 array(self::LEVEL_0, '[foo][bar]', 'address', 'address', 'address', 'street', 'street', 'data.foo[bar][street].prop'),
1100 array(self::LEVEL_0, '[foo][bar]', 'address', 'address', 'address', 'street', 'street', 'data[foo].bar.street'),
1101 array(self::LEVEL_0, '[foo][bar]', 'address', 'address', 'address', 'street', 'street', 'data[foo].bar.street.prop'),
1102 array(self::LEVEL_0, '[foo][bar]', 'address', 'address', 'address', 'street', 'street', 'data[foo].bar[street]'),
1103 array(self::LEVEL_0, '[foo][bar]', 'address', 'address', 'address', 'street', 'street', 'data[foo].bar[street].prop'),
1104 array(self::LEVEL_2, '[foo][bar]', 'address', 'address', 'address', 'street', 'street', 'data[foo][bar].street'),
1105 array(self::LEVEL_2, '[foo][bar]', 'address', 'address', 'address', 'street', 'street', 'data[foo][bar].street.prop'),
1106 array(self::LEVEL_1, '[foo][bar]', 'address', 'address', 'address', 'street', 'street', 'data[foo][bar][street]'),
1107 array(self::LEVEL_1, '[foo][bar]', 'address', 'address', 'address', 'street', 'street', 'data[foo][bar][street].prop'),
1108
1109 array(self::LEVEL_0, '[foo][bar]', 'address', 'address', 'address', 'street', '[street]', 'data.foo.bar.street'),
1110 array(self::LEVEL_0, '[foo][bar]', 'address', 'address', 'address', 'street', '[street]', 'data.foo.bar.street.prop'),
1111 array(self::LEVEL_0, '[foo][bar]', 'address', 'address', 'address', 'street', '[street]', 'data.foo.bar[street]'),
1112 array(self::LEVEL_0, '[foo][bar]', 'address', 'address', 'address', 'street', '[street]', 'data.foo.bar[street].prop'),
1113 array(self::LEVEL_0, '[foo][bar]', 'address', 'address', 'address', 'street', '[street]', 'data.foo[bar].street'),
1114 array(self::LEVEL_0, '[foo][bar]', 'address', 'address', 'address', 'street', '[street]', 'data.foo[bar].street.prop'),
1115 array(self::LEVEL_0, '[foo][bar]', 'address', 'address', 'address', 'street', '[street]', 'data.foo[bar][street]'),
1116 array(self::LEVEL_0, '[foo][bar]', 'address', 'address', 'address', 'street', '[street]', 'data.foo[bar][street].prop'),
1117 array(self::LEVEL_0, '[foo][bar]', 'address', 'address', 'address', 'street', '[street]', 'data[foo].bar.street'),
1118 array(self::LEVEL_0, '[foo][bar]', 'address', 'address', 'address', 'street', '[street]', 'data[foo].bar.street.prop'),
1119 array(self::LEVEL_0, '[foo][bar]', 'address', 'address', 'address', 'street', '[street]', 'data[foo].bar[street]'),
1120 array(self::LEVEL_0, '[foo][bar]', 'address', 'address', 'address', 'street', '[street]', 'data[foo].bar[street].prop'),
1121 array(self::LEVEL_1, '[foo][bar]', 'address', 'address', 'address', 'street', '[street]', 'data[foo][bar].street'),
1122 array(self::LEVEL_1, '[foo][bar]', 'address', 'address', 'address', 'street', '[street]', 'data[foo][bar].street.prop'),
1123 array(self::LEVEL_2, '[foo][bar]', 'address', 'address', 'address', 'street', '[street]', 'data[foo][bar][street]'),
1124 array(self::LEVEL_2, '[foo][bar]', 'address', 'address', 'address', 'street', '[street]', 'data[foo][bar][street].prop'),
1125
1126 array(self::LEVEL_2, 'foo', 'address.street', 'address', 'address', 'street', 'street', 'data.foo'),
1127 array(self::LEVEL_2, 'foo', 'address.street', 'address', 'address', 'street', 'street', 'data.foo.prop'),
1128 array(self::LEVEL_2, '[foo]', 'address.street', 'address', 'address', 'street', 'street', 'data[foo]'),
1129 array(self::LEVEL_2, '[foo]', 'address.street', 'address', 'address', 'street', 'street', 'data[foo].prop'),
1130
1131 array(self::LEVEL_2, 'foo', 'address.street', 'address', 'address', 'street', '[street]', 'data.foo'),
1132 array(self::LEVEL_2, 'foo', 'address.street', 'address', 'address', 'street', '[street]', 'data.foo.prop'),
1133 array(self::LEVEL_2, '[foo]', 'address.street', 'address', 'address', 'street', '[street]', 'data[foo]'),
1134 array(self::LEVEL_2, '[foo]', 'address.street', 'address', 'address', 'street', '[street]', 'data[foo].prop'),
1135
1136 array(self::LEVEL_2, 'foo', 'address.street', 'address', '[address]', 'street', 'street', 'data.foo'),
1137 array(self::LEVEL_2, 'foo', 'address.street', 'address', '[address]', 'street', 'street', 'data.foo.prop'),
1138 array(self::LEVEL_2, '[foo]', 'address.street', 'address', '[address]', 'street', 'street', 'data[foo]'),
1139 array(self::LEVEL_2, '[foo]', 'address.street', 'address', '[address]', 'street', 'street', 'data[foo].prop'),
1140
1141 array(self::LEVEL_2, 'foo.bar', 'address.street', 'address', 'address', 'street', 'street', 'data.foo.bar'),
1142 array(self::LEVEL_2, 'foo.bar', 'address.street', 'address', 'address', 'street', 'street', 'data.foo.bar.prop'),
1143 array(self::LEVEL_2, 'foo[bar]', 'address.street', 'address', 'address', 'street', 'street', 'data.foo[bar]'),
1144 array(self::LEVEL_2, 'foo[bar]', 'address.street', 'address', 'address', 'street', 'street', 'data.foo[bar].prop'),
1145 array(self::LEVEL_2, '[foo].bar', 'address.street', 'address', 'address', 'street', 'street', 'data[foo].bar'),
1146 array(self::LEVEL_2, '[foo].bar', 'address.street', 'address', 'address', 'street', 'street', 'data[foo].bar.prop'),
1147 array(self::LEVEL_2, '[foo][bar]', 'address.street', 'address', 'address', 'street', 'street', 'data[foo][bar]'),
1148 array(self::LEVEL_2, '[foo][bar]', 'address.street', 'address', 'address', 'street', 'street', 'data[foo][bar].prop'),
1149
1150 array(self::LEVEL_2, 'foo.bar', 'address.street', 'address', 'address', 'street', '[street]', 'data.foo.bar'),
1151 array(self::LEVEL_2, 'foo.bar', 'address.street', 'address', 'address', 'street', '[street]', 'data.foo.bar.prop'),
1152 array(self::LEVEL_2, 'foo[bar]', 'address.street', 'address', 'address', 'street', '[street]', 'data.foo[bar]'),
1153 array(self::LEVEL_2, 'foo[bar]', 'address.street', 'address', 'address', 'street', '[street]', 'data.foo[bar].prop'),
1154 array(self::LEVEL_2, '[foo].bar', 'address.street', 'address', 'address', 'street', '[street]', 'data[foo].bar'),
1155 array(self::LEVEL_2, '[foo].bar', 'address.street', 'address', 'address', 'street', '[street]', 'data[foo].bar.prop'),
1156 array(self::LEVEL_2, '[foo][bar]', 'address.street', 'address', 'address', 'street', '[street]', 'data[foo][bar]'),
1157 array(self::LEVEL_2, '[foo][bar]', 'address.street', 'address', 'address', 'street', '[street]', 'data[foo][bar].prop'),
1158
1159 array(self::LEVEL_2, 'foo.bar', 'address.street', 'address', '[address]', 'street', 'street', 'data.foo.bar'),
1160 array(self::LEVEL_2, 'foo.bar', 'address.street', 'address', '[address]', 'street', 'street', 'data.foo.bar.prop'),
1161 array(self::LEVEL_2, 'foo[bar]', 'address.street', 'address', '[address]', 'street', 'street', 'data.foo[bar]'),
1162 array(self::LEVEL_2, 'foo[bar]', 'address.street', 'address', '[address]', 'street', 'street', 'data.foo[bar].prop'),
1163 array(self::LEVEL_2, '[foo].bar', 'address.street', 'address', '[address]', 'street', 'street', 'data[foo].bar'),
1164 array(self::LEVEL_2, '[foo].bar', 'address.street', 'address', '[address]', 'street', 'street', 'data[foo].bar.prop'),
1165 array(self::LEVEL_2, '[foo][bar]', 'address.street', 'address', '[address]', 'street', 'street', 'data[foo][bar]'),
1166 array(self::LEVEL_2, '[foo][bar]', 'address.street', 'address', '[address]', 'street', 'street', 'data[foo][bar].prop'),
1167
1168 // Edge cases
1169 array(self::LEVEL_2, 'foo', 'address', 'address', '[address]', 'street', 'street', 'data.foo.street'),
1170 array(self::LEVEL_2, 'foo', 'address', 'address', '[address]', 'street', 'street', 'data.foo.street.prop'),
1171 array(self::LEVEL_1, 'foo', 'address', 'address', '[address]', 'street', 'street', 'data.foo[street]'),
1172 array(self::LEVEL_1, 'foo', 'address', 'address', '[address]', 'street', 'street', 'data.foo[street].prop'),
1173 array(self::LEVEL_0, 'foo', 'address', 'address', '[address]', 'street', 'street', 'data[foo].street'),
1174 array(self::LEVEL_0, 'foo', 'address', 'address', '[address]', 'street', 'street', 'data[foo].street.prop'),
1175 array(self::LEVEL_0, 'foo', 'address', 'address', '[address]', 'street', 'street', 'data[foo][street]'),
1176 array(self::LEVEL_0, 'foo', 'address', 'address', '[address]', 'street', 'street', 'data[foo][street].prop'),
1177
1178 array(self::LEVEL_0, '[foo]', 'address', 'address', 'address', 'street', 'street', 'data.foo.street'),
1179 array(self::LEVEL_0, '[foo]', 'address', 'address', 'address', 'street', 'street', 'data.foo.street.prop'),
1180 array(self::LEVEL_0, '[foo]', 'address', 'address', 'address', 'street', 'street', 'data.foo[street]'),
1181 array(self::LEVEL_0, '[foo]', 'address', 'address', 'address', 'street', 'street', 'data.foo[street].prop'),
1182 array(self::LEVEL_2, '[foo]', 'address', 'address', 'address', 'street', 'street', 'data[foo].street'),
1183 array(self::LEVEL_2, '[foo]', 'address', 'address', 'address', 'street', 'street', 'data[foo].street.prop'),
1184 array(self::LEVEL_1, '[foo]', 'address', 'address', 'address', 'street', 'street', 'data[foo][street]'),
1185 array(self::LEVEL_1, '[foo]', 'address', 'address', 'address', 'street', 'street', 'data[foo][street].prop'),
1186 );
1187 }
1188
1189 /**
1190 * @dataProvider provideCustomDataErrorTests
1191 */
1192 public function testCustomDataErrorMapping($target, $mapFrom, $mapTo, $childName, $childPath, $grandChildName, $grandChildPath, $violationPath)
1193 {
1194 $violation = $this->getConstraintViolation($violationPath);
1195 $parent = $this->getForm('parent', null, null, array($mapFrom => $mapTo));
1196 $child = $this->getForm($childName, $childPath);
1197 $grandChild = $this->getForm($grandChildName, $grandChildPath);
1198
1199 $parent->add($child);
1200 $child->add($grandChild);
1201
1202 // Add a field mapped to the first element of $mapFrom
1203 // to try to distract the algorithm
1204 // Only add it if we expect the error to come up on a different
1205 // level than LEVEL_0, because in this case the error would
1206 // (correctly) be mapped to the distraction field
1207 if ($target !== self::LEVEL_0) {
1208 $mapFromPath = new PropertyPath($mapFrom);
1209 $mapFromPrefix = $mapFromPath->isIndex(0)
1210 ? '['.$mapFromPath->getElement(0).']'
1211 : $mapFromPath->getElement(0);
1212 $distraction = $this->getForm('distraction', $mapFromPrefix);
1213
1214 $parent->add($distraction);
1215 }
1216
1217 $this->mapper->mapViolation($violation, $parent);
1218
1219 if ($target !== self::LEVEL_0) {
1220 $this->assertCount(0, $distraction->getErrors(), 'distraction should not have an error, but has one');
1221 }
1222
1223 if (self::LEVEL_0 === $target) {
1224 $this->assertEquals(array($this->getFormError()), $parent->getErrors(), $parent->getName().' should have an error, but has none');
1225 $this->assertCount(0, $child->getErrors(), $childName.' should not have an error, but has one');
1226 $this->assertCount(0, $grandChild->getErrors(), $grandChildName.' should not have an error, but has one');
1227 } elseif (self::LEVEL_1 === $target) {
1228 $this->assertCount(0, $parent->getErrors(), $parent->getName().' should not have an error, but has one');
1229 $this->assertEquals(array($this->getFormError()), $child->getErrors(), $childName.' should have an error, but has none');
1230 $this->assertCount(0, $grandChild->getErrors(), $grandChildName.' should not have an error, but has one');
1231 } else {
1232 $this->assertCount(0, $parent->getErrors(), $parent->getName().' should not have an error, but has one');
1233 $this->assertCount(0, $child->getErrors(), $childName.' should not have an error, but has one');
1234 $this->assertEquals(array($this->getFormError()), $grandChild->getErrors(), $grandChildName.' should have an error, but has none');
1235 }
1236 }
1237
1238 public function provideCustomFormErrorTests()
1239 {
1240 // This case is different than the data errors, because here the
1241 // left side of the mapping refers to the property path of the actual
1242 // children. In other words, a child error only works if
1243 // 1) the error actually maps to an existing child and
1244 // 2) the property path of that child (relative to the form providing
1245 // the mapping) matches the left side of the mapping
1246 return array(
1247 // mapping target, map from, map to, child name, its property path, grand child name, its property path, violation path
1248 array(self::LEVEL_1, 'foo', 'address', 'foo', 'foo', 'address', 'address', 'street', 'street', 'children[foo].children[street].data'),
1249 array(self::LEVEL_1, 'foo', 'address', 'foo', 'foo', 'address', 'address', 'street', 'street', 'children[foo].children[street].data.prop'),
1250 array(self::LEVEL_2, 'foo', 'address', 'foo', 'foo', 'address', 'address', 'street', 'street', 'children[foo].data.street'),
1251 array(self::LEVEL_2, 'foo', 'address', 'foo', 'foo', 'address', 'address', 'street', 'street', 'children[foo].data.street.prop'),
1252 array(self::LEVEL_1, 'foo', 'address', 'foo', 'foo', 'address', 'address', 'street', 'street', 'children[foo].data[street]'),
1253 array(self::LEVEL_1, 'foo', 'address', 'foo', 'foo', 'address', 'address', 'street', 'street', 'children[foo].data[street].prop'),
1254
1255 array(self::LEVEL_2, 'foo', 'address', 'foo', 'foo', 'address', 'address', 'street', 'street', 'children[address].children[street].data'),
1256 array(self::LEVEL_2, 'foo', 'address', 'foo', 'foo', 'address', 'address', 'street', 'street', 'children[address].children[street].data.prop'),
1257 array(self::LEVEL_2, 'foo', 'address', 'foo', 'foo', 'address', 'address', 'street', 'street', 'children[address].data.street'),
1258 array(self::LEVEL_2, 'foo', 'address', 'foo', 'foo', 'address', 'address', 'street', 'street', 'children[address].data.street.prop'),
1259 array(self::LEVEL_1, 'foo', 'address', 'foo', 'foo', 'address', 'address', 'street', 'street', 'children[address].data[street]'),
1260 array(self::LEVEL_1, 'foo', 'address', 'foo', 'foo', 'address', 'address', 'street', 'street', 'children[address].data[street].prop'),
1261
1262 // Property path of the erroneous field and mapping must match exactly
1263 array(self::LEVEL_1B, 'foo', 'address', 'foo', '[foo]', 'address', 'address', 'street', 'street', 'children[foo].children[street].data'),
1264 array(self::LEVEL_1B, 'foo', 'address', 'foo', '[foo]', 'address', 'address', 'street', 'street', 'children[foo].children[street].data.prop'),
1265 array(self::LEVEL_1B, 'foo', 'address', 'foo', '[foo]', 'address', 'address', 'street', 'street', 'children[foo].data.street'),
1266 array(self::LEVEL_1B, 'foo', 'address', 'foo', '[foo]', 'address', 'address', 'street', 'street', 'children[foo].data.street.prop'),
1267 array(self::LEVEL_1B, 'foo', 'address', 'foo', '[foo]', 'address', 'address', 'street', 'street', 'children[foo].data[street]'),
1268 array(self::LEVEL_1B, 'foo', 'address', 'foo', '[foo]', 'address', 'address', 'street', 'street', 'children[foo].data[street].prop'),
1269
1270 array(self::LEVEL_1B, '[foo]', 'address', 'foo', 'foo', 'address', 'address', 'street', 'street', 'children[foo].children[street].data'),
1271 array(self::LEVEL_1B, '[foo]', 'address', 'foo', 'foo', 'address', 'address', 'street', 'street', 'children[foo].children[street].data.prop'),
1272 array(self::LEVEL_1B, '[foo]', 'address', 'foo', 'foo', 'address', 'address', 'street', 'street', 'children[foo].data.street'),
1273 array(self::LEVEL_1B, '[foo]', 'address', 'foo', 'foo', 'address', 'address', 'street', 'street', 'children[foo].data.street.prop'),
1274 array(self::LEVEL_1B, '[foo]', 'address', 'foo', 'foo', 'address', 'address', 'street', 'street', 'children[foo].data[street]'),
1275 array(self::LEVEL_1B, '[foo]', 'address', 'foo', 'foo', 'address', 'address', 'street', 'street', 'children[foo].data[street].prop'),
1276
1277 array(self::LEVEL_1, '[foo]', 'address', 'foo', '[foo]', 'address', 'address', 'street', 'street', 'children[foo].children[street].data'),
1278 array(self::LEVEL_1, '[foo]', 'address', 'foo', '[foo]', 'address', 'address', 'street', 'street', 'children[foo].children[street].data.prop'),
1279 array(self::LEVEL_2, '[foo]', 'address', 'foo', '[foo]', 'address', 'address', 'street', 'street', 'children[foo].data.street'),
1280 array(self::LEVEL_2, '[foo]', 'address', 'foo', '[foo]', 'address', 'address', 'street', 'street', 'children[foo].data.street.prop'),
1281 array(self::LEVEL_1, '[foo]', 'address', 'foo', '[foo]', 'address', 'address', 'street', 'street', 'children[foo].data[street]'),
1282 array(self::LEVEL_1, '[foo]', 'address', 'foo', '[foo]', 'address', 'address', 'street', 'street', 'children[foo].data[street].prop'),
1283
1284 array(self::LEVEL_2, 'foo', 'address', 'foo', 'foo', 'address', 'address', 'street', '[street]', 'children[foo].children[street].data'),
1285 array(self::LEVEL_2, 'foo', 'address', 'foo', 'foo', 'address', 'address', 'street', '[street]', 'children[foo].children[street].data.prop'),
1286 array(self::LEVEL_1, 'foo', 'address', 'foo', 'foo', 'address', 'address', 'street', '[street]', 'children[foo].data.street'),
1287 array(self::LEVEL_1, 'foo', 'address', 'foo', 'foo', 'address', 'address', 'street', '[street]', 'children[foo].data.street.prop'),
1288 array(self::LEVEL_2, 'foo', 'address', 'foo', 'foo', 'address', 'address', 'street', '[street]', 'children[foo].data[street]'),
1289 array(self::LEVEL_2, 'foo', 'address', 'foo', 'foo', 'address', 'address', 'street', '[street]', 'children[foo].data[street].prop'),
1290
1291 array(self::LEVEL_2, 'foo', 'address', 'foo', 'foo', 'address', 'address', 'street', '[street]', 'children[address].children[street].data'),
1292 array(self::LEVEL_2, 'foo', 'address', 'foo', 'foo', 'address', 'address', 'street', '[street]', 'children[address].children[street].data.prop'),
1293 array(self::LEVEL_1, 'foo', 'address', 'foo', 'foo', 'address', 'address', 'street', '[street]', 'children[address].data.street'),
1294 array(self::LEVEL_1, 'foo', 'address', 'foo', 'foo', 'address', 'address', 'street', '[street]', 'children[address].data.street.prop'),
1295 array(self::LEVEL_2, 'foo', 'address', 'foo', 'foo', 'address', 'address', 'street', '[street]', 'children[address].data[street]'),
1296 array(self::LEVEL_2, 'foo', 'address', 'foo', 'foo', 'address', 'address', 'street', '[street]', 'children[address].data[street].prop'),
1297
1298 array(self::LEVEL_1, 'foo', 'address', 'foo', 'foo', 'address', '[address]', 'street', 'street', 'children[foo].children[street].data'),
1299 array(self::LEVEL_1, 'foo', 'address', 'foo', 'foo', 'address', '[address]', 'street', 'street', 'children[foo].children[street].data.prop'),
1300 array(self::LEVEL_2, 'foo', 'address', 'foo', 'foo', 'address', '[address]', 'street', 'street', 'children[foo].data.street'),
1301 array(self::LEVEL_2, 'foo', 'address', 'foo', 'foo', 'address', '[address]', 'street', 'street', 'children[foo].data.street.prop'),
1302 array(self::LEVEL_1, 'foo', 'address', 'foo', 'foo', 'address', '[address]', 'street', 'street', 'children[foo].data[street]'),
1303 array(self::LEVEL_1, 'foo', 'address', 'foo', 'foo', 'address', '[address]', 'street', 'street', 'children[foo].data[street].prop'),
1304
1305 array(self::LEVEL_2, 'foo', 'address', 'foo', 'foo', 'address', '[address]', 'street', 'street', 'children[address].children[street].data'),
1306 array(self::LEVEL_2, 'foo', 'address', 'foo', 'foo', 'address', '[address]', 'street', 'street', 'children[address].children[street].data.prop'),
1307 array(self::LEVEL_2, 'foo', 'address', 'foo', 'foo', 'address', '[address]', 'street', 'street', 'children[address].data.street'),
1308 array(self::LEVEL_2, 'foo', 'address', 'foo', 'foo', 'address', '[address]', 'street', 'street', 'children[address].data.street.prop'),
1309 array(self::LEVEL_1, 'foo', 'address', 'foo', 'foo', 'address', '[address]', 'street', 'street', 'children[address].data[street]'),
1310 array(self::LEVEL_1, 'foo', 'address', 'foo', 'foo', 'address', '[address]', 'street', 'street', 'children[address].data[street].prop'),
1311
1312 array(self::LEVEL_2, 'foo', 'address', 'foo', 'foo', 'address', '[address]', 'street', '[street]', 'children[foo].children[street].data'),
1313 array(self::LEVEL_2, 'foo', 'address', 'foo', 'foo', 'address', '[address]', 'street', '[street]', 'children[foo].children[street].data.prop'),
1314 array(self::LEVEL_1, 'foo', 'address', 'foo', 'foo', 'address', '[address]', 'street', '[street]', 'children[foo].data.street'),
1315 array(self::LEVEL_1, 'foo', 'address', 'foo', 'foo', 'address', '[address]', 'street', '[street]', 'children[foo].data.street.prop'),
1316 array(self::LEVEL_2, 'foo', 'address', 'foo', 'foo', 'address', '[address]', 'street', '[street]', 'children[foo].data[street]'),
1317 array(self::LEVEL_2, 'foo', 'address', 'foo', 'foo', 'address', '[address]', 'street', '[street]', 'children[foo].data[street].prop'),
1318
1319 array(self::LEVEL_2, 'foo', 'address', 'foo', 'foo', 'address', '[address]', 'street', '[street]', 'children[address].children[street].data'),
1320 array(self::LEVEL_2, 'foo', 'address', 'foo', 'foo', 'address', '[address]', 'street', '[street]', 'children[address].children[street].data.prop'),
1321 array(self::LEVEL_1, 'foo', 'address', 'foo', 'foo', 'address', '[address]', 'street', '[street]', 'children[address].data.street'),
1322 array(self::LEVEL_1, 'foo', 'address', 'foo', 'foo', 'address', '[address]', 'street', '[street]', 'children[address].data.street.prop'),
1323 array(self::LEVEL_2, 'foo', 'address', 'foo', 'foo', 'address', '[address]', 'street', '[street]', 'children[address].data[street]'),
1324 array(self::LEVEL_2, 'foo', 'address', 'foo', 'foo', 'address', '[address]', 'street', '[street]', 'children[address].data[street].prop'),
1325
1326 // Map to a nested child
1327 array(self::LEVEL_2, 'foo', 'address.street', 'foo', 'foo', 'address', 'address', 'street', 'street', 'children[foo]'),
1328 array(self::LEVEL_2, 'foo', 'address.street', 'foo', 'foo', 'address', 'address', 'street', '[street]', 'children[foo]'),
1329 array(self::LEVEL_2, 'foo', 'address.street', 'foo', 'foo', 'address', '[address]', 'street', 'street', 'children[foo]'),
1330 array(self::LEVEL_2, 'foo', 'address.street', 'foo', 'foo', 'address', '[address]', 'street', '[street]', 'children[foo]'),
1331
1332 // Map from a nested child
1333 array(self::LEVEL_1B, 'address.street', 'foo', 'foo', 'foo', 'address', 'address', 'street', 'street', 'children[address].children[street]'),
1334 array(self::LEVEL_1B, 'address.street', 'foo', 'foo', 'foo', 'address', 'address', 'street', 'street', 'children[address].data.street'),
1335 array(self::LEVEL_1, 'address.street', 'foo', 'foo', 'foo', 'address', 'address', 'street', 'street', 'children[address].data[street]'),
1336 array(self::LEVEL_2, 'address.street', 'foo', 'foo', 'foo', 'address', 'address', 'street', '[street]', 'children[address].children[street]'),
1337 array(self::LEVEL_1B, 'address.street', 'foo', 'foo', 'foo', 'address', 'address', 'street', '[street]', 'children[address].data.street'),
1338 array(self::LEVEL_2, 'address.street', 'foo', 'foo', 'foo', 'address', 'address', 'street', '[street]', 'children[address].data[street]'),
1339 array(self::LEVEL_2, 'address.street', 'foo', 'foo', 'foo', 'address', '[address]', 'street', 'street', 'children[address].children[street]'),
1340 array(self::LEVEL_2, 'address.street', 'foo', 'foo', 'foo', 'address', '[address]', 'street', 'street', 'children[address].data.street'),
1341 array(self::LEVEL_1, 'address.street', 'foo', 'foo', 'foo', 'address', '[address]', 'street', 'street', 'children[address].data[street]'),
1342 array(self::LEVEL_2, 'address.street', 'foo', 'foo', 'foo', 'address', '[address]', 'street', '[street]', 'children[address].children[street]'),
1343 array(self::LEVEL_1, 'address.street', 'foo', 'foo', 'foo', 'address', '[address]', 'street', '[street]', 'children[address].data.street'),
1344 array(self::LEVEL_2, 'address.street', 'foo', 'foo', 'foo', 'address', '[address]', 'street', '[street]', 'children[address].data[street]'),
1345
1346 array(self::LEVEL_2, 'address[street]', 'foo', 'foo', 'foo', 'address', 'address', 'street', 'street', 'children[address].children[street]'),
1347 array(self::LEVEL_2, 'address[street]', 'foo', 'foo', 'foo', 'address', 'address', 'street', 'street', 'children[address].data.street'),
1348 array(self::LEVEL_1B, 'address[street]', 'foo', 'foo', 'foo', 'address', 'address', 'street', 'street', 'children[address].data[street]'),
1349 array(self::LEVEL_1B, 'address[street]', 'foo', 'foo', 'foo', 'address', 'address', 'street', '[street]', 'children[address].children[street]'),
1350 array(self::LEVEL_1, 'address[street]', 'foo', 'foo', 'foo', 'address', 'address', 'street', '[street]', 'children[address].data.street'),
1351 array(self::LEVEL_1B, 'address[street]', 'foo', 'foo', 'foo', 'address', 'address', 'street', '[street]', 'children[address].data[street]'),
1352 array(self::LEVEL_2, 'address[street]', 'foo', 'foo', 'foo', 'address', '[address]', 'street', 'street', 'children[address].children[street]'),
1353 array(self::LEVEL_2, 'address[street]', 'foo', 'foo', 'foo', 'address', '[address]', 'street', 'street', 'children[address].data.street'),
1354 array(self::LEVEL_1, 'address[street]', 'foo', 'foo', 'foo', 'address', '[address]', 'street', 'street', 'children[address].data[street]'),
1355 array(self::LEVEL_2, 'address[street]', 'foo', 'foo', 'foo', 'address', '[address]', 'street', '[street]', 'children[address].children[street]'),
1356 array(self::LEVEL_1, 'address[street]', 'foo', 'foo', 'foo', 'address', '[address]', 'street', '[street]', 'children[address].data.street'),
1357 array(self::LEVEL_2, 'address[street]', 'foo', 'foo', 'foo', 'address', '[address]', 'street', '[street]', 'children[address].data[street]'),
1358
1359 array(self::LEVEL_2, '[address].street', 'foo', 'foo', 'foo', 'address', 'address', 'street', 'street', 'children[address].children[street]'),
1360 array(self::LEVEL_2, '[address].street', 'foo', 'foo', 'foo', 'address', 'address', 'street', 'street', 'children[address].data.street'),
1361 array(self::LEVEL_1, '[address].street', 'foo', 'foo', 'foo', 'address', 'address', 'street', 'street', 'children[address].data[street]'),
1362 array(self::LEVEL_2, '[address].street', 'foo', 'foo', 'foo', 'address', 'address', 'street', '[street]', 'children[address].children[street]'),
1363 array(self::LEVEL_1, '[address].street', 'foo', 'foo', 'foo', 'address', 'address', 'street', '[street]', 'children[address].data.street'),
1364 array(self::LEVEL_2, '[address].street', 'foo', 'foo', 'foo', 'address', 'address', 'street', '[street]', 'children[address].data[street]'),
1365 array(self::LEVEL_1B, '[address].street', 'foo', 'foo', 'foo', 'address', '[address]', 'street', 'street', 'children[address].children[street]'),
1366 array(self::LEVEL_1B, '[address].street', 'foo', 'foo', 'foo', 'address', '[address]', 'street', 'street', 'children[address].data.street'),
1367 array(self::LEVEL_1, '[address].street', 'foo', 'foo', 'foo', 'address', '[address]', 'street', 'street', 'children[address].data[street]'),
1368 array(self::LEVEL_2, '[address].street', 'foo', 'foo', 'foo', 'address', '[address]', 'street', '[street]', 'children[address].children[street]'),
1369 array(self::LEVEL_1B, '[address].street', 'foo', 'foo', 'foo', 'address', '[address]', 'street', '[street]', 'children[address].data.street'),
1370 array(self::LEVEL_2, '[address].street', 'foo', 'foo', 'foo', 'address', '[address]', 'street', '[street]', 'children[address].data[street]'),
1371
1372 array(self::LEVEL_2, '[address][street]', 'foo', 'foo', 'foo', 'address', 'address', 'street', 'street', 'children[address].children[street]'),
1373 array(self::LEVEL_2, '[address][street]', 'foo', 'foo', 'foo', 'address', 'address', 'street', 'street', 'children[address].data.street'),
1374 array(self::LEVEL_1, '[address][street]', 'foo', 'foo', 'foo', 'address', 'address', 'street', 'street', 'children[address].data[street]'),
1375 array(self::LEVEL_2, '[address][street]', 'foo', 'foo', 'foo', 'address', 'address', 'street', '[street]', 'children[address].children[street]'),
1376 array(self::LEVEL_1, '[address][street]', 'foo', 'foo', 'foo', 'address', 'address', 'street', '[street]', 'children[address].data.street'),
1377 array(self::LEVEL_2, '[address][street]', 'foo', 'foo', 'foo', 'address', 'address', 'street', '[street]', 'children[address].data[street]'),
1378 array(self::LEVEL_2, '[address][street]', 'foo', 'foo', 'foo', 'address', '[address]', 'street', 'street', 'children[address].children[street]'),
1379 array(self::LEVEL_2, '[address][street]', 'foo', 'foo', 'foo', 'address', '[address]', 'street', 'street', 'children[address].data.street'),
1380 array(self::LEVEL_1B, '[address][street]', 'foo', 'foo', 'foo', 'address', '[address]', 'street', 'street', 'children[address].data[street]'),
1381 array(self::LEVEL_1B, '[address][street]', 'foo', 'foo', 'foo', 'address', '[address]', 'street', '[street]', 'children[address].children[street]'),
1382 array(self::LEVEL_1, '[address][street]', 'foo', 'foo', 'foo', 'address', '[address]', 'street', '[street]', 'children[address].data.street'),
1383 array(self::LEVEL_1B, '[address][street]', 'foo', 'foo', 'foo', 'address', '[address]', 'street', '[street]', 'children[address].data[street]'),
1384 );
1385 }
1386
1387 /**
1388 * @dataProvider provideCustomFormErrorTests
1389 */
1390 public function testCustomFormErrorMapping($target, $mapFrom, $mapTo, $errorName, $errorPath, $childName, $childPath, $grandChildName, $grandChildPath, $violationPath)
1391 {
1392 $violation = $this->getConstraintViolation($violationPath);
1393 $parent = $this->getForm('parent', null, null, array($mapFrom => $mapTo));
1394 $child = $this->getForm($childName, $childPath);
1395 $grandChild = $this->getForm($grandChildName, $grandChildPath);
1396 $errorChild = $this->getForm($errorName, $errorPath);
1397
1398 $parent->add($child);
1399 $parent->add($errorChild);
1400 $child->add($grandChild);
1401
1402 $this->mapper->mapViolation($violation, $parent);
1403
1404 if (self::LEVEL_0 === $target) {
1405 $this->assertCount(0, $errorChild->getErrors(), $errorName.' should not have an error, but has one');
1406 $this->assertEquals(array($this->getFormError()), $parent->getErrors(), $parent->getName().' should have an error, but has none');
1407 $this->assertCount(0, $child->getErrors(), $childName.' should not have an error, but has one');
1408 $this->assertCount(0, $grandChild->getErrors(), $grandChildName.' should not have an error, but has one');
1409 } elseif (self::LEVEL_1 === $target) {
1410 $this->assertCount(0, $errorChild->getErrors(), $errorName.' should not have an error, but has one');
1411 $this->assertCount(0, $parent->getErrors(), $parent->getName().' should not have an error, but has one');
1412 $this->assertEquals(array($this->getFormError()), $child->getErrors(), $childName.' should have an error, but has none');
1413 $this->assertCount(0, $grandChild->getErrors(), $grandChildName.' should not have an error, but has one');
1414 } elseif (self::LEVEL_1B === $target) {
1415 $this->assertEquals(array($this->getFormError()), $errorChild->getErrors(), $errorName.' should have an error, but has none');
1416 $this->assertCount(0, $parent->getErrors(), $parent->getName().' should not have an error, but has one');
1417 $this->assertCount(0, $child->getErrors(), $childName.' should not have an error, but has one');
1418 $this->assertCount(0, $grandChild->getErrors(), $grandChildName.' should not have an error, but has one');
1419 } else {
1420 $this->assertCount(0, $errorChild->getErrors(), $errorName.' should not have an error, but has one');
1421 $this->assertCount(0, $parent->getErrors(), $parent->getName().' should not have an error, but has one');
1422 $this->assertCount(0, $child->getErrors(), $childName.' should not have an error, but has one');
1423 $this->assertEquals(array($this->getFormError()), $grandChild->getErrors(), $grandChildName.' should have an error, but has none');
1424 }
1425 }
1426
1427 public function provideErrorTestsForFormInheritingParentData()
1428 {
1429 return array(
1430 // mapping target, child name, its property path, grand child name, its property path, violation path
1431 array(self::LEVEL_2, 'address', 'address', 'street', 'street', 'children[address].children[street].data'),
1432 array(self::LEVEL_2, 'address', 'address', 'street', 'street', 'children[address].children[street].data.prop'),
1433 array(self::LEVEL_2, 'address', 'address', 'street', 'street', 'children[address].data.street'),
1434 array(self::LEVEL_2, 'address', 'address', 'street', 'street', 'children[address].data.street.prop'),
1435 array(self::LEVEL_1, 'address', 'address', 'street', 'street', 'children[address].data[street]'),
1436 array(self::LEVEL_1, 'address', 'address', 'street', 'street', 'children[address].data[street].prop'),
1437 array(self::LEVEL_2, 'address', 'address', 'street', 'street', 'data.street'),
1438 array(self::LEVEL_2, 'address', 'address', 'street', 'street', 'data.street.prop'),
1439 array(self::LEVEL_0, 'address', 'address', 'street', 'street', 'data[street]'),
1440 array(self::LEVEL_0, 'address', 'address', 'street', 'street', 'data[street].prop'),
1441 array(self::LEVEL_0, 'address', 'address', 'street', 'street', 'data.address.street'),
1442 array(self::LEVEL_0, 'address', 'address', 'street', 'street', 'data.address.street.prop'),
1443 array(self::LEVEL_0, 'address', 'address', 'street', 'street', 'data.address[street]'),
1444 array(self::LEVEL_0, 'address', 'address', 'street', 'street', 'data.address[street].prop'),
1445 array(self::LEVEL_0, 'address', 'address', 'street', 'street', 'data[address].street'),
1446 array(self::LEVEL_0, 'address', 'address', 'street', 'street', 'data[address].street.prop'),
1447 array(self::LEVEL_0, 'address', 'address', 'street', 'street', 'data[address][street]'),
1448 array(self::LEVEL_0, 'address', 'address', 'street', 'street', 'data[address][street].prop'),
1449 );
1450 }
1451
1452 /**
1453 * @dataProvider provideErrorTestsForFormInheritingParentData
1454 */
1455 public function testErrorMappingForFormInheritingParentData($target, $childName, $childPath, $grandChildName, $grandChildPath, $violationPath)
1456 {
1457 $violation = $this->getConstraintViolation($violationPath);
1458 $parent = $this->getForm('parent');
1459 $child = $this->getForm($childName, $childPath, null, array(), true);
1460 $grandChild = $this->getForm($grandChildName, $grandChildPath);
1461
1462 $parent->add($child);
1463 $child->add($grandChild);
1464
1465 $this->mapper->mapViolation($violation, $parent);
1466
1467 if (self::LEVEL_0 === $target) {
1468 $this->assertEquals(array($this->getFormError()), $parent->getErrors(), $parent->getName().' should have an error, but has none');
1469 $this->assertCount(0, $child->getErrors(), $childName.' should not have an error, but has one');
1470 $this->assertCount(0, $grandChild->getErrors(), $grandChildName.' should not have an error, but has one');
1471 } elseif (self::LEVEL_1 === $target) {
1472 $this->assertCount(0, $parent->getErrors(), $parent->getName().' should not have an error, but has one');
1473 $this->assertEquals(array($this->getFormError()), $child->getErrors(), $childName.' should have an error, but has none');
1474 $this->assertCount(0, $grandChild->getErrors(), $grandChildName.' should not have an error, but has one');
1475 } else {
1476 $this->assertCount(0, $parent->getErrors(), $parent->getName().' should not have an error, but has one');
1477 $this->assertCount(0, $child->getErrors(), $childName.' should not have an error, but has one');
1478 $this->assertEquals(array($this->getFormError()), $grandChild->getErrors(), $grandChildName.' should have an error, but has none');
1479 }
1480 }
1481}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Validator/ViolationMapper/ViolationPathTest.php b/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Validator/ViolationMapper/ViolationPathTest.php
deleted file mode 100644
index 02df8f43..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Tests/Extension/Validator/ViolationMapper/ViolationPathTest.php
+++ /dev/null
@@ -1,245 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Tests\Extension\Validator\ViolationMapper;
13
14use Symfony\Component\Form\Extension\Validator\ViolationMapper\ViolationPath;
15
16/**
17 * @author Bernhard Schussek <bschussek@gmail.com>
18 */
19class ViolationPathTest extends \PHPUnit_Framework_TestCase
20{
21 public function providePaths()
22 {
23 return array(
24 array('children[address]', array(
25 array('address', true, true),
26 )),
27 array('children[address].children[street]', array(
28 array('address', true, true),
29 array('street', true, true),
30 )),
31 array('children[address][street]', array(
32 array('address', true, true),
33 ), 'children[address]'),
34 array('children[address].data', array(
35 array('address', true, true),
36 ), 'children[address]'),
37 array('children[address].data.street', array(
38 array('address', true, true),
39 array('street', false, false),
40 )),
41 array('children[address].data[street]', array(
42 array('address', true, true),
43 array('street', false, true),
44 )),
45 array('children[address].children[street].data.name', array(
46 array('address', true, true),
47 array('street', true, true),
48 array('name', false, false),
49 )),
50 array('children[address].children[street].data[name]', array(
51 array('address', true, true),
52 array('street', true, true),
53 array('name', false, true),
54 )),
55 array('data.address', array(
56 array('address', false, false),
57 )),
58 array('data[address]', array(
59 array('address', false, true),
60 )),
61 array('data.address.street', array(
62 array('address', false, false),
63 array('street', false, false),
64 )),
65 array('data[address].street', array(
66 array('address', false, true),
67 array('street', false, false),
68 )),
69 array('data.address[street]', array(
70 array('address', false, false),
71 array('street', false, true),
72 )),
73 array('data[address][street]', array(
74 array('address', false, true),
75 array('street', false, true),
76 )),
77 // A few invalid examples
78 array('data', array(), ''),
79 array('children', array(), ''),
80 array('children.address', array(), ''),
81 array('children.address[street]', array(), ''),
82 );
83 }
84
85 /**
86 * @dataProvider providePaths
87 */
88 public function testCreatePath($string, $entries, $slicedPath = null)
89 {
90 if (null === $slicedPath) {
91 $slicedPath = $string;
92 }
93
94 $path = new ViolationPath($string);
95
96 $this->assertSame($slicedPath, $path->__toString());
97 $this->assertSame(count($entries), count($path->getElements()));
98 $this->assertSame(count($entries), $path->getLength());
99
100 foreach ($entries as $index => $entry) {
101 $this->assertEquals($entry[0], $path->getElement($index));
102 $this->assertSame($entry[1], $path->mapsForm($index));
103 $this->assertSame($entry[2], $path->isIndex($index));
104 $this->assertSame(!$entry[2], $path->isProperty($index));
105 }
106 }
107
108 public function provideParents()
109 {
110 return array(
111 array('children[address]', null),
112 array('children[address].children[street]', 'children[address]'),
113 array('children[address].data.street', 'children[address]'),
114 array('children[address].data[street]', 'children[address]'),
115 array('data.address', null),
116 array('data.address.street', 'data.address'),
117 array('data.address[street]', 'data.address'),
118 array('data[address].street', 'data[address]'),
119 array('data[address][street]', 'data[address]'),
120 );
121 }
122
123 /**
124 * @dataProvider provideParents
125 */
126 public function testGetParent($violationPath, $parentPath)
127 {
128 $path = new ViolationPath($violationPath);
129 $parent = $parentPath === null ? null : new ViolationPath($parentPath);
130
131 $this->assertEquals($parent, $path->getParent());
132 }
133
134 public function testGetElement()
135 {
136 $path = new ViolationPath('children[address].data[street].name');
137
138 $this->assertEquals('street', $path->getElement(1));
139 }
140
141 /**
142 * @expectedException \OutOfBoundsException
143 */
144 public function testGetElementDoesNotAcceptInvalidIndices()
145 {
146 $path = new ViolationPath('children[address].data[street].name');
147
148 $path->getElement(3);
149 }
150
151 /**
152 * @expectedException \OutOfBoundsException
153 */
154 public function testGetElementDoesNotAcceptNegativeIndices()
155 {
156 $path = new ViolationPath('children[address].data[street].name');
157
158 $path->getElement(-1);
159 }
160
161 public function testIsProperty()
162 {
163 $path = new ViolationPath('children[address].data[street].name');
164
165 $this->assertFalse($path->isProperty(1));
166 $this->assertTrue($path->isProperty(2));
167 }
168
169 /**
170 * @expectedException \OutOfBoundsException
171 */
172 public function testIsPropertyDoesNotAcceptInvalidIndices()
173 {
174 $path = new ViolationPath('children[address].data[street].name');
175
176 $path->isProperty(3);
177 }
178
179 /**
180 * @expectedException \OutOfBoundsException
181 */
182 public function testIsPropertyDoesNotAcceptNegativeIndices()
183 {
184 $path = new ViolationPath('children[address].data[street].name');
185
186 $path->isProperty(-1);
187 }
188
189 public function testIsIndex()
190 {
191 $path = new ViolationPath('children[address].data[street].name');
192
193 $this->assertTrue($path->isIndex(1));
194 $this->assertFalse($path->isIndex(2));
195 }
196
197 /**
198 * @expectedException \OutOfBoundsException
199 */
200 public function testIsIndexDoesNotAcceptInvalidIndices()
201 {
202 $path = new ViolationPath('children[address].data[street].name');
203
204 $path->isIndex(3);
205 }
206
207 /**
208 * @expectedException \OutOfBoundsException
209 */
210 public function testIsIndexDoesNotAcceptNegativeIndices()
211 {
212 $path = new ViolationPath('children[address].data[street].name');
213
214 $path->isIndex(-1);
215 }
216
217 public function testMapsForm()
218 {
219 $path = new ViolationPath('children[address].data[street].name');
220
221 $this->assertTrue($path->mapsForm(0));
222 $this->assertFalse($path->mapsForm(1));
223 $this->assertFalse($path->mapsForm(2));
224 }
225
226 /**
227 * @expectedException \OutOfBoundsException
228 */
229 public function testMapsFormDoesNotAcceptInvalidIndices()
230 {
231 $path = new ViolationPath('children[address].data[street].name');
232
233 $path->mapsForm(3);
234 }
235
236 /**
237 * @expectedException \OutOfBoundsException
238 */
239 public function testMapsFormDoesNotAcceptNegativeIndices()
240 {
241 $path = new ViolationPath('children[address].data[street].name');
242
243 $path->mapsForm(-1);
244 }
245}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Tests/Fixtures/AlternatingRowType.php b/vendor/symfony/form/Symfony/Component/Form/Tests/Fixtures/AlternatingRowType.php
deleted file mode 100644
index ee7d1353..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Tests/Fixtures/AlternatingRowType.php
+++ /dev/null
@@ -1,27 +0,0 @@
1<?php
2
3namespace Symfony\Component\Form\Tests\Fixtures;
4
5use Symfony\Component\Form\AbstractType;
6use Symfony\Component\Form\FormEvents;
7use Symfony\Component\Form\FormEvent;
8use Symfony\Component\Form\FormBuilderInterface;
9
10class AlternatingRowType extends AbstractType
11{
12 public function buildForm(FormBuilderInterface $builder, array $options)
13 {
14 $formFactory = $builder->getFormFactory();
15
16 $builder->addEventListener(FormEvents::PRE_SET_DATA, function (FormEvent $event) use ($formFactory) {
17 $form = $event->getForm();
18 $type = $form->getName() % 2 === 0 ? 'text' : 'textarea';
19 $form->add('title', $type);
20 });
21 }
22
23 public function getName()
24 {
25 return 'alternating_row';
26 }
27}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Tests/Fixtures/Author.php b/vendor/symfony/form/Symfony/Component/Form/Tests/Fixtures/Author.php
deleted file mode 100644
index 11204894..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Tests/Fixtures/Author.php
+++ /dev/null
@@ -1,71 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Tests\Fixtures;
13
14class Author
15{
16 public $firstName;
17 private $lastName;
18 private $australian;
19 public $child;
20 private $readPermissions;
21
22 private $privateProperty;
23
24 public function setLastName($lastName)
25 {
26 $this->lastName = $lastName;
27 }
28
29 public function getLastName()
30 {
31 return $this->lastName;
32 }
33
34 private function getPrivateGetter()
35 {
36 return 'foobar';
37 }
38
39 public function setAustralian($australian)
40 {
41 $this->australian = $australian;
42 }
43
44 public function isAustralian()
45 {
46 return $this->australian;
47 }
48
49 public function setReadPermissions($bool)
50 {
51 $this->readPermissions = $bool;
52 }
53
54 public function hasReadPermissions()
55 {
56 return $this->readPermissions;
57 }
58
59 private function isPrivateIsser()
60 {
61 return true;
62 }
63
64 public function getPrivateSetter()
65 {
66 }
67
68 private function setPrivateSetter($data)
69 {
70 }
71}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Tests/Fixtures/AuthorType.php b/vendor/symfony/form/Symfony/Component/Form/Tests/Fixtures/AuthorType.php
deleted file mode 100644
index 147f6e48..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Tests/Fixtures/AuthorType.php
+++ /dev/null
@@ -1,30 +0,0 @@
1<?php
2
3namespace Symfony\Component\Form\Tests\Fixtures;
4
5use Symfony\Component\Form\AbstractType;
6use Symfony\Component\Form\FormBuilderInterface;
7use Symfony\Component\OptionsResolver\OptionsResolverInterface;
8
9class AuthorType extends AbstractType
10{
11 public function buildForm(FormBuilderInterface $builder, array $options)
12 {
13 $builder
14 ->add('firstName')
15 ->add('lastName')
16 ;
17 }
18
19 public function getName()
20 {
21 return 'author';
22 }
23
24 public function setDefaultOptions(OptionsResolverInterface $resolver)
25 {
26 $resolver->setDefaults(array(
27 'data_class' => 'Symfony\Component\Form\Tests\Fixtures\Author',
28 ));
29 }
30}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Tests/Fixtures/CustomArrayObject.php b/vendor/symfony/form/Symfony/Component/Form/Tests/Fixtures/CustomArrayObject.php
deleted file mode 100644
index 950f677f..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Tests/Fixtures/CustomArrayObject.php
+++ /dev/null
@@ -1,70 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Tests\Fixtures;
13
14/**
15 * This class is a hand written simplified version of PHP native `ArrayObject`
16 * class, to show that it behaves differently than the PHP native implementation.
17 */
18class CustomArrayObject implements \ArrayAccess, \IteratorAggregate, \Countable, \Serializable
19{
20 private $array;
21
22 public function __construct(array $array = null)
23 {
24 $this->array = $array ?: array();
25 }
26
27 public function offsetExists($offset)
28 {
29 return array_key_exists($offset, $this->array);
30 }
31
32 public function offsetGet($offset)
33 {
34 return $this->array[$offset];
35 }
36
37 public function offsetSet($offset, $value)
38 {
39 if (null === $offset) {
40 $this->array[] = $value;
41 } else {
42 $this->array[$offset] = $value;
43 }
44 }
45
46 public function offsetUnset($offset)
47 {
48 unset($this->array[$offset]);
49 }
50
51 public function getIterator()
52 {
53 return new \ArrayIterator($this->array);
54 }
55
56 public function count()
57 {
58 return count($this->array);
59 }
60
61 public function serialize()
62 {
63 return serialize($this->array);
64 }
65
66 public function unserialize($serialized)
67 {
68 $this->array = (array) unserialize((string) $serialized);
69 }
70}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Tests/Fixtures/FixedDataTransformer.php b/vendor/symfony/form/Symfony/Component/Form/Tests/Fixtures/FixedDataTransformer.php
deleted file mode 100644
index a5a31248..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Tests/Fixtures/FixedDataTransformer.php
+++ /dev/null
@@ -1,45 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Tests\Fixtures;
13
14use Symfony\Component\Form\DataTransformerInterface;
15use Symfony\Component\Form\Exception\RuntimeException;
16
17class FixedDataTransformer implements DataTransformerInterface
18{
19 private $mapping;
20
21 public function __construct(array $mapping)
22 {
23 $this->mapping = $mapping;
24 }
25
26 public function transform($value)
27 {
28 if (!array_key_exists($value, $this->mapping)) {
29 throw new RuntimeException(sprintf('No mapping for value "%s"', $value));
30 }
31
32 return $this->mapping[$value];
33 }
34
35 public function reverseTransform($value)
36 {
37 $result = array_search($value, $this->mapping, true);
38
39 if ($result === false) {
40 throw new RuntimeException(sprintf('No reverse mapping for value "%s"', $value));
41 }
42
43 return $result;
44 }
45}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Tests/Fixtures/FixedFilterListener.php b/vendor/symfony/form/Symfony/Component/Form/Tests/Fixtures/FixedFilterListener.php
deleted file mode 100644
index 762a10b8..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Tests/Fixtures/FixedFilterListener.php
+++ /dev/null
@@ -1,66 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Tests\Fixtures;
13
14use Symfony\Component\Form\FormEvents;
15use Symfony\Component\Form\FormEvent;
16use Symfony\Component\EventDispatcher\EventSubscriberInterface;
17
18class FixedFilterListener implements EventSubscriberInterface
19{
20 private $mapping;
21
22 public function __construct(array $mapping)
23 {
24 $this->mapping = array_merge(array(
25 'preSubmit' => array(),
26 'onSubmit' => array(),
27 'preSetData' => array(),
28 ), $mapping);
29 }
30
31 public function preSubmit(FormEvent $event)
32 {
33 $data = $event->getData();
34
35 if (isset($this->mapping['preSubmit'][$data])) {
36 $event->setData($this->mapping['preSubmit'][$data]);
37 }
38 }
39
40 public function onSubmit(FormEvent $event)
41 {
42 $data = $event->getData();
43
44 if (isset($this->mapping['onSubmit'][$data])) {
45 $event->setData($this->mapping['onSubmit'][$data]);
46 }
47 }
48
49 public function preSetData(FormEvent $event)
50 {
51 $data = $event->getData();
52
53 if (isset($this->mapping['preSetData'][$data])) {
54 $event->setData($this->mapping['preSetData'][$data]);
55 }
56 }
57
58 public static function getSubscribedEvents()
59 {
60 return array(
61 FormEvents::PRE_SUBMIT => 'preSubmit',
62 FormEvents::SUBMIT => 'onSubmit',
63 FormEvents::PRE_SET_DATA => 'preSetData',
64 );
65 }
66}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Tests/Fixtures/FooSubType.php b/vendor/symfony/form/Symfony/Component/Form/Tests/Fixtures/FooSubType.php
deleted file mode 100644
index 4f7ba6d4..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Tests/Fixtures/FooSubType.php
+++ /dev/null
@@ -1,32 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Tests\Fixtures;
13
14use Symfony\Component\Form\AbstractType;
15use Symfony\Component\Form\FormBuilder;
16use Symfony\Component\Form\FormBuilderInterface;
17use Symfony\Component\Form\FormFactoryInterface;
18use Symfony\Component\EventDispatcher\EventDispatcher;
19use Symfony\Component\OptionsResolver\OptionsResolverInterface;
20
21class FooSubType extends AbstractType
22{
23 public function getName()
24 {
25 return 'foo_sub_type';
26 }
27
28 public function getParent()
29 {
30 return 'foo';
31 }
32}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Tests/Fixtures/FooSubTypeWithParentInstance.php b/vendor/symfony/form/Symfony/Component/Form/Tests/Fixtures/FooSubTypeWithParentInstance.php
deleted file mode 100644
index 468b5a32..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Tests/Fixtures/FooSubTypeWithParentInstance.php
+++ /dev/null
@@ -1,32 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Tests\Fixtures;
13
14use Symfony\Component\Form\AbstractType;
15use Symfony\Component\Form\FormBuilder;
16use Symfony\Component\Form\FormBuilderInterface;
17use Symfony\Component\Form\FormFactoryInterface;
18use Symfony\Component\EventDispatcher\EventDispatcher;
19use Symfony\Component\OptionsResolver\OptionsResolverInterface;
20
21class FooSubTypeWithParentInstance extends AbstractType
22{
23 public function getName()
24 {
25 return 'foo_sub_type_parent_instance';
26 }
27
28 public function getParent()
29 {
30 return new FooType();
31 }
32}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Tests/Fixtures/FooType.php b/vendor/symfony/form/Symfony/Component/Form/Tests/Fixtures/FooType.php
deleted file mode 100644
index d26d3f76..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Tests/Fixtures/FooType.php
+++ /dev/null
@@ -1,32 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Tests\Fixtures;
13
14use Symfony\Component\Form\AbstractType;
15use Symfony\Component\Form\FormBuilder;
16use Symfony\Component\Form\FormBuilderInterface;
17use Symfony\Component\Form\FormFactoryInterface;
18use Symfony\Component\EventDispatcher\EventDispatcher;
19use Symfony\Component\OptionsResolver\OptionsResolverInterface;
20
21class FooType extends AbstractType
22{
23 public function getName()
24 {
25 return 'foo';
26 }
27
28 public function getParent()
29 {
30 return null;
31 }
32}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Tests/Fixtures/FooTypeBarExtension.php b/vendor/symfony/form/Symfony/Component/Form/Tests/Fixtures/FooTypeBarExtension.php
deleted file mode 100644
index c5f92e11..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Tests/Fixtures/FooTypeBarExtension.php
+++ /dev/null
@@ -1,35 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Tests\Fixtures;
13
14use Symfony\Component\Form\AbstractTypeExtension;
15use Symfony\Component\Form\FormBuilderInterface;
16
17class FooTypeBarExtension extends AbstractTypeExtension
18{
19 public function buildForm(FormBuilderInterface $builder, array $options)
20 {
21 $builder->setAttribute('bar', 'x');
22 }
23
24 public function getAllowedOptionValues()
25 {
26 return array(
27 'a_or_b' => array('c'),
28 );
29 }
30
31 public function getExtendedType()
32 {
33 return 'foo';
34 }
35}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Tests/Fixtures/FooTypeBazExtension.php b/vendor/symfony/form/Symfony/Component/Form/Tests/Fixtures/FooTypeBazExtension.php
deleted file mode 100644
index 2e364754..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Tests/Fixtures/FooTypeBazExtension.php
+++ /dev/null
@@ -1,28 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Tests\Fixtures;
13
14use Symfony\Component\Form\AbstractTypeExtension;
15use Symfony\Component\Form\FormBuilderInterface;
16
17class FooTypeBazExtension extends AbstractTypeExtension
18{
19 public function buildForm(FormBuilderInterface $builder, array $options)
20 {
21 $builder->setAttribute('baz', 'x');
22 }
23
24 public function getExtendedType()
25 {
26 return 'foo';
27 }
28}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Tests/Fixtures/TestExtension.php b/vendor/symfony/form/Symfony/Component/Form/Tests/Fixtures/TestExtension.php
deleted file mode 100644
index f9de560f..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Tests/Fixtures/TestExtension.php
+++ /dev/null
@@ -1,72 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Tests\Fixtures;
13
14use Symfony\Component\Form\FormTypeInterface;
15use Symfony\Component\Form\FormTypeExtensionInterface;
16use Symfony\Component\Form\FormTypeGuesserInterface;
17use Symfony\Component\Form\FormExtensionInterface;
18
19class TestExtension implements FormExtensionInterface
20{
21 private $types = array();
22
23 private $extensions = array();
24
25 private $guesser;
26
27 public function __construct(FormTypeGuesserInterface $guesser)
28 {
29 $this->guesser = $guesser;
30 }
31
32 public function addType(FormTypeInterface $type)
33 {
34 $this->types[$type->getName()] = $type;
35 }
36
37 public function getType($name)
38 {
39 return isset($this->types[$name]) ? $this->types[$name] : null;
40 }
41
42 public function hasType($name)
43 {
44 return isset($this->types[$name]);
45 }
46
47 public function addTypeExtension(FormTypeExtensionInterface $extension)
48 {
49 $type = $extension->getExtendedType();
50
51 if (!isset($this->extensions[$type])) {
52 $this->extensions[$type] = array();
53 }
54
55 $this->extensions[$type][] = $extension;
56 }
57
58 public function getTypeExtensions($name)
59 {
60 return isset($this->extensions[$name]) ? $this->extensions[$name] : array();
61 }
62
63 public function hasTypeExtensions($name)
64 {
65 return isset($this->extensions[$name]);
66 }
67
68 public function getTypeGuesser()
69 {
70 return $this->guesser;
71 }
72}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Tests/Fixtures/foo b/vendor/symfony/form/Symfony/Component/Form/Tests/Fixtures/foo
deleted file mode 100644
index e69de29b..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Tests/Fixtures/foo
+++ /dev/null
diff --git a/vendor/symfony/form/Symfony/Component/Form/Tests/FormBuilderTest.php b/vendor/symfony/form/Symfony/Component/Form/Tests/FormBuilderTest.php
deleted file mode 100644
index e076c97e..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Tests/FormBuilderTest.php
+++ /dev/null
@@ -1,232 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Tests;
13
14use Symfony\Component\Form\FormBuilder;
15
16class FormBuilderTest extends \PHPUnit_Framework_TestCase
17{
18 private $dispatcher;
19
20 private $factory;
21
22 private $builder;
23
24 protected function setUp()
25 {
26 if (!class_exists('Symfony\Component\EventDispatcher\EventDispatcher')) {
27 $this->markTestSkipped('The "EventDispatcher" component is not available');
28 }
29
30 $this->dispatcher = $this->getMock('Symfony\Component\EventDispatcher\EventDispatcherInterface');
31 $this->factory = $this->getMock('Symfony\Component\Form\FormFactoryInterface');
32 $this->builder = new FormBuilder('name', null, $this->dispatcher, $this->factory);
33 }
34
35 protected function tearDown()
36 {
37 $this->dispatcher = null;
38 $this->factory = null;
39 $this->builder = null;
40 }
41
42 /**
43 * Changing the name is not allowed, otherwise the name and property path
44 * are not synchronized anymore
45 *
46 * @see FormType::buildForm
47 */
48 public function testNoSetName()
49 {
50 $this->assertFalse(method_exists($this->builder, 'setName'));
51 }
52
53 public function testAddNameNoStringAndNoInteger()
54 {
55 $this->setExpectedException('Symfony\Component\Form\Exception\UnexpectedTypeException');
56 $this->builder->add(true);
57 }
58
59 public function testAddTypeNoString()
60 {
61 $this->setExpectedException('Symfony\Component\Form\Exception\UnexpectedTypeException');
62 $this->builder->add('foo', 1234);
63 }
64
65 public function testAddWithGuessFluent()
66 {
67 $this->builder = new FormBuilder('name', 'stdClass', $this->dispatcher, $this->factory);
68 $builder = $this->builder->add('foo');
69 $this->assertSame($builder, $this->builder);
70 }
71
72 public function testAddIsFluent()
73 {
74 $builder = $this->builder->add('foo', 'text', array('bar' => 'baz'));
75 $this->assertSame($builder, $this->builder);
76 }
77
78 public function testAdd()
79 {
80 $this->assertFalse($this->builder->has('foo'));
81 $this->builder->add('foo', 'text');
82 $this->assertTrue($this->builder->has('foo'));
83 }
84
85 public function testAddIntegerName()
86 {
87 $this->assertFalse($this->builder->has(0));
88 $this->builder->add(0, 'text');
89 $this->assertTrue($this->builder->has(0));
90 }
91
92 public function testAll()
93 {
94 $this->factory->expects($this->once())
95 ->method('createNamedBuilder')
96 ->with('foo', 'text')
97 ->will($this->returnValue(new FormBuilder('foo', null, $this->dispatcher, $this->factory)));
98
99 $this->assertCount(0, $this->builder->all());
100 $this->assertFalse($this->builder->has('foo'));
101
102 $this->builder->add('foo', 'text');
103 $children = $this->builder->all();
104
105 $this->assertTrue($this->builder->has('foo'));
106 $this->assertCount(1, $children);
107 $this->assertArrayHasKey('foo', $children);
108 }
109
110 /*
111 * https://github.com/symfony/symfony/issues/4693
112 */
113 public function testMaintainOrderOfLazyAndExplicitChildren()
114 {
115 $this->builder->add('foo', 'text');
116 $this->builder->add($this->getFormBuilder('bar'));
117 $this->builder->add('baz', 'text');
118
119 $children = $this->builder->all();
120
121 $this->assertSame(array('foo', 'bar', 'baz'), array_keys($children));
122 }
123
124 public function testAddFormType()
125 {
126 $this->assertFalse($this->builder->has('foo'));
127 $this->builder->add('foo', $this->getMock('Symfony\Component\Form\FormTypeInterface'));
128 $this->assertTrue($this->builder->has('foo'));
129 }
130
131 public function testRemove()
132 {
133 $this->builder->add('foo', 'text');
134 $this->builder->remove('foo');
135 $this->assertFalse($this->builder->has('foo'));
136 }
137
138 public function testRemoveUnknown()
139 {
140 $this->builder->remove('foo');
141 $this->assertFalse($this->builder->has('foo'));
142 }
143
144 // https://github.com/symfony/symfony/pull/4826
145 public function testRemoveAndGetForm()
146 {
147 $this->builder->add('foo', 'text');
148 $this->builder->remove('foo');
149 $form = $this->builder->getForm();
150 $this->assertInstanceOf('Symfony\Component\Form\Form', $form);
151 }
152
153 public function testCreateNoTypeNo()
154 {
155 $this->factory->expects($this->once())
156 ->method('createNamedBuilder')
157 ->with('foo', 'text', null, array())
158 ;
159
160 $this->builder->create('foo');
161 }
162
163 public function testGetUnknown()
164 {
165 $this->setExpectedException('Symfony\Component\Form\Exception\InvalidArgumentException', 'The child with the name "foo" does not exist.');
166 $this->builder->get('foo');
167 }
168
169 public function testGetExplicitType()
170 {
171 $expectedType = 'text';
172 $expectedName = 'foo';
173 $expectedOptions = array('bar' => 'baz');
174
175 $this->factory->expects($this->once())
176 ->method('createNamedBuilder')
177 ->with($expectedName, $expectedType, null, $expectedOptions)
178 ->will($this->returnValue($this->getFormBuilder()));
179
180 $this->builder->add($expectedName, $expectedType, $expectedOptions);
181 $builder = $this->builder->get($expectedName);
182
183 $this->assertNotSame($builder, $this->builder);
184 }
185
186 public function testGetGuessedType()
187 {
188 $expectedName = 'foo';
189 $expectedOptions = array('bar' => 'baz');
190
191 $this->factory->expects($this->once())
192 ->method('createBuilderForProperty')
193 ->with('stdClass', $expectedName, null, $expectedOptions)
194 ->will($this->returnValue($this->getFormBuilder()));
195
196 $this->builder = new FormBuilder('name', 'stdClass', $this->dispatcher, $this->factory);
197 $this->builder->add($expectedName, null, $expectedOptions);
198 $builder = $this->builder->get($expectedName);
199
200 $this->assertNotSame($builder, $this->builder);
201 }
202
203 public function testGetFormConfigErasesReferences()
204 {
205 $builder = new FormBuilder('name', null, $this->dispatcher, $this->factory);
206 $builder->add(new FormBuilder('child', null, $this->dispatcher, $this->factory));
207
208 $config = $builder->getFormConfig();
209 $reflClass = new \ReflectionClass($config);
210 $children = $reflClass->getProperty('children');
211 $unresolvedChildren = $reflClass->getProperty('unresolvedChildren');
212
213 $children->setAccessible(true);
214 $unresolvedChildren->setAccessible(true);
215
216 $this->assertEmpty($children->getValue($config));
217 $this->assertEmpty($unresolvedChildren->getValue($config));
218 }
219
220 private function getFormBuilder($name = 'name')
221 {
222 $mock = $this->getMockBuilder('Symfony\Component\Form\FormBuilder')
223 ->disableOriginalConstructor()
224 ->getMock();
225
226 $mock->expects($this->any())
227 ->method('getName')
228 ->will($this->returnValue($name));
229
230 return $mock;
231 }
232}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Tests/FormConfigTest.php b/vendor/symfony/form/Symfony/Component/Form/Tests/FormConfigTest.php
deleted file mode 100644
index 961dfd33..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Tests/FormConfigTest.php
+++ /dev/null
@@ -1,148 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Tests;
13
14use Symfony\Component\Form\Exception\UnexpectedTypeException;
15use Symfony\Component\Form\FormConfigBuilder;
16use Symfony\Component\Form\Exception\InvalidArgumentException;
17
18/**
19 * @author Bernhard Schussek <bschussek@gmail.com>
20 */
21class FormConfigTest extends \PHPUnit_Framework_TestCase
22{
23 public function getHtml4Ids()
24 {
25 return array(
26 array('z0', true),
27 array('A0', true),
28 array('A9', true),
29 array('Z0', true),
30 array('#', false),
31 array('a#', false),
32 array('a$', false),
33 array('a%', false),
34 array('a ', false),
35 array("a\t", false),
36 array("a\n", false),
37 array('a-', true),
38 array('a_', true),
39 array('a:', true),
40 // Periods are allowed by the HTML4 spec, but disallowed by us
41 // because they break the generated property paths
42 array('a.', false),
43 // Contrary to the HTML4 spec, we allow names starting with a
44 // number, otherwise naming fields by collection indices is not
45 // possible.
46 // For root forms, leading digits will be stripped from the
47 // "id" attribute to produce valid HTML4.
48 array('0', true),
49 array('9', true),
50 // Contrary to the HTML4 spec, we allow names starting with an
51 // underscore, since this is already a widely used practice in
52 // Symfony2.
53 // For root forms, leading underscores will be stripped from the
54 // "id" attribute to produce valid HTML4.
55 array('_', true),
56 // Integers are allowed
57 array(0, true),
58 array(123, true),
59 // NULL is allowed
60 array(null, true),
61 // Other types are not
62 array(1.23, false),
63 array(5., false),
64 array(true, false),
65 array(new \stdClass(), false),
66 );
67 }
68
69 /**
70 * @dataProvider getHtml4Ids
71 */
72 public function testNameAcceptsOnlyNamesValidAsIdsInHtml4($name, $accepted)
73 {
74 $dispatcher = $this->getMock('Symfony\Component\EventDispatcher\EventDispatcherInterface');
75
76 try {
77 new FormConfigBuilder($name, null, $dispatcher);
78 if (!$accepted) {
79 $this->fail(sprintf('The value "%s" should not be accepted', $name));
80 }
81 } catch (UnexpectedTypeException $e) {
82 // if the value was not accepted, but should be, rethrow exception
83 if ($accepted) {
84 throw $e;
85 }
86 } catch (InvalidArgumentException $e) {
87 // if the value was not accepted, but should be, rethrow exception
88 if ($accepted) {
89 throw $e;
90 }
91 }
92 }
93
94 public function testGetRequestHandlerCreatesNativeRequestHandlerIfNotSet()
95 {
96 $config = $this->getConfigBuilder()->getFormConfig();
97
98 $this->assertInstanceOf('Symfony\Component\Form\NativeRequestHandler', $config->getRequestHandler());
99 }
100
101 public function testGetRequestHandlerReusesNativeRequestHandlerInstance()
102 {
103 $config1 = $this->getConfigBuilder()->getFormConfig();
104 $config2 = $this->getConfigBuilder()->getFormConfig();
105
106 $this->assertSame($config1->getRequestHandler(), $config2->getRequestHandler());
107 }
108
109 public function testSetMethodAllowsGet()
110 {
111 $this->getConfigBuilder()->setMethod('GET');
112 }
113
114 public function testSetMethodAllowsPost()
115 {
116 $this->getConfigBuilder()->setMethod('POST');
117 }
118
119 public function testSetMethodAllowsPut()
120 {
121 $this->getConfigBuilder()->setMethod('PUT');
122 }
123
124 public function testSetMethodAllowsDelete()
125 {
126 $this->getConfigBuilder()->setMethod('DELETE');
127 }
128
129 public function testSetMethodAllowsPatch()
130 {
131 $this->getConfigBuilder()->setMethod('PATCH');
132 }
133
134 /**
135 * @expectedException \Symfony\Component\Form\Exception\InvalidArgumentException
136 */
137 public function testSetMethodDoesNotAllowOtherValues()
138 {
139 $this->getConfigBuilder()->setMethod('foo');
140 }
141
142 private function getConfigBuilder($name = 'name')
143 {
144 $dispatcher = $this->getMock('Symfony\Component\EventDispatcher\EventDispatcherInterface');
145
146 return new FormConfigBuilder($name, null, $dispatcher);
147 }
148}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Tests/FormFactoryBuilderTest.php b/vendor/symfony/form/Symfony/Component/Form/Tests/FormFactoryBuilderTest.php
deleted file mode 100644
index a1292dbe..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Tests/FormFactoryBuilderTest.php
+++ /dev/null
@@ -1,59 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Tests;
13
14use Symfony\Component\Form\FormFactoryBuilder;
15use Symfony\Component\Form\Tests\Fixtures\FooType;
16
17class FormFactoryBuilderTest extends \PHPUnit_Framework_TestCase
18{
19 private $registry;
20 private $guesser;
21 private $type;
22
23 protected function setUp()
24 {
25 $factory = new \ReflectionClass('Symfony\Component\Form\FormFactory');
26 $this->registry = $factory->getProperty('registry');
27 $this->registry->setAccessible(true);
28
29 $this->guesser = $this->getMock('Symfony\Component\Form\FormTypeGuesserInterface');
30 $this->type = new FooType;
31 }
32
33 public function testAddType()
34 {
35 $factoryBuilder = new FormFactoryBuilder;
36 $factoryBuilder->addType($this->type);
37
38 $factory = $factoryBuilder->getFormFactory();
39 $registry = $this->registry->getValue($factory);
40 $extensions = $registry->getExtensions();
41
42 $this->assertCount(1, $extensions);
43 $this->assertTrue($extensions[0]->hasType($this->type->getName()));
44 $this->assertNull($extensions[0]->getTypeGuesser());
45 }
46
47 public function testAddTypeGuesser()
48 {
49 $factoryBuilder = new FormFactoryBuilder;
50 $factoryBuilder->addTypeGuesser($this->guesser);
51
52 $factory = $factoryBuilder->getFormFactory();
53 $registry = $this->registry->getValue($factory);
54 $extensions = $registry->getExtensions();
55
56 $this->assertCount(1, $extensions);
57 $this->assertNotNull($extensions[0]->getTypeGuesser());
58 }
59}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Tests/FormFactoryTest.php b/vendor/symfony/form/Symfony/Component/Form/Tests/FormFactoryTest.php
deleted file mode 100644
index ea872b01..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Tests/FormFactoryTest.php
+++ /dev/null
@@ -1,506 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Tests;
13
14use Symfony\Component\Form\FormTypeGuesserChain;
15use Symfony\Component\Form\FormFactory;
16use Symfony\Component\Form\Guess\Guess;
17use Symfony\Component\Form\Guess\ValueGuess;
18use Symfony\Component\Form\Guess\TypeGuess;
19use Symfony\Component\Form\Tests\Fixtures\Author;
20use Symfony\Component\Form\Tests\Fixtures\FooType;
21use Symfony\Component\Form\Tests\Fixtures\FooSubType;
22use Symfony\Component\Form\Tests\Fixtures\FooSubTypeWithParentInstance;
23
24/**
25 * @author Bernhard Schussek <bschussek@gmail.com>
26 */
27class FormFactoryTest extends \PHPUnit_Framework_TestCase
28{
29 /**
30 * @var \PHPUnit_Framework_MockObject_MockObject
31 */
32 private $guesser1;
33
34 /**
35 * @var \PHPUnit_Framework_MockObject_MockObject
36 */
37 private $guesser2;
38
39 /**
40 * @var \PHPUnit_Framework_MockObject_MockObject
41 */
42 private $registry;
43
44 /**
45 * @var \PHPUnit_Framework_MockObject_MockObject
46 */
47 private $resolvedTypeFactory;
48
49 /**
50 * @var FormFactory
51 */
52 private $factory;
53
54 protected function setUp()
55 {
56 if (!class_exists('Symfony\Component\EventDispatcher\EventDispatcher')) {
57 $this->markTestSkipped('The "EventDispatcher" component is not available');
58 }
59
60 $this->resolvedTypeFactory = $this->getMock('Symfony\Component\Form\ResolvedFormTypeFactoryInterface');
61 $this->guesser1 = $this->getMock('Symfony\Component\Form\FormTypeGuesserInterface');
62 $this->guesser2 = $this->getMock('Symfony\Component\Form\FormTypeGuesserInterface');
63 $this->registry = $this->getMock('Symfony\Component\Form\FormRegistryInterface');
64 $this->factory = new FormFactory($this->registry, $this->resolvedTypeFactory);
65
66 $this->registry->expects($this->any())
67 ->method('getTypeGuesser')
68 ->will($this->returnValue(new FormTypeGuesserChain(array(
69 $this->guesser1,
70 $this->guesser2,
71 ))));
72 }
73
74 public function testCreateNamedBuilderWithTypeName()
75 {
76 $options = array('a' => '1', 'b' => '2');
77 $resolvedType = $this->getMockResolvedType();
78
79 $this->registry->expects($this->once())
80 ->method('getType')
81 ->with('type')
82 ->will($this->returnValue($resolvedType));
83
84 $resolvedType->expects($this->once())
85 ->method('createBuilder')
86 ->with($this->factory, 'name', $options)
87 ->will($this->returnValue('BUILDER'));
88
89 $this->assertSame('BUILDER', $this->factory->createNamedBuilder('name', 'type', null, $options));
90 }
91
92 public function testCreateNamedBuilderWithTypeInstance()
93 {
94 $options = array('a' => '1', 'b' => '2');
95 $type = new FooType();
96 $resolvedType = $this->getMockResolvedType();
97
98 $this->resolvedTypeFactory->expects($this->once())
99 ->method('createResolvedType')
100 ->with($type)
101 ->will($this->returnValue($resolvedType));
102
103 $resolvedType->expects($this->once())
104 ->method('createBuilder')
105 ->with($this->factory, 'name', $options)
106 ->will($this->returnValue('BUILDER'));
107
108 $this->assertSame('BUILDER', $this->factory->createNamedBuilder('name', $type, null, $options));
109 }
110
111 public function testCreateNamedBuilderWithTypeInstanceWithParentType()
112 {
113 $options = array('a' => '1', 'b' => '2');
114 $type = new FooSubType();
115 $resolvedType = $this->getMockResolvedType();
116 $parentResolvedType = $this->getMockResolvedType();
117
118 $this->registry->expects($this->once())
119 ->method('getType')
120 ->with('foo')
121 ->will($this->returnValue($parentResolvedType));
122
123 $this->resolvedTypeFactory->expects($this->once())
124 ->method('createResolvedType')
125 ->with($type, array(), $parentResolvedType)
126 ->will($this->returnValue($resolvedType));
127
128 $resolvedType->expects($this->once())
129 ->method('createBuilder')
130 ->with($this->factory, 'name', $options)
131 ->will($this->returnValue('BUILDER'));
132
133 $this->assertSame('BUILDER', $this->factory->createNamedBuilder('name', $type, null, $options));
134 }
135
136 public function testCreateNamedBuilderWithTypeInstanceWithParentTypeInstance()
137 {
138 $options = array('a' => '1', 'b' => '2');
139 $type = new FooSubTypeWithParentInstance();
140 $resolvedType = $this->getMockResolvedType();
141 $parentResolvedType = $this->getMockResolvedType();
142
143 $this->resolvedTypeFactory->expects($this->at(0))
144 ->method('createResolvedType')
145 ->with($type->getParent())
146 ->will($this->returnValue($parentResolvedType));
147
148 $this->resolvedTypeFactory->expects($this->at(1))
149 ->method('createResolvedType')
150 ->with($type, array(), $parentResolvedType)
151 ->will($this->returnValue($resolvedType));
152
153 $resolvedType->expects($this->once())
154 ->method('createBuilder')
155 ->with($this->factory, 'name', $options)
156 ->will($this->returnValue('BUILDER'));
157
158 $this->assertSame('BUILDER', $this->factory->createNamedBuilder('name', $type, null, $options));
159 }
160
161 public function testCreateNamedBuilderWithResolvedTypeInstance()
162 {
163 $options = array('a' => '1', 'b' => '2');
164 $resolvedType = $this->getMockResolvedType();
165
166 $resolvedType->expects($this->once())
167 ->method('createBuilder')
168 ->with($this->factory, 'name', $options)
169 ->will($this->returnValue('BUILDER'));
170
171 $this->assertSame('BUILDER', $this->factory->createNamedBuilder('name', $resolvedType, null, $options));
172 }
173
174 public function testCreateNamedBuilderFillsDataOption()
175 {
176 $givenOptions = array('a' => '1', 'b' => '2');
177 $expectedOptions = array_merge($givenOptions, array('data' => 'DATA'));
178 $resolvedType = $this->getMockResolvedType();
179
180 $this->registry->expects($this->once())
181 ->method('getType')
182 ->with('type')
183 ->will($this->returnValue($resolvedType));
184
185 $resolvedType->expects($this->once())
186 ->method('createBuilder')
187 ->with($this->factory, 'name', $expectedOptions)
188 ->will($this->returnValue('BUILDER'));
189
190 $this->assertSame('BUILDER', $this->factory->createNamedBuilder('name', 'type', 'DATA', $givenOptions));
191 }
192
193 public function testCreateNamedBuilderDoesNotOverrideExistingDataOption()
194 {
195 $options = array('a' => '1', 'b' => '2', 'data' => 'CUSTOM');
196 $resolvedType = $this->getMockResolvedType();
197
198 $this->registry->expects($this->once())
199 ->method('getType')
200 ->with('type')
201 ->will($this->returnValue($resolvedType));
202
203 $resolvedType->expects($this->once())
204 ->method('createBuilder')
205 ->with($this->factory, 'name', $options)
206 ->will($this->returnValue('BUILDER'));
207
208 $this->assertSame('BUILDER', $this->factory->createNamedBuilder('name', 'type', 'DATA', $options));
209 }
210
211 /**
212 * @expectedException \Symfony\Component\Form\Exception\UnexpectedTypeException
213 * @expectedExceptionMessage Expected argument of type "string, Symfony\Component\Form\ResolvedFormTypeInterface or Symfony\Component\Form\FormTypeInterface", "stdClass" given
214 */
215 public function testCreateNamedBuilderThrowsUnderstandableException()
216 {
217 $this->factory->createNamedBuilder('name', new \stdClass());
218 }
219
220 public function testCreateUsesTypeNameIfTypeGivenAsString()
221 {
222 $options = array('a' => '1', 'b' => '2');
223 $resolvedType = $this->getMockResolvedType();
224 $builder = $this->getMockFormBuilder();
225
226 $this->registry->expects($this->once())
227 ->method('getType')
228 ->with('TYPE')
229 ->will($this->returnValue($resolvedType));
230
231 $resolvedType->expects($this->once())
232 ->method('createBuilder')
233 ->with($this->factory, 'TYPE', $options)
234 ->will($this->returnValue($builder));
235
236 $builder->expects($this->once())
237 ->method('getForm')
238 ->will($this->returnValue('FORM'));
239
240 $this->assertSame('FORM', $this->factory->create('TYPE', null, $options));
241 }
242
243 public function testCreateUsesTypeNameIfTypeGivenAsObject()
244 {
245 $options = array('a' => '1', 'b' => '2');
246 $resolvedType = $this->getMockResolvedType();
247 $builder = $this->getMockFormBuilder();
248
249 $resolvedType->expects($this->once())
250 ->method('getName')
251 ->will($this->returnValue('TYPE'));
252
253 $resolvedType->expects($this->once())
254 ->method('createBuilder')
255 ->with($this->factory, 'TYPE', $options)
256 ->will($this->returnValue($builder));
257
258 $builder->expects($this->once())
259 ->method('getForm')
260 ->will($this->returnValue('FORM'));
261
262 $this->assertSame('FORM', $this->factory->create($resolvedType, null, $options));
263 }
264
265 public function testCreateNamed()
266 {
267 $options = array('a' => '1', 'b' => '2');
268 $resolvedType = $this->getMockResolvedType();
269 $builder = $this->getMockFormBuilder();
270
271 $this->registry->expects($this->once())
272 ->method('getType')
273 ->with('type')
274 ->will($this->returnValue($resolvedType));
275
276 $resolvedType->expects($this->once())
277 ->method('createBuilder')
278 ->with($this->factory, 'name', $options)
279 ->will($this->returnValue($builder));
280
281 $builder->expects($this->once())
282 ->method('getForm')
283 ->will($this->returnValue('FORM'));
284
285 $this->assertSame('FORM', $this->factory->createNamed('name', 'type', null, $options));
286 }
287
288 public function testCreateBuilderForPropertyWithoutTypeGuesser()
289 {
290 $registry = $this->getMock('Symfony\Component\Form\FormRegistryInterface');
291 $factory = $this->getMockBuilder('Symfony\Component\Form\FormFactory')
292 ->setMethods(array('createNamedBuilder'))
293 ->setConstructorArgs(array($registry, $this->resolvedTypeFactory))
294 ->getMock();
295
296 $factory->expects($this->once())
297 ->method('createNamedBuilder')
298 ->with('firstName', 'text', null, array())
299 ->will($this->returnValue('builderInstance'));
300
301 $builder = $factory->createBuilderForProperty('Application\Author', 'firstName');
302
303 $this->assertEquals('builderInstance', $builder);
304 }
305
306 public function testCreateBuilderForPropertyCreatesFormWithHighestConfidence()
307 {
308 $this->guesser1->expects($this->once())
309 ->method('guessType')
310 ->with('Application\Author', 'firstName')
311 ->will($this->returnValue(new TypeGuess(
312 'text',
313 array('max_length' => 10),
314 Guess::MEDIUM_CONFIDENCE
315 )));
316
317 $this->guesser2->expects($this->once())
318 ->method('guessType')
319 ->with('Application\Author', 'firstName')
320 ->will($this->returnValue(new TypeGuess(
321 'password',
322 array('max_length' => 7),
323 Guess::HIGH_CONFIDENCE
324 )));
325
326 $factory = $this->getMockFactory(array('createNamedBuilder'));
327
328 $factory->expects($this->once())
329 ->method('createNamedBuilder')
330 ->with('firstName', 'password', null, array('max_length' => 7))
331 ->will($this->returnValue('builderInstance'));
332
333 $builder = $factory->createBuilderForProperty('Application\Author', 'firstName');
334
335 $this->assertEquals('builderInstance', $builder);
336 }
337
338 public function testCreateBuilderCreatesTextFormIfNoGuess()
339 {
340 $this->guesser1->expects($this->once())
341 ->method('guessType')
342 ->with('Application\Author', 'firstName')
343 ->will($this->returnValue(null));
344
345 $factory = $this->getMockFactory(array('createNamedBuilder'));
346
347 $factory->expects($this->once())
348 ->method('createNamedBuilder')
349 ->with('firstName', 'text')
350 ->will($this->returnValue('builderInstance'));
351
352 $builder = $factory->createBuilderForProperty('Application\Author', 'firstName');
353
354 $this->assertEquals('builderInstance', $builder);
355 }
356
357 public function testOptionsCanBeOverridden()
358 {
359 $this->guesser1->expects($this->once())
360 ->method('guessType')
361 ->with('Application\Author', 'firstName')
362 ->will($this->returnValue(new TypeGuess(
363 'text',
364 array('max_length' => 10),
365 Guess::MEDIUM_CONFIDENCE
366 )));
367
368 $factory = $this->getMockFactory(array('createNamedBuilder'));
369
370 $factory->expects($this->once())
371 ->method('createNamedBuilder')
372 ->with('firstName', 'text', null, array('max_length' => 11))
373 ->will($this->returnValue('builderInstance'));
374
375 $builder = $factory->createBuilderForProperty(
376 'Application\Author',
377 'firstName',
378 null,
379 array('max_length' => 11)
380 );
381
382 $this->assertEquals('builderInstance', $builder);
383 }
384
385 public function testCreateBuilderUsesMaxLengthIfFound()
386 {
387 $this->guesser1->expects($this->once())
388 ->method('guessMaxLength')
389 ->with('Application\Author', 'firstName')
390 ->will($this->returnValue(new ValueGuess(
391 15,
392 Guess::MEDIUM_CONFIDENCE
393 )));
394
395 $this->guesser2->expects($this->once())
396 ->method('guessMaxLength')
397 ->with('Application\Author', 'firstName')
398 ->will($this->returnValue(new ValueGuess(
399 20,
400 Guess::HIGH_CONFIDENCE
401 )));
402
403 $factory = $this->getMockFactory(array('createNamedBuilder'));
404
405 $factory->expects($this->once())
406 ->method('createNamedBuilder')
407 ->with('firstName', 'text', null, array('max_length' => 20))
408 ->will($this->returnValue('builderInstance'));
409
410 $builder = $factory->createBuilderForProperty(
411 'Application\Author',
412 'firstName'
413 );
414
415 $this->assertEquals('builderInstance', $builder);
416 }
417
418 public function testCreateBuilderUsesRequiredSettingWithHighestConfidence()
419 {
420 $this->guesser1->expects($this->once())
421 ->method('guessRequired')
422 ->with('Application\Author', 'firstName')
423 ->will($this->returnValue(new ValueGuess(
424 true,
425 Guess::MEDIUM_CONFIDENCE
426 )));
427
428 $this->guesser2->expects($this->once())
429 ->method('guessRequired')
430 ->with('Application\Author', 'firstName')
431 ->will($this->returnValue(new ValueGuess(
432 false,
433 Guess::HIGH_CONFIDENCE
434 )));
435
436 $factory = $this->getMockFactory(array('createNamedBuilder'));
437
438 $factory->expects($this->once())
439 ->method('createNamedBuilder')
440 ->with('firstName', 'text', null, array('required' => false))
441 ->will($this->returnValue('builderInstance'));
442
443 $builder = $factory->createBuilderForProperty(
444 'Application\Author',
445 'firstName'
446 );
447
448 $this->assertEquals('builderInstance', $builder);
449 }
450
451 public function testCreateBuilderUsesPatternIfFound()
452 {
453 $this->guesser1->expects($this->once())
454 ->method('guessPattern')
455 ->with('Application\Author', 'firstName')
456 ->will($this->returnValue(new ValueGuess(
457 '[a-z]',
458 Guess::MEDIUM_CONFIDENCE
459 )));
460
461 $this->guesser2->expects($this->once())
462 ->method('guessPattern')
463 ->with('Application\Author', 'firstName')
464 ->will($this->returnValue(new ValueGuess(
465 '[a-zA-Z]',
466 Guess::HIGH_CONFIDENCE
467 )));
468
469 $factory = $this->getMockFactory(array('createNamedBuilder'));
470
471 $factory->expects($this->once())
472 ->method('createNamedBuilder')
473 ->with('firstName', 'text', null, array('pattern' => '[a-zA-Z]'))
474 ->will($this->returnValue('builderInstance'));
475
476 $builder = $factory->createBuilderForProperty(
477 'Application\Author',
478 'firstName'
479 );
480
481 $this->assertEquals('builderInstance', $builder);
482 }
483
484 private function getMockFactory(array $methods = array())
485 {
486 return $this->getMockBuilder('Symfony\Component\Form\FormFactory')
487 ->setMethods($methods)
488 ->setConstructorArgs(array($this->registry, $this->resolvedTypeFactory))
489 ->getMock();
490 }
491
492 private function getMockResolvedType()
493 {
494 return $this->getMock('Symfony\Component\Form\ResolvedFormTypeInterface');
495 }
496
497 private function getMockType()
498 {
499 return $this->getMock('Symfony\Component\Form\FormTypeInterface');
500 }
501
502 private function getMockFormBuilder()
503 {
504 return $this->getMock('Symfony\Component\Form\Test\FormBuilderInterface');
505 }
506}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Tests/FormIntegrationTestCase.php b/vendor/symfony/form/Symfony/Component/Form/Tests/FormIntegrationTestCase.php
deleted file mode 100644
index 763286c2..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Tests/FormIntegrationTestCase.php
+++ /dev/null
@@ -1,21 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Tests;
13
14use Symfony\Component\Form\Test\FormIntegrationTestCase as BaseFormIntegrationTestCase;
15
16/**
17 * @deprecated Deprecated since version 2.3, to be removed in 3.0. Use Symfony\Component\Form\Test\FormIntegrationTestCase instead.
18 */
19abstract class FormIntegrationTestCase extends BaseFormIntegrationTestCase
20{
21}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Tests/FormPerformanceTestCase.php b/vendor/symfony/form/Symfony/Component/Form/Tests/FormPerformanceTestCase.php
deleted file mode 100644
index 39882e85..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Tests/FormPerformanceTestCase.php
+++ /dev/null
@@ -1,21 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Tests;
13
14use Symfony\Component\Form\Test\FormPerformanceTestCase as BaseFormPerformanceTestCase;
15
16/**
17 * @deprecated Deprecated since version 2.3, to be removed in 3.0. Use Symfony\Component\Form\Test\FormPerformanceTestCase instead.
18 */
19abstract class FormPerformanceTestCase extends BaseFormPerformanceTestCase
20{
21}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Tests/FormRegistryTest.php b/vendor/symfony/form/Symfony/Component/Form/Tests/FormRegistryTest.php
deleted file mode 100644
index 0c8bb6b4..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Tests/FormRegistryTest.php
+++ /dev/null
@@ -1,243 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Tests;
13
14use Symfony\Component\Form\FormRegistry;
15use Symfony\Component\Form\FormTypeGuesserChain;
16use Symfony\Component\Form\Tests\Fixtures\TestExtension;
17use Symfony\Component\Form\Tests\Fixtures\FooSubTypeWithParentInstance;
18use Symfony\Component\Form\Tests\Fixtures\FooSubType;
19use Symfony\Component\Form\Tests\Fixtures\FooTypeBazExtension;
20use Symfony\Component\Form\Tests\Fixtures\FooTypeBarExtension;
21use Symfony\Component\Form\Tests\Fixtures\FooType;
22
23/**
24 * @author Bernhard Schussek <bschussek@gmail.com>
25 */
26class FormRegistryTest extends \PHPUnit_Framework_TestCase
27{
28 /**
29 * @var FormRegistry
30 */
31 private $registry;
32
33 /**
34 * @var \PHPUnit_Framework_MockObject_MockObject
35 */
36 private $resolvedTypeFactory;
37
38 /**
39 * @var \PHPUnit_Framework_MockObject_MockObject
40 */
41 private $guesser1;
42
43 /**
44 * @var \PHPUnit_Framework_MockObject_MockObject
45 */
46 private $guesser2;
47
48 /**
49 * @var TestExtension
50 */
51 private $extension1;
52
53 /**
54 * @var TestExtension
55 */
56 private $extension2;
57
58 protected function setUp()
59 {
60 $this->resolvedTypeFactory = $this->getMock('Symfony\Component\Form\ResolvedFormTypeFactory');
61 $this->guesser1 = $this->getMock('Symfony\Component\Form\FormTypeGuesserInterface');
62 $this->guesser2 = $this->getMock('Symfony\Component\Form\FormTypeGuesserInterface');
63 $this->extension1 = new TestExtension($this->guesser1);
64 $this->extension2 = new TestExtension($this->guesser2);
65 $this->registry = new FormRegistry(array(
66 $this->extension1,
67 $this->extension2,
68 ), $this->resolvedTypeFactory);
69 }
70
71 public function testGetTypeFromExtension()
72 {
73 $type = new FooType();
74 $resolvedType = $this->getMock('Symfony\Component\Form\ResolvedFormTypeInterface');
75
76 $this->extension2->addType($type);
77
78 $this->resolvedTypeFactory->expects($this->once())
79 ->method('createResolvedType')
80 ->with($type)
81 ->will($this->returnValue($resolvedType));
82
83 $resolvedType->expects($this->any())
84 ->method('getName')
85 ->will($this->returnValue('foo'));
86
87 $resolvedType = $this->registry->getType('foo');
88
89 $this->assertSame($resolvedType, $this->registry->getType('foo'));
90 }
91
92 public function testGetTypeWithTypeExtensions()
93 {
94 $type = new FooType();
95 $ext1 = new FooTypeBarExtension();
96 $ext2 = new FooTypeBazExtension();
97 $resolvedType = $this->getMock('Symfony\Component\Form\ResolvedFormTypeInterface');
98
99 $this->extension2->addType($type);
100 $this->extension1->addTypeExtension($ext1);
101 $this->extension2->addTypeExtension($ext2);
102
103 $this->resolvedTypeFactory->expects($this->once())
104 ->method('createResolvedType')
105 ->with($type, array($ext1, $ext2))
106 ->will($this->returnValue($resolvedType));
107
108 $resolvedType->expects($this->any())
109 ->method('getName')
110 ->will($this->returnValue('foo'));
111
112 $this->assertSame($resolvedType, $this->registry->getType('foo'));
113 }
114
115 public function testGetTypeConnectsParent()
116 {
117 $parentType = new FooType();
118 $type = new FooSubType();
119 $parentResolvedType = $this->getMock('Symfony\Component\Form\ResolvedFormTypeInterface');
120 $resolvedType = $this->getMock('Symfony\Component\Form\ResolvedFormTypeInterface');
121
122 $this->extension1->addType($parentType);
123 $this->extension2->addType($type);
124
125 $this->resolvedTypeFactory->expects($this->at(0))
126 ->method('createResolvedType')
127 ->with($parentType)
128 ->will($this->returnValue($parentResolvedType));
129
130 $this->resolvedTypeFactory->expects($this->at(1))
131 ->method('createResolvedType')
132 ->with($type, array(), $parentResolvedType)
133 ->will($this->returnValue($resolvedType));
134
135 $parentResolvedType->expects($this->any())
136 ->method('getName')
137 ->will($this->returnValue('foo'));
138
139 $resolvedType->expects($this->any())
140 ->method('getName')
141 ->will($this->returnValue('foo_sub_type'));
142
143 $this->assertSame($resolvedType, $this->registry->getType('foo_sub_type'));
144 }
145
146 public function testGetTypeConnectsParentIfGetParentReturnsInstance()
147 {
148 $type = new FooSubTypeWithParentInstance();
149 $parentResolvedType = $this->getMock('Symfony\Component\Form\ResolvedFormTypeInterface');
150 $resolvedType = $this->getMock('Symfony\Component\Form\ResolvedFormTypeInterface');
151
152 $this->extension1->addType($type);
153
154 $this->resolvedTypeFactory->expects($this->at(0))
155 ->method('createResolvedType')
156 ->with($this->isInstanceOf('Symfony\Component\Form\Tests\Fixtures\FooType'))
157 ->will($this->returnValue($parentResolvedType));
158
159 $this->resolvedTypeFactory->expects($this->at(1))
160 ->method('createResolvedType')
161 ->with($type, array(), $parentResolvedType)
162 ->will($this->returnValue($resolvedType));
163
164 $parentResolvedType->expects($this->any())
165 ->method('getName')
166 ->will($this->returnValue('foo'));
167
168 $resolvedType->expects($this->any())
169 ->method('getName')
170 ->will($this->returnValue('foo_sub_type_parent_instance'));
171
172 $this->assertSame($resolvedType, $this->registry->getType('foo_sub_type_parent_instance'));
173 }
174
175 /**
176 * @expectedException \Symfony\Component\Form\Exception\UnexpectedTypeException
177 */
178 public function testGetTypeThrowsExceptionIfParentNotFound()
179 {
180 $type = new FooSubType();
181
182 $this->extension1->addType($type);
183
184 $this->registry->getType($type);
185 }
186
187 /**
188 * @expectedException \Symfony\Component\Form\Exception\InvalidArgumentException
189 */
190 public function testGetTypeThrowsExceptionIfTypeNotFound()
191 {
192 $this->registry->getType('bar');
193 }
194
195 /**
196 * @expectedException \Symfony\Component\Form\Exception\UnexpectedTypeException
197 */
198 public function testGetTypeThrowsExceptionIfNoString()
199 {
200 $this->registry->getType(array());
201 }
202
203 public function testHasTypeAfterLoadingFromExtension()
204 {
205 $type = new FooType();
206 $resolvedType = $this->getMock('Symfony\Component\Form\ResolvedFormTypeInterface');
207
208 $this->resolvedTypeFactory->expects($this->once())
209 ->method('createResolvedType')
210 ->with($type)
211 ->will($this->returnValue($resolvedType));
212
213 $resolvedType->expects($this->any())
214 ->method('getName')
215 ->will($this->returnValue('foo'));
216
217 $this->assertFalse($this->registry->hasType('foo'));
218
219 $this->extension2->addType($type);
220
221 $this->assertTrue($this->registry->hasType('foo'));
222 }
223
224 public function testGetTypeGuesser()
225 {
226 $expectedGuesser = new FormTypeGuesserChain(array($this->guesser1, $this->guesser2));
227
228 $this->assertEquals($expectedGuesser, $this->registry->getTypeGuesser());
229
230 $registry = new FormRegistry(
231 array($this->getMock('Symfony\Component\Form\FormExtensionInterface')),
232 $this->resolvedTypeFactory);
233
234 $this->assertNull($registry->getTypeGuesser());
235 }
236
237 public function testGetExtensions()
238 {
239 $expectedExtensions = array($this->extension1, $this->extension2);
240
241 $this->assertEquals($expectedExtensions, $this->registry->getExtensions());
242 }
243}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Tests/FormRendererTest.php b/vendor/symfony/form/Symfony/Component/Form/Tests/FormRendererTest.php
deleted file mode 100644
index 69b048f7..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Tests/FormRendererTest.php
+++ /dev/null
@@ -1,27 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Test;
13
14class FormRendererTest extends \PHPUnit_Framework_TestCase
15{
16 public function testHumanize()
17 {
18 $renderer = $this->getMockBuilder('Symfony\Component\Form\FormRenderer')
19 ->setMethods(null)
20 ->disableOriginalConstructor()
21 ->getMock()
22 ;
23
24 $this->assertEquals('Is active', $renderer->humanize('is_active'));
25 $this->assertEquals('Is active', $renderer->humanize('isActive'));
26 }
27}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Tests/Guess/GuessTest.php b/vendor/symfony/form/Symfony/Component/Form/Tests/Guess/GuessTest.php
deleted file mode 100644
index 235eb6ed..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Tests/Guess/GuessTest.php
+++ /dev/null
@@ -1,36 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Tests\Guess;
13
14use Symfony\Component\Form\Guess\Guess;
15
16class TestGuess extends Guess {}
17
18class GuessTest extends \PHPUnit_Framework_TestCase
19{
20 public function testGetBestGuessReturnsGuessWithHighestConfidence()
21 {
22 $guess1 = new TestGuess(Guess::MEDIUM_CONFIDENCE);
23 $guess2 = new TestGuess(Guess::LOW_CONFIDENCE);
24 $guess3 = new TestGuess(Guess::HIGH_CONFIDENCE);
25
26 $this->assertSame($guess3, Guess::getBestGuess(array($guess1, $guess2, $guess3)));
27 }
28
29 /**
30 * @expectedException \InvalidArgumentException
31 */
32 public function testGuessExpectsValidConfidence()
33 {
34 new TestGuess(5);
35 }
36}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Tests/NativeRequestHandlerTest.php b/vendor/symfony/form/Symfony/Component/Form/Tests/NativeRequestHandlerTest.php
deleted file mode 100644
index 9d3a997f..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Tests/NativeRequestHandlerTest.php
+++ /dev/null
@@ -1,219 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Tests;
13
14use Symfony\Component\Form\NativeRequestHandler;
15
16/**
17 * @author Bernhard Schussek <bschussek@gmail.com>
18 */
19class NativeRequestHandlerTest extends AbstractRequestHandlerTest
20{
21 private static $serverBackup;
22
23 public static function setUpBeforeClass()
24 {
25 self::$serverBackup = $_SERVER;
26 }
27
28 protected function setUp()
29 {
30 parent::setUp();
31
32 $_GET = array();
33 $_POST = array();
34 $_FILES = array();
35 $_SERVER = array(
36 // PHPUnit needs this entry
37 'SCRIPT_NAME' => self::$serverBackup['SCRIPT_NAME'],
38 );
39 }
40
41 protected function tearDown()
42 {
43 parent::tearDown();
44
45 $_GET = array();
46 $_POST = array();
47 $_FILES = array();
48 $_SERVER = self::$serverBackup;
49 }
50
51 /**
52 * @expectedException \Symfony\Component\Form\Exception\UnexpectedTypeException
53 */
54 public function testRequestShouldBeNull()
55 {
56 $this->requestHandler->handleRequest($this->getMockForm('name', 'GET'), 'request');
57 }
58
59 public function testMethodOverrideHeaderTakesPrecedenceIfPost()
60 {
61 $form = $this->getMockForm('param1', 'PUT');
62
63 $this->setRequestData('POST', array(
64 'param1' => 'DATA',
65 ));
66
67 $_SERVER['HTTP_X_HTTP_METHOD_OVERRIDE'] = 'PUT';
68
69 $form->expects($this->once())
70 ->method('submit')
71 ->with('DATA');
72
73 $this->requestHandler->handleRequest($form, $this->request);
74 }
75
76 public function testConvertEmptyUploadedFilesToNull()
77 {
78 $form = $this->getMockForm('param1', 'POST', false);
79
80 $this->setRequestData('POST', array(), array('param1' => array(
81 'name' => '',
82 'type' => '',
83 'tmp_name' => '',
84 'error' => UPLOAD_ERR_NO_FILE,
85 'size' => 0
86 )));
87
88 $form->expects($this->once())
89 ->method('submit')
90 ->with($this->identicalTo(null));
91
92 $this->requestHandler->handleRequest($form, $this->request);
93 }
94
95 public function testFixBuggyFilesArray()
96 {
97 $form = $this->getMockForm('param1', 'POST', false);
98
99 $this->setRequestData('POST', array(), array('param1' => array(
100 'name' => array(
101 'field' => 'upload.txt',
102 ),
103 'type' => array(
104 'field' => 'text/plain',
105 ),
106 'tmp_name' => array(
107 'field' => 'owfdskjasdfsa',
108 ),
109 'error' => array(
110 'field' => UPLOAD_ERR_OK,
111 ),
112 'size' => array(
113 'field' => 100,
114 ),
115 )));
116
117 $form->expects($this->once())
118 ->method('submit')
119 ->with(array(
120 'field' => array(
121 'name' => 'upload.txt',
122 'type' => 'text/plain',
123 'tmp_name' => 'owfdskjasdfsa',
124 'error' => UPLOAD_ERR_OK,
125 'size' => 100,
126 ),
127 ));
128
129 $this->requestHandler->handleRequest($form, $this->request);
130 }
131
132 public function testFixBuggyNestedFilesArray()
133 {
134 $form = $this->getMockForm('param1', 'POST');
135
136 $this->setRequestData('POST', array(), array('param1' => array(
137 'name' => array(
138 'field' => array('subfield' => 'upload.txt'),
139 ),
140 'type' => array(
141 'field' => array('subfield' => 'text/plain'),
142 ),
143 'tmp_name' => array(
144 'field' => array('subfield' => 'owfdskjasdfsa'),
145 ),
146 'error' => array(
147 'field' => array('subfield' => UPLOAD_ERR_OK),
148 ),
149 'size' => array(
150 'field' => array('subfield' => 100),
151 ),
152 )));
153
154 $form->expects($this->once())
155 ->method('submit')
156 ->with(array(
157 'field' => array(
158 'subfield' => array(
159 'name' => 'upload.txt',
160 'type' => 'text/plain',
161 'tmp_name' => 'owfdskjasdfsa',
162 'error' => UPLOAD_ERR_OK,
163 'size' => 100,
164 ),
165 ),
166 ));
167
168 $this->requestHandler->handleRequest($form, $this->request);
169 }
170
171 public function testMethodOverrideHeaderIgnoredIfNotPost()
172 {
173 $form = $this->getMockForm('param1', 'POST');
174
175 $this->setRequestData('GET', array(
176 'param1' => 'DATA',
177 ));
178
179 $_SERVER['HTTP_X_HTTP_METHOD_OVERRIDE'] = 'PUT';
180
181 $form->expects($this->never())
182 ->method('submit');
183
184 $this->requestHandler->handleRequest($form, $this->request);
185 }
186
187 protected function setRequestData($method, $data, $files = array())
188 {
189 if ('GET' === $method) {
190 $_GET = $data;
191 $_FILES = array();
192 } else {
193 $_POST = $data;
194 $_FILES = $files;
195 }
196
197 $_SERVER = array(
198 'REQUEST_METHOD' => $method,
199 // PHPUnit needs this entry
200 'SCRIPT_NAME' => self::$serverBackup['SCRIPT_NAME'],
201 );
202 }
203
204 protected function getRequestHandler()
205 {
206 return new NativeRequestHandler();
207 }
208
209 protected function getMockFile()
210 {
211 return array(
212 'name' => 'upload.txt',
213 'type' => 'text/plain',
214 'tmp_name' => 'owfdskjasdfsa',
215 'error' => UPLOAD_ERR_OK,
216 'size' => 100,
217 );
218 }
219}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Tests/ResolvedFormTypeTest.php b/vendor/symfony/form/Symfony/Component/Form/Tests/ResolvedFormTypeTest.php
deleted file mode 100644
index bb32a241..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Tests/ResolvedFormTypeTest.php
+++ /dev/null
@@ -1,280 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Tests;
13
14use Symfony\Component\Form\ResolvedFormType;
15use Symfony\Component\Form\FormView;
16use Symfony\Component\Form\FormBuilder;
17use Symfony\Component\Form\Form;
18use Symfony\Component\OptionsResolver\OptionsResolverInterface;
19
20/**
21 * @author Bernhard Schussek <bschussek@gmail.com>
22 */
23class ResolvedFormTypeTest extends \PHPUnit_Framework_TestCase
24{
25 /**
26 * @var \PHPUnit_Framework_MockObject_MockObject
27 */
28 private $dispatcher;
29
30 /**
31 * @var \PHPUnit_Framework_MockObject_MockObject
32 */
33 private $factory;
34
35 /**
36 * @var \PHPUnit_Framework_MockObject_MockObject
37 */
38 private $dataMapper;
39
40 protected function setUp()
41 {
42 if (!class_exists('Symfony\Component\OptionsResolver\OptionsResolver')) {
43 $this->markTestSkipped('The "OptionsResolver" component is not available');
44 }
45
46 if (!class_exists('Symfony\Component\EventDispatcher\EventDispatcher')) {
47 $this->markTestSkipped('The "EventDispatcher" component is not available');
48 }
49
50 $this->dispatcher = $this->getMock('Symfony\Component\EventDispatcher\EventDispatcherInterface');
51 $this->factory = $this->getMock('Symfony\Component\Form\FormFactoryInterface');
52 $this->dataMapper = $this->getMock('Symfony\Component\Form\DataMapperInterface');
53 }
54
55 public function testCreateBuilder()
56 {
57 if (version_compare(\PHPUnit_Runner_Version::id(), '3.7', '<')) {
58 $this->markTestSkipped('This test requires PHPUnit 3.7.');
59 }
60
61 $parentType = $this->getMockFormType();
62 $type = $this->getMockFormType();
63 $extension1 = $this->getMockFormTypeExtension();
64 $extension2 = $this->getMockFormTypeExtension();
65
66 $parentResolvedType = new ResolvedFormType($parentType);
67 $resolvedType = new ResolvedFormType($type, array($extension1, $extension2), $parentResolvedType);
68
69 $test = $this;
70 $i = 0;
71
72 $assertIndex = function ($index) use (&$i, $test) {
73 return function () use (&$i, $test, $index) {
74 /* @var \PHPUnit_Framework_TestCase $test */
75 $test->assertEquals($index, $i, 'Executed at index '.$index);
76
77 ++$i;
78 };
79 };
80
81 $assertIndexAndAddOption = function ($index, $option, $default) use ($assertIndex) {
82 $assertIndex = $assertIndex($index);
83
84 return function (OptionsResolverInterface $resolver) use ($assertIndex, $index, $option, $default) {
85 $assertIndex();
86
87 $resolver->setDefaults(array($option => $default));
88 };
89 };
90
91 // First the default options are generated for the super type
92 $parentType->expects($this->once())
93 ->method('setDefaultOptions')
94 ->will($this->returnCallback($assertIndexAndAddOption(0, 'a', 'a_default')));
95
96 // The form type itself
97 $type->expects($this->once())
98 ->method('setDefaultOptions')
99 ->will($this->returnCallback($assertIndexAndAddOption(1, 'b', 'b_default')));
100
101 // And its extensions
102 $extension1->expects($this->once())
103 ->method('setDefaultOptions')
104 ->will($this->returnCallback($assertIndexAndAddOption(2, 'c', 'c_default')));
105
106 $extension2->expects($this->once())
107 ->method('setDefaultOptions')
108 ->will($this->returnCallback($assertIndexAndAddOption(3, 'd', 'd_default')));
109
110 $givenOptions = array('a' => 'a_custom', 'c' => 'c_custom');
111 $resolvedOptions = array('a' => 'a_custom', 'b' => 'b_default', 'c' => 'c_custom', 'd' => 'd_default');
112
113 // Then the form is built for the super type
114 $parentType->expects($this->once())
115 ->method('buildForm')
116 ->with($this->anything(), $resolvedOptions)
117 ->will($this->returnCallback($assertIndex(4)));
118
119 // Then the type itself
120 $type->expects($this->once())
121 ->method('buildForm')
122 ->with($this->anything(), $resolvedOptions)
123 ->will($this->returnCallback($assertIndex(5)));
124
125 // Then its extensions
126 $extension1->expects($this->once())
127 ->method('buildForm')
128 ->with($this->anything(), $resolvedOptions)
129 ->will($this->returnCallback($assertIndex(6)));
130
131 $extension2->expects($this->once())
132 ->method('buildForm')
133 ->with($this->anything(), $resolvedOptions)
134 ->will($this->returnCallback($assertIndex(7)));
135
136 $factory = $this->getMockFormFactory();
137 $builder = $resolvedType->createBuilder($factory, 'name', $givenOptions);
138
139 $this->assertSame($resolvedType, $builder->getType());
140 }
141
142 public function testCreateView()
143 {
144 $parentType = $this->getMockFormType();
145 $type = $this->getMockFormType();
146 $field1Type = $this->getMockFormType();
147 $field2Type = $this->getMockFormType();
148 $extension1 = $this->getMockFormTypeExtension();
149 $extension2 = $this->getMockFormTypeExtension();
150
151 $parentResolvedType = new ResolvedFormType($parentType);
152 $resolvedType = new ResolvedFormType($type, array($extension1, $extension2), $parentResolvedType);
153 $field1ResolvedType = new ResolvedFormType($field1Type);
154 $field2ResolvedType = new ResolvedFormType($field2Type);
155
156 $options = array('a' => '1', 'b' => '2');
157 $form = $this->getBuilder('name', $options)
158 ->setCompound(true)
159 ->setDataMapper($this->dataMapper)
160 ->setType($resolvedType)
161 ->add($this->getBuilder('foo')->setType($field1ResolvedType))
162 ->add($this->getBuilder('bar')->setType($field2ResolvedType))
163 ->getForm();
164
165 $test = $this;
166 $i = 0;
167
168 $assertIndexAndNbOfChildViews = function ($index, $nbOfChildViews) use (&$i, $test) {
169 return function (FormView $view) use (&$i, $test, $index, $nbOfChildViews) {
170 /* @var \PHPUnit_Framework_TestCase $test */
171 $test->assertEquals($index, $i, 'Executed at index '.$index);
172 $test->assertCount($nbOfChildViews, $view);
173
174 ++$i;
175 };
176 };
177
178 // First the super type
179 $parentType->expects($this->once())
180 ->method('buildView')
181 ->with($this->anything(), $form, $options)
182 ->will($this->returnCallback($assertIndexAndNbOfChildViews(0, 0)));
183
184 // Then the type itself
185 $type->expects($this->once())
186 ->method('buildView')
187 ->with($this->anything(), $form, $options)
188 ->will($this->returnCallback($assertIndexAndNbOfChildViews(1, 0)));
189
190 // Then its extensions
191 $extension1->expects($this->once())
192 ->method('buildView')
193 ->with($this->anything(), $form, $options)
194 ->will($this->returnCallback($assertIndexAndNbOfChildViews(2, 0)));
195
196 $extension2->expects($this->once())
197 ->method('buildView')
198 ->with($this->anything(), $form, $options)
199 ->will($this->returnCallback($assertIndexAndNbOfChildViews(3, 0)));
200
201 // Now the first child form
202 $field1Type->expects($this->once())
203 ->method('buildView')
204 ->will($this->returnCallback($assertIndexAndNbOfChildViews(4, 0)));
205 $field1Type->expects($this->once())
206 ->method('finishView')
207 ->will($this->returnCallback($assertIndexAndNbOfChildViews(5, 0)));
208
209 // And the second child form
210 $field2Type->expects($this->once())
211 ->method('buildView')
212 ->will($this->returnCallback($assertIndexAndNbOfChildViews(6, 0)));
213 $field2Type->expects($this->once())
214 ->method('finishView')
215 ->will($this->returnCallback($assertIndexAndNbOfChildViews(7, 0)));
216
217 // Again first the parent
218 $parentType->expects($this->once())
219 ->method('finishView')
220 ->with($this->anything(), $form, $options)
221 ->will($this->returnCallback($assertIndexAndNbOfChildViews(8, 2)));
222
223 // Then the type itself
224 $type->expects($this->once())
225 ->method('finishView')
226 ->with($this->anything(), $form, $options)
227 ->will($this->returnCallback($assertIndexAndNbOfChildViews(9, 2)));
228
229 // Then its extensions
230 $extension1->expects($this->once())
231 ->method('finishView')
232 ->with($this->anything(), $form, $options)
233 ->will($this->returnCallback($assertIndexAndNbOfChildViews(10, 2)));
234
235 $extension2->expects($this->once())
236 ->method('finishView')
237 ->with($this->anything(), $form, $options)
238 ->will($this->returnCallback($assertIndexAndNbOfChildViews(11, 2)));
239
240 $parentView = new FormView();
241 $view = $resolvedType->createView($form, $parentView);
242
243 $this->assertSame($parentView, $view->parent);
244 }
245
246 /**
247 * @return \PHPUnit_Framework_MockObject_MockObject
248 */
249 private function getMockFormType()
250 {
251 return $this->getMock('Symfony\Component\Form\FormTypeInterface');
252 }
253
254 /**
255 * @return \PHPUnit_Framework_MockObject_MockObject
256 */
257 private function getMockFormTypeExtension()
258 {
259 return $this->getMock('Symfony\Component\Form\FormTypeExtensionInterface');
260 }
261
262 /**
263 * @return \PHPUnit_Framework_MockObject_MockObject
264 */
265 private function getMockFormFactory()
266 {
267 return $this->getMock('Symfony\Component\Form\FormFactoryInterface');
268 }
269
270 /**
271 * @param string $name
272 * @param array $options
273 *
274 * @return FormBuilder
275 */
276 protected function getBuilder($name = 'name', array $options = array())
277 {
278 return new FormBuilder($name, null, $this->dispatcher, $this->factory, $options);
279 }
280}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Tests/SimpleFormTest.php b/vendor/symfony/form/Symfony/Component/Form/Tests/SimpleFormTest.php
deleted file mode 100644
index bedad676..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Tests/SimpleFormTest.php
+++ /dev/null
@@ -1,1045 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Tests;
13
14use Symfony\Component\Form\Form;
15use Symfony\Component\Form\FormEvent;
16use Symfony\Component\Form\FormEvents;
17use Symfony\Component\PropertyAccess\PropertyPath;
18use Symfony\Component\Form\FormConfigBuilder;
19use Symfony\Component\Form\FormError;
20use Symfony\Component\Form\Exception\TransformationFailedException;
21use Symfony\Component\EventDispatcher\EventDispatcher;
22use Symfony\Component\Form\Tests\Fixtures\FixedDataTransformer;
23use Symfony\Component\Form\Tests\Fixtures\FixedFilterListener;
24
25class SimpleFormTest_Countable implements \Countable
26{
27 private $count;
28
29 public function __construct($count)
30 {
31 $this->count = $count;
32 }
33
34 public function count()
35 {
36 return $this->count;
37 }
38}
39
40class SimpleFormTest_Traversable implements \IteratorAggregate
41{
42 private $iterator;
43
44 public function __construct($count)
45 {
46 $this->iterator = new \ArrayIterator($count > 0 ? array_fill(0, $count, 'Foo') : array());
47 }
48
49 public function getIterator()
50 {
51 return $this->iterator;
52 }
53}
54
55class SimpleFormTest extends AbstractFormTest
56{
57 public function testDataIsInitializedToConfiguredValue()
58 {
59 $model = new FixedDataTransformer(array(
60 'default' => 'foo',
61 ));
62 $view = new FixedDataTransformer(array(
63 'foo' => 'bar',
64 ));
65
66 $config = new FormConfigBuilder('name', null, $this->dispatcher);
67 $config->addViewTransformer($view);
68 $config->addModelTransformer($model);
69 $config->setData('default');
70 $form = new Form($config);
71
72 $this->assertSame('default', $form->getData());
73 $this->assertSame('foo', $form->getNormData());
74 $this->assertSame('bar', $form->getViewData());
75 }
76
77 // https://github.com/symfony/symfony/commit/d4f4038f6daf7cf88ca7c7ab089473cce5ebf7d8#commitcomment-1632879
78 public function testDataIsInitializedFromSubmit()
79 {
80 $mock = $this->getMockBuilder('\stdClass')
81 ->setMethods(array('preSetData', 'preSubmit'))
82 ->getMock();
83 $mock->expects($this->at(0))
84 ->method('preSetData');
85 $mock->expects($this->at(1))
86 ->method('preSubmit');
87
88 $config = new FormConfigBuilder('name', null, $this->dispatcher);
89 $config->addEventListener(FormEvents::PRE_SET_DATA, array($mock, 'preSetData'));
90 $config->addEventListener(FormEvents::PRE_SUBMIT, array($mock, 'preSubmit'));
91 $form = new Form($config);
92
93 // no call to setData() or similar where the object would be
94 // initialized otherwise
95
96 $form->submit('foobar');
97 }
98
99 // https://github.com/symfony/symfony/pull/7789
100 public function testFalseIsConvertedToNull()
101 {
102 $mock = $this->getMockBuilder('\stdClass')
103 ->setMethods(array('preBind'))
104 ->getMock();
105 $mock->expects($this->once())
106 ->method('preBind')
107 ->with($this->callback(function ($event) {
108 return null === $event->getData();
109 }));
110
111 $config = new FormConfigBuilder('name', null, $this->dispatcher);
112 $config->addEventListener(FormEvents::PRE_BIND, array($mock, 'preBind'));
113 $form = new Form($config);
114
115 $form->bind(false);
116
117 $this->assertTrue($form->isValid());
118 $this->assertNull($form->getData());
119 }
120
121 /**
122 * @expectedException \Symfony\Component\Form\Exception\AlreadySubmittedException
123 */
124 public function testSubmitThrowsExceptionIfAlreadySubmitted()
125 {
126 $this->form->submit(array());
127 $this->form->submit(array());
128 }
129
130 public function testSubmitIsIgnoredIfDisabled()
131 {
132 $form = $this->getBuilder()
133 ->setDisabled(true)
134 ->setData('initial')
135 ->getForm();
136
137 $form->submit('new');
138
139 $this->assertEquals('initial', $form->getData());
140 $this->assertTrue($form->isSubmitted());
141 }
142
143 public function testNeverRequiredIfParentNotRequired()
144 {
145 $parent = $this->getBuilder()->setRequired(false)->getForm();
146 $child = $this->getBuilder()->setRequired(true)->getForm();
147
148 $child->setParent($parent);
149
150 $this->assertFalse($child->isRequired());
151 }
152
153 public function testRequired()
154 {
155 $parent = $this->getBuilder()->setRequired(true)->getForm();
156 $child = $this->getBuilder()->setRequired(true)->getForm();
157
158 $child->setParent($parent);
159
160 $this->assertTrue($child->isRequired());
161 }
162
163 public function testNotRequired()
164 {
165 $parent = $this->getBuilder()->setRequired(true)->getForm();
166 $child = $this->getBuilder()->setRequired(false)->getForm();
167
168 $child->setParent($parent);
169
170 $this->assertFalse($child->isRequired());
171 }
172
173 public function testAlwaysDisabledIfParentDisabled()
174 {
175 $parent = $this->getBuilder()->setDisabled(true)->getForm();
176 $child = $this->getBuilder()->setDisabled(false)->getForm();
177
178 $child->setParent($parent);
179
180 $this->assertTrue($child->isDisabled());
181 }
182
183 public function testDisabled()
184 {
185 $parent = $this->getBuilder()->setDisabled(false)->getForm();
186 $child = $this->getBuilder()->setDisabled(true)->getForm();
187
188 $child->setParent($parent);
189
190 $this->assertTrue($child->isDisabled());
191 }
192
193 public function testNotDisabled()
194 {
195 $parent = $this->getBuilder()->setDisabled(false)->getForm();
196 $child = $this->getBuilder()->setDisabled(false)->getForm();
197
198 $child->setParent($parent);
199
200 $this->assertFalse($child->isDisabled());
201 }
202
203 public function testGetRootReturnsRootOfParent()
204 {
205 $parent = $this->getMockForm();
206 $parent->expects($this->once())
207 ->method('getRoot')
208 ->will($this->returnValue('ROOT'));
209
210 $this->form->setParent($parent);
211
212 $this->assertEquals('ROOT', $this->form->getRoot());
213 }
214
215 public function testGetRootReturnsSelfIfNoParent()
216 {
217 $this->assertSame($this->form, $this->form->getRoot());
218 }
219
220 public function testEmptyIfEmptyArray()
221 {
222 $this->form->setData(array());
223
224 $this->assertTrue($this->form->isEmpty());
225 }
226
227 public function testEmptyIfEmptyCountable()
228 {
229 $this->form = new Form(new FormConfigBuilder('name', __NAMESPACE__.'\SimpleFormTest_Countable', $this->dispatcher));
230
231 $this->form->setData(new SimpleFormTest_Countable(0));
232
233 $this->assertTrue($this->form->isEmpty());
234 }
235
236 public function testNotEmptyIfFilledCountable()
237 {
238 $this->form = new Form(new FormConfigBuilder('name', __NAMESPACE__.'\SimpleFormTest_Countable', $this->dispatcher));
239
240 $this->form->setData(new SimpleFormTest_Countable(1));
241
242 $this->assertFalse($this->form->isEmpty());
243 }
244
245 public function testEmptyIfEmptyTraversable()
246 {
247 $this->form = new Form(new FormConfigBuilder('name', __NAMESPACE__.'\SimpleFormTest_Traversable', $this->dispatcher));
248
249 $this->form->setData(new SimpleFormTest_Traversable(0));
250
251 $this->assertTrue($this->form->isEmpty());
252 }
253
254 public function testNotEmptyIfFilledTraversable()
255 {
256 $this->form = new Form(new FormConfigBuilder('name', __NAMESPACE__.'\SimpleFormTest_Traversable', $this->dispatcher));
257
258 $this->form->setData(new SimpleFormTest_Traversable(1));
259
260 $this->assertFalse($this->form->isEmpty());
261 }
262
263 public function testEmptyIfNull()
264 {
265 $this->form->setData(null);
266
267 $this->assertTrue($this->form->isEmpty());
268 }
269
270 public function testEmptyIfEmptyString()
271 {
272 $this->form->setData('');
273
274 $this->assertTrue($this->form->isEmpty());
275 }
276
277 public function testNotEmptyIfText()
278 {
279 $this->form->setData('foobar');
280
281 $this->assertFalse($this->form->isEmpty());
282 }
283
284 public function testValidIfSubmitted()
285 {
286 $form = $this->getBuilder()->getForm();
287 $form->submit('foobar');
288
289 $this->assertTrue($form->isValid());
290 }
291
292 public function testValidIfSubmittedAndDisabled()
293 {
294 $form = $this->getBuilder()->setDisabled(true)->getForm();
295 $form->submit('foobar');
296
297 $this->assertTrue($form->isValid());
298 }
299
300 public function testNotValidIfNotSubmitted()
301 {
302 $this->assertFalse($this->form->isValid());
303 }
304
305 public function testNotValidIfErrors()
306 {
307 $form = $this->getBuilder()->getForm();
308 $form->submit('foobar');
309 $form->addError(new FormError('Error!'));
310
311 $this->assertFalse($form->isValid());
312 }
313
314 public function testHasErrors()
315 {
316 $this->form->addError(new FormError('Error!'));
317
318 $this->assertCount(1, $this->form->getErrors());
319 }
320
321 public function testHasNoErrors()
322 {
323 $this->assertCount(0, $this->form->getErrors());
324 }
325
326 /**
327 * @expectedException \Symfony\Component\Form\Exception\AlreadySubmittedException
328 */
329 public function testSetParentThrowsExceptionIfAlreadySubmitted()
330 {
331 $this->form->submit(array());
332 $this->form->setParent($this->getBuilder('parent')->getForm());
333 }
334
335 public function testSubmitted()
336 {
337 $form = $this->getBuilder()->getForm();
338 $form->submit('foobar');
339
340 $this->assertTrue($form->isSubmitted());
341 }
342
343 public function testNotSubmitted()
344 {
345 $this->assertFalse($this->form->isSubmitted());
346 }
347
348 /**
349 * @expectedException \Symfony\Component\Form\Exception\AlreadySubmittedException
350 */
351 public function testSetDataThrowsExceptionIfAlreadySubmitted()
352 {
353 $this->form->submit(array());
354 $this->form->setData(null);
355 }
356
357 public function testSetDataClonesObjectIfNotByReference()
358 {
359 $data = new \stdClass();
360 $form = $this->getBuilder('name', null, '\stdClass')->setByReference(false)->getForm();
361 $form->setData($data);
362
363 $this->assertNotSame($data, $form->getData());
364 $this->assertEquals($data, $form->getData());
365 }
366
367 public function testSetDataDoesNotCloneObjectIfByReference()
368 {
369 $data = new \stdClass();
370 $form = $this->getBuilder('name', null, '\stdClass')->setByReference(true)->getForm();
371 $form->setData($data);
372
373 $this->assertSame($data, $form->getData());
374 }
375
376 public function testSetDataExecutesTransformationChain()
377 {
378 // use real event dispatcher now
379 $form = $this->getBuilder('name', new EventDispatcher())
380 ->addEventSubscriber(new FixedFilterListener(array(
381 'preSetData' => array(
382 'app' => 'filtered',
383 ),
384 )))
385 ->addModelTransformer(new FixedDataTransformer(array(
386 '' => '',
387 'filtered' => 'norm',
388 )))
389 ->addViewTransformer(new FixedDataTransformer(array(
390 '' => '',
391 'norm' => 'client',
392 )))
393 ->getForm();
394
395 $form->setData('app');
396
397 $this->assertEquals('filtered', $form->getData());
398 $this->assertEquals('norm', $form->getNormData());
399 $this->assertEquals('client', $form->getViewData());
400 }
401
402 public function testSetDataExecutesViewTransformersInOrder()
403 {
404 $form = $this->getBuilder()
405 ->addViewTransformer(new FixedDataTransformer(array(
406 '' => '',
407 'first' => 'second',
408 )))
409 ->addViewTransformer(new FixedDataTransformer(array(
410 '' => '',
411 'second' => 'third',
412 )))
413 ->getForm();
414
415 $form->setData('first');
416
417 $this->assertEquals('third', $form->getViewData());
418 }
419
420 public function testSetDataExecutesModelTransformersInReverseOrder()
421 {
422 $form = $this->getBuilder()
423 ->addModelTransformer(new FixedDataTransformer(array(
424 '' => '',
425 'second' => 'third',
426 )))
427 ->addModelTransformer(new FixedDataTransformer(array(
428 '' => '',
429 'first' => 'second',
430 )))
431 ->getForm();
432
433 $form->setData('first');
434
435 $this->assertEquals('third', $form->getNormData());
436 }
437
438 /*
439 * When there is no data transformer, the data must have the same format
440 * in all three representations
441 */
442 public function testSetDataConvertsScalarToStringIfNoTransformer()
443 {
444 $form = $this->getBuilder()->getForm();
445
446 $form->setData(1);
447
448 $this->assertSame('1', $form->getData());
449 $this->assertSame('1', $form->getNormData());
450 $this->assertSame('1', $form->getViewData());
451 }
452
453 /*
454 * Data in client format should, if possible, always be a string to
455 * facilitate differentiation between '0' and ''
456 */
457 public function testSetDataConvertsScalarToStringIfOnlyModelTransformer()
458 {
459 $form = $this->getBuilder()
460 ->addModelTransformer(new FixedDataTransformer(array(
461 '' => '',
462 1 => 23,
463 )))
464 ->getForm();
465
466 $form->setData(1);
467
468 $this->assertSame(1, $form->getData());
469 $this->assertSame(23, $form->getNormData());
470 $this->assertSame('23', $form->getViewData());
471 }
472
473 /*
474 * NULL remains NULL in app and norm format to remove the need to treat
475 * empty values and NULL explicitly in the application
476 */
477 public function testSetDataConvertsNullToStringIfNoTransformer()
478 {
479 $form = $this->getBuilder()->getForm();
480
481 $form->setData(null);
482
483 $this->assertNull($form->getData());
484 $this->assertNull($form->getNormData());
485 $this->assertSame('', $form->getViewData());
486 }
487
488 public function testSetDataIsIgnoredIfDataIsLocked()
489 {
490 $form = $this->getBuilder()
491 ->setData('default')
492 ->setDataLocked(true)
493 ->getForm();
494
495 $form->setData('foobar');
496
497 $this->assertSame('default', $form->getData());
498 }
499
500 public function testSubmitConvertsEmptyToNullIfNoTransformer()
501 {
502 $form = $this->getBuilder()->getForm();
503
504 $form->submit('');
505
506 $this->assertNull($form->getData());
507 $this->assertNull($form->getNormData());
508 $this->assertSame('', $form->getViewData());
509 }
510
511 public function testSubmitExecutesTransformationChain()
512 {
513 // use real event dispatcher now
514 $form = $this->getBuilder('name', new EventDispatcher())
515 ->addEventSubscriber(new FixedFilterListener(array(
516 'preSubmit' => array(
517 'client' => 'filteredclient',
518 ),
519 'onSubmit' => array(
520 'norm' => 'filterednorm',
521 ),
522 )))
523 ->addViewTransformer(new FixedDataTransformer(array(
524 '' => '',
525 // direction is reversed!
526 'norm' => 'filteredclient',
527 'filterednorm' => 'cleanedclient'
528 )))
529 ->addModelTransformer(new FixedDataTransformer(array(
530 '' => '',
531 // direction is reversed!
532 'app' => 'filterednorm',
533 )))
534 ->getForm();
535
536 $form->submit('client');
537
538 $this->assertEquals('app', $form->getData());
539 $this->assertEquals('filterednorm', $form->getNormData());
540 $this->assertEquals('cleanedclient', $form->getViewData());
541 }
542
543 public function testSubmitExecutesViewTransformersInReverseOrder()
544 {
545 $form = $this->getBuilder()
546 ->addViewTransformer(new FixedDataTransformer(array(
547 '' => '',
548 'third' => 'second',
549 )))
550 ->addViewTransformer(new FixedDataTransformer(array(
551 '' => '',
552 'second' => 'first',
553 )))
554 ->getForm();
555
556 $form->submit('first');
557
558 $this->assertEquals('third', $form->getNormData());
559 }
560
561 public function testSubmitExecutesModelTransformersInOrder()
562 {
563 $form = $this->getBuilder()
564 ->addModelTransformer(new FixedDataTransformer(array(
565 '' => '',
566 'second' => 'first',
567 )))
568 ->addModelTransformer(new FixedDataTransformer(array(
569 '' => '',
570 'third' => 'second',
571 )))
572 ->getForm();
573
574 $form->submit('first');
575
576 $this->assertEquals('third', $form->getData());
577 }
578
579 public function testSynchronizedByDefault()
580 {
581 $this->assertTrue($this->form->isSynchronized());
582 }
583
584 public function testSynchronizedAfterSubmission()
585 {
586 $this->form->submit('foobar');
587
588 $this->assertTrue($this->form->isSynchronized());
589 }
590
591 public function testNotSynchronizedIfViewReverseTransformationFailed()
592 {
593 $transformer = $this->getDataTransformer();
594 $transformer->expects($this->once())
595 ->method('reverseTransform')
596 ->will($this->throwException(new TransformationFailedException()));
597
598 $form = $this->getBuilder()
599 ->addViewTransformer($transformer)
600 ->getForm();
601
602 $form->submit('foobar');
603
604 $this->assertFalse($form->isSynchronized());
605 }
606
607 public function testNotSynchronizedIfModelReverseTransformationFailed()
608 {
609 $transformer = $this->getDataTransformer();
610 $transformer->expects($this->once())
611 ->method('reverseTransform')
612 ->will($this->throwException(new TransformationFailedException()));
613
614 $form = $this->getBuilder()
615 ->addModelTransformer($transformer)
616 ->getForm();
617
618 $form->submit('foobar');
619
620 $this->assertFalse($form->isSynchronized());
621 }
622
623 public function testEmptyDataCreatedBeforeTransforming()
624 {
625 $form = $this->getBuilder()
626 ->setEmptyData('foo')
627 ->addViewTransformer(new FixedDataTransformer(array(
628 '' => '',
629 // direction is reversed!
630 'bar' => 'foo',
631 )))
632 ->getForm();
633
634 $form->submit('');
635
636 $this->assertEquals('bar', $form->getData());
637 }
638
639 public function testEmptyDataFromClosure()
640 {
641 $test = $this;
642 $form = $this->getBuilder()
643 ->setEmptyData(function ($form) use ($test) {
644 // the form instance is passed to the closure to allow use
645 // of form data when creating the empty value
646 $test->assertInstanceOf('Symfony\Component\Form\FormInterface', $form);
647
648 return 'foo';
649 })
650 ->addViewTransformer(new FixedDataTransformer(array(
651 '' => '',
652 // direction is reversed!
653 'bar' => 'foo',
654 )))
655 ->getForm();
656
657 $form->submit('');
658
659 $this->assertEquals('bar', $form->getData());
660 }
661
662 public function testSubmitResetsErrors()
663 {
664 $this->form->addError(new FormError('Error!'));
665 $this->form->submit('foobar');
666
667 $this->assertSame(array(), $this->form->getErrors());
668 }
669
670 public function testCreateView()
671 {
672 $type = $this->getMock('Symfony\Component\Form\ResolvedFormTypeInterface');
673 $view = $this->getMock('Symfony\Component\Form\FormView');
674 $form = $this->getBuilder()->setType($type)->getForm();
675
676 $type->expects($this->once())
677 ->method('createView')
678 ->with($form)
679 ->will($this->returnValue($view));
680
681 $this->assertSame($view, $form->createView());
682 }
683
684 public function testCreateViewWithParent()
685 {
686 $type = $this->getMock('Symfony\Component\Form\ResolvedFormTypeInterface');
687 $view = $this->getMock('Symfony\Component\Form\FormView');
688 $parentForm = $this->getMock('Symfony\Component\Form\Test\FormInterface');
689 $parentView = $this->getMock('Symfony\Component\Form\FormView');
690 $form = $this->getBuilder()->setType($type)->getForm();
691 $form->setParent($parentForm);
692
693 $parentForm->expects($this->once())
694 ->method('createView')
695 ->will($this->returnValue($parentView));
696
697 $type->expects($this->once())
698 ->method('createView')
699 ->with($form, $parentView)
700 ->will($this->returnValue($view));
701
702 $this->assertSame($view, $form->createView());
703 }
704
705 public function testCreateViewWithExplicitParent()
706 {
707 $type = $this->getMock('Symfony\Component\Form\ResolvedFormTypeInterface');
708 $view = $this->getMock('Symfony\Component\Form\FormView');
709 $parentView = $this->getMock('Symfony\Component\Form\FormView');
710 $form = $this->getBuilder()->setType($type)->getForm();
711
712 $type->expects($this->once())
713 ->method('createView')
714 ->with($form, $parentView)
715 ->will($this->returnValue($view));
716
717 $this->assertSame($view, $form->createView($parentView));
718 }
719
720 public function testGetErrorsAsString()
721 {
722 $this->form->addError(new FormError('Error!'));
723
724 $this->assertEquals("ERROR: Error!\n", $this->form->getErrorsAsString());
725 }
726
727 public function testFormCanHaveEmptyName()
728 {
729 $form = $this->getBuilder('')->getForm();
730
731 $this->assertEquals('', $form->getName());
732 }
733
734 public function testSetNullParentWorksWithEmptyName()
735 {
736 $form = $this->getBuilder('')->getForm();
737 $form->setParent(null);
738
739 $this->assertNull($form->getParent());
740 }
741
742 /**
743 * @expectedException \Symfony\Component\Form\Exception\LogicException
744 * @expectedExceptionMessage A form with an empty name cannot have a parent form.
745 */
746 public function testFormCannotHaveEmptyNameNotInRootLevel()
747 {
748 $this->getBuilder()
749 ->setCompound(true)
750 ->setDataMapper($this->getDataMapper())
751 ->add($this->getBuilder(''))
752 ->getForm();
753 }
754
755 public function testGetPropertyPathReturnsConfiguredPath()
756 {
757 $form = $this->getBuilder()->setPropertyPath('address.street')->getForm();
758
759 $this->assertEquals(new PropertyPath('address.street'), $form->getPropertyPath());
760 }
761
762 // see https://github.com/symfony/symfony/issues/3903
763 public function testGetPropertyPathDefaultsToNameIfParentHasDataClass()
764 {
765 $parent = $this->getBuilder(null, null, 'stdClass')
766 ->setCompound(true)
767 ->setDataMapper($this->getDataMapper())
768 ->getForm();
769 $form = $this->getBuilder('name')->getForm();
770 $parent->add($form);
771
772 $this->assertEquals(new PropertyPath('name'), $form->getPropertyPath());
773 }
774
775 // see https://github.com/symfony/symfony/issues/3903
776 public function testGetPropertyPathDefaultsToIndexedNameIfParentDataClassIsNull()
777 {
778 $parent = $this->getBuilder()
779 ->setCompound(true)
780 ->setDataMapper($this->getDataMapper())
781 ->getForm();
782 $form = $this->getBuilder('name')->getForm();
783 $parent->add($form);
784
785 $this->assertEquals(new PropertyPath('[name]'), $form->getPropertyPath());
786 }
787
788 public function testGetPropertyPathDefaultsToNameIfFirstParentWithoutInheritDataHasDataClass()
789 {
790 $grandParent = $this->getBuilder(null, null, 'stdClass')
791 ->setCompound(true)
792 ->setDataMapper($this->getDataMapper())
793 ->getForm();
794 $parent = $this->getBuilder()
795 ->setCompound(true)
796 ->setDataMapper($this->getDataMapper())
797 ->setInheritData(true)
798 ->getForm();
799 $form = $this->getBuilder('name')->getForm();
800 $grandParent->add($parent);
801 $parent->add($form);
802
803 $this->assertEquals(new PropertyPath('name'), $form->getPropertyPath());
804 }
805
806 public function testGetPropertyPathDefaultsToIndexedNameIfDataClassOfFirstParentWithoutInheritDataIsNull()
807 {
808 $grandParent = $this->getBuilder()
809 ->setCompound(true)
810 ->setDataMapper($this->getDataMapper())
811 ->getForm();
812 $parent = $this->getBuilder()
813 ->setCompound(true)
814 ->setDataMapper($this->getDataMapper())
815 ->setInheritData(true)
816 ->getForm();
817 $form = $this->getBuilder('name')->getForm();
818 $grandParent->add($parent);
819 $parent->add($form);
820
821 $this->assertEquals(new PropertyPath('[name]'), $form->getPropertyPath());
822 }
823
824 /**
825 * @expectedException \Symfony\Component\Form\Exception\LogicException
826 */
827 public function testViewDataMustNotBeObjectIfDataClassIsNull()
828 {
829 $config = new FormConfigBuilder('name', null, $this->dispatcher);
830 $config->addViewTransformer(new FixedDataTransformer(array(
831 '' => '',
832 'foo' => new \stdClass(),
833 )));
834 $form = new Form($config);
835
836 $form->setData('foo');
837 }
838
839 public function testViewDataMayBeArrayAccessIfDataClassIsNull()
840 {
841 $arrayAccess = $this->getMock('\ArrayAccess');
842 $config = new FormConfigBuilder('name', null, $this->dispatcher);
843 $config->addViewTransformer(new FixedDataTransformer(array(
844 '' => '',
845 'foo' => $arrayAccess,
846 )));
847 $form = new Form($config);
848
849 $form->setData('foo');
850
851 $this->assertSame($arrayAccess, $form->getViewData());
852 }
853
854 /**
855 * @expectedException \Symfony\Component\Form\Exception\LogicException
856 */
857 public function testViewDataMustBeObjectIfDataClassIsSet()
858 {
859 $config = new FormConfigBuilder('name', 'stdClass', $this->dispatcher);
860 $config->addViewTransformer(new FixedDataTransformer(array(
861 '' => '',
862 'foo' => array('bar' => 'baz'),
863 )));
864 $form = new Form($config);
865
866 $form->setData('foo');
867 }
868
869 /**
870 * @expectedException \Symfony\Component\Form\Exception\RuntimeException
871 */
872 public function testSetDataCannotInvokeItself()
873 {
874 // Cycle detection to prevent endless loops
875 $config = new FormConfigBuilder('name', 'stdClass', $this->dispatcher);
876 $config->addEventListener(FormEvents::PRE_SET_DATA, function (FormEvent $event) {
877 $event->getForm()->setData('bar');
878 });
879 $form = new Form($config);
880
881 $form->setData('foo');
882 }
883
884 public function testSubmittingWrongDataIsIgnored()
885 {
886 $test = $this;
887
888 $child = $this->getBuilder('child', $this->dispatcher);
889 $child->addEventListener(FormEvents::PRE_SUBMIT, function (FormEvent $event) use ($test) {
890 // child form doesn't receive the wrong data that is submitted on parent
891 $test->assertNull($event->getData());
892 });
893
894 $parent = $this->getBuilder('parent', new EventDispatcher())
895 ->setCompound(true)
896 ->setDataMapper($this->getDataMapper())
897 ->add($child)
898 ->getForm();
899
900 $parent->submit('not-an-array');
901 }
902
903 public function testHandleRequestForwardsToRequestHandler()
904 {
905 $handler = $this->getMock('Symfony\Component\Form\RequestHandlerInterface');
906
907 $form = $this->getBuilder()
908 ->setRequestHandler($handler)
909 ->getForm();
910
911 $handler->expects($this->once())
912 ->method('handleRequest')
913 ->with($this->identicalTo($form), 'REQUEST');
914
915 $this->assertSame($form, $form->handleRequest('REQUEST'));
916 }
917
918 public function testFormInheritsParentData()
919 {
920 $child = $this->getBuilder('child')
921 ->setInheritData(true);
922
923 $parent = $this->getBuilder('parent')
924 ->setCompound(true)
925 ->setDataMapper($this->getDataMapper())
926 ->setData('foo')
927 ->addModelTransformer(new FixedDataTransformer(array(
928 'foo' => 'norm[foo]',
929 )))
930 ->addViewTransformer(new FixedDataTransformer(array(
931 'norm[foo]' => 'view[foo]',
932 )))
933 ->add($child)
934 ->getForm();
935
936 $this->assertSame('foo', $parent->get('child')->getData());
937 $this->assertSame('norm[foo]', $parent->get('child')->getNormData());
938 $this->assertSame('view[foo]', $parent->get('child')->getViewData());
939 }
940
941 /**
942 * @expectedException \Symfony\Component\Form\Exception\RuntimeException
943 */
944 public function testInheritDataDisallowsSetData()
945 {
946 $form = $this->getBuilder()
947 ->setInheritData(true)
948 ->getForm();
949
950 $form->setData('foo');
951 }
952
953 /**
954 * @expectedException \Symfony\Component\Form\Exception\RuntimeException
955 */
956 public function testGetDataRequiresParentToBeSetIfInheritData()
957 {
958 $form = $this->getBuilder()
959 ->setInheritData(true)
960 ->getForm();
961
962 $form->getData();
963 }
964
965 /**
966 * @expectedException \Symfony\Component\Form\Exception\RuntimeException
967 */
968 public function testGetNormDataRequiresParentToBeSetIfInheritData()
969 {
970 $form = $this->getBuilder()
971 ->setInheritData(true)
972 ->getForm();
973
974 $form->getNormData();
975 }
976
977 /**
978 * @expectedException \Symfony\Component\Form\Exception\RuntimeException
979 */
980 public function testGetViewDataRequiresParentToBeSetIfInheritData()
981 {
982 $form = $this->getBuilder()
983 ->setInheritData(true)
984 ->getForm();
985
986 $form->getViewData();
987 }
988
989 public function testPostSubmitDataIsNullIfInheritData()
990 {
991 $test = $this;
992 $form = $this->getBuilder()
993 ->addEventListener(FormEvents::POST_SUBMIT, function (FormEvent $event) use ($test) {
994 $test->assertNull($event->getData());
995 })
996 ->setInheritData(true)
997 ->getForm();
998
999 $form->submit('foo');
1000 }
1001
1002 public function testSubmitIsNeverFiredIfInheritData()
1003 {
1004 $test = $this;
1005 $form = $this->getBuilder()
1006 ->addEventListener(FormEvents::SUBMIT, function (FormEvent $event) use ($test) {
1007 $test->fail('The SUBMIT event should not be fired');
1008 })
1009 ->setInheritData(true)
1010 ->getForm();
1011
1012 $form->submit('foo');
1013 }
1014
1015 public function testInitializeSetsDefaultData()
1016 {
1017 $config = $this->getBuilder()->setData('DEFAULT')->getFormConfig();
1018 $form = $this->getMock('Symfony\Component\Form\Form', array('setData'), array($config));
1019
1020 $form->expects($this->once())
1021 ->method('setData')
1022 ->with($this->identicalTo('DEFAULT'));
1023
1024 /* @var Form $form */
1025 $form->initialize();
1026 }
1027
1028 /**
1029 * @expectedException \Symfony\Component\Form\Exception\RuntimeException
1030 */
1031 public function testInitializeFailsIfParent()
1032 {
1033 $parent = $this->getBuilder()->setRequired(false)->getForm();
1034 $child = $this->getBuilder()->setRequired(true)->getForm();
1035
1036 $child->setParent($parent);
1037
1038 $child->initialize();
1039 }
1040
1041 protected function createForm()
1042 {
1043 return $this->getBuilder()->getForm();
1044 }
1045}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Util/FormUtil.php b/vendor/symfony/form/Symfony/Component/Form/Util/FormUtil.php
deleted file mode 100644
index 7647691e..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Util/FormUtil.php
+++ /dev/null
@@ -1,42 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Util;
13
14/**
15 * @author Bernhard Schussek <bschussek@gmail.com>
16 */
17class FormUtil
18{
19 /**
20 * This class should not be instantiated
21 */
22 private function __construct() {}
23
24 /**
25 * Returns whether the given data is empty.
26 *
27 * This logic is reused multiple times throughout the processing of
28 * a form and needs to be consistent. PHP's keyword `empty` cannot
29 * be used as it also considers 0 and "0" to be empty.
30 *
31 * @param mixed $data
32 *
33 * @return Boolean
34 */
35 public static function isEmpty($data)
36 {
37 // Should not do a check for array() === $data!!!
38 // This method is used in occurrences where arrays are
39 // not considered to be empty, ever.
40 return null === $data || '' === $data;
41 }
42}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Util/InheritDataAwareIterator.php b/vendor/symfony/form/Symfony/Component/Form/Util/InheritDataAwareIterator.php
deleted file mode 100644
index 5c2c5fad..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Util/InheritDataAwareIterator.php
+++ /dev/null
@@ -1,35 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Util;
13
14/**
15 * Iterator that returns only forms from a form tree that do not inherit their
16 * parent data.
17 *
18 * If the iterator encounters a form that inherits its parent data, it enters
19 * the form and traverses its children as well.
20 *
21 * @author Bernhard Schussek <bschussek@gmail.com>
22 */
23class InheritDataAwareIterator extends VirtualFormAwareIterator
24{
25 /**
26 * Creates a new iterator.
27 *
28 * @param \Symfony\Component\Form\FormInterface[] $forms An array
29 */
30 public function __construct(array $forms)
31 {
32 // Skip the deprecation error
33 \ArrayIterator::__construct($forms);
34 }
35}
diff --git a/vendor/symfony/form/Symfony/Component/Form/Util/VirtualFormAwareIterator.php b/vendor/symfony/form/Symfony/Component/Form/Util/VirtualFormAwareIterator.php
deleted file mode 100644
index 24fdc8bb..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/Util/VirtualFormAwareIterator.php
+++ /dev/null
@@ -1,50 +0,0 @@
1<?php
2
3/*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11
12namespace Symfony\Component\Form\Util;
13
14/**
15 * Iterator that returns only forms from a form tree that do not inherit their
16 * parent data.
17 *
18 * If the iterator encounters a form that inherits its parent data, it enters
19 * the form and traverses its children as well.
20 *
21 * @author Bernhard Schussek <bschussek@gmail.com>
22 *
23 * @deprecated Deprecated since version 2.3, to be removed in 3.0. Use
24 * {@link InheritDataAwareIterator} instead.
25 */
26class VirtualFormAwareIterator extends \ArrayIterator implements \RecursiveIterator
27{
28 /**
29 * Creates a new iterator.
30 *
31 * @param \Symfony\Component\Form\FormInterface[] $forms An array
32 */
33 public function __construct(array $forms)
34 {
35 // Uncomment this as soon as the deprecation note should be shown
36 // trigger_error('VirtualFormAwareIterator is deprecated since version 2.3 and will be removed in 3.0. Use InheritDataAwareIterator instead.', E_USER_DEPRECATED);
37
38 parent::__construct($forms);
39 }
40
41 public function getChildren()
42 {
43 return new static($this->current()->all());
44 }
45
46 public function hasChildren()
47 {
48 return $this->current()->getConfig()->getInheritData();
49 }
50}
diff --git a/vendor/symfony/form/Symfony/Component/Form/composer.json b/vendor/symfony/form/Symfony/Component/Form/composer.json
deleted file mode 100644
index 73415011..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/composer.json
+++ /dev/null
@@ -1,43 +0,0 @@
1{
2 "name": "symfony/form",
3 "type": "library",
4 "description": "Symfony Form Component",
5 "keywords": [],
6 "homepage": "http://symfony.com",
7 "license": "MIT",
8 "authors": [
9 {
10 "name": "Fabien Potencier",
11 "email": "fabien@symfony.com"
12 },
13 {
14 "name": "Symfony Community",
15 "homepage": "http://symfony.com/contributors"
16 }
17 ],
18 "require": {
19 "php": ">=5.3.3",
20 "symfony/event-dispatcher": "~2.1",
21 "symfony/intl": "~2.3",
22 "symfony/options-resolver": "~2.1",
23 "symfony/property-access": "~2.2"
24 },
25 "require-dev": {
26 "symfony/validator": "~2.2",
27 "symfony/http-foundation": "~2.2"
28 },
29 "suggest": {
30 "symfony/validator": "",
31 "symfony/http-foundation": ""
32 },
33 "autoload": {
34 "psr-0": { "Symfony\\Component\\Form\\": "" }
35 },
36 "target-dir": "Symfony/Component/Form",
37 "minimum-stability": "dev",
38 "extra": {
39 "branch-alias": {
40 "dev-master": "2.3-dev"
41 }
42 }
43}
diff --git a/vendor/symfony/form/Symfony/Component/Form/phpunit.xml.dist b/vendor/symfony/form/Symfony/Component/Form/phpunit.xml.dist
deleted file mode 100644
index d0d261f1..00000000
--- a/vendor/symfony/form/Symfony/Component/Form/phpunit.xml.dist
+++ /dev/null
@@ -1,29 +0,0 @@
1<?xml version="1.0" encoding="UTF-8"?>
2
3<phpunit backupGlobals="false"
4 backupStaticAttributes="false"
5 colors="true"
6 convertErrorsToExceptions="true"
7 convertNoticesToExceptions="true"
8 convertWarningsToExceptions="true"
9 processIsolation="false"
10 stopOnFailure="false"
11 syntaxCheck="false"
12 bootstrap="vendor/autoload.php"
13>
14 <testsuites>
15 <testsuite name="Symfony Form Component Test Suite">
16 <directory>./Tests/</directory>
17 </testsuite>
18 </testsuites>
19
20 <filter>
21 <whitelist>
22 <directory>./</directory>
23 <exclude>
24 <directory>./Tests</directory>
25 <directory>./vendor</directory>
26 </exclude>
27 </whitelist>
28 </filter>
29</phpunit>