forms


symfony3+PHPUnit form test issue


form test return error
Tests\AppBundle\Form\Type\UserPreferencesTypeTest::testUserPreferencesForm
Symfony\Component\OptionsResolver\Exception\UndefinedOptionsException: The option "constraints" does not exist. Defined options are: "action", "attr", "auto_initialize", "block_name", "by_reference", "choice_attr", "choice_label", "choice_loader", "choice_name", "choice_translation_domain", "choice_value", "choices", "choices_as_values", "compound", "data", "data_class", "disabled", "empty_data", "error_bubbling", "expanded", "group_by", "inherit_data", "label", "label_attr", "label_format", "mapped", "method", "multiple", "placeholder", "post_max_size_message", "preferred_choices", "property_path", "required", "translation_domain", "trim", "upload_max_size_message".
here is my form
public function buildForm(FormBuilderInterface $builder, array $options)
{
$builder->add('global_review_count_threshold', ChoiceType::class, array(
'choices' => array(
'5%' => 5,
'10%' => 10,
'15%' => 15,
'20%' => 20,
'25%' => 25,
'30%' => 30,
'35%' => 35,
'40%' => 40,
'45%' => 45,
'50%' => 50,
), 'constraints' => array( new NotBlank(),), 'label' => "Global Review Count Threshold",
'data' => $options['review_count_choice']
));
}
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults(array(
'review_count_choice' => null,
));
}
public function getName()
{
return 'app_bundle_user_preferences_form';
}
and my form test
public function testUserPreferencesForm()
{
$formData = array(
'global_review_count_threshold' => '10%',
);
$form = $this->factory->create(UserPreferencesType::class);
//$object = TestObject::fromArray($formData);
$form->submit($formData);
$this->assertTrue($form->isSynchronized());
//$this->assertEquals($object, $form->getData());
$view = $form->createView();
$children = $view->children;
foreach (array_keys($formData) as $key) {
$this->assertArrayHasKey($key, $children);
}
}

Related Links

New to Oracle DataBase.. Need to remote access the data for small buissness [closed]
How change return render direction in Symfony2
laravel lost password issue
Symfony2 - Variable “form” does not exist when it's being passed in
Submitting form in Coldfusion causes basket discrepancy
What happens first - Symfony2 persist
MS Access Application - Render a Command Button inactive until specific criteria is met in a Form
Pager alongside search form in Play! 2.3.3
Powershell: creating dynamic forms
Recaptcha not working on Umbraco Contour 3.0.21
can't set Form field Entity (Many to Many) as required
in Symfony 2 : How to do a select of entity names in a form when entities are linked by id
ext4js - placing a textfield next to a checkboxfield
RoR - Call a new Action without a View on a form
Dynamic Number Of Inputs In Form
Symfony2 translation form with a2lix_translations and Gedmo doctrine-extensions

Categories

HOME
url-redirection
azure-stream-analytics
jpa
wakanda
webdriver
case
obfuscation
devise
nuget
nested-if
settings
nstableheaderview
accessibility
pattern-matching
augeas
gson
mxgraph
emoji
spring-social
stellar.js
speech-synthesis
zerobrane
altera
azure-iot-hub
easyphp
html5-appcache
xmonad
delphi-xe5
enterprise-miner
asp.net-core-webapi
simpleitk
undertow
exit
aggregation
tosca
jquery-callback
jquery-multiselect
delimiter
has-and-belongs-to-many
intersystems-cache
failover
event-flow
python-2.6
hibernate-validator
reactjs.net
baidu-map
least-squares
apic
playframework-2.1
dm-script
sessionstorage
flatmap
dcmtk
naming
wc
ovf
xbmc
textsum
bluez
google-cse
boxing
headless
trigger.io
offline.js
rxtx
pocketsphinx-android
pure-css
autosar
builtins
resourcemanager
jodd
eigenvector
android-wake-lock
sapscript
visual-sourcesafe-2005
liquid-layout
alloy-ui
uvc
jquery-forms-plugin
osc
phpldapadmin
openbabel
variadic-templates
ssis-data-flow
pseudo-class
formview
insight.database
dct
terminate
gae-quotas
conditionaltagsupport
oocss
unit-of-work
nevron
sqlclr
dopostback
urlrewriter
umra
dataform
tmx
twitterizer
timertask
mathematical-notation
leader
great-circle

Resources

Encrypt Message