├── .gitignore ├── .travis.yml ├── CONTRIBUTING.md ├── LICENSE ├── composer.json └── data ├── architecture.yml ├── automated-tests.yml ├── cache-http.yml ├── command-line.yml ├── config.yml ├── controllers.yml ├── dependency-injection.yml ├── forms.yml ├── http.yml ├── misc.yml ├── php.yml ├── process.yml ├── psr.yml ├── routing.yml ├── security.yml ├── standardization.yml ├── validation.yml └── yaml.yml /.gitignore: -------------------------------------------------------------------------------- 1 | /vendor/ 2 | composer.lock -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: php 2 | 3 | php: 4 | - 7.0 5 | 6 | before_script: 7 | - composer install --prefer-source 8 | 9 | script: vendor/bin/yaml-linter ./data/ 10 | 11 | notifications: 12 | email: 13 | - andrieu.travail@gmail.com -------------------------------------------------------------------------------- /CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | Contributing 2 | ============ 3 | 4 | # Important notes 5 | 6 | Here are some important notes before you contribute to Certificationy Symfony Pack: 7 | 8 | * For legal reasons, you *MUST* have never passed the Symfony certification yet, 9 | * All questions existing in Certificationy are not copied from a certification exam, 10 | * You are not allowed to use the questions from the [Unofficial self-study guide](https://leanpub.com/symfony-selfstudy). 11 | 12 | # Add questions 13 | 14 | The official SensioLabs Symfony Certification contains 75 randomly chosen questions and is 90 minutes long. The examination covers the following topics: 15 | 16 | * PHP 17 | * HTTP 18 | * Architecture 19 | * Standardization 20 | * Bundles 21 | * Controllers 22 | * Routing 23 | * Twig 24 | * Forms 25 | * Validation 26 | * Dependency Injection 27 | * Security 28 | * HTTP Caching 29 | * Command Line Interface 30 | * Automated testing 31 | * Miscellaneous (error handling, code debugging) 32 | 33 | from [Official Symfony certification](https://certification.symfony.com/). 34 | 35 | You can add questions to each category. There are three types of questions: 36 | 37 | * True/false questions 38 | * Single answer questions 39 | * Multiple answers questions 40 | 41 | *There are no open questions or any lines of code to write.* 42 | 43 | To contribute to the Symfony Pack, you can add questions in each category in YAML: 44 | 45 | ```yaml 46 | - 47 | question: 'What is the prefix of environment variables used by Symfony?' 48 | answers: 49 | - {value: "SYMFONY__", correct: true} 50 | - {value: "SF__", correct: false} 51 | - {value: "SYMFONY-", correct: false} 52 | - {value: "SF-", correct: false} 53 | ``` 54 | 55 | Check if the question is not present, to avoid duplications. 56 | 57 | Finally, validate your YAML files: you can use the built-in command of Symfony: 58 | 59 | ```bash 60 | $ php app/console lint:yaml /path/to/your/yaml/file.yaml 61 | ``` 62 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2013-2014 Vincent Composieux 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "certificationy/symfony-pack", 3 | "type": "certificationy-pack", 4 | "description": "A series of questions to prepare for the certification Symfony2", 5 | "keywords": ["symfony", "certification", "test", "exam"], 6 | "homepage": "http://github.com/certificationy/symfony-pack", 7 | "license": "MIT", 8 | "authors": [ 9 | { 10 | "name": "Mickaël Andrieu", 11 | "email": "andrieu.travail@gmail.com" 12 | } 13 | ], 14 | "require-dev": { 15 | "certificationy/yaml-linter": "v1.0.1" 16 | } 17 | } 18 | 19 | -------------------------------------------------------------------------------- /data/architecture.yml: -------------------------------------------------------------------------------- 1 | category: Architecture 2 | questions: 3 | - 4 | question: 'What is the path to set session cookie_lifetime parameter in a project configuration?' 5 | answers: 6 | - {value: framework.session.cookie_lifetime, correct: true} 7 | - {value: framework.session.cookie.lifetime, correct: false} 8 | - {value: framework.parameters.cookie_lifetime, correct: false} 9 | - {value: framework.cookie_lifetime, correct: false} 10 | help: | 11 | 'https://symfony.com/doc/current/reference/configuration/framework.html' 12 | - 13 | question: 'Which design pattern implements the EventDispatcher component?' 14 | answers: 15 | - {value: Adapter, correct: false} 16 | - {value: Decorator, correct: false} 17 | - {value: Observer, correct: true} 18 | - {value: Mediator, correct: true} 19 | help: | 20 | 'https://symfony.com/doc/current/components/event_dispatcher.html#introduction' 21 | - 22 | question: 'What is the right parameter path to set a version number for assets?' 23 | answers: 24 | - {value: "framework.assets.version: v2", correct: true} 25 | - {value: "framework.assets.version_number: v2", correct: false} 26 | - {value: "framework.templating.version: v2", correct: false} 27 | - {value: "framework.templating.version_number: v2", correct: false} 28 | - {value: "framework.twig.version: v2", correct: false} 29 | - {value: "framework.twig.version_number: v2", correct: false} 30 | help: | 31 | 'https://symfony.com/doc/current/reference/configuration/framework.html#version' 32 | - 33 | question: 'Which method from EventSubscriberInterface return array of events that subscriber wants to listen to?' 34 | answers: 35 | - {value: "getEvents()", correct: false} 36 | - {value: "getSubscribedEvents()", correct: true} 37 | - {value: "getSubscribed()", correct: false} 38 | - {value: "getSubscribedEventsList()", correct: false} 39 | help: | 40 | 'https://symfony.com/doc/current/event_dispatcher.html#creating-an-event-subscriber' 41 | 42 | - 43 | question: 'Which method from Symfony\Contracts\EventDispatcher\EventDispatcherInterface forwarding an event to all registered listeners?' 44 | answers: 45 | - {value: "dispatch(object $event, string $eventName = null): object", correct: true} 46 | - {value: "send(object $event, string $eventName = null): object", correct: false} 47 | - {value: "fire(object $event, string $eventName = null): object", correct: false} 48 | - {value: "sendOff(object $event, string $eventName = null): object", correct: false} 49 | help: | 50 | 'https://symfony.com/doc/current/components/event_dispatcher.html#dispatch-the-event' 51 | - 52 | question: 'Which method of the Symfony\Component\EventDispatcher\EventDispatcherInterface belongs to its parent Symfony\Contracts\EventDispatcher\EventDispatcherInterface' 53 | answers: 54 | - {value: 'dispatch(object $event, string $eventName = null): object', correct: true} 55 | - {value: 'addListener(string $eventName, $listener, int $priority = 0)', correct: false} 56 | - {value: 'hasListeners(string $eventName = null)', correct: false} 57 | - {value: 'removeListener(string $eventName, $listener)', correct: false} 58 | help: | 59 | 'source file vendor/symfony/event-dispatcher(-contracts)/EventDispatcherInterface.php' 60 | - 61 | question: 'Which method allows to prevent any other Event listeners from being called?' 62 | answers: 63 | - {value: "stopPropagation()", correct: true} 64 | - {value: "preventDefault()", correct: false} 65 | - {value: "stop()", correct: false} 66 | - {value: "off()", correct: false} 67 | help: | 68 | 'https://symfony.com/doc/current/components/event_dispatcher.html#stopping-event-flow-propagation' 69 | - 70 | question: 'Is it possible to detect if an Event was stopped during runtime?' 71 | answers: 72 | - {value: "no", correct: false} 73 | - {value: "yes", correct: true} 74 | - {value: "yes, but not always", correct: false} 75 | - {value: "yes, but only once", correct: false} 76 | help: | 77 | 'https://symfony.com/doc/current/components/event_dispatcher.html#stopping-event-flow-propagation' 78 | - 79 | question: 'Using FrameworkBundle configuration, what is the correct path to fill proxies IP?' 80 | answers: 81 | - {value: "trusted_proxies", correct: true} 82 | - {value: "proxies_trusted", correct: false} 83 | - {value: "proxies", correct: false} 84 | - {value: "proxies_list", correct: false} 85 | help: | 86 | 'trusted_proxies was removed in 3.3, method setTrustedProxies now used https://symfony.com/doc/current/reference/configuration/framework.html#trusted-proxies' 87 | - 88 | question: 'Using FrameworkBundle configuration, what is the default framework.assets.version_format value?' 89 | answers: 90 | - {value: "%%s?%%s", correct: true} 91 | - {value: "%s?%s", correct: false} 92 | - {value: "?%%s", correct: false} 93 | - {value: "?%s", correct: false} 94 | help: | 95 | 'https://symfony.com/doc/current/reference/configuration/framework.html#version-format' 96 | - 97 | question: 'Instantiating a new Symfony\Component\HttpKernel\Kernel, what is the correct arguments order?' 98 | answers: 99 | - {value: "public function __construct(string $environment, bool $debug)", correct: true} 100 | - {value: "public function __construct(bool $debug, string $environment)", correct: false} 101 | - {value: "public function __construct(string $name, string $environment, bool $debug)", correct: false} 102 | - {value: "public function __construct(string $environment, bool $debug, string $name = null)", correct: false} 103 | help: | 104 | 'https://github.com/symfony/symfony/blob/4.2/src/Symfony/Component/HttpKernel/Kernel.php' 105 | 106 | - 107 | question: 'What is the prefix of environment variables used by Symfony?' 108 | answers: 109 | - {value: "APP__", correct: true} 110 | - {value: "APP--", correct: false} 111 | - {value: "SYMFONY__", correct: false} 112 | - {value: "SF__", correct: false} 113 | - {value: "SYMFONY-", correct: false} 114 | - {value: "SF-", correct: false} 115 | help: | 116 | 'no answer found, however, for symfonycloud, the prefix is SYMFONY_ https://symfony.com/doc/current/cloud/cookbooks/env.html#symfonycloud-environment-variables' 117 | in Symfony 5, this is achieved by using env vars https://symfony.com/doc/current/configuration.html#configuration-based-on-environment-variables' 118 | - 119 | question: 'According to Symfony best practices, ____ is/are located in _____ file/folder.' 120 | answers: 121 | - {value: "templates, /", correct: true} 122 | - {value: "Controller, src/", correct: true} 123 | - {value: "services, config/services.yaml", correct: true} 124 | - {value: "routes, config/routes.yaml", correct: true} 125 | - {value: "templates, src/", correct: false} 126 | - {value: "assets, public/", correct: false} 127 | - {value: "services, src/Resources/services.yaml", correct: false} 128 | - {value: "translations, Resources/translations/", correct: false} 129 | help: | 130 | 'https://symfony.com/doc/current/best_practices.html#use-the-default-directory-structure 131 | however, routes are recommended to be defined as annotations and assets are stored in public/build folder' 132 | - 133 | question: 'Where can you find the file `form_table_layout.html.twig` ?' 134 | answers: 135 | - {value: "In Twig Bundle", correct: false} 136 | - {value: "In Twig Bridge", correct: true} 137 | - {value: "In FrameworkExtraBundle", correct: false} 138 | help: | 139 | 'https://github.com/symfony/symfony/blob/master/src/Symfony/Bridge/Twig/Resources/views/Form/form_table_layout.html.twig' 140 | - 141 | question: 'If you pass 0 (zero) as third parameter (int $indent) in \Symfony\Component\Yaml\Yaml::dump, the generated YAML string will be indented with tabs' 142 | answers: 143 | - {value: "True", correct: false} 144 | - {value: "False", correct: true} 145 | help: 146 | 'tabs are not allowed in yaml https://yaml.org/faq.html' 147 | 148 | - 149 | question: 'Symfony is released under which license ?' 150 | answers: 151 | - {value: "GNU General Public License (GPL)", correct: false} 152 | - {value: "ISC License", correct: false} 153 | - {value: "BSD license", correct: false} 154 | - {value: "MIT license", correct: true} 155 | help: | 156 | 'https://symfony.com/doc/current/contributing/code/license.html' 157 | - 158 | question: 'Which kernel event exist ?' 159 | answers: 160 | - {value: "kernel.request", correct: true} 161 | - {value: "kernel.controller", correct: true} 162 | - {value: "kernel.template", correct: false} 163 | - {value: "kernel.view", correct: true} 164 | - {value: "kernel.response", correct: true} 165 | - {value: "kernel.answer", correct: false} 166 | - {value: "kernel.finish_request", correct: true} 167 | - {value: "kernel.start_request", correct: false} 168 | - {value: "kernel.terminate", correct: true} 169 | - {value: "kernel.start", correct: false} 170 | - {value: "kernel.exception", correct: true} 171 | help: | 172 | 'https://symfony.com/doc/current/components/http_kernel.html#creating-an-event-listener' 173 | - 174 | question: 'Arguments are resolved before calling the Controller ?' 175 | answers: 176 | - {value: "yes", correct: true} 177 | - {value: "no", correct: false} 178 | help: | 179 | 'https://symfony.com/doc/current/components/http_kernel.html#the-workflow-of-a-request' 180 | - 181 | question: 'How do you detect if an Event was stopped during runtime?' 182 | answers: 183 | - {value: "$event->isPropagationStopped()", correct: true} 184 | - {value: "$event->isStopped()", correct: false} 185 | - {value: "$event->isPropagationStop()", correct: false} 186 | - {value: "$event->isStop()", correct: false} 187 | help: | 188 | 'https://symfony.com/doc/current/components/event_dispatcher.html#stopping-event-flow-propagation' 189 | 190 | - 191 | question: 'What is/are the recommended way to create a new Symfony web application' 192 | answers: 193 | - {value: "Symfony installer", correct: false} 194 | - {value: "composer create-project symfony/skeleton my_project_name", correct: true} 195 | - {value: "composer new-project symfony/skeleton my_project_name", correct: false} 196 | - {value: "php bin/console new-project my_project_name", correct: false} 197 | - {value: "symfony new my_project_name --full", correct: true} 198 | help: | 199 | 'https://symfony.com/doc/4.0/setup/flex.html#using-symfony-flex-in-new-applications' 200 | 201 | - 202 | question: 'Using Flex is mandatory since Symfony 4.0' 203 | answers: 204 | - {value: "False", correct: true} 205 | - {value: "True", correct: false} 206 | help: | 207 | 'https://symfony.com/doc/4.0/setup/flex.html#upgrading-existing-applications-to-flex' 208 | 209 | - 210 | question: 'Which file should be edited in order to customize the default server error page ?' 211 | answers: 212 | - {value: "templates/bundles/TwigBundle/Exception/error.html.twig", correct: true} 213 | - {value: "templates/bundles/TwigBundle/Exception/error500.html.twig", correct: false} 214 | - {value: "src/Controller/ExceptionController", correct: false} 215 | help: | 216 | 'https://symfony.com/doc/current/controller/error_pages.html#overriding-the-default-error-templates' 217 | 218 | # - 219 | # question: '' 220 | # answers: 221 | # - {value: "", correct: } 222 | # - {value: "", correct: } 223 | # - {value: "", correct: } 224 | # - {value: "", correct: } 225 | # - {value: "", correct: } 226 | # help: | 227 | # '' 228 | 229 | -------------------------------------------------------------------------------- /data/automated-tests.yml: -------------------------------------------------------------------------------- 1 | category: Automated tests 2 | questions: 3 | - 4 | question: 'Using PHPUnit, which method names are used to share test setup code?' 5 | answers: 6 | - {value: setUp(), correct: true} 7 | - {value: __construct(), correct: false} 8 | - {value: shutdown(), correct: false} 9 | - {value: tearDown(), correct: true} 10 | help: | 11 | 'https://www.w3resource.com/php/PHPUnit/fixtures.php' 12 | 13 | - 14 | question: 'How to disable constructor when mocking an object?' 15 | answers: 16 | - {value: $this->getMock('My\Class')->disableOriginalConstructor()->getMock(), correct: false} 17 | - {value: $this->disableOriginalConstructor('My\Class'), correct: false} 18 | - {value: $this->getMockBuilder('My\Class')->disableOriginalConstructor()->getMock(), correct: true} 19 | - {value: $this->getMockBuilder('My\Class')->getMock()->disableConstructor(), correct: false} 20 | help: | 21 | 'https://phpunit.de/manual/6.5/en/test-doubles.html#test-doubles.stubs.examples.StubTest2.php' 22 | - 23 | question: 'Which Symfony class offers method to test commands?' 24 | answers: 25 | - {value: Symfony\Component\Console\Tester\Command, correct: false} 26 | - {value: Symfony\Component\Console\Tester\CommandTester, correct: true} 27 | - {value: Symfony\Component\Console\Tester\CommandUnitTester, correct: false} 28 | - {value: Symfony\Component\Console\Tester\CommandUnit, correct: false} 29 | help: | 30 | 'https://symfony.com/doc/current/console.html#testing-commands' 31 | - 32 | question: 'Using PHPUnit, which method allows to specify a mock response on second call?' 33 | answers: 34 | - {value: $mock->expects($this->at(1)), correct: true} 35 | - {value: $mock->expects($this->at(2)), correct: false} 36 | - {value: $mock->expects($this->exactly(2)), correct: false} 37 | - {value: $mock->expects($this->on(2)), correct: false} 38 | help: | 39 | 'https://phpunit.de/manual/6.5/en/test-doubles.html' 40 | - 41 | question: 'Using PHPUnit, which method allows you to expect an exception to be thrown?' 42 | answers: 43 | - {value: $this->setExpectedException('MyException'), correct: false} 44 | - {value: $this->setExceptionExpected('MyException'), correct: false} 45 | - {value: $this->expectException('MyException'), correct: true} 46 | - {value: $this->setExpected('MyException'), correct: false} 47 | help: | 48 | 'https://phpunit.de/manual/6.5/en/writing-tests-for-phpunit.html#writing-tests-for-phpunit.exceptions' 49 | 50 | - 51 | question: 'What command used for run all of your application tests by default?' 52 | answers: 53 | - {value: phpunit -c app/, correct: false} 54 | - {value: phpunit app/, correct: false} 55 | - {value: phpunit -c, correct: false} 56 | - {value: phpunit, correct: true} 57 | help: | 58 | 'https://symfony.com/doc/current/testing.html#unit-tests' 59 | - 60 | question: 'Where live functional tests in Symfony (inside a project structure)?' 61 | answers: 62 | - {value: Tests/, correct: false} 63 | - {value: Tests/Controller/, correct: true} 64 | - {value: Tests/Functional/, correct: false} 65 | - {value: Tests/Functional/Controller, correct: false} 66 | - {value: Tests/Functional/Controllers, correct: false} 67 | - {value: Tests/Controllers/, correct: false} 68 | - {value: Controller/, correct: false} 69 | help: | 70 | 'https://symfony.com/doc/current/testing.html#your-first-functional-test' 71 | - 72 | question: 'Using Symfony\Component\BrowserKit\Client which of these methods can be called?' 73 | answers: 74 | - {value: back(), correct: true} 75 | - {value: forward(), correct: true} 76 | - {value: insulate(), correct: true} 77 | - {value: restart(), correct: true} 78 | - {value: followRedirect(), correct: true} 79 | - {value: reload(), correct: true} 80 | - {value: next(), correct: false} 81 | help: | 82 | 'https://github.com/symfony/browser-kit/blob/master/AbstractBrowser.php' 83 | - 84 | question: 'Using Swiftmailer, which of these configuration allows to disable email delivery?' 85 | answers: 86 | - {value: 'swiftmailer.disable_delivery: true', correct: true} 87 | - {value: 'swiftmailer.delivery: false', correct: false} 88 | - {value: 'swiftmailer.delivery_disable: false', correct: false} 89 | - {value: 'framework.mailer.dsn: null://null', correct: false} 90 | - {value: 'framework.mailer.dsn: null', correct: false} 91 | - {value: 'framework.mailer.dsn: false', correct: false} 92 | help: | 93 | 'https://symfony.com/doc/current/email.html#disabling-sending' 94 | 95 | - 96 | question: 'Using the Crawler client, how to follow a redirection ?' 97 | answers: 98 | - {value: $client->redirect(), correct: false} 99 | - {value: $client->followRedirect(), correct: true} 100 | - {value: $client->followRedirects(), correct: true} 101 | - {value: $client->redirectAll(), correct: false} 102 | help: | 103 | 'followRedirects() is tricky as it will follow ALL redirections. https://symfony.com/doc/current/testing.html#redirecting' 104 | -------------------------------------------------------------------------------- /data/cache-http.yml: -------------------------------------------------------------------------------- 1 | category: HTTP Cache 2 | questions: 3 | - 4 | question: 'What is the correct way to render a ESI tag using HTML?' 5 | answers: 6 | - {value: , correct: false} 7 | - {value: , correct: true} 8 | - {value: , correct: false} 9 | - {value: , correct: false} 10 | help: | 11 | 'https://symfony.com/doc/current/http_cache/esi.html' 12 | 13 | - 14 | question: 'What is the Twig function to render an ESI?' 15 | answers: 16 | - {value: cache_esi(), correct: false} 17 | - {value: esi_cache(), correct: false} 18 | - {value: esi_render(), correct: false} 19 | - {value: render_esi(), correct: true} 20 | help: | 21 | 'https://symfony.com/doc/current/http_cache/esi.html' 22 | 23 | - 24 | question: 'Which HTTP headers belongs to expiration cache model?' 25 | answers: 26 | - {value: Expires, correct: true} 27 | - {value: Last-Modified, correct: false} 28 | - {value: ETag, correct: false} 29 | - {value: Cache-Control, correct: true} 30 | - {value: Cookie, correct: false} 31 | help: | 32 | 'https://symfony.com/doc/current/http_cache/expiration.html' 33 | - 34 | question: 'Which HTTP headers belongs to validation cache model?' 35 | answers: 36 | - {value: Expires, correct: false} 37 | - {value: Last-Modified, correct: true} 38 | - {value: ETag, correct: true} 39 | - {value: Cache-Control, correct: false} 40 | - {value: Cookie, correct: false} 41 | help: | 42 | 'https://symfony.com/doc/current/http_cache/validation.html' 43 | - 44 | question: 'Which HTTP status code must be returned if the cache is still valid ?' 45 | answers: 46 | - {value: '304', correct: true} 47 | - {value: '200', correct: false} 48 | - {value: '202', correct: false} 49 | - {value: '300', correct: false} 50 | - {value: '305', correct: false} 51 | - 52 | question: 'True or False ? ESI need to be activated in configuration.' 53 | answers: 54 | - {value: "True", correct: true} 55 | - {value: "False", correct: false} 56 | help: | 57 | 'https://symfony.com/doc/current/http_cache/esi.html' 58 | - 59 | question: 'According to HTTP/1.1 what is the max value for Expires ?' 60 | answers: 61 | - {value: "one year", correct: true} 62 | - {value: "one month", correct: false} 63 | - {value: "one week", correct: false} 64 | - {value: "There is not limit", correct: false} 65 | help: 66 | 'https://symfony.com/doc/current/http_cache/expiration.html#expiration-with-the-expires-header' 67 | - 68 | question: 'True or False ? You can use both validation and expiration within the same Response.' 69 | answers: 70 | - {value: "True", correct: true} 71 | - {value: "False", correct: false} 72 | help: | 73 | 'https://symfony.com/doc/current/http_cache/expiration.html' 74 | - 75 | question: 'True or False ? Using ETag saves CPU cycles.' 76 | answers: 77 | - {value: "True", correct: false} 78 | - {value: "False", correct: true} 79 | help: | 80 | 'https://symfony.com/doc/current/http_cache/validation.html#validation-with-the-etag-header' 81 | -------------------------------------------------------------------------------- /data/command-line.yml: -------------------------------------------------------------------------------- 1 | category: The Command Line 2 | questions: 3 | - 4 | question: 'Which helper is not available in the Console component?' 5 | answers: 6 | - {value: QuestionHelper, correct: false} 7 | - {value: Table, correct: false} 8 | - {value: FormatterHelper, correct: false} 9 | - {value: ProcessHelper, correct: false} 10 | - {value: Progress Bar, correct: false} 11 | - {value: Debug formatter helper, correct: false} 12 | - {value: FileHelper, correct: true} 13 | - {value: DialogHelper, correct: true} 14 | - {value: InformationHelper, correct: true} 15 | help: | 16 | 'https://symfony.com/doc/current/components/console/helpers/index.html' 17 | - 18 | question: 'Which event is not available in the Console Component?' 19 | answers: 20 | - {value: ConsoleEvents::COMMAND, correct: false} 21 | - {value: ConsoleEvents::TERMINATE, correct: false} 22 | - {value: ConsoleEvents::ERROR, correct: false} 23 | - {value: ConsoleEvents::LAUNCH, correct: true} 24 | - {value: ConsoleEvents::START, correct: true} 25 | - {value: ConsoleEvents::BEGIN, correct: true} 26 | - {value: ConsoleEvents::END, correct: true} 27 | - {value: ConsoleEvents::EXCEPTION, correct: true} 28 | help: | 29 | 'https://symfony.com/doc/current/components/console/events.html' 30 | - 31 | question: 'Using Console component, which of these class allows to create custom output styles?' 32 | answers: 33 | - {value: Symfony\Component\Console\OutputFormatterStyle, correct: true} 34 | - {value: Symfony\Component\Console\OutputStyleFormatter, correct: false} 35 | - {value: Symfony\Component\Console\OutputStyle, correct: false} 36 | - {value: Symfony\Component\Console\OutputFormatter, correct: false} 37 | help: | 38 | 'https://symfony.com/doc/current/console/coloring.html#using-color-styles' 39 | - 40 | question: 'Which argument can be passed to the debug:router command?' 41 | answers: 42 | - {value: An argument can be omitted, correct: true} 43 | - {value: A regexp search filter, correct: false} 44 | - {value: A route limit, correct: false} 45 | - {value: The route URL, correct: false} 46 | - {value: A route name, correct: true} 47 | help: | 48 | 'https://symfony.com/doc/current/routing.html#debugging-routes' 49 | 50 | - 51 | question: 'Which argument can be passed to the router:match command?' 52 | answers: 53 | - {value: An argument can be omitted, correct: false} 54 | - {value: A regexp search filter, correct: false} 55 | - {value: A route limit, correct: false} 56 | - {value: The route URL, correct: true} 57 | - {value: A route name, correct: false} 58 | help: | 59 | 'https://symfony.com/doc/current/routing.html#debugging-routes' 60 | - 61 | question: 'What is the command to check the syntax of a Twig template?' 62 | answers: 63 | - {value: php bin/console lint:twig, correct: true} 64 | - {value: php bin/console twig:lint, correct: false} 65 | - {value: php bin/console twig:validate, correct: false} 66 | - {value: php bin/console twig:syntax, correct: false} 67 | help: | 68 | 'https://symfony.com/doc/current/templates.html#linting-twig-templates' 69 | - 70 | question: 'What is the console command to clear cache?' 71 | answers: 72 | - {value: php bin/console cache:clear, correct: true} 73 | - {value: php bin/console clear:cache, correct: false} 74 | - {value: php bin/console cache:clean, correct: false} 75 | - {value: php bin/console cache:invalidate, correct: false} 76 | help: | 77 | 'https://symfony.com/doc/current/cache.html#clearing-the-cache' 78 | - 79 | question: 'Which tag name you should use when you register command as service?' 80 | answers: 81 | - {value: command.console, correct: false} 82 | - {value: console.command, correct: true} 83 | - {value: console.console_command, correct: false} 84 | - {value: command, correct: false} 85 | - {value: console, correct: false} 86 | help: | 87 | 'https://symfony.com/doc/current/console/commands_as_services.html' 88 | - 89 | question: 'What is the command line to list all known entities by doctrine 2 in your project ?' 90 | answers: 91 | - {value: 'php bin/console doctrine:mapping:info', correct: true} 92 | - {value: 'php bin/console doctrine:mapping:import', correct: false} 93 | - {value: 'php bin/console doctrine:mapping:info --all', correct: false} 94 | - {value: 'php bin/console doctrine:mapping:import --all', correct: false} 95 | help: 96 | 'http://assets.andreiabohner.org/symfony/sf42-console-cheat-sheet.pdf' 97 | - 98 | # CHECKME this has been removed for symfony 5 docs but console still support it, is it obsolete ? 99 | question: 'What is the command line to validate the doctrine mapping files ?' 100 | answers: 101 | - {value: 'php bin/console doctrine:schema:validate', correct: true} 102 | - {value: 'php bin/console doctrine:schema:validation', correct: false} 103 | - {value: 'php bin/console doctrine:schema:update --dump-sql', correct: false} 104 | - {value: 'php bin/console doctrine:schema:update --force', correct: false} 105 | - {value: 'php bin/console doctrine:mapping:convert', correct: false} 106 | - {value: 'php bin/console doctrine:mapping:import', correct: false} 107 | help: | 108 | 'https://symfony.com/doc/3.3/doctrine.html#add-mapping-information' 109 | - 110 | # FIXED calling config:dump-reference work both with extension alias and bundle name; config:dump is an alias for config:dump-reference (tested but not documented => remove from answers?) 111 | # debug:config will work to display config of a bundle WITH a bundle name or alias as param 112 | question: "How do you display complete configuration of a bundle ?" 113 | answers: 114 | - {value: "php bin/console dump:config acme", correct: false} 115 | - {value: "php bin/console config:dump-reference acme", correct: true} 116 | - {value: "php bin/console config:dump AcmeBundle", correct: true} 117 | - {value: "php bin/console config:dump-reference AcmeBundle", correct: true} 118 | - {value: "php bin/console debug:config", correct: false} 119 | help: | 120 | 'https://symfony.com/doc/current/bundles/configuration.html#dump-the-configuration https://symfony.com/doc/current/reference/configuration/debug.html' 121 | - 122 | # FIXME ambiguous question. descriptors are methods, NOT objects. also there is no mention of the term 'descriptor' in the doc 123 | question: 'Descriptors are objects to render documentation on Symfony Console Apps?' 124 | answers: 125 | - {value: 'Yes', correct: true} 126 | - {value: 'No', correct: false} 127 | help: | 128 | 'https://symfony.com/doc/current/console.html#configuring-the-command' 129 | - 130 | question: 'Does the Symfony Console component needs PHP globals internals variables to work?' 131 | answers: 132 | - {value: 'Yes', correct: false} 133 | - {value: 'No', correct: true} 134 | help: | 135 | 'https://symfony.com/doc/current/components/console.html#installation' 136 | - 137 | question: 'What is the console command to create a new entity?' 138 | answers: 139 | - {value: php bin/console doctrine:generate:entity, correct: false} 140 | - {value: php bin/console generate:entity, correct: false} 141 | - {value: php bin/console database:create:entity, correct: false} 142 | - {value: php bin/console doctrine:create:entity, correct: false} 143 | - {value: php bin/console make:entity, correct: true} 144 | - {value: php bin/console entity:make, correct: false} 145 | help: | 146 | 'https://symfony.com/doc/current/doctrine.html#creating-an-entity-class' 147 | - 148 | question: 'What is the command to update the database from entities?' 149 | answers: 150 | - {value: php bin/console doctrine:schema:update, correct: false} 151 | - {value: php bin/console doctrine:entity:update, correct: false} 152 | - {value: php bin/console doctrine:entity --create, correct: false} 153 | - {value: php bin/console doctrine:schema:create, correct: false} 154 | - {value: php bin/console make:migration; php bin/console doctrine:migrations:migrate, correct: true} 155 | help: | 156 | 'https://symfony.com/doc/current/doctrine.html#migrations-creating-the-database-tables-schema' 157 | - 158 | question: 'What is the right command name to load Doctrine fixtures?' 159 | answers: 160 | - {value: php bin/console doctrine:fixtures:load, correct: true} 161 | - {value: php bin/console doctrine:load:fixtures, correct: false} 162 | - {value: php bin/console doctrine:fixtures, correct: false} 163 | - {value: php bin/console doctrine:fixtures:import, correct: false} 164 | help: | 165 | 'https://symfony.com/doc/current/bundles/DoctrineFixturesBundle/index.html#loading-fixtures' 166 | - 167 | question: 'Symfony Console: which one(s) are valid verbosity levels ?' 168 | answers: 169 | - {value: OutputInterface::VERBOSITY_QUIET, correct: true} 170 | - {value: OutputInterface::VERBOSITY_NORMAL, correct: true} 171 | - {value: OutputInterface::VERBOSITY_VERBOSE, correct: true} 172 | - {value: OutputInterface::VERBOSITY_VERY_VERBOSE, correct: true} 173 | - {value: OutputInterface::VERBOSITY_DEBUG, correct: true} 174 | - {value: OutputInterface::VERBOSITY_VERY_VERY_VERBOSE, correct: false} 175 | - {value: OutputInterface::VERBOSITY_ALERT, correct: false} 176 | help: | 177 | 'https://symfony.com/doc/current/console/verbosity.html' 178 | - 179 | question: 'Symfony Console: InputArgument::REQUIRED, InputArgument::OPTIONAL and ... ?' 180 | answers: 181 | - {value: InputArgument::DEFAULT, correct: false} 182 | - {value: InputArgument::IS_ARRAY, correct: true} 183 | - {value: InputArgument::LIST, correct: false} 184 | - {value: InputArgument::ENUM, correct: false} 185 | help: | 186 | 'https://symfony.com/doc/current/console/input.html#using-command-arguments' 187 | - 188 | question: 'Symfony Console: which of the following sentences are true?' 189 | answers: 190 | - {value: 'initialize() and configure() are invoked before the ConsoleEvents::COMMAND', correct: false} 191 | - {value: 'ConsoleEvents::TERMINATE is dispatched even when an exception is thrown' , correct: true} 192 | - {value: 'initialize has InputInterface, OutputInterface parameters', correct: true} 193 | - {value: 'Events can disable the command', correct: true} 194 | help: | 195 | 'https://symfony.com/doc/current/components/console/events.html 196 | https://symfony.com/doc/current/components/console/events.html#disable-commands-inside-listeners 197 | https://github.com/symfony/console/blob/master/Command/Command.php' 198 | - 199 | # CHECKME source file https://github.com/symfony/console/blob/master/Command/Command.php says only execute() is mandatory; 200 | # besides, doc doesnt say configure is mandatory 201 | question: 'Which function are mandatory to your command class ?' 202 | answers: 203 | - {value: "configure()", correct: true} 204 | - {value: "execute(InputInterface $input, OutputInterface $output)", correct: true} 205 | - {value: "interact()", correct: false} 206 | - {value: "initialize()", correct: false} 207 | help: | 208 | 'https://symfony.com/doc/current/console.html#creating-a-command' 209 | - 210 | question: 'Which Question class are available ?' 211 | answers: 212 | - {value: "Symfony\\Component\\Console\\Question\\Question", correct: true} 213 | - {value: "Symfony\\Component\\Console\\Question\\ChoiceQuestion", correct: true} 214 | - {value: "Symfony\\Component\\Console\\Question\\ConfirmationQuestion", correct: true} 215 | - {value: "Symfony\\Component\\Console\\Question\\SelectQuestion", correct: false} 216 | - {value: "Symfony\\Component\\Console\\Question\\ValidQuestion", correct: false} 217 | help: | 218 | 'https://symfony.com/doc/current/components/console/helpers/questionhelper.html' 219 | - 220 | question: 'How to Call Other Commands in a command ?' 221 | answers: 222 | - {value: "$command->execute($input, $output);", correct: false} 223 | - {value: "$command->run($input, $output);", correct: true} 224 | - {value: "$command->call($input, $output);", correct: false} 225 | - {value: "$command->forward($input, $output);", correct: false} 226 | help: | 227 | 'https://symfony.com/doc/current/console/calling_commands.html' 228 | -------------------------------------------------------------------------------- /data/config.yml: -------------------------------------------------------------------------------- 1 | category: Config 2 | questions: 3 | - 4 | question: 'Which of these configuration node types are available?' 5 | answers: 6 | - {value: scalar, correct: true} 7 | - {value: array, correct: true} 8 | - {value: enum, correct: true} 9 | - {value: string, correct: false} 10 | help: | 11 | 'https://symfony.com/doc/current/components/config/definition.html#node-type' 12 | - 13 | question: 'Which of these methods are existing?' 14 | answers: 15 | - {value: useAttributeAsKey(), correct: true} 16 | - {value: isRequired(), correct: true} 17 | - {value: cannotBeEmpty(), correct: true} 18 | - {value: setDefaultValue(), correct: false} 19 | - {value: setValidation(), correct: false} 20 | help: 21 | 'https://symfony.com/doc/current/components/config/definition.html' 22 | - 23 | question: 'Which class is used to define hierarchy of configuration values?' 24 | answers: 25 | - {value: Symfony\Component\Config\Definition\Builder\TreeBuilder, correct: true} 26 | - {value: Symfony\Component\Config\Definition\Builder\HierarchyBuilder, correct: false} 27 | - {value: Symfony\Component\Config\Definition\Builder\NodeBuilder, correct: false} 28 | - {value: Symfony\Component\Config\Definition\Builder\Builder, correct: false} 29 | help: | 30 | 'https://symfony.com/doc/current/components/config/definition.html#defining-a-hierarchy-of-configuration-values-using-the-treebuilder' 31 | -------------------------------------------------------------------------------- /data/controllers.yml: -------------------------------------------------------------------------------- 1 | category: Controllers 2 | questions: 3 | - 4 | question: 'How to perform a redirection on example.org in a controller?' 5 | answers: 6 | - {value: return $this->redirect($this->generateUrl('http://www.example.org')), correct: false} 7 | - {value: return $this->redirectUrl('http://www.example.org'), correct: false} 8 | - {value: return $this->redirect('http://www.example.org'), correct: true} 9 | - {value: return $this->generateUrl('http://www.example.org'), correct: false} 10 | help: | 11 | 'https://symfony.com/doc/current/controller.html#redirecting' 12 | - 13 | question: 'Which class may be extended by your controllers?' 14 | answers: 15 | - {value: Symfony\Bundle\FrameworkBundle\Controller\AbstractController, correct: true} 16 | - {value: Symfony\Component\FrameworkBundle\Controller\AbstractController, correct: false} 17 | - {value: Symfony\Bundle\HttpBundle\Controller\AbstractController, correct: false} 18 | - {value: Symfony\Component\MvcBundle\Controller\AbstractController, correct: false} 19 | help: | 20 | 'https://symfony.com/doc/current/controller.html#the-base-controller-classes-services' 21 | - 22 | question: 'Which of these annotations can be used in a controller?' 23 | answers: 24 | - {value: '@Cache', correct: true} 25 | - {value: '@ParamConverter', correct: true} 26 | - {value: '@Security', correct: true} 27 | - {value: '@Template', correct: true} 28 | - {value: '@Method', correct: false} 29 | - {value: '@Post', correct: false} 30 | - {value: '@CatchException', correct: false} 31 | help: | 32 | 'https://symfony.com/doc/current/bundles/SensioFrameworkExtraBundle/index.html#annotations-for-controllers' 33 | - 34 | question: 'Which of these response objects does not exists?' 35 | answers: 36 | - {value: XmlResponse, correct: true} 37 | - {value: FileResponse, correct: true} 38 | - {value: TwigResponse, correct: true} 39 | - {value: JsonResponse, correct: false} 40 | - {value: BinaryFileResponse, correct: false} 41 | - {value: RedirectResponse, correct: false} 42 | - {value: StreamedResponse, correct: false} 43 | help: | 44 | 'https://symfony.com/doc/current/components/http_foundation.html#response' 45 | - 46 | question: 'Which class will you use to convert an action parameter?' 47 | answers: 48 | - {value: Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter, correct: true} 49 | - {value: Sensio\Bundle\FrameworkExtraBundle\Controller\ParamConverter, correct: false} 50 | - {value: Symfony\Bundle\FrameworkBundle\Configuration\ParamConverter, correct: false} 51 | - {value: Symfony\Bundle\FrameworkBundle\Controller\ParamConverter, correct: false} 52 | help: | 53 | 'https://symfony.com/doc/current/bundles/SensioFrameworkExtraBundle/annotations/converters.html' 54 | - 55 | question: 'Which controller/action allows to render a template without a specific controller?' 56 | answers: 57 | - {value: Symfony\Bundle\FrameworkBundle\Controller\TemplateController, correct: true} 58 | - {value: Sensio\Bundle\FrameworkExtraBundle\Controller\TemplateController, correct: false} 59 | - {value: Symfony\Bundle\FrameworkBundle\Controller\TwigController, correct: false} 60 | - {value: Sensio\Bundle\FrameworkExtraBundle\Controller\TwigController, correct: false} 61 | help: | 62 | 'https://symfony.com/doc/current/templates.html#rendering-a-template-directly-from-a-route' 63 | - 64 | question: | 65 | According to this action : 66 | 67 | /** 68 | * @Route("/comment/{postSlug}/new", name = "comment_new") 69 | * 70 | */ 71 | public function newAction(Request $request, Post $post) 72 | { 73 | // ... 74 | } 75 | 76 | 77 | How my ParamConverter should be configured to match "postSlug" params with "slug" in Post ? 78 | answers: 79 | - {value: '@ParamConverter("post", options={"mapping": {"postSlug": "slug"}})', correct: true} 80 | - {value: '@ParamConverter("post", options={"mapping": {"slug": "postSlug"}})', correct: false} 81 | - {value: '@ParamConverter("post", options={"mapping": {"field": "slug"}})', correct: false} 82 | - {value: '@ParamConverter("post", options={"mapping": {"Post": "slug"}})', correct: false} 83 | - {value: 'It is not possible, params and fields must match', correct: false} 84 | help: | 85 | 'https://symfony.com/doc/current/bundles/SensioFrameworkExtraBundle/annotations/converters.html#doctrineconverter-options' 86 | -------------------------------------------------------------------------------- /data/dependency-injection.yml: -------------------------------------------------------------------------------- 1 | category: Dependency Injection 2 | questions: 3 | - 4 | question: 'When setting up the container with configuratio XML files and Config component, how to inject my.custome.service ?' 5 | help: https://symfony.com/doc/current/service_container/injection_types.html#constructor-injection 6 | answers: 7 | - {value: , correct: false} 8 | - {value: , correct: false} 9 | - {value: , correct: true} 10 | - {value: , correct: false} 11 | help: | 12 | https://symfony.com/doc/current/service_container.html#choose-a-specific-service 13 | - 14 | question: 'Which types of injection are available in the component?' 15 | help: https://symfony.com/doc/current/service_container/injection_types.html 16 | answers: 17 | - {value: constructor, correct: true} 18 | - {value: property, correct: true} 19 | - {value: setter, correct: true} 20 | - {value: immutable-property, correct: false} 21 | - {value: immutable-setter, correct: true} 22 | - {value: constant, correct: false} 23 | - {value: getter, correct: false} 24 | help: | 25 | https://symfony.com/doc/current/service_container/injection_types.html 26 | - 27 | question: 'Using XML, which of these lines are correct to inject a service?' 28 | help: https://symfony.com/doc/current/service_container/injection_types.html 29 | answers: 30 | - {value: , correct: false} 31 | - {value: , correct: true} 32 | - {value: , correct: true} 33 | - {value: , correct: false} 34 | - {value: , correct: true} 35 | help: | 36 | https://symfony.com/doc/current/service_container/injection_types.html 37 | - 38 | question: 'Using YML, which line allows to inject proxy of exceptionnaly large services when working with symfony/proxy-manager-bridge ?' 39 | help: https://symfony.com/doc/current/service_container/lazy_services.html 40 | answers: 41 | - {value: "proxy_service: true", correct: false} 42 | - {value: "lazy: true", correct: true} 43 | - {value: "proxy: enabled", correct: false} 44 | - {value: "proxy: true", correct: false} 45 | help: | 46 | https://symfony.com/doc/current/service_container/lazy_services.html#configuration 47 | - 48 | question: 'When implementing Command pattern, the use of Service Subscriber is another lazy loading implementation. Which of the following statement is true ?' 49 | help: https://symfony.com/doc/current/service_container/service_subscribers_locators.html#defining-a-service-subscriber 50 | answers: 51 | - {value: "Your implementation must implement ServiceSubscriberInterface", correct: true} 52 | - {value: "Static method getSubscribedServices shall be implemented and listed services can be indexed with your own keys", correct: true} 53 | - {value: "Static method getSubscribedServices shall be implemented and listed services canot be indexed with your own keys", correct: false} 54 | - {value: "ContainerInterface must be injected in your implementation", correct: true} 55 | - {value: "Service locator is a subset of service container", correct: true} 56 | - 57 | question: 'Which of the following statements are true about autowiring ?' 58 | help: https://symfony.com/doc/current/service_container/autowiring.html 59 | answers: 60 | - {value: "Symfony basic configuration comes with autowire set to true", correct: true} 61 | - {value: "Type-hinting is used to map the correct services from the service container, using type-hinting as service id", correct: true} 62 | - {value: "Autowiring can be used in the __construct() method as well as in all other methods of the service", correct: true} 63 | - {value: "Autowiring can only be used in the __construct() method of the service", correct: false} 64 | - 65 | question: | 66 | Using autowire, interfaces can be used instead of services implementation. In order to autowire implementation, you can setup an alias with the interface id. 67 | App\MyInterface: '@App\MyServiceImplementation' 68 | In case of multiple implementation of your interface, you can use the argument name to determine which service will be injected. 69 | App\MyInterface $serviceA: '@App\MyServiceImplementationA' 70 | App\MyInterface: '@App\MyServiceImplementationB' 71 | help: https://symfony.com/doc/current/service_container/autowiring.html#dealing-with-multiple-implementations-of-the-same-type 72 | answers: 73 | - {value: "true", correct: true} 74 | - {value: "false", correct: false} 75 | - 76 | question: 'Which of the following factory design pattern are available for service container defintion ?' 77 | help: https://symfony.com/doc/current/service_container/factories.html 78 | answers: 79 | - {value: 'Static factories', correct: true} 80 | - {value: 'Non-Static factories', correct: true} 81 | - {value: 'Dynamic factories', correct: false} 82 | - {value: 'Invokable factories', correct: true} 83 | - {value: 'Clonable factories', correct: false} 84 | - 85 | question: 'In order to create a App\Email\NewsletterManager using createNewsletterManager static method from NewsletterManagerStaticFactory or createNewsletterManager method from NewsletterManagerFactory, which of the following service YAML definition for App\Email\NewsletterManager can you use ?' 86 | help: https://symfony.com/doc/current/service_container/factories.html#static-factories 87 | answers: 88 | - {value: 'factory: ["App\Email\NewsletterManagerStaticFactory", "createNewsletterManager"]', correct: true} 89 | - {value: 'factory: ["@App\Email\NewsletterManagerFactory", "createNewsletterManager"]', correct: true} 90 | - {value: 'factory: ["@App\Email\NewsletterManagerStaticFactory", "createNewsletterManager"]', correct: false} 91 | - {value: 'factory: ["App\Email\NewsletterManagerFactory", "createNewsletterManager"]', correct: false} 92 | - {value: 'call: ["App\Email\NewsletterManagerStaticFactory", "createNewsletterManager"]', correct: false} 93 | - {value: 'service: ["App\Email\NewsletterManagerStaticFactory", "createNewsletterManager"]', correct: false} 94 | - 95 | question: 'Using Dependency Injection, what is the correct way to override a service class using ContainerBuilder class?' 96 | answers: 97 | - {value: "$container->getDefinition('my.service')->setClass('My\\Service\\Class')", correct: true} 98 | - {value: "$container->getService('my.service')->setDefinition('My\\Service\\Class')", correct: false} 99 | - {value: "$container->getDefinition('my.service')->setService('My\\Service\\Class')", correct: false} 100 | - {value: "$container->getService('my.service')->setClass('My\\Service\\Class')", correct: false} 101 | help: | 102 | https://symfony.com/doc/current/service_container/definitions.html 103 | - 104 | question: 'Using a compiler pass, how do you check the existence of service ?' 105 | help: https://symfony.com/doc/current/service_container/definitions.html#getting-and-setting-service-definitions 106 | answers: 107 | - {value: "$container->hasDefinition('my.service')", correct: true} 108 | - {value: "$container->has('my.service')", correct: true} 109 | - {value: "$container->contains('my.service')", correct: false} 110 | - {value: "$container->getService('my.service')", correct: false} 111 | - 112 | question: 'Using a compiler pass, how do you retrieve a definition of service ?' 113 | help: https://symfony.com/doc/current/service_container/definitions.html#getting-and-setting-service-definitions 114 | answers: 115 | - {value: "$container->getDefinition('my.service')", correct: true} 116 | - {value: "$container->findDefinition('my.service')", correct: true} 117 | - {value: "$container->retrieveDefinition('my.service')", correct: false} 118 | - {value: "$container->getService('my.service')", correct: false} 119 | help: | 120 | https://github.com/symfony/dependency-injection/blob/master/ContainerBuilder.php 121 | - 122 | question: 'What are existing compiler pass order ?' 123 | help: https://symfony.com/doc/current/components/dependency_injection/compilation.html#controlling-the-pass-ordering 124 | answers: 125 | - {value: "PassConfig::TYPE_BEFORE_OPTIMIZATION", correct: true} 126 | - {value: "PassConfig::TYPE_OPTIMIZE", correct: true} 127 | - {value: "PassConfig::TYPE_AFTER_OPTIMIZATION", correct: false} 128 | - {value: "PassConfig::TYPE_BEFORE_REMOVING", correct: true} 129 | - {value: "PassConfig::TYPE_REMOVE", correct: true} 130 | - {value: "PassConfig::TYPE_AFTER_REMOVING", correct: true} 131 | - {value: "PassConfig::TYPE_AFTER_COMPILING", correct: false} 132 | - {value: "PassConfig::TYPE_COMPILE", correct: false} 133 | - {value: "PassConfig::TYPE_BEFORE_COMPILING", correct: false} 134 | help: | 135 | 'https://symfony.com/doc/current/components/dependency_injection/compilation.html#controlling-the-pass-ordering' 136 | 137 | - 138 | # FIXME unclear question text and contradictory answers 139 | # ls -al => App_KernelDevDebugContainer.php (symfony 5) 140 | # <> Symfony doc => appDevDebugProjectContainer.php (symfony 5) 141 | # <> certificationy => srcApp_KernelDevDebugContainer.php (symfony ?) 142 | question: "As dev environment, what is the name of dumped container ?" 143 | answers: 144 | - {value: "srcApp_KernelDevDebugContainer.php", correct: false} 145 | - {value: "App_KernelDevDebugContainer.php", correct: true} 146 | - {value: "appDevDebugProjectContainer.php", correct: false} 147 | - {value: "appDevProjectContainer.php", correct: false} 148 | - {value: "appDevDebugProjectServiceContainer", correct: false} 149 | - {value: "srcApp_DevDebugContainer.php", correct: false} 150 | help: | 151 | '# ls -al var/cache/dev 152 | https://symfony.com/doc/current/configuration/front_controllers_and_kernel.html#environments-and-the-cache-directory' 153 | - 154 | question: "True or false, parameters can also contain array values ?" 155 | answers: 156 | - {value: "true", correct: true} 157 | - {value: "false", correct: false} 158 | help: | 159 | https://symfony.com/doc/current/configuration.html#configuration-parameters 160 | - 161 | question: "What is the correct syntax to inject a service app.mailer ?" 162 | answers: 163 | - {value: "arguments: ['@app.mailer']", correct: true} 164 | - {value: "arguments: ['%app.mailer%']", correct: false} 165 | - {value: "arguments: ['app.mailer']", correct: false} 166 | help: | 167 | https://symfony.com/doc/current/service_container.html#service-parameters 168 | - 169 | question: "What is the correct syntax to inject a parameter mailer.transport ?" 170 | answers: 171 | - {value: "arguments: ['@mailer.transport']", correct: false} 172 | - {value: "arguments: ['%mailer.transport%']", correct: true} 173 | - {value: "arguments: ['mailer.transport']", correct: false} 174 | help: | 175 | https://symfony.com/doc/current/configuration.html#configuration-parameters 176 | - 177 | question: "How to define a service as private ?" 178 | answers: 179 | - {value: "type: private", correct: false} 180 | - {value: "scope: private", correct: false} 181 | - {value: "public: false", correct: true} 182 | - {value: "private: true", correct: false} 183 | help: | 184 | 'Services are private by default. https://symfony.com/doc/current/service_container.html#public-versus-private-services' 185 | - 186 | question: "True or False, With default configuration each time you retrieve the service, you'll get the same instance ?" 187 | answers: 188 | - {value: "true", correct: true} 189 | - {value: "false", correct: false} 190 | help: | 191 | https://symfony.com/doc/current/service_container.html#creating-configuring-services-in-the-container 192 | 193 | - 194 | question: 'What is the correct load() method definition in Symfony\Component\DependencyInjection\Extension\ExtensionInterface?' 195 | answers: 196 | - {value: "public function load(array $configs, ContainerBuilder $container)", correct: true} 197 | - {value: "public function load(array $config, ContainerBuilder $container)", correct: false} 198 | - {value: "public function load(ContainerBuilder $container, array $configs)", correct: false} 199 | - {value: "public function load(ContainerBuilder $container, array $config)", correct: false} 200 | help: | 201 | https://symfony.com/doc/current/components/dependency_injection/compilation.html#managing-configuration-with-extensions 202 | - 203 | question: 'Service parameters can be set at runtime' 204 | answers: 205 | - {value: "true", correct: false} 206 | - {value: "false", correct: true} 207 | help: | 208 | https://symfony.com/doc/current/service_container.html#service-parameters 209 | - 210 | question: "The lint:container command checks that the arguments injected into services match their type declarations" 211 | help: https://symfony.com/doc/current/service_container.html#linting-service-definitions 212 | answers: 213 | - {value: "true", correct: true} 214 | - {value: "false", correct: false} 215 | - 216 | question: "Decorating services can be done in YAML using the decorates key. This prevent original service override and autowire decorated class name with decorator instance" 217 | help: https://symfony.com/doc/current/service_container/service_decoration.html 218 | answers: 219 | - {value: "true", correct: true} 220 | - {value: "false", correct: false} 221 | -------------------------------------------------------------------------------- /data/forms.yml: -------------------------------------------------------------------------------- 1 | category: Forms 2 | questions: 3 | - 4 | question: 'Inside a form type, how to render a DateType field in an text input field?' 5 | answers: 6 | - {value: Add an option 'render' => 'input', correct: false} 7 | - {value: Add an option 'widget' => 'text', correct: false} 8 | - {value: Add an option 'widget' => 'single_text', correct: true} 9 | - {value: Add an option 'widget' => 'input', correct: false} 10 | help: | 11 | https://symfony.com/doc/current/reference/forms/types/date.html#widget 12 | - 13 | question: 'Which method allows you to handle the request on a form instance?' 14 | answers: 15 | - {value: $form->bindRequest($request), correct: false} 16 | - {value: $form->handleRequest($request), correct: true} 17 | - {value: $form->handle($request), correct: false} 18 | - {value: $form->request($request), correct: false} 19 | help: | 20 | https://symfony.com/doc/current/forms.html#processing-forms 21 | - 22 | question: 'From a Form instance, which method can you call to obtain a FormView instance?' 23 | answers: 24 | - {value: $form->getView(), correct: false} 25 | - {value: $form->renderView(), correct: false} 26 | - {value: $form->view(), correct: false} 27 | - {value: $form->createView(), correct: true} 28 | help: | 29 | https://symfony.com/doc/current/forms.html#processing-forms 30 | - 31 | question: 'In a Twig template, which function render a form field?' 32 | answers: 33 | - {value: "{{ form_item(form.field) }}", correct: false} 34 | - {value: "{{ form_render(form.field) }}", correct: false} 35 | - {value: "{{ form_widget(form.field) }}", correct: true} 36 | - {value: "{{ form_view(form.field) }}", correct: false} 37 | help: | 38 | https://symfony.com/doc/current/form/form_customization.html#form-widget-form-view-variables 39 | - 40 | question: 'Using Form factory, how to define a CSRF provider?' 41 | answers: 42 | - {value: $formFactory->addExtension(new CsrfExtension($csrfManager));, correct: true} 43 | - {value: $formFactory->setExtension(new CsrfExtension($csrfManager));, correct: false} 44 | - {value: $formFactory->addCsrfExtension(new CsrfExtension($csrfManager));, correct: false} 45 | - {value: $formFactory->addExtension(new Csrf($csrfManager));, correct: false} 46 | help: | 47 | https://symfony.com/doc/current/components/form.html#csrf-protection 48 | - 49 | # FIXME setDefaultOptions now deprecated in favor of configureOptions https://github.com/symfony/symfony/pull/12891 50 | question: 'Using Form component, which option can you use into configureOptions() method to define CSRF field name?' 51 | answers: 52 | - {value: csrf_field_name, correct: true} 53 | - {value: csrf_fieldname, correct: false} 54 | - {value: csrf_field, correct: false} 55 | - {value: csrf_name, correct: false} 56 | - {value: csrf_protection, correct: false} 57 | help: | 58 | https://symfony.com/doc/current/security/csrf.html#csrf-protection-in-symfony-forms 59 | - 60 | question: 'Using Form component, which option can you use into configureOptions() method to enable CSRF protection?' 61 | answers: 62 | - {value: '"csrf_protection" => true', correct: true} 63 | - {value: '"csrf_field" => true', correct: false} 64 | - {value: '"csrf" => "enabled"', correct: false} 65 | - {value: '"csrf" => true', correct: false} 66 | help: | 67 | https://symfony.com/doc/current/security/csrf.html#csrf-protection-in-symfony-forms 68 | - 69 | question: 'Using Form component, option csrf_error_message can be used in configureOptions() to define a custom CSRF error message?' 70 | answers: 71 | - {value: Yes, correct: false} 72 | - {value: No, correct: true} 73 | help: | 74 | https://symfony.com/doc/current/security/csrf.html#csrf-protection-in-symfony-forms 75 | 76 | - 77 | question: 'Using Form component, which option will allow you to specify groups used for validation?' 78 | answers: 79 | - {value: validation_groups, correct: true} 80 | - {value: groups_validation, correct: false} 81 | - {value: validator_groups, correct: false} 82 | - {value: groups_validator, correct: false} 83 | help: | 84 | https://symfony.com/doc/current/form/validation_groups.html#validation-groups 85 | - 86 | question: 'Which form event exist?' 87 | answers: 88 | - {value: "FormEvents::PRE_SET_DATA", correct: true} 89 | - {value: "FormEvents::SET_DATA", correct: false} 90 | - {value: "FormEvents::POST_SET_DATA", correct: true} 91 | - {value: "FormEvents::PRE_SUBMIT", correct: true} 92 | - {value: "FormEvents::SUBMIT", correct: true} 93 | - {value: "FormEvents::POST_SUBMIT", correct: true} 94 | - {value: "FormEvents::POST_REQUEST", correct: false} 95 | - {value: "FormEvents::REQUEST", correct: false} 96 | - {value: "FormEvents::PRE_REQUEST", correct: false} 97 | help: | 98 | https://symfony.com/doc/current/form/events.html 99 | - 100 | question: 'What data is inside FormEvent object at FormEvents::PRE_SET_DATA?' 101 | answers: 102 | - {value: "Model data", correct: true} 103 | - {value: "Normalized data", correct: false} 104 | - {value: "Request data", correct: false} 105 | - {value: "View data", correct: false} 106 | help: | 107 | https://symfony.com/doc/current/form/events.html#registering-event-listeners-or-event-subscribers 108 | - 109 | question: 'What data is inside FormEvent object at FormEvents::PRE_SUBMIT?' 110 | answers: 111 | - {value: "Model data", correct: false} 112 | - {value: "Normalized data", correct: false} 113 | - {value: "Request data", correct: true} 114 | - {value: "View data", correct: false} 115 | help: | 116 | https://symfony.com/doc/current/form/events.html#registering-event-listeners-or-event-subscribers 117 | - 118 | question: 'What data is inside FormEvent object at FormEvents::POST_SET_DATA?' 119 | answers: 120 | - {value: "Model data", correct: true} 121 | - {value: "Normalized data", correct: false} 122 | - {value: "Request data", correct: false} 123 | - {value: "View data", correct: false} 124 | help: | 125 | https://symfony.com/doc/current/form/events.html#registering-event-listeners-or-event-subscribers 126 | - 127 | question: 'What data is inside FormEvent object at FormEvents::SUBMIT?' 128 | answers: 129 | - {value: "Model data", correct: false} 130 | - {value: "Normalized data", correct: true} 131 | - {value: "Request data", correct: false} 132 | - {value: "View data", correct: false} 133 | help: | 134 | https://symfony.com/doc/current/form/events.html#registering-event-listeners-or-event-subscribers 135 | - 136 | question: 'What data is inside FormEvent object at FormEvents::POST_SUBMIT?' 137 | answers: 138 | - {value: "Model data", correct: false} 139 | - {value: "Normalized data", correct: false} 140 | - {value: "Request data", correct: false} 141 | - {value: "View data", correct: true} 142 | help: | 143 | https://symfony.com/doc/current/form/events.html#registering-event-listeners-or-event-subscribers 144 | - 145 | # FIXME all non numeric text fields extend from TextType. 146 | # Looking from the source they extend AbstractType but their getParent method return TextType and doc says they extend TextType 147 | question: 'Which one of these types extends from TextType?' 148 | answers: 149 | - {value: "MoneyType", correct: false} 150 | - {value: "CurrencyType", correct: false} 151 | - {value: "TextareaType", correct: true} 152 | - {value: "UrlType", correct: true} 153 | - {value: "Password", correct: true} 154 | - {value: "EmailType", correct: true} 155 | help: | 156 | https://symfony.com/doc/current/reference/forms/types.html#text-fields 157 | https://github.com/symfony/symfony/tree/master/src/Symfony/Component/Form/Extension/Core/Type 158 | - 159 | question: 'Which date type exist?' 160 | answers: 161 | - {value: "date", correct: true} 162 | - {value: "datetime", correct: true} 163 | - {value: "time", correct: true} 164 | - {value: "timestamp", correct: false} 165 | help: | 166 | https://symfony.com/doc/current/reference/forms/types.html#date-and-time-fields 167 | - 168 | question: 'How do you bind a constraint to a form field?' 169 | answers: 170 | - {value: "Using option 'constraints' in $formBuilder->add()", correct: true} 171 | - {value: "Passing constraint instance in $this->createFormBuilder()", correct: false} 172 | - {value: "Invoke $formBuilder->setConstraints() method", correct: false} 173 | - {value: "Add an annotation in model", correct: true} 174 | help: | 175 | https://symfony.com/doc/current/forms.html#validating-forms 176 | https://symfony.com/doc/current/components/form.html#component-form-intro-validation 177 | - 178 | question: 'Using form component, option "error_bubbling" will include error in current field.' 179 | answers: 180 | - {value: "True", correct: false} 181 | - {value: "False", correct: true} 182 | help: | 183 | https://symfony.com/doc/current/reference/forms/types/text.html#error-bubbling 184 | - 185 | question: 'How do you set default value?' 186 | answers: 187 | - {value: "$this->createFormBuilder($defaultEntityOrArray)", correct: true} 188 | - {value: "$this->createFormBuilder(null, $defaultEntityOrArray)", correct: false} 189 | - {value: "$this->createFormBuilder()->setDefaults($defaultEntityOrArray)", correct: false} 190 | - {value: "$this->createFormBuilder()->addDefaults($defaultEntityOrArray)", correct: false} 191 | help: | 192 | https://symfony.com/doc/current/components/form.html#setting-default-values 193 | - 194 | question: 'Your Form class must extends ____ ' 195 | answers: 196 | - {value: Symfony\Component\Form\FormType, correct: false} 197 | - {value: Symfony\Component\Form\AbstractType, correct: true} 198 | - {value: Symfony\Component\Form\AbstractFormType, correct: false} 199 | help: | 200 | https://symfony.com/doc/current/forms.html#creating-form-classes 201 | - 202 | # TESTME is the first answer really correct ? 203 | question: 'How to add an extra field `extra` with the form ?' 204 | answers: 205 | - {value: "$builder->add('extra', null, ['mapped' => false])", correct: true} 206 | - {value: "$builder->add('extra', 'hidden', ['mapped' => false])", correct: true} 207 | - {value: "$builder->add('extra', null, ['validation' => false]", correct: false} 208 | help: | 209 | https://symfony.com/doc/current/forms.html#unmapped-fields 210 | - 211 | question: 'How do you render all the form fields in twig ?' 212 | answers: 213 | - {value: "form_widget(form)", correct: true} 214 | - {value: "form_render(form)", correct: false} 215 | - {value: "form_fields(form)", correct: false} 216 | - {value: "render_form(form)", correct: false} 217 | help: | 218 | https://symfony.com/doc/current/form/form_customization.html#form-widget-form-view-variables 219 | - 220 | question: 'If you use form_widget() on a single fields, which parts are render ?' 221 | answers: 222 | - {value: "label", correct: false} 223 | - {value: "input", correct: true} 224 | - {value: "error", correct: false} 225 | - {value: "label and input", correct: false} 226 | - {value: "error, label and input", correct: false} 227 | help: | 228 | https://symfony.com/doc/current/form/form_customization.html#form-rendering-functions 229 | - 230 | question: 'According to Symfony best practices, where you should add buttons ?' 231 | answers: 232 | - {value: "Template", correct: true} 233 | - {value: "Form", correct: false} 234 | - {value: "Controller", correct: false} 235 | help: | 236 | https://symfony.com/doc/current/best_practices.html#add-form-buttons-in-templates 237 | - 238 | question: 'Which Field type exist?' 239 | answers: 240 | - {value: "HiddenType", correct: true} 241 | - {value: "SearchType", correct: true} 242 | - {value: "BirthdayType", correct: true} 243 | - {value: "PasswordType", correct: true} 244 | - {value: "SelectType", correct: false} 245 | - {value: "FloatType", correct: false} 246 | - {value: "BooleanType", correct: false} 247 | help: | 248 | https://github.com/symfony/symfony/tree/master/src/Symfony/Component/Form/Extension/Core/Type 249 | - 250 | question: 'How to Disable the Validation of Submitted Data' 251 | answers: 252 | - {value: "set the validation_groups option to false", correct: true} 253 | - {value: "set the validation_enable option to false", correct: false} 254 | - {value: "set the enable_validation option to false", correct: false} 255 | - {value: "$this->createFormBuilder()->isValidated(false)", correct: false} 256 | - {value: "By using false as third parameter for createFormBuilder", correct: false} 257 | help: | 258 | https://symfony.com/doc/current/form/disabling_validation.html 259 | - 260 | question: 'Which form event dont exist?' 261 | answers: 262 | - {value: "FormEvents::PRE_SET_DATA", correct: false} 263 | - {value: "FormEvents::SUBMIT", correct: false} 264 | - {value: "FormEvents::POST_SUBMIT", correct: false} 265 | - {value: "FormEvents::SET_DATA", correct: true} 266 | help: | 267 | https://symfony.com/doc/current/form/events.html 268 | - 269 | question: 'How do you upload a UploadedFile ?' 270 | answers: 271 | - {value: "$file->move(string $directory, string $name = null)", correct: true} 272 | - {value: "$file->upload(string $directory, string $name = null)", correct: false} 273 | - {value: "$file->uploadFile(string $directory, string $name = null)", correct: false} 274 | - {value: "$file->save(string $directory, string $name = null)", correct: false} 275 | help: | 276 | https://symfony.com/doc/current/controller/upload_file.html#creating-an-uploader-service 277 | - 278 | question: 'How to Use Data Transformers ?' 279 | answers: 280 | - {value: "$builder->get('tags')->addModelTransformer(...);", correct: true} 281 | - {value: "$builder->add($builder->create('tags', TextType::class)->addModelTransformer(...));", correct: true} 282 | - {value: "$builder->add('tags', TextType::class)->addModelTransformer(...);", correct: false} 283 | help: | 284 | https://symfony.com/doc/current/form/data_transformers.html 285 | -------------------------------------------------------------------------------- /data/http.yml: -------------------------------------------------------------------------------- 1 | category: HTTP 2 | questions: 3 | - 4 | question: 'Which of these HTTP headers does not exist?' 5 | answers: 6 | - {value: Control-Cache, correct: true} 7 | - {value: Cache-Modifier, correct: true} 8 | - {value: Expires, correct: false} 9 | - {value: Last-Modified, correct: false} 10 | - {value: Cache-Control, correct: false} 11 | help: | 12 | https://github.com/for-GET/know-your-http-well/blob/master/headers.md 13 | - 14 | question: 'Which one of these Response methods check if cache must be revalidated?' 15 | answers: 16 | - {value: $response->mustRevalidate(), correct: true} 17 | - {value: $response->isRevalidated(), correct: false} 18 | - {value: $response->getRevalidated(), correct: false} 19 | - {value: $response->mustBeRevalidated(), correct: false} 20 | help: | 21 | https://github.com/symfony/symfony/blob/5.1/src/Symfony/Component/HttpFoundation/Response.php 22 | - 23 | question: 'Using a Response instance, which of these methods are available to check status code?' 24 | answers: 25 | - {value: $response->isInformational(), correct: true} 26 | - {value: $response->isSuccessful(), correct: true} 27 | - {value: $response->isRedirection(), correct: true} 28 | - {value: $response->isInvalid(), correct: true} 29 | - {value: $response->isError(), correct: false} 30 | help: | 31 | https://github.com/symfony/symfony/blob/5.1/src/Symfony/Component/HttpFoundation/Response.php 32 | - 33 | question: 'How to access the `foo` GET parameter from Request object $request ?' 34 | answers: 35 | - {value: "$request->query->get('foo');", correct: true} 36 | - {value: "$request->request->get('foo');", correct: false} 37 | - {value: "{$request->query->all()}['foo'];", correct: true} 38 | - {value: "$request->get('foo');", correct: true} 39 | help: | 40 | https://symfony.com/doc/current/components/http_foundation.html#accessing-request-data 41 | - 42 | question: 'How to access the `bar` POST parameter from Request object $request ?' 43 | answers: 44 | - {value: "$request->query->get('bar');", correct: false} 45 | - {value: "$request->request->get('bar');", correct: true} 46 | - {value: "{$request->query->all()}['baz'];", correct: false} 47 | - {value: "$request->post('bar');", correct: false} 48 | help: | 49 | https://symfony.com/doc/current/components/http_foundation.html#accessing-request-data 50 | - 51 | question: 'The method getLanguages() from Request object:' 52 | answers: 53 | - {value: 'return the value of the metadata lang', correct: false} 54 | - {value: 'return an array of languages available in translations', correct: false} 55 | - {value: 'return an array of languages the client accepts', correct: true} 56 | - {value: 'does not exists', correct: false} 57 | help: | 58 | https://github.com/symfony/symfony/blob/master/src/Symfony/Component/HttpFoundation/Request.php#L1653 59 | - 60 | question: 'How to get the Content Type from Request ?' 61 | answers: 62 | - {value: "$request->headers->get('content_type');", correct: true} 63 | - {value: "$request->headers->get('content-type');", correct: true} 64 | - {value: "$request->headers->get('Content-Type');", correct: true} 65 | - {value: "$request->getContentType();", correct: true} 66 | help: | 67 | 'headers are not case sensitive https://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html#sec4.2 68 | underscore are legals but with issues https://www.nginx.com/resources/wiki/start/topics/tutorials/config_pitfalls/?highlight=disappearing%20http%20headers#missing-disappearing-http-headers 69 | getContentType() exist https://github.com/symfony/symfony/blob/5.1/src/Symfony/Component/HttpFoundation/Request.php' 70 | - 71 | question: 'How to check if a request has been sent using AJAX ?' 72 | answers: 73 | - {value: $request->isXmlHttpRequest();, correct: true} 74 | - {value: $request->isAJAX();, correct: false} 75 | - {value: "$this->headers->get('X-Requested-With') === 'XMLHttpRequest';", correct: true} 76 | help: | 77 | https://github.com/symfony/symfony/blob/5.1/src/Symfony/Component/HttpFoundation/Request.php 78 | - 79 | question: 'Which Response subclasses are available?' 80 | answers: 81 | - {value: JsonResponse, correct: true} 82 | - {value: StreamResponse, correct: false} 83 | - {value: BinaryFileResponse, correct: true} 84 | - {value: XmlResponse, correct: false} 85 | help: | 86 | 'https://symfony.com/doc/current/components/http_foundation.html#response' 87 | - 88 | question: 'Which HTTP status code should be used for a resource that moved temporarily ?' 89 | answers: 90 | - {value: 301, correct: false} 91 | - {value: 302, correct: true} 92 | - {value: 201, correct: false} 93 | - {value: 204, correct: false} 94 | help: | 95 | https://github.com/for-GET/know-your-http-well/blob/master/status-codes.md 96 | - 97 | question: 'Which HTTP status code should be used for a resource that moved permanently ?' 98 | answers: 99 | - {value: 301, correct: true} 100 | - {value: 302, correct: false} 101 | - {value: 201, correct: false} 102 | - {value: 204, correct: false} 103 | help: | 104 | https://tools.ietf.org/html/rfc2616#section-10.3.2 105 | - 106 | question: 'True or False ? Server returns an status code when you are not allowed to access a resource' 107 | answers: 108 | - {value: "True", correct: true} 109 | - {value: "False", correct: false} 110 | help: | 111 | https://github.com/for-GET/know-your-http-well/blob/master/status-codes.md 112 | - 113 | question: 'Which method exist in Symfony\Component\HttpFoundation\Request ?' 114 | answers: 115 | - {value: "getPathInfo", correct: true} 116 | - {value: "getMethod", correct: true} 117 | - {value: "getLanguages", correct: true} 118 | - {value: "getHeaders", correct: false} 119 | - {value: "getHttpHost", correct: true} 120 | - {value: "getUrl", correct: false} 121 | - {value: "getUri", correct: true} 122 | help: | 123 | https://github.com/symfony/symfony/blob/5.1/src/Symfony/Component/HttpFoundation/Request.php 124 | - 125 | question: 'How can you set status code of Symfony\Component\HttpFoundation\Response' 126 | answers: 127 | - {value: "By you pass the value as second parameter of new Response()", correct: true} 128 | - {value: "By using setStatusCode()", correct: true} 129 | - {value: "By using setCodeStatus()", correct: false} 130 | - {value: "By using setHttpCode()", correct: false} 131 | help: | 132 | https://symfony.com/doc/current/components/http_foundation.html#response 133 | - 134 | question: 'To override the 404 error template for HTML page, how should you name the template ?' 135 | answers: 136 | - {value: "error404.html.twig", correct: true} 137 | - {value: "404.html.twig", correct: false} 138 | - {value: "twig.404.html.twig", correct: false} 139 | help: | 140 | 'https://symfony.com/doc/current/controller/error_pages.html#overriding-the-default-error-templates' 141 | - 142 | question: 'Which of the following HTTP headers can be used by the server to the client to exchange informations about cookies ?' 143 | answers: 144 | - {value: 'Cookie', correct: false} 145 | - {value: 'Set-Cookie', correct: true} 146 | - {value: 'Delete-Cookie', correct: false} 147 | help: | 148 | https://en.wikipedia.org/wiki/List_of_HTTP_header_fields 149 | https://developer.mozilla.org/fr/docs/Web/HTTP/Cookies 150 | - 151 | question: 'Which of the following HTTP headers can be used by the server to the client to exchange informations about content negotiation ?' 152 | answers: 153 | - {value: 'Accept-Charset', correct: false} 154 | - {value: 'Content-Encoding', correct: true} 155 | - {value: 'Content-Language', correct: true} 156 | - {value: 'Accept', correct: false} 157 | - {value: 'Content-Type', correct: true} 158 | help: | 159 | https://developer.mozilla.org/en-US/docs/Web/HTTP/Content_negotiation 160 | - 161 | question: 'Which of the following HTTP headers can be used by the client to the server to exchange informations about content negotiation ?' 162 | answers: 163 | - {value: 'Accept-Charset', correct: true} 164 | - {value: 'Content-Encoding', correct: false} 165 | - {value: 'Content-Language', correct: false} 166 | - {value: 'Accept', correct: true} 167 | - {value: 'Content-Type', correct: false} 168 | help: | 169 | https://developer.mozilla.org/en-US/docs/Web/HTTP/Content_negotiation 170 | - 171 | question: 'Which of the following HTTP methods are safe ?' 172 | answers: 173 | - {value: 'HEAD', correct: true} 174 | - {value: 'POST', correct: false} 175 | - {value: 'GET', correct: true} 176 | - {value: 'PUT', correct: false} 177 | - {value: 'DELETE', correct: false} 178 | - {value: 'TRACE', correct: true} 179 | - {value: 'OPTIONS', correct: true} 180 | - {value: 'PATCH', correct: false} 181 | help: | 182 | https://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html 183 | https://tools.ietf.org/html/rfc7231#section-4.2.1 184 | - 185 | question: 'Which of the following HTTP methods are idempotent ?' 186 | answers: 187 | - {value: 'HEAD', correct: true} 188 | - {value: 'POST', correct: false} 189 | - {value: 'GET', correct: true} 190 | - {value: 'PUT', correct: true} 191 | - {value: 'DELETE', correct: true} 192 | - {value: 'OPTIONS', correct: true} 193 | - {value: 'PATCH', correct: false} 194 | - {value: 'TRACE', correct: true} 195 | help: | 196 | https://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html 197 | https://tools.ietf.org/html/rfc7231#section-4.2.2 198 | -------------------------------------------------------------------------------- /data/misc.yml: -------------------------------------------------------------------------------- 1 | category: Miscellaneous 2 | questions: 3 | - 4 | question: 'Which controller/action allows to render a template without a specific controller?' 5 | answers: 6 | - 7 | value: | 8 | acme_privacy: 9 | path: /privacy 10 | controller: Symfony\Bundle\FrameworkBundle\Controller\TemplateController 11 | defaults: 12 | action: static/privacy.html.twig 13 | correct: false 14 | - 15 | value: | 16 | acme_privacy: 17 | path: /privacy 18 | controller: Symfony\Bundle\FrameworkBundle\Controller\TemplateController 19 | defaults: 20 | render: static/privacy.html.twig 21 | correct: false 22 | - 23 | value: | 24 | acme_privacy: 25 | path: /privacy 26 | controller: Symfony\Bundle\FrameworkBundle\Controller\TemplateController 27 | defaults: 28 | template: static/privacy.html.twig 29 | correct: true 30 | help: | 31 | https://symfony.com/doc/current/templates.html#rendering-a-template-directly-from-a-route 32 | - 33 | question: 'What is the LoggerInterface correct namespace?' 34 | answers: 35 | - {value: Psr\LoggerInterface, correct: false} 36 | - {value: Psr\Log\LoggerInterface, correct: true} 37 | - {value: Symfony\Bridge\Monolog\LoggerInterface, correct: false} 38 | - {value: Symfony\Bridge\Monolog\Log\LoggerInterface, correct: false} 39 | help: | 40 | https://symfony.com/doc/current/logging.html#logging-a-message 41 | 42 | # FIXME this question is obsolete, sym 5 seems to have url_generating_routes.php but could not locate doc 43 | # - 44 | # question: 'Using a dev environment, what is the correct cached file name of the generated configuration routes?' 45 | # answers: 46 | # - {value: "appDevUrlGenerator.php", correct: false} 47 | # - {value: "appDevGeneratorUrl.php", correct: false} 48 | # - {value: "appDevUrlDump.php", correct: false} 49 | # - {value: "UrlGenerator.php", correct: true} 50 | # help: 51 | # https://symfony.com/doc/4.1/configuration/environments.html#environments-and-the-cache-directory 52 | - 53 | # https://github.com/symfony/error-handler/blob/master/Debug.php is not in the Debug NS anymore, now in Component/ErrorHandler 54 | question: 'Using Symfony\Component\ErrorHandler\Debug static class, what is the only method available?' 55 | answers: 56 | - {value: "public static function enable()", correct: true} 57 | - {value: "public static function create()", correct: false} 58 | - {value: "public static function load()", correct: false} 59 | - {value: "public static function start()", correct: false} 60 | - {value: "public static function register()", correct: false} 61 | help: | 62 | https://github.com/symfony/symfony/blob/master/src/Symfony/Component/ErrorHandler/Debug.php 63 | 64 | # https://github.com/symfony/error-handler/blob/master/ErrorHandler.php is not in the Debug NS anymore, now in Component/ErrorHandler 65 | # also, register() doesnt seem to be the only method available ? 66 | - 67 | question: 'Using Symfony\Component\ErrorHandler\ErrorHandler static class, what is the only method available?' 68 | answers: 69 | - {value: "public static function enable(self $handler = null, bool $replace = true)", correct: false} 70 | - {value: "public static function create(self $handler = null, bool $replace = true)", correct: false} 71 | - {value: "public static function load(self $handler = null, bool $replace = true)", correct: false} 72 | - {value: "public static function start(self $handler = null, bool $replace = true)", correct: false} 73 | - {value: "public static function register(self $handler = null, bool $replace = true)", correct: true} 74 | help: | 75 | https://github.com/symfony/error-handler 76 | - 77 | question: 'In order to be able to use render_hinclude(url(...)), we need to add this configuration in ``framework` section:' 78 | answers: 79 | - {value: 'hinclude: enabled', correct: false} 80 | - 81 | value: | 82 | fragments: 83 | {path:/_fragment} 84 | correct: false 85 | - {value: 'none of the above', correct: true} 86 | help: | 87 | https://symfony.com/doc/current/templating/hinclude.html 88 | - 89 | question: 'What is the correct CssSelector class namespace?' 90 | answers: 91 | - {value: Symfony\Component\CssSelector\CssSelector, correct: true} 92 | - {value: Symfony\Component\BrowserKit\CssSelector, correct: false} 93 | - {value: Symfony\Component\DomCrawler\CssSelector, correct: false} 94 | - {value: Symfony\Bundle\FrameworkBundle\CssSelector, correct: false} 95 | help: | 96 | https://symfony.com/doc/current/components/css_selector.html#id1 97 | - 98 | question: 'Event Listeners is use to Regrouping multiple listeners inside a single class ?' 99 | answers: 100 | - {value: "False", correct: true} 101 | - {value: "True", correct: false} 102 | help: | 103 | https://symfony.com/doc/current/event_dispatcher.html#creating-an-event-listener 104 | -------------------------------------------------------------------------------- /data/php.yml: -------------------------------------------------------------------------------- 1 | category: PHP 2 | questions: 3 | - 4 | question: 'What is the short open tag for PHP?' 5 | answers: 6 | - {value: "=5.6 argument lists may include the ... token to denote that the function accepts a variable number of arguments", correct: false} 68 | - {value: "A function name, as other labels in PHP, must match the following regular expression: [a-zA-Z_\x7f-\xff][a-zA-Z0-9_\x7f-\xff]*", correct: false} 69 | - {value: "Variable functions work with language constructs such as echo, print, unset(), isset(), empty(), include or require", correct: true} 70 | - {value: "Assigning a closure (anonymous function) to a variable uses the same syntax as any other assignment, including the trailing semicolon", correct: false} 71 | help: | 72 | https://www.php.net/manual/en/functions.arguments.php#functions.variable-arg-list 73 | https://www.php.net/manual/en/functions.user-defined.php 74 | https://www.php.net/manual/en/functions.anonymous.php 75 | https://www.php.net/manual/en/functions.variable-functions.php 76 | - 77 | question: 'Which of the following function declarations must be used to return a reference?' 78 | answers: 79 | - {value: "function &foo() {...}", correct: true} 80 | - {value: "function $foo() {...}", correct: false} 81 | - {value: "function %foo() {...}", correct: false} 82 | - {value: "function $$foo() {...}", correct: false} 83 | help: | 84 | https://www.php.net/manual/en/language.references.return.php 85 | - 86 | question: 'The ______ keyword is used to indicate an incomplete class or method, which must be further extended and/or implemented in order to be used.' 87 | answers: 88 | - {value: "abstract", correct: true} 89 | - {value: "final", correct: false} 90 | - {value: "protected", correct: false} 91 | - {value: "incomplete", correct: false} 92 | - {value: "implements", correct: false} 93 | help: | 94 | https://www.php.net/manual/en/language.oop5.abstract.php 95 | - 96 | question: 'According to the PHP Framework Interoperability Group, which PSRs concern best coding practices ?' 97 | answers: 98 | - {value: "PSR-0", correct: false} 99 | - {value: "PSR-1", correct: true} 100 | - {value: "PSR-2", correct: true} 101 | - {value: "PSR-3", correct: false} 102 | - {value: "PSR-4", correct: false} 103 | help: | 104 | https://www.php-fig.org/psr/ 105 | - 106 | question: 'Since PHP 5.4, which functionality allows horizontal composition of behavior ?' 107 | answers: 108 | - {value: "Traits", correct: true} 109 | - {value: "Object Cloning", correct: false} 110 | - {value: "ReflectionClass", correct: false} 111 | - {value: "Inheritance", correct: false} 112 | help: | 113 | https://www.php.net/manual/en/language.oop5.traits.php 114 | - 115 | question: 'True or False ? A closure is a lambda function that is aware of its surrounding context.' 116 | answers: 117 | - {value: "True", correct: true} 118 | - {value: "False", correct: false} 119 | help: | 120 | http://fabien.potencier.org/on-php-5-3-lambda-functions-and-closures.html 121 | https://www.php.net/manual/en/functions.anonymous.php 122 | - 123 | question: 'True or False ? A lambda function is a named PHP function that can be stored in a variable.' 124 | answers: 125 | - {value: "True", correct: false} 126 | - {value: "False", correct: true} 127 | help: | 128 | http://fabien.potencier.org/on-php-5-3-lambda-functions-and-closures.html 129 | https://www.php.net/manual/en/functions.anonymous.php 130 | - 131 | question: 'True or False ? An object is always used by reference ?' 132 | answers: 133 | - {value: "True", correct: true} 134 | - {value: "False", correct: false} 135 | help: | 136 | http://php.net/manual/en/oop5.intro.php 137 | - 138 | question: | 139 | $instance = new SimpleClass(); 140 | $assigned = $instance; 141 | $instance = null; 142 | var_dump($assigned); 143 | True or false ? The code above display "null" ? 144 | answers: 145 | - {value: "True", correct: false} 146 | - {value: "False", correct: true} 147 | help: | 148 | http://php.net/manual/en/language.oop5.basic.php#example-179 149 | - 150 | question: 'In a class, "public $var4 = self::myStaticMethod();" is a valid property declaration ?' 151 | answers: 152 | - {value: "True", correct: false} 153 | - {value: "False", correct: true} 154 | help: | 155 | http://php.net/manual/en/language.oop5.properties.php#example-186 156 | - 157 | question: 'True or False ? Is it possible to declare constant in an interface ?' 158 | answers: 159 | - {value: "True", correct: true} 160 | - {value: "False", correct: false} 161 | help: | 162 | http://php.net/manual/en/language.oop5.interfaces.php#language.oop5.interfaces.constants 163 | - 164 | question: 'True or False ? Declaring class properties or methods as static makes them accessible without needing an instantiation of the class ?' 165 | answers: 166 | - {value: "True", correct: true} 167 | - {value: "False", correct: false} 168 | help: | 169 | http://php.net/manual/en/language.oop5.static.php 170 | - 171 | question: 'Which keyword permit to use the late static binding ?' 172 | answers: 173 | - {value: "self", correct: false} 174 | - {value: "static", correct: true} 175 | - {value: "parent", correct: false} 176 | help: | 177 | http://php.net/manual/en/language.oop5.late-static-bindings.php 178 | -------------------------------------------------------------------------------- /data/process.yml: -------------------------------------------------------------------------------- 1 | category: Process 2 | questions: 3 | - 4 | question: 'What is the default signal sent by Process component to stop a process ?' 5 | answers: 6 | - {value: 'SIGINT', correct: false} 7 | - {value: 'SIGKILL', correct: true} 8 | - {value: 'Process::STOP', correct: false} 9 | - {value: '9', correct: true} 10 | help: | 11 | https://symfony.com/doc/current/components/process.html#stopping-a-process 12 | https://www.computerhope.com/unix/signals.htm#system-specific 13 | -------------------------------------------------------------------------------- /data/psr.yml: -------------------------------------------------------------------------------- 1 | category: PHP Standards Recommendations 2 | questions: 3 | - 4 | question: 'Psr-3 LoggerInterface exposes eight methods to write logs to the eight RFC 5424 levels, which level does not exist ?' 5 | answers: 6 | - {value: debug, correct: false} 7 | - {value: alert, correct: false} 8 | - {value: severe, correct: true} 9 | - {value: warning, correct: false} 10 | help: | 11 | https://www.php-fig.org/psr/psr-3/#5-psrlogloglevel 12 | - 13 | question: "Which methods is not in Psr-3" 14 | answers: 15 | - {value: log, correct: false} 16 | - {value: set, correct: true} 17 | - {value: dump, correct: true} 18 | - {value: print, correct: true} 19 | help: | 20 | https://www.php-fig.org/psr/psr-3/#3-psrlogloggerinterface 21 | - 22 | question: 'In Psr-3 what delimiter is used for placeholder names ?' 23 | answers: 24 | - {value: '( name )', correct: false} 25 | - {value: '[ name ]', correct: false} 26 | - {value: '{{ name }}', correct: false} 27 | - {value: '{ name }', correct: true} 28 | help: | 29 | https://www.php-fig.org/psr/psr-3/#12-message 30 | - 31 | question: 'Which Psr is about autoloading ?' 32 | answers: 33 | - {value: Psr-0, correct: true} 34 | - {value: Psr-11, correct: false} 35 | - {value: Psr-4, correct: true} 36 | - {value: Psr-6, correct: false} 37 | help: | 38 | https://www.php-fig.org/psr/ 39 | 40 | - 41 | question: 'According to Psr-2, Which code is correct ?' 42 | answers: 43 | - {value: '$foo->bar($arg1);', correct: true} 44 | - {value: '$Foo->bar($arg1);', correct: false} 45 | - {value: 'class Foo extends Bar implements FooInterface', correct: true} 46 | - {value: 'class foo extends Bar implements FooInterface', correct: false} 47 | help: | 48 | https://www.php-fig.org/psr/psr-1/#1-overview 49 | - 50 | question: 'According to Psr-1 methods have to be declared like ?' 51 | answers: 52 | - {value: 'myMethod();', correct: true} 53 | - {value: 'MyMethod();', correct: false} 54 | - {value: 'my_method();', correct: false} 55 | - {value: 'My_Method();', correct: false} 56 | help: | 57 | https://www.php-fig.org/psr/psr-1/ 58 | - 59 | question: 'Which Psr is about caching ?' 60 | answers: 61 | - {value: 'Psr-0', correct: false} 62 | - {value: 'Psr-6', correct: true} 63 | - {value: 'Psr-16', correct: true} 64 | - {value: 'Psr-1', correct: false} 65 | - {value: 'Psr-2', correct: false} 66 | help: | 67 | https://www.php-fig.org/psr/ 68 | - 69 | question: 'Which Psr is deprecated now ?' 70 | answers: 71 | - {value: 'Psr-1 (Basic Coding Standard)', correct: false} 72 | - {value: 'Psr-6 (Caching Interface)', correct: false} 73 | - {value: 'Psr-0 (Autoloading Standard)', correct: true} 74 | - {value: 'Psr-11 (Container Interface)', correct: false} 75 | help: | 76 | https://www.php-fig.org/psr/#deprecated 77 | -------------------------------------------------------------------------------- /data/routing.yml: -------------------------------------------------------------------------------- 1 | category: Routing 2 | questions: 3 | - 4 | question: 'Using XML or YAML, how to declare a route for a specific domain/host?' 5 | answers: 6 | - {value: Add a "domain" attribute, correct: false} 7 | - {value: Add a "host" attribute, correct: true} 8 | - {value: Add a "path" attribute, correct: false} 9 | - {value: Add a "subdomain" attribute, correct: false} 10 | help: | 11 | https://symfony.com/doc/current/routing.html#sub-domain-routing 12 | - 13 | question: 'What variable can be used as controller argument to get the name of the route name?' 14 | answers: 15 | - {value: $_route, correct: true} 16 | - {value: $_controller, correct: false} 17 | - {value: $_method, correct: false} 18 | - {value: $_action, correct: false} 19 | help: | 20 | https://symfony.com/doc/current/routing.html#getting-the-route-name-and-parameters 21 | - 22 | question: 'Using XML, how to ensure that a route is accessed via HTTPS?' 23 | answers: 24 | - {value: schemes="https", correct: true} 25 | - {value: https="true", correct: false} 26 | - {value: protocol="https", correct: false} 27 | - {value: ensure="https", correct: false} 28 | help: | 29 | https://symfony.com/doc/current/routing.html#forcing-https-on-generated-urls 30 | - 31 | question: 'Which special routing parameters are available in Symfony:' 32 | answers: 33 | - {value: "_controller", correct: true} 34 | - {value: "_format", correct: true} 35 | - {value: "_fragment", correct: true} 36 | - {value: "_locale", correct: true} 37 | - {value: "_route", correct: false} 38 | help: | 39 | https://symfony.com/doc/current/routing.html#special-parameters 40 | - 41 | question: 'How to generate absolute URL for a given route in controller ?' 42 | answers: 43 | - {value: "By using UrlGeneratorInterface::ABSOLUTE_URL as third parameter for generateUrl", correct: true} 44 | - {value: "generateUrl generate absolute URL by default", correct: false} 45 | - {value: "$this->generateAbsoluteUrl()", correct: false} 46 | help: | 47 | https://symfony.com/doc/current/routing.html#generating-urls-in-controllers 48 | -------------------------------------------------------------------------------- /data/security.yml: -------------------------------------------------------------------------------- 1 | category: Security 2 | questions: 3 | - 4 | question: 'Which line is correct to add a security.access_control line?' 5 | answers: 6 | - {value: "- { path: ^/admin, roles: ROLE_ADMIN }", correct: true} 7 | - {value: "- { path: ^/admin, acl: ROLE_ADMIN }", correct: false} 8 | - {value: "- { url: ^/admin, roles: ROLE_ADMIN }", correct: false} 9 | - {value: "- { url: ^/admin, acl: ROLE_ADMIN }", correct: false} 10 | help: | 11 | https://symfony.com/doc/current/security/access_control.html#matching-options 12 | - 13 | question: 'After a login success, what is the parameter name to redirect on referer URL?' 14 | answers: 15 | - {value: security.firewalls..form_login.use_referer, correct: true} 16 | - {value: security.firewalls..form_login.after_login_referer, correct: false} 17 | - {value: security.firewalls..form_login.referer, correct: false} 18 | - {value: security.firewalls..form_login.success_referer, correct: false} 19 | help: | 20 | https://symfony.com/doc/current/security/form_login.html#using-the-referring-url 21 | - 22 | question: 'In Symfony Security component:' 23 | answers: 24 | - {value: 'Symfony\Bundle\SecurityBundle\Security\FirewallContext services are publicly created that correspond to each context you create under your security.yml, a context is called an authenticator', correct: false} 25 | - {value: 'Symfony\Bundle\SecurityBundle\Security\FirewallContext services are privately created that correspond to each context you create under your security.yml, a context is also known as per each firewall', correct: false} 26 | - {value: 'Symfony\Bundle\SecurityBundle\Security\FirewallContext services are synthetically created that correspond to each context you create under your security.yml, each context is linked to an authenticator', correct: false} 27 | - {value: 'Symfony\Bundle\SecurityBundle\Security\FirewallContext services are publicly created that correspond to each context you create under your security.yml, a context is related to each FirewallContext directly but is overall handled by a generic Symfony\Bundle\SecurityBundle\Security\Firewall object', correct: true} 28 | help: | 29 | https://symfony.com/doc/current/reference/configuration/security.html#firewalls 30 | - 31 | question: 'Is user authenticated in all of security firewalls after a successful login:' 32 | answers: 33 | - {value: 'Yes, it happens automatically', correct: false} 34 | - {value: 'Yes, if firewalls have the same value of the `context` option', correct: true} 35 | - {value: 'Yes, if option `shared` is set to true', correct: false} 36 | - {value: 'No, it is not possible, firewalls are independent from each other', correct: false} 37 | help: | 38 | https://symfony.com/doc/current/security.html#frequently-asked-questions 39 | https://symfony.com/doc/current/reference/configuration/security.html#reference-security-firewall-context 40 | - 41 | question: 'How to force a secure area to use the HTTPS protocol in the security config?' 42 | answers: 43 | - {value: 'access_control: { path: ^/secure, requires_channel: https }', correct: true} 44 | - {value: 'access_control: { path: ^/secure, use_https: true }', correct: false} 45 | - {value: 'access_control: { path: ^/secure, always_use_https: true }', correct: false} 46 | - {value: 'access_control: { path: ^/secure, schemes: [https] }', correct: false} 47 | - 48 | question: 'What is the purpose of security encoders in security.yml?' 49 | answers: 50 | - {value: 'Encode user passwords using given algorithm', correct: true} 51 | - {value: 'Encrypt a HTTP response', correct: false} 52 | - {value: 'Encode all data in the application database', correct: false} 53 | help: | 54 | https://symfony.com/doc/current/reference/configuration/security.html#encoders 55 | 56 | - 57 | question: 'Which authentication events exist in the Security component?' 58 | answers: 59 | - {value: 'security.authentication.success', correct: true} 60 | - {value: 'security.authentication.failure', correct: true} 61 | - {value: 'security.interactive_login', correct: true} 62 | - {value: 'security.login', correct: false} 63 | - {value: 'security.switch_user', correct: true} 64 | - {value: 'security.logout_on_change', correct: true} 65 | - {value: 'security.authentication.start', correct: false} 66 | - {value: 'security.remember_me_login', correct: false} 67 | help: | 68 | https://symfony.com/doc/current/components/security/authentication.html#authentication-events 69 | - 70 | question: 'What does the default strategy `affirmative` of the access decision manager mean?' 71 | answers: 72 | - {value: 'Access is granted as soon as there is one voter granting access', correct: true} 73 | - {value: 'Access is granted if there are more voters granting access than denying', correct: false} 74 | - {value: 'Access is granted if all voters grant acces', correct: false} 75 | - {value: 'Access is granted if no voters throw an exception', correct: false} 76 | help: | 77 | https://symfony.com/doc/current/components/security/authorization.html#access-decision-manager 78 | - 79 | question: 'What does the strategy `consensus` of the access decision manager mean?' 80 | answers: 81 | - {value: 'Access is granted as soon as there is one voter granting access', correct: false} 82 | - {value: 'Access is granted if there are more voters granting access than denying', correct: true} 83 | - {value: 'Access is granted if all voters grant acces', correct: false} 84 | - {value: 'Access is granted if no voters throw an exception', correct: false} 85 | help: | 86 | https://symfony.com/doc/current/components/security/authorization.html#access-decision-manager 87 | - 88 | question: 'What does the strategy `unanimous` of the access decision manager mean?' 89 | answers: 90 | - {value: 'Access is granted as soon as there is one voter granting access', correct: false} 91 | - {value: 'Access is granted if there are more voters granting access than denying', correct: false} 92 | - {value: 'Access is granted if there is no voter denying access', correct: true} 93 | - {value: 'Access is granted if no voters throw an exception', correct: false} 94 | help: | 95 | https://symfony.com/doc/current/components/security/authorization.html#access-decision-manager 96 | - 97 | question: 'What decision strategy exist ?' 98 | answers: 99 | - {value: 'affirmative', correct: true} 100 | - {value: 'consensus', correct: true} 101 | - {value: 'unanimous', correct: true} 102 | - {value: 'positive', correct: false} 103 | - {value: 'negative', correct: false} 104 | help: | 105 | https://symfony.com/doc/current/components/security/authorization.html#access-decision-manager 106 | - 107 | question: 'How to Restrict Firewalls to a Specific Request Pattern ?' 108 | answers: 109 | - {value: 'pattern: ^/(myurl)/', correct: true} 110 | - {value: 'route: ^/(myurl)/', correct: false} 111 | - {value: 'url: ^/(myurl)/', correct: false} 112 | - {value: 'path: ^/(myurl)/', correct: false} 113 | help: | 114 | https://symfony.com/doc/current/security/firewall_restriction.html#restricting-by-path 115 | - 116 | 117 | #CHECKME obsolete answers ? 118 | #@Security(has_roles() -> @Security(is_granted() symfony 5 119 | question: 'Which annotation is valid to check role ?' 120 | answers: 121 | # - {value: '@Security("has_role("ROLE_ADMIN")")', correct: true} 122 | - {value: '@Security("is_granted("ROLE_ADMIN")")', correct: true} 123 | - {value: '@IsGranted("ROLE_ADMIN")', correct: true} 124 | - {value: '@Security("restrict_for("ROLE_ADMIN")")', correct: false} 125 | - {value: '@Security("role("ROLE_ADMIN")")', correct: false} 126 | - 127 | question: 'Which default role exist ?' 128 | answers: 129 | - {value: 'IS_AUTHENTICATED_REMEMBERED', correct: true} 130 | - {value: 'IS_AUTHENTICATED_FULLY', correct: true} 131 | - {value: 'IS_AUTHENTICATED_ANONYMOUSLY', correct: true} 132 | - {value: 'IS_NOT_AUTHENTICATED', correct: false} 133 | help: | 134 | https://symfony.com/doc/current/components/security/authorization.html#authenticatedvoter 135 | - 136 | #CHECKME obsolete answers ? 137 | #@Security(has_roles() -> @Security(is_granted() symfony 5 138 | # security.authorization_checker > gone from doc 139 | question: 'How can you deny access to user in your controller ?' 140 | answers: 141 | - {value: "$this->denyAccessUnlessGranted('ROLE_ADMIN')", correct: true} 142 | - {value: '@Security("is_granted("ROLE_ADMIN")")', correct: true} 143 | # - {value: "if (!$this->get('security.authorization_checker')->isGranted('ROLE_ADMIN')) { throw $this->createAccessDeniedException(); }", correct: true} 144 | - {value: "$this->user->denyAccessUnlessGranted('ROLE_ADMIN')", correct: false} 145 | - 146 | question: 'For implements Symfony\Component\Security\Core\User\UserInterface which method you have to define ?' 147 | answers: 148 | - {value: "getRoles()", correct: true} 149 | - {value: "getSalt()", correct: true} 150 | - {value: "getUsername()", correct: true} 151 | - {value: "eraseCredentials()", correct: true} 152 | - {value: "getCredentials()", correct: false} 153 | - {value: "getHash()", correct: false} 154 | - {value: "getId()", correct: false} 155 | help: | 156 | https://github.com/symfony/symfony/blob/master/src/Symfony/Component/Security/Core/User/UserInterface.php 157 | - 158 | question: 'For implements Symfony\Component\Security\Core\User\UserProviderInterface which method you have to define ?' 159 | answers: 160 | - {value: "loadUserByUsername($username)", correct: true} 161 | - {value: "loadUser($username)", correct: false} 162 | - {value: "refreshUser(UserInterface $user)", correct: true} 163 | - {value: "getUser($username)", correct: false} 164 | - {value: "supports($class)", correct: false} 165 | - {value: "supportsClass($class)", correct: true} 166 | help: | 167 | https://symfony.com/doc/current/security/user_provider.html#creating-a-custom-user-provider 168 | -------------------------------------------------------------------------------- /data/standardization.yml: -------------------------------------------------------------------------------- 1 | category: Standardization 2 | questions: 3 | - 4 | # FIXME didnt find relevant doc to answer 5 | question: 'Using Console, what is the correct filename for a command?' 6 | answers: 7 | - {value: "MyTestCommand.php", correct: true} 8 | - {value: "CommandMyTest.php", correct: false} 9 | - {value: "MyTestConsoleCommand.php", correct: true} 10 | - {value: "MyTestCommandConsole.php", correct: false} 11 | -------------------------------------------------------------------------------- /data/validation.yml: -------------------------------------------------------------------------------- 1 | category: Validation 2 | questions: 3 | - 4 | question: 'In order to use validation group, which interface will you implement on your object?' 5 | answers: 6 | - {value: Symfony\Component\Validator\GroupValidationInterface, correct: false} 7 | - {value: Symfony\Component\Validator\GroupValidationProviderInterface, correct: false} 8 | - {value: Symfony\Component\Validator\GroupProviderInterface, correct: false} 9 | - {value: Symfony\Component\Validator\GroupSequenceProviderInterface, correct: true} 10 | help: | 11 | https://symfony.com/doc/current/validation/sequence_provider.html#group-sequence-providers 12 | - 13 | question: 'Using Validator component, which method is used to validate a value against a constraint?' 14 | answers: 15 | - {value: "$validator->validate($object, $constraint)", correct: true} 16 | - {value: "$validator->validateValue($object, $constraint)", correct: false} 17 | - {value: "$validator->isValid($object, $constraint)", correct: false} 18 | - {value: "$validator->validation($object, $constraint)", correct: false} 19 | help: | 20 | https://symfony.com/doc/current/components/validator.html#installation 21 | - 22 | question: 'True or False ? All entities have at least 2 validation groups.' 23 | answers: 24 | - {value: "True", correct: true} 25 | - {value: "False", correct: false} 26 | help: | 27 | https://symfony.com/doc/current/validation/groups.html 28 | - 29 | question: 'True or False ? We can also apply constraints on class getters with ``addPropertyConstraint()``' 30 | answers: 31 | - {value: "True", correct: false} 32 | - {value: "False", correct: true} 33 | help: | 34 | https://symfony.com/doc/current/components/validator/metadata.html 35 | - 36 | question: 'True or False ? We can also apply constraints on class getters with ``addGetterConstraint()``' 37 | answers: 38 | - {value: "True", correct: true} 39 | - {value: "False", correct: false} 40 | help: | 41 | https://symfony.com/doc/current/components/validator/metadata.html 42 | - 43 | question: 'Which of these sentences is true ? In Symfony:' 44 | answers: 45 | - {value: "Annotations mapping are enabled by default", correct: false} 46 | - {value: "UniqueEntity is provided by Doctrine Bundle", correct: false} 47 | - {value: "We can validate partial object with @Assert\\GroupSequence", correct: true} 48 | - {value: "All assertions above are valid", correct: false} 49 | help: | 50 | https://symfony.com/doc/current/reference/constraints/UniqueEntity.html 51 | https://symfony.com/doc/current/validation/sequence_provider.html 52 | https://symfony.com/doc/current/validation.html#configuration 53 | - 54 | question: 'Which constraints exist?' 55 | answers: 56 | - {value: "Blank", correct: true} 57 | - {value: "IdenticalTo", correct: true} 58 | - {value: "EqualTo", correct: true} 59 | - {value: "SameAs", correct: false} 60 | help: | 61 | https://symfony.com/doc/current/reference/constraints.html 62 | - 63 | question: 'Which annotation are valid ?' 64 | answers: 65 | - {value: '@Assert\Choice({"male", "female", "other"})', correct: true} 66 | - {value: '@Assert\Choice(choices = {"male", "female", "other"})', correct: true} 67 | - {value: '@Assert\Choices({"male", "female", "other"})', correct: false} 68 | - {value: '@Assert\Choices(choices = {"male", "female", "other"})', correct: false} 69 | help: | 70 | https://symfony.com/doc/current/reference/constraints/Choice.html#basic-usage 71 | - 72 | question: 'How to tell the validator to use a specific group ?' 73 | answers: 74 | - {value: 'pass one or more group names as the third argument of $validator->validate()', correct: true} 75 | - {value: 'pass one or more group names as the second argument of $validator->validate()', correct: false} 76 | - {value: 'use $validator->setValidationGroups(array)', correct: false} 77 | help: | 78 | https://symfony.com/doc/current/validation/groups.html 79 | -------------------------------------------------------------------------------- /data/yaml.yml: -------------------------------------------------------------------------------- 1 | category: Yaml 2 | questions: 3 | - 4 | question: | 5 | What can be placed in ????? to be valid? 6 | 7 | use Symfony\Component\Yaml\Yaml; 8 | 9 | $value = Yaml::parse(?????); 10 | answers: 11 | - {value: '"/path/to/file.yml"', correct: false} 12 | - {value: 'file_get_contents("/path/to/file.yml")', correct: true} 13 | - {value: 'Both are valid', correct: false} 14 | help: | 15 | https://symfony.com/doc/current/components/yaml.html#reading-yaml-contents 16 | --------------------------------------------------------------------------------