-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathbuilt_in_validation_constraints.yaml
114 lines (114 loc) · 5.96 KB
/
built_in_validation_constraints.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
questions:
-
uuid: 1eebf878-8b97-6034-8e0b-99d84c92580c
question: 'How can you inverse the result of the validation when using a Symfony\Component\Validator\Constraints\Regex validation constraint ?'
answers:
- { value: 'Using the not option.', correct: false }
- { value: 'Using the inverse option.', correct: false }
- { value: 'Using the match option.', correct: true }
- { value: 'Using the prune option.', correct: false }
help: 'https://symfony.com/doc/current/reference/constraints/Regex.html'
-
uuid: 1eebf878-8b98-6592-b2c2-99d84c92580c
question: 'What is the translation domain for validation error messages?'
answers:
- { value: validation, correct: false }
- { value: constraint, correct: false }
- { value: validators, correct: true }
- { value: messages, correct: false }
- { value: contraints, correct: false }
- { value: validator, correct: false }
- { value: validations, correct: false }
help: 'https://symfony.com/doc/current/reference/configuration/framework.html#translation-domain'
-
uuid: 1eebf878-8b9b-6b98-970c-99d84c92580c
question: 'Which constraint should be used to assert that a collection contains exactly 2 items? We assume that Assert is an Alias to Symfony\Component\Validator\Constraints namespace.'
answers:
- { value: '@Assert\Length(min=2, max=2)', correct: false }
- { value: '@Assert\Count(min=2)', correct: false }
- { value: '@Assert\Length(2)', correct: false }
- { value: '@Assert\Count(min=2, max=2)', correct: true }
help: 'https://symfony.com/doc/current/reference/constraints/Count.html'
-
uuid: 1eebf878-8b9d-65a6-a7ee-99d84c92580c
question: 'What is the return type of the ValidatorInterface::validate method?'
answers:
- { value: Doctrine\Common\Collections\Collection, correct: false }
- { value: Symfony\Component\Validator\ConstraintViolationListInterface, correct: true }
- { value: array, correct: false }
help: 'https://github.com/symfony/symfony/blob/6.4/src/Symfony/Component/Validator/Validator/ValidatorInterface.php#L40'
-
uuid: 1eebf878-8b9f-6d24-94f5-99d84c92580c
question: 'How do you bind a constraint to a form field?'
answers:
- { value: 'Using option "constraints" in $formBuilder->add()', correct: true }
- { value: 'Passing constraint instance in $this->createFormBuilder()', correct: false }
- { value: 'Invoke $formBuilder->setConstraints() method', correct: false }
- { value: 'Add an annotation in model', correct: true }
help: 'https://symfony.com/doc/current/forms.html#validating-forms'
-
uuid: 1eebf878-8ba1-675a-a899-99d84c92580c
question: 'Using Validator component, which method is used to validate a value against a constraint?'
answers:
- { value: '$validator->validate($object, $constraint)', correct: true }
- { value: '$validator->validateValue($object, $constraint)', correct: false }
- { value: '$validator->isValid($object, $constraint)', correct: false }
- { value: '$validator->validation($object, $constraint)', correct: false }
help: 'https://symfony.com/doc/current/components/validator.html#installation'
-
uuid: 1eebf878-8ba1-68d6-b09a-99d84c92580c
question: 'Which constraints exist?'
answers:
- { value: Blank, correct: true }
- { value: IdenticalTo, correct: true }
- { value: EqualTo, correct: true }
- { value: SameAs, correct: false }
help: 'https://symfony.com/doc/current/reference/constraints.html'
-
uuid: 1eebf878-8ba1-6db8-8235-99d84c92580c
question: "Which of the following values doesn't trigger a violation when the Date constraint is applied to it?"
answers:
- { value: 'null', correct: true }
- { value: '2020-01-15', correct: true }
- { value: 15/01/2020, correct: false }
- { value: 'new \DateTime("2020-01-15")', correct: false }
- { value: '2020-13-15', correct: false }
- { value: 15/13/2020, correct: false }
help: 'https://symfony.com/doc/current/reference/constraints/Date.html'
-
uuid: 1eebf878-8ba2-68e4-9e14-99d84c92580c
question: "Which of the following values don't trigger a violation when the Blank constraint is applied to them ?"
answers:
- { value: 'null', correct: false }
- { value: 'empty string', correct: false }
- { value: 'false', correct: true }
- { value: 'empty array', correct: false }
help: 'https://symfony.com/doc/current/reference/constraints/Blank.html'
-
uuid: 1eebf878-8ba3-6618-974f-99d84c92580c
question: 'Which of the followings are not validation constraints?'
answers:
- { value: Password, correct: true }
- { value: File, correct: false }
- { value: Search, correct: true }
- { value: All, correct: false }
help: 'https://symfony.com/doc/current/reference/constraints.html'
-
uuid: 1eebf878-8ba3-665e-8fe7-99d84c92580c
question: 'Which of the following are valid targets when adding new validation constraints to a PHP object?'
answers:
- { value: 'On the class itself.', correct: false }
- { value: 'On certain public methods of the class.', correct: false }
- { value: 'On any public, private or protected properties.', correct: true }
- { value: 'On any public static methods of the class only.', correct: false }
- { value: 'On any public properties only.', correct: false }
help: 'https://symfony.com/doc/current/validation.html#validator-constraint-targets'
-
uuid: 1eed57f8-fb54-62a6-91f8-d952ea3a2c23
question: 'When using the Symfony\Component\Validator\Constraints\Url validation constraint, what protocols are allowed by default ?'
answers:
- { value: 'Only HTTP.', correct: false }
- { value: 'Any protocol.', correct: true }
- { value: 'HTTP and HTTPS.', correct: false }
- { value: 'HTTP, HTTPS, FTP and SMTP.', correct: false }
help: 'https://symfony.com/doc/current/reference/constraints/Url.html'