Skip to content

Commit

Permalink
fix questions (#50)
Browse files Browse the repository at this point in the history
* fix questions, remove html, one question

---------

Co-authored-by: lacpandore <[email protected]>
  • Loading branch information
Louis-Arnaud and lacpandore authored Sep 25, 2024
1 parent 432a8b8 commit c6357f9
Show file tree
Hide file tree
Showing 19 changed files with 44 additions and 70 deletions.
18 changes: 9 additions & 9 deletions data/Console/built_in_helpers.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ questions:
answers:
- { value: $cursor->moveRight(3);, correct: true }
- { value: $cursor->moveRight()->moveRight()->moveRight();, correct: true }
- { value: '$cursor->moveToPosition( $cursor->getCurrentPosition()[0], $cursor->getCurrentPosition()[1] + 3 );', correct: true }
- { value: '$cursor->moveToPosition( $cursor->getCurrentPosition()[0], $cursor->getCurrentPosition()[1] + 3 );', correct: true }
help: 'https://symfony.com/doc/current/components/console/helpers/cursor.html#moving-the-cursor'
-
uuid: 1eebf878-8ba5-6be8-a74b-99d84c92580c
Expand All @@ -51,7 +51,7 @@ questions:
help: 'https://symfony.com/doc/current/components/console/helpers/formatterhelper.html'
-
uuid: 1eebf878-8ba5-6c74-a208-99d84c92580c
question: 'What is the correct way to truncate a message in a console with the formater helper ? $message = This is a very long message, which should be truncated ; to $message = This is a very long message, which should be!! ;'
question: 'What is the correct way to truncate a message in a console with the formater helper ? $message = This is a very long message, which should be truncated ; to $message = This is a very long message, which should be!! ;'
answers:
- { value: "$formatter->truncate($message, 44, '!!');", correct: true }
- { value: "$formatter->truncateMessage($message, -10, '!!');", correct: false }
Expand Down Expand Up @@ -85,7 +85,7 @@ questions:
help: 'https://symfony.com/doc/current/components/console/helpers/table.html#modifying-rendered-tables'
-
uuid: 1eebf878-8ba5-6e2c-93d3-99d84c92580c
question: 'What is the parameter option to give to $table = new Table(XXX); in a console ?'
question: 'What is the parameter option to give to $table = new Table(XXX); in a console ?'
answers:
- { value: 'int $length, the number of lines for the table', correct: false }
- { value: OutputInterface, correct: true }
Expand All @@ -94,7 +94,7 @@ questions:
help: 'https://symfony.com/doc/current/components/console/helpers/table.html'
-
uuid: 1eebf878-8ba5-6e7c-b3dd-99d84c92580c
question: 'In a console, what kind of Question could you have as a third argument in this question ? $helper->ask($input, $output, $question);'
question: 'In a console, what kind of Question could you have as a third argument in this question ? $helper->ask($input, $output, $question);'
answers:
- { value: Symfony\Component\Console\Question\ChoiceQuestion, correct: true }
- { value: Symfony\Component\Console\Question\ConfirmationQuestion, correct: true }
Expand All @@ -119,15 +119,15 @@ questions:
help: 'https://symfony.com/doc/current/components/console/helpers/questionhelper.html#validating-the-answer'
-
uuid: 1eebf878-8ba5-6f62-b189-99d84c92580c
question: 'What is the method to set the given value in the QuestionHelper for a test in the given tester: $commandTester = new CommandTester($command);'
question: 'What is the method to set the given value in the QuestionHelper for a test in the given tester: $commandTester = new CommandTester($command);'
answers:
- { value: '$commandTester->setAnswer([ Test ]);', correct: false }
- { value: '$commandTester->setGivenValue([ Test ]);', correct: false }
- { value: '$commandTester->setInputs([ Test ]);', correct: true }
help: 'https://symfony.com/doc/current/components/console/helpers/questionhelper.html#testing-a-command-that-expects-input'
-
uuid: 1eebf878-8ba5-6ff8-80bd-99d84c92580c
question: "In a question in your command, what is the way to set a list of valid values autocompletable that the user can answer to this question ? $question = new Question('Please enter the name of a bundle', 'FooBundle'); $bundles = ['AcmeDemoBundle', 'AcmeBlogBundle', 'AcmeStoreBundle'];"
question: "In a question in your command, what is the way to set a list of valid values autocompletable that the user can answer to this question ? $question = new Question('Please enter the name of a bundle', 'FooBundle'); $bundles = ['AcmeDemoBundle', 'AcmeBlogBundle', 'AcmeStoreBundle'];"
answers:
- { value: $question->setPossibleAnswers($bundles);, correct: false }
- { value: $question->setAutocomplete($bundles);, correct: false }
Expand All @@ -154,7 +154,7 @@ questions:
help: 'https://symfony.com/doc/current/components/console/helpers/progressbar.html#customizing-the-progress-bar'
-
uuid: 1eebf878-8ba6-60de-91d5-99d84c92580c
question: 'For performance reasons, symfony redraws the screen once every XXXXms. If this is too fast or too slow for your application, use the methods minSecondsBetweenRedraws() and maxSecondsBetweenRedraws(): How much is XXX ?'
question: 'For performance reasons, symfony redraws the screen once every XXXXms. If this is too fast or too slow for your application, use the methods minSecondsBetweenRedraws() and maxSecondsBetweenRedraws(): How much is XXX ?'
answers:
- { value: '50 ms', correct: false }
- { value: '80 ms', correct: false }
Expand All @@ -169,13 +169,13 @@ questions:
answers:
- { value: "$helper->run($output, 'figlet Symfony');", correct: true }
- { value: "$helper->run($output, ['figlet', 'Symfony']);", correct: true }
- { value: "$process = new Process(['figlet', 'Symfony']); $helper->run($output, $process);", correct: true }
- { value: "$process = new Process(['figlet', 'Symfony']); $helper->run($output, $process);", correct: true }
help: 'https://symfony.com/doc/current/components/console/helpers/processhelper.html'
-
uuid: 1eebf878-8ba6-6174-a67f-99d84c92580c
question: "How can you customize the error message when using the Process Helper's run() method, such as in $helper->run($output, 'ls')?"
answers:
- { value: "by adding ->setInvalidMesage($errorMessage) on run method like $helper->run($output, $process')->setInvalidMessage('Failed);", correct: false }
- { value: "by adding ->setInvalidMesage($errorMessage) on run method like $helper->run($output, $process')->setInvalidMessage('Failed);", correct: false }
- { value: 'by adding a third argument $helper->run($output, $process, Failed );', correct: true }
- { value: 'By overring the message of the ProcessHelperException', correct: false }
help: 'https://symfony.com/doc/current/components/console/helpers/processhelper.html#customized-display'
12 changes: 6 additions & 6 deletions data/Console/custom_commands.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ questions:
uuid: 1eebf878-8b99-6bea-907b-99d84c92580c
question: 'Which of the following constants from Symfony\Component\Console\Input\InputArgument do not exist?'
answers:
- {value: 'REQUIRED', correct: false}
- {value: 'NEGATABLE', correct: true}
- {value: 'IS_ARRAY', correct: false}
- {value: 'OPTIONAL', correct: false}
- {value: 'NONE', correct: true}
- { value: REQUIRED, correct: false }
- { value: NEGATABLE, correct: true }
- { value: IS_ARRAY, correct: false }
- { value: OPTIONAL, correct: false }
- { value: NONE, correct: true }
help: 'https://github.com/symfony/console/blob/7.0/Input/InputArgument.php'
-
uuid: 1eebf878-8b9b-61b6-82fd-99d84c92580c
Expand Down Expand Up @@ -44,7 +44,7 @@ questions:
help: 'https://symfony.com/doc/current/console.html#creating-a-command'
-
uuid: 1eebf878-8ba3-6b36-baf6-99d84c92580c
question: "What needs to be done to register a custom command so it can be executed and listed when you execute php bin/console list ?"
question: 'What needs to be done to register a custom command so it can be executed and listed when you execute php bin/console list ?'
answers:
- { value: 'Add it to the registerCommands() method in the AppKernel class', correct: false }
- { value: 'Define the command as a service and tag it with kernel.command.', correct: false }
Expand Down
10 changes: 0 additions & 10 deletions data/Console/options_and_arguments.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,3 @@ questions:
- { value: 'False', correct: true }
- { value: 'True', correct: false }
help: 'https://github.com/symfony/symfony/blob/6.4/src/Symfony/Component/Console/Command/Command.php#L544'
-
uuid: 1eebf878-8ba4-6202-a4b0-99d84c92580c
question: "Given a command that requires answering to a multiple choices question, how could the inputs (marked as ???) be set in a test? final class CommandTest extends TestCase { public function testExecute(): void { $commandTester = new CommandTester($command); $commandTester->setInputs(???); $commandTester->execute([ 'command' => $command->getName(), ]); } }"
answers:
- {value: '["first_input" && "second_input"]', correct: false}
- {value: '["first_input, second_input"]', correct: false}
- {value: '["first_input">>"second_input"]', correct: false}
- {value: 'It"s not possible', correct: false}
- {value: '["first_input", "second_input"]', correct: true}
help: 'https://symfony.com/doc/current/components/console/helpers/questionhelper.html#testing-a-command-that-expects-input'
16 changes: 8 additions & 8 deletions data/Console/verbosity_levels.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,17 @@ questions:
uuid: 1eebf878-8ba5-68c8-80d0-99d84c92580c
question: 'In a console, what are the available methods to show messages only in a case of verbosity ?'
answers:
- {value: 'isQuiet()', correct: true}
- {value: 'normal()', correct: false}
- {value: 'isVerbose()', correct: true}
- {value: 'isVeryVerbose()', correct: true}
- {value: 'isVeryVeryVerbose()', correct: false}
- {value: 'isDebug()', correct: true}
- {value: 'isVeryDebug()', correct: false}
- { value: isQuiet(), correct: true }
- { value: normal(), correct: false }
- { value: isVerbose(), correct: true }
- { value: isVeryVerbose(), correct: true }
- { value: isVeryVeryVerbose(), correct: false }
- { value: isDebug(), correct: true }
- { value: isVeryDebug(), correct: false }
help: 'https://symfony.com/doc/current/console/verbosity.html'
-
uuid: 1eebf878-8ba5-690e-84ef-99d84c92580c
question: "Is this a correct way to print information in a console for a verbose level or higher ? $output->writeln(OutputInterface::VERBOSITY_VERBOSE, 'Printed in verbose mode or higher');"
question: "Is this a correct way to print information in a console for a verbose level or higher ? $output->writeln(OutputInterface::VERBOSITY_VERBOSE, 'Printed in verbose mode or higher');"
answers:
- { value: 'Yes', correct: false }
- { value: 'No', correct: true }
Expand Down
2 changes: 1 addition & 1 deletion data/forms/form_types.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ questions:
help: 'https://symfony.com/doc/current/reference/forms/types/money.html'
-
uuid: 1eebf878-8b99-6c30-8ce8-99d84c92580c
question: 'Which option should you use to render a DateType form type as an HTML5 ?'
question: 'Which option should you use to render a DateType form type as an HTML5 <input type= date >?'
answers:
- { value: no_javascript, correct: false }
- { value: type_date, correct: false }
Expand Down
2 changes: 1 addition & 1 deletion data/http_caching/expiration_expires_cache_control.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
questions:
-
uuid: 1eebf878-8b99-65a0-956f-99d84c92580c
question: 'Given the following header, will the resource be considered as fresh? Expires: 0'
question: 'Given the following header, will the resource be considered as fresh? Expires: 0 '
answers:
- { value: 'Yes', correct: false }
- { value: 'No', correct: true }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,10 +124,10 @@ questions:
uuid: 1eebf878-8ba3-61e0-9460-99d84c92580c
question: 'How to specify the date format for a date attribute in a serialization context ?'
answers:
- { value: "#[Serializer\Context([DateTimeNormalizer::FORMAT_KEY => 'Y-m-d'])] public \DateTime $date;", correct: true }
- { value: "#[Serializer\\Context([DateTimeNormalizer::FORMAT_KEY => 'Y-m-d'])] public DateTime $date;", correct: true }
- { value: "It's not possible", correct: false }
- { value: "/** @Serializer\Context({ DateTimeNormalizer::FORMAT_KEY = 'Y-m-d' }) */ public \DateTime $date;", correct: true }
- { value: "/** @Serializer\DateFormat('Y-m-d' ) */ public \DateTime $date;", correct: false }
- { value: "/** @Serializer\\Context({ DateTimeNormalizer::FORMAT_KEY = 'Y-m-d' }) */ public DateTime $date;", correct: true }
- { value: "/** @Serializer\\DateFormat('Y-m-d' ) */ public DateTime $date;", correct: false }
help: 'https://symfony.com/doc/current/serializer.html#serializer-context'
-
uuid: 1eebf878-8ba3-68f2-a0ce-99d84c92580c
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,4 @@
questions:
-
uuid: 1eebf878-8ba9-646e-93a2-99d84c92580c
question: "What will be the output of this ? $message = ''; $example = function ($arg) use ($message) { var_dump($arg . ' ' . $message); }; $example( hello );"
answers:
- { value: hello, correct: true }
- { value: 'Fatal Error', correct: false }
- { value: 'Hello World', correct: false }
help: 'https://www.php.net/manual/en/functions.anonymous.php'
-
uuid: 1eebf878-8ba9-6536-8861-99d84c92580c
question: 'What will be the output of this ? $result = 0; echo function() { var_dump($result); };'
Expand Down
4 changes: 2 additions & 2 deletions data/php_and_web_security/namespaces.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,15 @@ questions:
help: 'https://github.com/symfony/symfony/tree/master/src/Symfony'
-
uuid: 1eebf878-8ba9-63d8-874d-99d84c92580c
question: 'Where is the Test Class ? namespace Foo\Bar; use Foo\Test;'
question: 'Where is the Test Class ? namespace Foo\Bar; use Foo\Test;'
answers:
- { value: 'in Foo\Test', correct: true }
- { value: 'in Foo\Bar', correct: false }
- { value: 'in Foo\Bar\Foo\Test', correct: false }
help: 'https://www.php.net/manual/en/language.oop5.traits.php#113047'
-
uuid: 1eebf878-8ba9-641e-8f50-99d84c92580c
question: "Where is the Test Class ? namespace Foo\Bar; class SomeClass { use Foo\Test; }"
question: 'Where is the Test Class ? namespace Foo\Bar; class SomeClass { use Foo\Test; }'
answers:
- { value: Foo\Bar, correct: false }
- { value: Foo\Bar\Foo\Test, correct: true }
Expand Down
2 changes: 1 addition & 1 deletion data/php_and_web_security/object_oriented_programming.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ questions:
help: 'https://php.net/manual/en/language.oop5.static.php'
-
uuid: 1eebf878-8ba2-6934-ad03-99d84c92580c
question: "What will be the output of the following code? class Foo { const BAR = 4+1 } echo Foo::BAR;"
question: 'What will be the output of the following code? class Foo { const BAR = 4+1 } echo Foo::BAR;'
answers:
- { value: 'An error', correct: false }
- { value: '1', correct: false }
Expand Down
2 changes: 1 addition & 1 deletion data/php_and_web_security/php_extensions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ questions:
help: 'https://www.php.net/manual/en/function.header.php'
-
uuid: 1eebf878-8ba5-624c-866b-99d84c92580c
question: 'What is the output ? $a = "0"; echo strlen($a); echo empty($a) ? $a : 5; echo $a ?: 5;'
question: "What is the output ? $a = '0' ; echo strlen($a); echo empty($a) ? $a : 5; echo $a ?: 5;"
answers:
- { value: '100', correct: false }
- { value: '005', correct: false }
Expand Down
4 changes: 2 additions & 2 deletions data/php_and_web_security/phpapi_up_to_php81_version.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ questions:
help: 'https://www.php.net/manual/en/function.extract.php'
-
uuid: 1eebf878-8b9c-6656-8085-99d84c92580c
question: "Which function would best parse the following string by the tab (\\t) and newline (\\n) characters ?$string = John\\tMark\\nTed\\tLarry ;"
question: 'Which function would best parse the following string by the tab (\t) and newline (\n) characters ? $string = John\tMark\nTed\tLarry ;'
answers:
- { value: 'explode($string, \t\n );', correct: false }
- { value: strtok($string);, correct: true }
Expand Down Expand Up @@ -272,7 +272,7 @@ questions:
help: 'https://www.php.net/manual/en/language.operators.comparison.php'
-
uuid: 1eebf878-8ba3-6dc0-bb50-99d84c92580c
question: "What is the most recommended way to count the number of occurences of each unique value in the following array?\_$a=[1,1,2,3,4,4,5,6,6,6,3,2,2,2];"
question: "What is the most recommended way to count the number of occurences of each unique value in the following array? $a=[1,1,2,3,4,4,5,6,6,6,3,2,2,2];"
answers:
- { value: '$ = array_unique($a);$k = array_fill(0,count($k), 0);$n = array_combine($k, $v);reset($a);for($i =0; $i < count($a); $i++){++$n[current($a)];', correct: false }
- { value: '$n = array_count_values($a);', correct: true }
Expand Down
8 changes: 0 additions & 8 deletions data/php_and_web_security/traits.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,6 @@ questions:
- { value: 'Yes', correct: false }
- { value: 'No', correct: true }
help: 'https://www.php.net/manual/en/language.oop5.traits.php'
-
uuid: 1eebf878-8ba9-6072-929e-99d84c92580c
question: "What will the output of this function ? trait HelloWorld { public function sayHello() { echo 'Hello World!' } } class TheWorldIsNotEnough { use HelloWorld public function sayHello() { echo 'Hello Universe!'; } } $o= new TheWorldIsNotEnough(); $o->sayHello();"
answers:
- { value: 'Hello World!', correct: false }
- { value: 'Hello Universe!', correct: true }
- { value: 'Fatal Error', correct: false }
help: 'https://www.php.net/manual/en/language.oop5.traits.php'
-
uuid: 1eebf878-8ba9-6108-8a3b-99d84c92580c
question: "To resolve naming conflicts between Traits used in the same class, what's the operator needed to be used to choose exactly one of the conflicting methods ?"
Expand Down
2 changes: 1 addition & 1 deletion data/routing/router_debugging.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
questions:
-
uuid: 1eebf878-8ba4-66d0-9c83-99d84c92580c
question: "php bin/console debug:router XXXXXX What's the argument after this command in XXXXXX ?"
question: "What's the argument after php bin/console debug:router ?"
answers:
- { value: 'No arguments', correct: true }
- { value: 'a specific path', correct: false }
Expand Down
2 changes: 1 addition & 1 deletion data/security/password_hashers.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ questions:
help: 'https://symfony.com/doc/current/security/passwords.html#configuring-a-password-hasher'
-
uuid: 1eebf878-8ba6-62f0-a65c-99d84c92580c
question: 'What is the interface you need to call in your controller to get the $passwordHasher ? $hashedPassword = $passwordHasher->hashPassword( $user, $plaintextPassword ); $user->setPassword($hashedPassword);'
question: 'What is the interface you need to call in your controller to get the $passwordHasher ? $hashedPassword = $passwordHasher->hashPassword( $user, $plaintextPassword );'
answers:
- { value: UserPasswordHasherInterface, correct: true }
- { value: HasherInterface, correct: false }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ questions:
uuid: 1eebf878-8b96-6eea-8d09-99d84c92580c
question: 'In which order does Symfony trigger the following events?'
answers:
- { value: kernel.requestkernel.controllerkernel.controller_argumentskernel.viewkernel.responsekernel.finish_requestkernel.terminate, correct: true }
- { value: kernel.requestkernel.controllerkernel.controller_argumentskernel.viewkernel.responsekernel.terminatekernel.finish_request, correct: false }
- { value: kernel.requestkernel.controllerkernel.controller_argumentskernel.responsekernel.viewkernel.terminatekernel.finish_request, correct: false }
- { value: kernel.requestkernel.controllerkernel.controller_argumentskernel.responsekernel.viewkernel.finish_requestkernel.terminate, correct: false }
- { value: 'kernel.request, kernel.controller, kernel.controller_arguments, kernel.view, kernel.response, kernel.finish_request, kernel.terminate', correct: true }
- { value: 'kernel.request, kernel.controller, kernel.controller_arguments, kernel.view, kernel.response, kernel.terminate, kernel.finish_request', correct: false }
- { value: 'kernel.request, kernel.controller, kernel.controller_arguments, kernel.response, kernel.view, kernel.terminate, kernel.finish_request', correct: false }
- { value: 'kernel.request, kernel.controller, kernel.controller_arguments, kernel.response, kernel.view, kernel.finish_request, kernel.terminate', correct: false }
help: 'https://symfony.com/doc/current/components/http_kernel.html#creating-an-event-listener'
-
uuid: 1eebf878-8b97-658e-8993-99d84c92580c
Expand Down
Loading

0 comments on commit c6357f9

Please sign in to comment.