From 019c164e0a449e9c4421c86d5f726baa478d1b1c Mon Sep 17 00:00:00 2001 From: Mathieu LOUVEL Date: Wed, 6 Sep 2017 12:18:07 +0200 Subject: [PATCH] Add more question --- .idea/modules.xml | 8 + .idea/symfony-pack.iml | 8 + .idea/vcs.xml | 6 + .idea/workspace.xml | 502 ++++++++++++++++++++++++++++++++++ data/architecture.yml | 33 +++ data/bundles.yml | 9 + data/cache-http.yml | 17 ++ data/command-line.yml | 22 ++ data/controllers.yml | 21 ++ data/dependency-injection.yml | 29 ++ data/forms.yml | 67 +++++ data/http.yml | 22 ++ data/misc.yml | 6 + data/routing.yml | 6 + data/security.yml | 70 ++++- data/templating.yml | 14 + data/validation.yml | 20 ++ 17 files changed, 859 insertions(+), 1 deletion(-) create mode 100644 .idea/modules.xml create mode 100644 .idea/symfony-pack.iml create mode 100644 .idea/vcs.xml create mode 100644 .idea/workspace.xml diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..fc27ef7 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/symfony-pack.iml b/.idea/symfony-pack.iml new file mode 100644 index 0000000..c956989 --- /dev/null +++ b/.idea/symfony-pack.iml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/workspace.xml b/.idea/workspace.xml new file mode 100644 index 0000000..27cdb90 --- /dev/null +++ b/.idea/workspace.xml @@ -0,0 +1,502 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1504598468513 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/data/architecture.yml b/data/architecture.yml index 79ddfbb..9a648c0 100644 --- a/data/architecture.yml +++ b/data/architecture.yml @@ -123,3 +123,36 @@ questions: answers: - {value: "True", correct: false} - {value: "False", correct: true} + - + question: 'Symfony is released under which license ?' + answers: + - {value: "GNU General Public License (GPL)", correct: false} + - {value: "ISC License", correct: false} + - {value: "BSD license", correct: false} + - {value: "MIT license", correct: true} + - + question: 'Which kernel event exist ?' + answers: + - {value: "kernel.request", correct: true} + - {value: "kernel.controller", correct: true} + - {value: "kernel.template", correct: false} + - {value: "kernel.view", correct: true} + - {value: "kernel.response", correct: true} + - {value: "kernel.answer", correct: false} + - {value: "kernel.finish_request", correct: true} + - {value: "kernel.start_request", correct: false} + - {value: "kernel.terminate", correct: true} + - {value: "kernel.start", correct: false} + - {value: "kernel.exception", correct: true} + - + question: 'Arguments are resolve before to Call Controller ?' + answers: + - {value: "yes", correct: true} + - {value: "no", correct: false} + - + question: 'How to you detect if an Event was stopped during runtime?' + answers: + - {value: "$event->isPropagationStopped()", correct: true} + - {value: "$event->isStopped()", correct: false} + - {value: "$event->isPropagationStop()", correct: false} + - {value: "$event->isStop()", correct: false} diff --git a/data/bundles.yml b/data/bundles.yml index 52a03f6..2a9a7b9 100644 --- a/data/bundles.yml +++ b/data/bundles.yml @@ -68,3 +68,12 @@ questions: answers: - {value: "True", correct: true} - {value: "False", correct: false} + - + question: 'According to Symfony best practices, which files files are mandatory in your bundle AcmeBlogBundle directory Structure ?' + answers: + - {value: "AcmeNameBundle.php", correct: true} + - {value: "README.md", correct: true} + - {value: "LICENSE", correct: true} + - {value: "Resources/doc/index.rst", correct: true} + - {value: "Resources/config/routing.yml", correct: false} + - {value: "Resources/config/services.yml", correct: false} diff --git a/data/cache-http.yml b/data/cache-http.yml index 4fd433a..818e5aa 100644 --- a/data/cache-http.yml +++ b/data/cache-http.yml @@ -43,3 +43,20 @@ questions: answers: - {value: "True", correct: true} - {value: "False", correct: false} + - + question: 'According to HTTP/1.1 what is the max value for Expires ?' + answers: + - {value: "one year", correct: true} + - {value: "one month", correct: false} + - {value: "one week", correct: false} + - {value: "There is not limit", correct: false} + - + question: 'True or False ? You can use both validation and expiration within the same Response.' + answers: + - {value: "True", correct: true} + - {value: "False", correct: false} + - + question: 'True or False ? Using ETag saves CPU cycles.' + answers: + - {value: "True", correct: false} + - {value: "False", correct: true} diff --git a/data/command-line.yml b/data/command-line.yml index 0b4126f..0f571ca 100644 --- a/data/command-line.yml +++ b/data/command-line.yml @@ -145,3 +145,25 @@ questions: - {value: 'ConsoleEvents::TERMINATE is dispatched even when an exception is thrown' , correct: true} - {value: 'initialize has InputInterface, OutputInterface parameters', correct: true} - {value: 'ConsoleEvents can be disabled', correct: true} + - + question: 'Which function are mandatory to your command class ?' + answers: + - {value: "configure()", correct: true} + - {value: "execute(InputInterface $input, OutputInterface $output)", correct: true} + - {value: "interact()", correct: false} + - {value: "initialize()", correct: false} + - + question: 'Which Question class are available ?' + answers: + - {value: "Symfony\\Component\\Console\\Question\\Question", correct: true} + - {value: "Symfony\\Component\\Console\\Question\\ChoiceQuestion", correct: true} + - {value: "Symfony\\Component\\Console\\Question\\ConfirmationQuestion", correct: true} + - {value: "Symfony\\Component\\Console\\Question\\SelectQuestion", correct: false} + - {value: "Symfony\\Component\\Console\\Question\\ValidQuestion", correct: false} + - + question: 'How to Call Other Commands in a command ?' + answers: + - {value: "$command->execute($input, $output);", correct: false} + - {value: "$command->run($input, $output);", correct: true} + - {value: "$command->call($input, $output);", correct: false} + - {value: "$command->forward($input, $output);", correct: false} diff --git a/data/controllers.yml b/data/controllers.yml index cc74671..cd56b02 100644 --- a/data/controllers.yml +++ b/data/controllers.yml @@ -57,3 +57,24 @@ questions: - {value: $request, correct: true} - {value: $_locale, correct: true} - {value: $_format, correct: true} + - + question: | + According to this action : + + /** + * @Route("/comment/{postSlug}/new", name = "comment_new") + * + */ + public function newAction(Request $request, Post $post) + { + // ... + } + + + How my ParamConverter should be configured to match "postSlug" params with "slug" in Post ? + answers: + - {value: '@ParamConverter("post", options={"mapping": {"postSlug": "slug"}})', correct: true} + - {value: '@ParamConverter("post", options={"mapping": {"slug": "postSlug"}})', correct: false} + - {value: '@ParamConverter("post", options={"mapping": {"field": "slug"}})', correct: false} + - {value: '@ParamConverter("post", options={"mapping": {"Post": "slug"}})', correct: false} + - {value: 'It is not possible, params and fields must match', correct: false} diff --git a/data/dependency-injection.yml b/data/dependency-injection.yml index 08895d8..0091bd1 100644 --- a/data/dependency-injection.yml +++ b/data/dependency-injection.yml @@ -71,3 +71,32 @@ questions: - {value: "appDevProjectContainer.php", correct: false} - {value: "appDevDebugProjectServiceContainer", correct: false} - {value: "appDevDebugContainer", correct: false} + - + question: "True or false, parameters can also contain array values ?" + answers: + - {value: "true", correct: true} + - {value: "false", correct: false} + - + question: "What is the correct syntax to inject a service app.mailer ?" + answers: + - {value: "arguments: ['@app.mailer']", correct: true} + - {value: "arguments: ['%app.mailer%']", correct: false} + - {value: "arguments: ['app.mailer']", correct: false} + - + question: "What is the correct syntax to inject a parameter mailer.transport ?" + answers: + - {value: "arguments: ['@mailer.transport']", correct: false} + - {value: "arguments: ['%mailer.transport%']", correct: true} + - {value: "arguments: ['mailer.transport']", correct: false} + - + question: "How to define a service as private ?" + answers: + - {value: "type: private", correct: false} + - {value: "scope: private", correct: false} + - {value: "public: false", correct: true} + - {value: "private: true", correct: false} + - + question: "True or False, With defaut configuration each time you retrieve the service, you'll get the same instance ?" + answers: + - {value: "true", correct: true} + - {value: "false", correct: false} diff --git a/data/forms.yml b/data/forms.yml index ab78cf2..3206f10 100644 --- a/data/forms.yml +++ b/data/forms.yml @@ -120,3 +120,70 @@ questions: - {value: "$builder->add('extra', null, ['mapped' => false])", correct: true} - {value: "$builder->add('extra', 'hidden', ['mapped' => false])", correct: true} - {value: "$builder->add('extra', null, ['validation' => false]", correct: false} + - + question: 'How do you render all the form fields in twig ?' + answers: + - {value: "form_widget(form)", correct: true} + - {value: "form_render(form)", correct: false} + - {value: "form_fields(form)", correct: false} + - {value: "render_form(form)", correct: false} + - {value: "form_row(form)", correct: false} + - + question: 'If you use form_widget() on a single fields, which parts are render ?' + answers: + - {value: "label", correct: false} + - {value: "input", correct: true} + - {value: "error", correct: false} + - {value: "label and input", correct: false} + - {value: "error, label and input", correct: false} + - + question: 'According to Symfony best practices, where you should add buttons ?' + answers: + - {value: "Template", correct: true} + - {value: "Form", correct: false} + - {value: "Controller", correct: false} + - + question: 'Which Field type exist?' + answers: + - {value: "HiddenType", correct: true} + - {value: "SearchType", correct: true} + - {value: "BirthdayType", correct: true} + - {value: "PasswordType", correct: true} + - {value: "SelectType", correct: false} + - {value: "FloatType", correct: false} + - {value: "BooleanType", correct: false} + - + question: 'How to Disable the Validation of Submitted Data' + answers: + - {value: "set the validation_groups option to false", correct: true} + - {value: "set the validation_enable option to false", correct: false} + - {value: "set the enable_validation option to false", correct: false} + - {value: "$this->createFormBuilder()->isValidated(false)", correct: false} + - {value: "By using false as third parameter for createFormBuilder", correct: false} + - + question: 'What data is inside FormEvent object at FormEvents::POST_SET_DATA?' + answers: + - {value: "Model data", correct: false} + - {value: "Normalized data", correct: true} + - {value: "Request data", correct: false} + - {value: "View data", correct: false} + - + question: 'Which form event dont exist?' + answers: + - {value: "FormEvents::PRE_SET_DATA", correct: false} + - {value: "FormEvents::SUBMIT", correct: false} + - {value: "FormEvents::POST_SUBMIT", correct: false} + - {value: "FormEvents::SET_DATA", correct: true} + - + question: 'How do you upload a UploadedFile ?' + answers: + - {value: "$file->move(string $directory, string $name = null)", correct: true} + - {value: "$file->upload(string $directory, string $name = null)", correct: false} + - {value: "$file->uploadFile(string $directory, string $name = null)", correct: false} + - {value: "$file->save(string $directory, string $name = null)", correct: false} + - + question: 'How to Use Data Transformers ?' + answers: + - {value: "$builder->get('tags')->addModelTransformer());", correct: true} + - {value: "$builder->add($builder->create('tags', TextType::class)->addModelTransformer(...));", correct: true} + - {value: "$builder->add('tags', TextType::class)->addModelTransformer(...);", correct: false} diff --git a/data/http.yml b/data/http.yml index 1ab2ebf..afcd4c9 100644 --- a/data/http.yml +++ b/data/http.yml @@ -76,3 +76,25 @@ questions: answers: - {value: "True", correct: true} - {value: "False", correct: false} + - + question: 'Which method exist in Symfony\Component\HttpFoundation\Request ?' + answers: + - {value: "getPathInfo", correct: true} + - {value: "getMethod", correct: true} + - {value: "getLanguages", correct: true} + - {value: "getHeaders", correct: false} + - {value: "getHttpHost", correct: true} + - {value: "getUrl", correct: false} + - + question: 'How can you set status code of Symfony\Component\HttpFoundation\Response' + answers: + - {value: "By you pass the vaklue as second parameter of new Response()", correct: true} + - {value: "By using setStatusCode()", correct: true} + - {value: "By using setCodeStatus()", correct: false} + - {value: "By using setHttpCode()", correct: false} + - + question: 'To override the 404 error template for HTML page, how should you name the template ?' + answers: + - {value: "error404.html.twig", correct: true} + - {value: "404.html.twig", correct: false} + - {value: "twig.404.html.twig", correct: false} diff --git a/data/misc.yml b/data/misc.yml index 5a4d1b8..bd50a1e 100644 --- a/data/misc.yml +++ b/data/misc.yml @@ -48,3 +48,9 @@ questions: - {value: Symfony\Component\BrowserKit\CssSelector, correct: false} - {value: Symfony\Component\DomCrawler\CssSelector, correct: false} - {value: Symfony\Bundle\FrameworkBundle\CssSelector, correct: false} + - + question: 'Event Listeners is use to Regrouping multiple listeners inside a single class ?' + answers: + - {value: false, correct: true} + - {value: true, correct: false} + diff --git a/data/routing.yml b/data/routing.yml index eec34f8..f5348ec 100644 --- a/data/routing.yml +++ b/data/routing.yml @@ -28,3 +28,9 @@ questions: - {value: "_route, _controller, _action", correct: false} - {value: "_controller, _locale, _format", correct: true} - {value: "_locale, _format and another one.", correct: false} + - + question: 'How to generate absolute URL for a given route in controller ?' + answers: + - {value: "By using UrlGeneratorInterface::ABSOLUTE_URL as third parameter for generateUrl", correct: true} + - {value: "generateUrl generate absolute URL by default", correct: false} + - {value: "$this->generateAbsoluteUrl()", correct: false} diff --git a/data/security.yml b/data/security.yml index 34d4103..7e0c83d 100644 --- a/data/security.yml +++ b/data/security.yml @@ -59,4 +59,72 @@ questions: - {value: 'Access is granted if there are more voters granting access than denying', correct: false} - {value: 'Access is granted if all voters grant acces', correct: false} - {value: 'Access is granted if no voters throw an exception', correct: false} - + - + question: 'What does the strategy `consensus` of the access decision manager mean?' + answers: + - {value: 'Access is granted as soon as there is one voter granting access', correct: false} + - {value: 'Access is granted if there are more voters granting access than denying', correct: true} + - {value: 'Access is granted if all voters grant acces', correct: false} + - {value: 'Access is granted if no voters throw an exception', correct: false} + - + question: 'What does the strategy `unanimous` of the access decision manager mean?' + answers: + - {value: 'Access is granted as soon as there is one voter granting access', correct: false} + - {value: 'Access is granted if there are more voters granting access than denying', correct: false} + - {value: 'Access is granted if all voters grant acces', correct: true} + - {value: 'Access is granted if no voters throw an exception', correct: false} + - + question: 'What decision strategy exist ?' + answers: + - {value: 'affirmative', correct: true} + - {value: 'consensus', correct: true} + - {value: 'unanimous', correct: true} + - {value: 'positive', correct: false} + - {value: 'negative', correct: false} + - + question: 'How to Restrict Firewalls to a Specific Request Pattern ?' + answers: + - {value: 'pattern: ^/(myurl)/', correct: true} + - {value: 'route: ^/(myurl)/', correct: false} + - {value: 'url: ^/(myurl)/', correct: false} + - {value: 'path: ^/(myurl)/', correct: false} + - + question: 'Which annotation is valid to check role ?' + answers: + - {value: '@Security("has_role("ROLE_ADMIN")")', correct: true} + - {value: '@Security("is_granted("ROLE_ADMIN")")', correct: false} + - {value: '@Security("restrict_for("ROLE_ADMIN")")', correct: false} + - {value: '@Security("role("ROLE_ADMIN")")', correct: false} + - + question: 'Which default role exist ?' + answers: + - {value: 'IS_AUTHENTICATED_REMEMBERED', correct: true} + - {value: 'IS_AUTHENTICATED_FULLY', correct: true} + - {value: 'IS_AUTHENTICATED_ANONYMOUSLY', correct: true} + - {value: 'IS_NOT_AUTHENTICATED', correct: false} + - + question: 'How can you deny acces to user in your controller ?' + answers: + - {value: "$this->denyAccessUnlessGranted('ROLE_ADMIN')", correct: true} + - {value: '@Security("has_role("ROLE_ADMIN")")', correct: true} + - {value: "if (!$this->get('security.authorization_checker')->isGranted('ROLE_ADMIN')) { throw $this->createAccessDeniedException(); }", correct: true} + - {value: "$this->user->denyAccessUnlessGranted('ROLE_ADMIN')", correct: false} + - + question: 'For implements Symfony\Component\Security\Core\User\UserInterface which method you have to define ?' + answers: + - {value: "getRoles()", correct: true} + - {value: "getPassword()", correct: true} + - {value: "getSalt()", correct: true} + - {value: "getUsername()", correct: true} + - {value: "eraseCredentials()", correct: true} + - {value: "getCredentials()", correct: false} + - {value: "getHash()", correct: false} + - {value: "getId()", correct: false} + - + question: 'For implements Symfony\Component\Security\Core\User\UserProviderInterface which method you have to define ?' + answers: + - {value: "loadUserByUsername($username)", correct: true} + - {value: "loadUser($username)", correct: false} + - {value: "refreshUser(UserInterface $user)", correct: true} + - {value: "getUser($username)", correct: false} + - {value: "supportsClass($class)", correct: true} diff --git a/data/templating.yml b/data/templating.yml index 89a55de..7089f8e 100644 --- a/data/templating.yml +++ b/data/templating.yml @@ -179,3 +179,17 @@ questions: answers: - {value: 'True', correct: false} - {value: 'False', correct: true} + - + question: 'Using Twig, what syntax used to print the content of a variable ?' + answers: + - {value: "{% %}", correct: false} + - {value: "{{ }}", correct: true} + - {value: "{# #}", correct: false} + - {value: "{ }", correct: false} + - + question: 'Using Twig, what syntax used to add comments ?' + answers: + - {value: "{% %}", correct: false} + - {value: "{{ }}", correct: false} + - {value: "{# #}", correct: true} + - {value: "{ }", correct: false} diff --git a/data/validation.yml b/data/validation.yml index 1abf72a..f4e0a0f 100644 --- a/data/validation.yml +++ b/data/validation.yml @@ -31,3 +31,23 @@ questions: - {value: "UniqueEntity is provided by Doctrine Bundle", correct: false} - {value: "We can validate partial object with @Assert\\GroupSequence", correct: true} - {value: "All assertions above are valid", correct: false} + - + question: 'Which constraints exist?' + answers: + - {value: "Blank", correct: true} + - {value: "IdenticalTo", correct: true} + - {value: "EqualTo", correct: true} + - {value: "SameAs", correct: false} + - + question: 'Which annotation are valid ?' + answers: + - {value: '@Assert\Choice({"male", "female", "other"})', correct: true} + - {value: '@Assert\Choice(choices = {"male", "female", "other"})', correct: true} + - {value: '@Assert\Choices({"male", "female", "other"})', correct: false} + - {value: '@Assert\Choices(choices = {"male", "female", "other"})', correct: false} + - + question: 'How to tell the validator to use a specific group ?' + answers: + - {value: 'pass one or more group names as the third argument of $validator->validate()', correct: true} + - {value: 'pass one or more group names as the second argument of $validator->validate()', correct: false} + - {value: 'use $validator->setValidationGroups(array)', correct: false}