File tree Expand file tree Collapse file tree 2 files changed +30
-1
lines changed
Filter options
Tests/DependencyInjection Expand file tree Collapse file tree 2 files changed +30
-1
lines changed
Original file line number Diff line number Diff line change 45
45
use Symfony \Component \Serializer \Serializer ;
46
46
use Symfony \Component \Translation \Translator ;
47
47
use Symfony \Component \Uid \Factory \UuidFactory ;
48
+ use Symfony \Component \Validator \Constraints \Email ;
48
49
use Symfony \Component \Validator \Validation ;
49
50
use Symfony \Component \Webhook \Controller \WebhookController ;
50
51
use Symfony \Component \WebLink \HttpHeaderSerializer ;
@@ -1066,7 +1067,7 @@ private function addValidationSection(ArrayNodeDefinition $rootNode, callable $e
1066
1067
->validate ()->castToArray ()->end ()
1067
1068
->end ()
1068
1069
->scalarNode ('translation_domain ' )->defaultValue ('validators ' )->end ()
1069
- ->enumNode ('email_validation_mode ' )->values ([ ' html5 ' , ' loose ' , ' strict ' ])->end ()
1070
+ ->enumNode ('email_validation_mode ' )->values (Email:: VALIDATION_MODES + [ ' loose ' ])->end ()
1070
1071
->arrayNode ('mapping ' )
1071
1072
->addDefaultsIfNotSet ()
1072
1073
->fixXmlConfig ('path ' )
Original file line number Diff line number Diff line change 17
17
use Symfony \Component \DependencyInjection \Exception \LogicException ;
18
18
use Symfony \Component \DependencyInjection \Exception \OutOfBoundsException ;
19
19
use Symfony \Component \DependencyInjection \Loader \PhpFileLoader ;
20
+ use Symfony \Component \Validator \Constraints \Email ;
20
21
use Symfony \Component \Workflow \Exception \InvalidDefinitionException ;
21
22
22
23
class PhpFrameworkExtensionTest extends FrameworkExtensionTestCase
@@ -245,4 +246,31 @@ public function testRateLimiterLockFactory()
245
246
246
247
$ container ->getDefinition ('limiter.without_lock ' )->getArgument (2 );
247
248
}
249
+
250
+ /**
251
+ * @dataProvider emailValidationModeProvider
252
+ */
253
+ public function testValidatorEmailValidationMode (string $ mode )
254
+ {
255
+ $ this ->expectNotToPerformAssertions ();
256
+
257
+ $ this ->createContainerFromClosure (function (ContainerBuilder $ container ) use ($ mode ) {
258
+ $ container ->loadFromExtension ('framework ' , [
259
+ 'annotations ' => false ,
260
+ 'http_method_override ' => false ,
261
+ 'handle_all_throwables ' => true ,
262
+ 'php_errors ' => ['log ' => true ],
263
+ 'validation ' => [
264
+ 'email_validation_mode ' => $ mode ,
265
+ ],
266
+ ]);
267
+ });
268
+ }
269
+
270
+ public function emailValidationModeProvider ()
271
+ {
272
+ foreach (Email::VALIDATION_MODES as $ mode ) {
273
+ yield [$ mode ];
274
+ }
275
+ }
248
276
}
You can’t perform that action at this time.
0 commit comments