Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitfa0328d

Browse files
author
Peter Gribanov
committed
fix tests
1 parenteff921d commitfa0328d

File tree

7 files changed

+64
-19
lines changed

7 files changed

+64
-19
lines changed

‎src/Symfony/Component/Form/Tests/AbstractLayoutTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2805,6 +2805,7 @@ public function trans(TranslatorInterface $translator, string $locale = null): s
28052805
};
28062806

28072807
$form =$this->factory->createNamed('name','Symfony\Component\Form\Extension\Core\Type\TextType',null, [
2808+
'empty_data' =>null,
28082809
'help' =>$message,
28092810
]);
28102811
$html =$this->renderHelp($form->createView());

‎src/Symfony/Component/Form/Tests/CompoundFormTest.php

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,9 @@ public function testAdd()
205205

206206
publicfunctiontestAddUsingNameAndType()
207207
{
208-
$this->form->add('foo', TextType::class);
208+
$this->form->add('foo', TextType::class, [
209+
'empty_data' =>null,
210+
]);
209211

210212
$this->assertTrue($this->form->has('foo'));
211213

@@ -218,7 +220,9 @@ public function testAddUsingNameAndType()
218220
publicfunctiontestAddUsingIntegerNameAndType()
219221
{
220222
// in order to make casting unnecessary
221-
$this->form->add(0, TextType::class);
223+
$this->form->add(0, TextType::class, [
224+
'empty_data' =>null,
225+
]);
222226

223227
$this->assertTrue($this->form->has(0));
224228

@@ -230,7 +234,9 @@ public function testAddUsingIntegerNameAndType()
230234

231235
publicfunctiontestAddWithoutType()
232236
{
233-
$this->form->add('foo');
237+
$this->form->add('foo',null, [
238+
'empty_data' =>null,
239+
]);
234240

235241
$this->assertTrue($this->form->has('foo'));
236242

@@ -247,7 +253,9 @@ public function testAddUsingNameButNoType()
247253
->setDataMapper(newDataMapper())
248254
->getForm();
249255

250-
$this->form->add('foo');
256+
$this->form->add('foo',null, [
257+
'empty_data' =>null,
258+
]);
251259

252260
$this->assertTrue($this->form->has('foo'));
253261

@@ -264,7 +272,9 @@ public function testAddUsingNameButNoTypeAndOptions()
264272
->setDataMapper(newDataMapper())
265273
->getForm();
266274

267-
$this->form->add('foo');
275+
$this->form->add('foo',null, [
276+
'empty_data' =>null,
277+
]);
268278

269279
$this->assertTrue($this->form->has('foo'));
270280

‎src/Symfony/Component/Form/Tests/Extension/Core/Type/CollectionTypeTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -424,6 +424,7 @@ public function testPrototypeOptionsOverrideEntryOptions()
424424
],
425425
'prototype_options' => [
426426
'help' =>'foo',
427+
'empty_data' =>null,
427428
],
428429
]);
429430

‎src/Symfony/Component/Form/Tests/Extension/HtmlSanitizer/Type/TextTypeHtmlSanitizerExtensionTest.php

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,22 @@ protected function getExtensions()
4545
publicfunctiontestSanitizer()
4646
{
4747
$form =$this->factory->createBuilder(FormType::class, ['data' =>null])
48-
->add('data', TextType::class, ['sanitize_html' =>true])
48+
->add('data', TextType::class, [
49+
'empty_data' =>null,
50+
'sanitize_html' =>true,
51+
])
4952
->getForm()
5053
;
5154
$form->submit(['data' =>'foobar']);
5255

5356
$this->assertSame(['data' =>'foo'],$form->getData());
5457

5558
$form =$this->factory->createBuilder(FormType::class, ['data' =>null])
56-
->add('data', TextType::class, ['sanitize_html' =>true,'sanitizer' =>'bar'])
59+
->add('data', TextType::class, [
60+
'empty_data' =>null,
61+
'sanitize_html' =>true,
62+
'sanitizer' =>'bar',
63+
])
5764
->getForm()
5865
;
5966
$form->submit(['data' =>'foobar']);

‎src/Symfony/Component/Form/Tests/Extension/Validator/Constraints/FormValidatorFunctionalTest.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,9 @@ public function testCascadeValidationToArrayChildForm()
347347
$form =$this->formFactory->create(FormType::class,null, [
348348
'data_class' => Review::class,
349349
])
350-
->add('title')
350+
->add('title',null, [
351+
'empty_data' =>null,
352+
])
351353
->add('customers', CollectionType::class, [
352354
'mapped' =>false,
353355
'entry_type' => CustomerType::class,

‎src/Symfony/Component/Form/Tests/FormBuilderTest.php

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,9 @@ public function testRemoveAndGetForm()
142142

143143
publicfunctiontestCreateNoTypeNo()
144144
{
145-
$builder =$this->builder->create('foo');
145+
$builder =$this->builder->create('foo',null, [
146+
'empty_data' =>null,
147+
]);
146148

147149
$this->assertInstanceOf(TextType::class,$builder->getType()->getInnerType());
148150
}
@@ -165,7 +167,9 @@ public function testGetUnknown()
165167

166168
publicfunctiontestGetExplicitType()
167169
{
168-
$this->builder->add('foo','Symfony\Component\Form\Extension\Core\Type\TextType');
170+
$this->builder->add('foo','Symfony\Component\Form\Extension\Core\Type\TextType', [
171+
'empty_data' =>null,
172+
]);
169173
$builder =$this->builder->get('foo');
170174

171175
$this->assertNotSame($builder,$this->builder);
@@ -174,7 +178,9 @@ public function testGetExplicitType()
174178
publicfunctiontestGetGuessedType()
175179
{
176180
$rootFormBuilder =newFormBuilder('name','stdClass',newEventDispatcher(),$this->factory);
177-
$rootFormBuilder->add('foo');
181+
$rootFormBuilder->add('foo',null, [
182+
'empty_data' =>null,
183+
]);
178184
$fooBuilder =$rootFormBuilder->get('foo');
179185

180186
$this->assertNotSame($fooBuilder,$rootFormBuilder);

‎src/Symfony/Component/Form/Tests/FormFactoryTest.php

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,9 @@ public function testCreateNamed()
102102

103103
publicfunctiontestCreateBuilderForPropertyWithoutTypeGuesser()
104104
{
105-
$builder =$this->factory->createBuilderForProperty('Application\Author','firstName');
105+
$builder =$this->factory->createBuilderForProperty('Application\Author','firstName',null, [
106+
'empty_data' =>null,
107+
]);
106108

107109
$this->assertSame('firstName',$builder->getName());
108110
}
@@ -112,7 +114,9 @@ public function testCreateBuilderForPropertyCreatesFormWithHighestConfidence()
112114
$this->guesser1->configureTypeGuess(TextType::class, ['attr' => ['maxlength' =>10]], Guess::MEDIUM_CONFIDENCE);
113115
$this->guesser2->configureTypeGuess(PasswordType::class, ['attr' => ['maxlength' =>7]], Guess::HIGH_CONFIDENCE);
114116

115-
$builder =$this->factory->createBuilderForProperty('Application\Author','firstName');
117+
$builder =$this->factory->createBuilderForProperty('Application\Author','firstName',null, [
118+
'empty_data' =>null,
119+
]);
116120

117121
$this->assertSame('firstName',$builder->getName());
118122
$this->assertSame(['maxlength' =>7],$builder->getOption('attr'));
@@ -121,7 +125,9 @@ public function testCreateBuilderForPropertyCreatesFormWithHighestConfidence()
121125

122126
publicfunctiontestCreateBuilderCreatesTextFormIfNoGuess()
123127
{
124-
$builder =$this->factory->createBuilderForProperty('Application\Author','firstName');
128+
$builder =$this->factory->createBuilderForProperty('Application\Author','firstName',null, [
129+
'empty_data' =>null,
130+
]);
125131

126132
$this->assertSame('firstName',$builder->getName());
127133
$this->assertInstanceOf(TextType::class,$builder->getType()->getInnerType());
@@ -131,7 +137,10 @@ public function testOptionsCanBeOverridden()
131137
{
132138
$this->guesser1->configureTypeGuess(TextType::class, ['attr' => ['class' =>'foo','maxlength' =>10]], Guess::MEDIUM_CONFIDENCE);
133139

134-
$builder =$this->factory->createBuilderForProperty('Application\Author','firstName',null, ['attr' => ['maxlength' =>11]]);
140+
$builder =$this->factory->createBuilderForProperty('Application\Author','firstName',null, [
141+
'empty_data' =>null,
142+
'attr' => ['maxlength' =>11],
143+
]);
135144

136145
$this->assertSame('firstName',$builder->getName());
137146
$this->assertSame(['class' =>'foo','maxlength' =>11],$builder->getOption('attr'));
@@ -143,7 +152,9 @@ public function testCreateBuilderUsesMaxLengthIfFound()
143152
$this->guesser1->configureMaxLengthGuess(15, Guess::MEDIUM_CONFIDENCE);
144153
$this->guesser2->configureMaxLengthGuess(20, Guess::HIGH_CONFIDENCE);
145154

146-
$builder =$this->factory->createBuilderForProperty('Application\Author','firstName');
155+
$builder =$this->factory->createBuilderForProperty('Application\Author','firstName',null, [
156+
'empty_data' =>null,
157+
]);
147158

148159
$this->assertSame('firstName',$builder->getName());
149160
$this->assertSame(['maxlength' =>20],$builder->getOption('attr'));
@@ -155,7 +166,10 @@ public function testCreateBuilderUsesMaxLengthAndPattern()
155166
$this->guesser1->configureMaxLengthGuess(20, Guess::HIGH_CONFIDENCE);
156167
$this->guesser2->configurePatternGuess('.{5,}', Guess::HIGH_CONFIDENCE);
157168

158-
$builder =$this->factory->createBuilderForProperty('Application\Author','firstName',null, ['attr' => ['class' =>'tinymce']]);
169+
$builder =$this->factory->createBuilderForProperty('Application\Author','firstName',null, [
170+
'empty_data' =>null,
171+
'attr' => ['class' =>'tinymce']
172+
]);
159173

160174
$this->assertSame('firstName',$builder->getName());
161175
$this->assertSame(['maxlength' =>20,'pattern' =>'.{5,}','class' =>'tinymce'],$builder->getOption('attr'));
@@ -167,7 +181,9 @@ public function testCreateBuilderUsesRequiredSettingWithHighestConfidence()
167181
$this->guesser1->configureRequiredGuess(true, Guess::MEDIUM_CONFIDENCE);
168182
$this->guesser2->configureRequiredGuess(false, Guess::HIGH_CONFIDENCE);
169183

170-
$builder =$this->factory->createBuilderForProperty('Application\Author','firstName');
184+
$builder =$this->factory->createBuilderForProperty('Application\Author','firstName',null, [
185+
'empty_data' =>null,
186+
]);
171187

172188
$this->assertSame('firstName',$builder->getName());
173189
$this->assertFalse($builder->getOption('required'));
@@ -179,7 +195,9 @@ public function testCreateBuilderUsesPatternIfFound()
179195
$this->guesser1->configurePatternGuess('[a-z]', Guess::MEDIUM_CONFIDENCE);
180196
$this->guesser2->configurePatternGuess('[a-zA-Z]', Guess::HIGH_CONFIDENCE);
181197

182-
$builder =$this->factory->createBuilderForProperty('Application\Author','firstName');
198+
$builder =$this->factory->createBuilderForProperty('Application\Author','firstName',null, [
199+
'empty_data' =>null,
200+
]);
183201

184202
$this->assertSame('firstName',$builder->getName());
185203
$this->assertSame(['pattern' =>'[a-zA-Z]'],$builder->getOption('attr'));

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp