From 26fdbe05e409e542954610368b6428a7d9f1a0b8 Mon Sep 17 00:00:00 2001 From: Robin Chalas Date: Sat, 28 May 2016 09:43:00 +0200 Subject: [PATCH 01/25] [Console] Adapt doc for easier testing of commands needing user inputs Fix missing colon Change userInputs to inputs Try to fix platformsh build Re-add useful use statements Fixed typo, use FQCN::method Rollback not useful diff Formatting Add more examples, precise documentation typo 'would have type' => 'would have typed' removing an ending dot in comment for consistency --- components/console/helpers/questionhelper.rst | 34 ++++++++++--------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/components/console/helpers/questionhelper.rst b/components/console/helpers/questionhelper.rst index 6ea453beeb7..006787c1da6 100644 --- a/components/console/helpers/questionhelper.rst +++ b/components/console/helpers/questionhelper.rst @@ -277,7 +277,7 @@ Testing a Command that Expects Input ------------------------------------ If you want to write a unit test for a command which expects some kind of input -from the command line, you need to set the helper input stream:: +from the command line, you need to set the inputs that the command expects:: use Symfony\Component\Console\Helper\QuestionHelper; use Symfony\Component\Console\Helper\HelperSet; @@ -289,26 +289,28 @@ from the command line, you need to set the helper input stream:: // ... $commandTester = new CommandTester($command); - $helper = $command->getHelper('question'); - $helper->setInputStream($this->getInputStream("Test\n")); // Equals to a user inputting "Test" and hitting ENTER - // If you need to enter a confirmation, "yes\n" will work + $commandTester->setInputs(array('Test')); + + // Equals to a user inputting "This", "That" and hitting ENTER + // This can be used for answering two separated questions for instance + $commandTester->setInputs(array('This', 'That')); + + // For simulating a positive answer to a confirmation question, adding an + // additional input saying "yes" will work + $commandTester->setInputs(array('yes')); $commandTester->execute(array('command' => $command->getName())); // $this->assertRegExp('/.../', $commandTester->getDisplay()); } - protected function getInputStream($input) - { - $stream = fopen('php://memory', 'r+', false); - fputs($stream, $input); - rewind($stream); - - return $stream; - } +By calling :method:`Symfony\\Component\\Console\\Tester\\CommandTester::setInputs`, +you imitate what the console would do internally with all user input through the CLI. +This method takes an array as only argument with, for each input that the command expects, +a string representing what the user would have typed. +This way you can test any user interaction (even complex ones) by passing the appropriate inputs. -By setting the input stream of the ``QuestionHelper``, you imitate what the -console would do internally with all user input through the CLI. This way -you can test any user interaction (even complex ones) by passing an appropriate -input stream. +.. note:: + The :class:`Symfony\\Component\\Console\\Tester\\CommandTester` automatically simulates a user + hitting ``ENTER`` after each input, no need for passing an additional input. From 6e4b3a08cf727dc7061c3497ee0124954def415e Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Thu, 30 Jun 2016 18:59:29 +0200 Subject: [PATCH 02/25] [#6623] fix note directive --- components/console/helpers/questionhelper.rst | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/components/console/helpers/questionhelper.rst b/components/console/helpers/questionhelper.rst index 006787c1da6..9c9284f2768 100644 --- a/components/console/helpers/questionhelper.rst +++ b/components/console/helpers/questionhelper.rst @@ -312,5 +312,7 @@ a string representing what the user would have typed. This way you can test any user interaction (even complex ones) by passing the appropriate inputs. .. note:: - The :class:`Symfony\\Component\\Console\\Tester\\CommandTester` automatically simulates a user - hitting ``ENTER`` after each input, no need for passing an additional input. + + The :class:`Symfony\\Component\\Console\\Tester\\CommandTester` automatically + simulates a user hitting ``ENTER`` after each input, no need for passing + an additional input. From 34a3166f0202f4a025fb8c4593eb5dfb10284dce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Machulda?= Date: Wed, 25 May 2016 17:15:41 +0200 Subject: [PATCH 03/25] Routes should be just imported, not mounted --- cookbook/configuration/micro-kernel-trait.rst | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/cookbook/configuration/micro-kernel-trait.rst b/cookbook/configuration/micro-kernel-trait.rst index b1498d2bb1e..74a89b24590 100644 --- a/cookbook/configuration/micro-kernel-trait.rst +++ b/cookbook/configuration/micro-kernel-trait.rst @@ -194,15 +194,12 @@ to hold the kernel. Now it looks like this:: { // import the WebProfilerRoutes, only if the bundle is enabled if (isset($this->bundles['WebProfilerBundle'])) { - $routes->mount('/_wdt', $routes->import('@WebProfilerBundle/Resources/config/routing/wdt.xml')); - $routes->mount('/_profiler', $routes->import('@WebProfilerBundle/Resources/config/routing/profiler.xml')); + $routes->import('@WebProfilerBundle/Resources/config/routing/wdt.xml', '/_wdt'); + $routes->import('@WebProfilerBundle/Resources/config/routing/profiler.xml', '/_profiler'); } // load the annotation routes - $routes->mount( - '/', - $routes->import(__DIR__.'/../src/App/Controller/', '/', 'annotation') - ); + $routes->import(__DIR__.'/../src/App/Controller/', '/', 'annotation'); } } From 3150d2a424776030b13bb859ce0322112f211e0f Mon Sep 17 00:00:00 2001 From: WouterJ Date: Sat, 2 Jul 2016 15:00:16 +0200 Subject: [PATCH 04/25] added June changelog --- changelog.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/changelog.rst b/changelog.rst index 56fddcb4daf..12bb4726df6 100644 --- a/changelog.rst +++ b/changelog.rst @@ -20,6 +20,7 @@ New Documentation ~~~~~~~~~~~~~~~~~ * `#6515 `_ Added the documentation for the Cache component (javiereguiluz) +* `#6623 `_ [Console] Adapt doc for easier testing of commands needing user inputs (chalasr) * `#6690 `_ Added an example for a different method of verbosity level usage. (smatyas) * `#6648 `_ Process: callbacks now allowed when output disabled (avindra) * `#6587 `_ Updating recommended email settings for monolog (jorgelbg) From be5e95113f0cad816820a95463e7433193774337 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Fri, 8 Jul 2016 19:40:02 +0200 Subject: [PATCH 05/25] Document the file() controller helper --- book/controller.rst | 41 +++++++++++++++++++++++++++++++++++++---- 1 file changed, 37 insertions(+), 4 deletions(-) diff --git a/book/controller.rst b/book/controller.rst index f1b65ae09aa..85561039b6e 100644 --- a/book/controller.rst +++ b/book/controller.rst @@ -782,6 +782,12 @@ There are also special classes to make certain kinds of responses easier: :class:`Symfony\\Component\\HttpFoundation\\StreamedResponse`. See :ref:`streaming-response`. +.. seealso:: + + Now that you know the basics you can continue your research on Symfony + ``Request`` and ``Response`` object in the + :ref:`HttpFoundation component documentation `. + JSON Helper ~~~~~~~~~~~ @@ -806,11 +812,38 @@ If the :doc:`serializer service ` is enabled in your application, contents passed to ``json()`` are encoded with it. Otherwise, the :phpfunction:`json_encode` function is used. -.. seealso:: +File helper +~~~~~~~~~~~ - Now that you know the basics you can continue your research on Symfony - ``Request`` and ``Response`` object in the - :ref:`HttpFoundation component documentation `. +.. versionadded:: 3.2 + The ``file()`` helper was introduced in Symfony 3.2. + +You can use the :method:`Symfony\\Bundle\\FrameworkBundle\\Controller\\Controller::file` +helper to serve a file from inside a controller:: + + public function fileAction() + { + // send the file contents and force the browser to download it + return $this->file('/path/to/some_file.pdf'); + } + +The ``file()`` helper provides some arguments to configure its behavior:: + + use Symfony\Component\HttpFoundation\File\File; + use Symfony\Component\HttpFoundation\ResponseHeaderBag; + + public function fileAction() + { + // load the file from the filesystem + $file = new File('/path/to/some_file.pdf'); + return $this->file($file); + + // rename the downloaded file + return $this->file($file, 'custom_name.pdf'); + + // display the file contents in the browser instead of downloading it + return $this->file('invoice_3241.pdf', 'my_invoice.pdf', ResponseHeaderBag::DISPOSITION_INLINE); + } Creating Static Pages --------------------- From d40985d35d1a16e19707df4df8fceb107d43d465 Mon Sep 17 00:00:00 2001 From: WouterJ Date: Sat, 9 Jul 2016 10:49:30 +0200 Subject: [PATCH 06/25] [#6737] Fix CS --- book/controller.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/book/controller.rst b/book/controller.rst index 85561039b6e..2ed860564af 100644 --- a/book/controller.rst +++ b/book/controller.rst @@ -836,6 +836,7 @@ The ``file()`` helper provides some arguments to configure its behavior:: { // load the file from the filesystem $file = new File('/path/to/some_file.pdf'); + return $this->file($file); // rename the downloaded file From 86bb5acfb0239daac706a07de69865f081975fcb Mon Sep 17 00:00:00 2001 From: Qiangjun Ran Date: Mon, 11 Jul 2016 23:22:06 +0800 Subject: [PATCH 07/25] Fix web/front.php $controller always return false. $controller = $controllerResolver->getController($request); $arguments = $argumentResolver->getArguments($request, $controller); The two lines above should run after: $request->attributes->add($matcher->match($request->getPathInfo())); --- create_framework/http_kernel_controller_resolver.rst | 3 --- 1 file changed, 3 deletions(-) diff --git a/create_framework/http_kernel_controller_resolver.rst b/create_framework/http_kernel_controller_resolver.rst index 75f58cef2f4..ad1a5715d6e 100644 --- a/create_framework/http_kernel_controller_resolver.rst +++ b/create_framework/http_kernel_controller_resolver.rst @@ -185,9 +185,6 @@ Let's conclude with the new version of our framework:: $controllerResolver = new HttpKernel\Controller\ControllerResolver(); $argumentResolver = new HttpKernel\Controller\ArgumentResolver(); - $controller = $controllerResolver->getController($request); - $arguments = $argumentResolver->getArguments($request, $controller); - try { $request->attributes->add($matcher->match($request->getPathInfo())); From 84ac92d0fb9a2e23869eceb4e7da78444bbc3dec Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Thu, 14 Jul 2016 15:38:06 -0400 Subject: [PATCH 08/25] bootstrapping workflow docs --- components/workflow.rst | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 components/workflow.rst diff --git a/components/workflow.rst b/components/workflow.rst new file mode 100644 index 00000000000..fab80080333 --- /dev/null +++ b/components/workflow.rst @@ -0,0 +1,19 @@ +.. index:: + single: Workflow + single: Components; Workflow + +The Workflow Component +====================== + + The Workflow component provides tools for managing a workflow or, finite state + machine. + +Installation +------------ + +You can install the component in 2 different ways: + +* :doc:`Install it via Composer ` (``symfony/workflow`` on `Packagist`_); +* Use the official Git repository (https://github.com/symfony/workflow). + +For more information, see the code in the Git Repository. From 3a948246beb2907b9c844ba9ea2a4dfcb5924da8 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Fri, 15 Jul 2016 12:00:05 +0200 Subject: [PATCH 09/25] Minor fixes for the workflow component --- components/workflow.rst | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/components/workflow.rst b/components/workflow.rst index fab80080333..1b479698e73 100644 --- a/components/workflow.rst +++ b/components/workflow.rst @@ -5,9 +5,12 @@ The Workflow Component ====================== - The Workflow component provides tools for managing a workflow or, finite state + The Workflow component provides tools for managing a workflow or finite state machine. +.. versionadded:: 2.8 + The Workflow component was introduced in Symfony 3.2. + Installation ------------ @@ -17,3 +20,5 @@ You can install the component in 2 different ways: * Use the official Git repository (https://github.com/symfony/workflow). For more information, see the code in the Git Repository. + +.. _Packagist: https://packagist.org/packages/symfony/workflow From 53e29cf1926515b6f15c09f1e670d2a2ad53fa8e Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Fri, 15 Jul 2016 13:46:13 +0200 Subject: [PATCH 10/25] fix version number --- components/workflow.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/workflow.rst b/components/workflow.rst index 1b479698e73..656d37f2e65 100644 --- a/components/workflow.rst +++ b/components/workflow.rst @@ -8,7 +8,7 @@ The Workflow Component The Workflow component provides tools for managing a workflow or finite state machine. -.. versionadded:: 2.8 +.. versionadded:: 3.2 The Workflow component was introduced in Symfony 3.2. Installation From 42d7888b744b511a5e7f0170f716d313b773919f Mon Sep 17 00:00:00 2001 From: WouterJ Date: Fri, 5 Aug 2016 11:41:32 +0200 Subject: [PATCH 11/25] Added July changelog --- changelog.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/changelog.rst b/changelog.rst index 802bec858e8..a11ab15b8d4 100644 --- a/changelog.rst +++ b/changelog.rst @@ -22,6 +22,7 @@ New Documentation * `#6744 `_ [Form] Ambiguous block prefixes render incorrectly (foaly-nr1) * `#6611 `_ Discourage the use of controllers as services (javiereguiluz) * `#5672 `_ Add constants to BC promise (WouterJ) +* `#6737 `_ Document the file() controller helper (javiereguiluz) * `#6707 `_ Describe serialization config location in cookbook (jcrombez, WouterJ) * `#6726 `_ Use getParameter method in controllers (peterkokot) * `#6727 `_ Updated the condition to display console name (mickaelandrieu) @@ -40,6 +41,7 @@ Fixed Documentation * `#6714 `_ UppercaseRot13Transformer wrong class name used (jevgenijusr) * `#6704 `_ Encountered an error when following the steps for contribution (chancegarcia) * `#6708 `_ Routes should be just imported, not mounted (OndraM) +* `#6708 `_ Routes should be just imported, not mounted (OndraM) Minor Documentation Changes ~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -60,6 +62,7 @@ Minor Documentation Changes * `#100 `_ Add file extension to SOAP article (WouterJ) * `#92 `_ Make usage of "The" in the edition list consistent (WouterJ) * `#91 `_ Create a section for "Getting Started" so we can generate a book (javiereguiluz) +* `#86 `_ bootstrapping Workflow component docs (weaverryan) * `#77 `_ Proofing the controller chapter (weaverryan) * `#90 `_ Fixed doc build issues (javiereguiluz) * `#82 `_ Bootstrapping property info doc (weaverryan) From f0fe7397b3270a9f765a83418ed252e56dd0bf42 Mon Sep 17 00:00:00 2001 From: Maxime Steinhausser Date: Sat, 27 Aug 2016 20:58:38 +0200 Subject: [PATCH 12/25] [WCM][Config] Add ExprBuilder::ifEmpty() --- components/config/definition.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/components/config/definition.rst b/components/config/definition.rst index e7654c0c14c..c383fa5cd39 100644 --- a/components/config/definition.rst +++ b/components/config/definition.rst @@ -736,6 +736,7 @@ the following ways: - ``ifTrue()`` - ``ifString()`` - ``ifNull()`` +- ``ifEmpty()`` (since Symfony 3.2) - ``ifArray()`` - ``ifInArray()`` - ``ifNotInArray()`` From 46825abc6bda448754c778703fde6e13bb9f58d6 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Mon, 12 Sep 2016 17:50:12 +0200 Subject: [PATCH 13/25] [Bridge/PhpUnit] doc bin/simple-phpunit --- components/phpunit_bridge.rst | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/components/phpunit_bridge.rst b/components/phpunit_bridge.rst index ee6438649ed..191fab8c13e 100644 --- a/components/phpunit_bridge.rst +++ b/components/phpunit_bridge.rst @@ -20,13 +20,16 @@ It comes with the following features: * Provides a ``ClockMock`` helper class for time-sensitive tests. +* Provides a modified version of phpunit that does not embed ``symfony/yaml`` nor + ``prophecy`` to prevent any conflicts with these dependencies. + Installation ------------ You can install the component in 2 different ways: * :doc:`Install it via Composer ` - (``symfony/phpunit-bridge`` on `Packagist`_); as a dev dependency; + (``symfony/phpunit-bridge`` on `Packagist`_); as a ``dev`` dependency; * Use the official Git repository (https://github.com/symfony/phpunit-bridge). @@ -326,6 +329,35 @@ namespaces in the ``phpunit.xml`` file, as done for example in the +Modified PHPUnit script +----------------------- + +.. versionadded:: 3.2 + The modified PHPUnit script script was introduced in Symfony 3.2. + +This bridges provides a modified version of phpunit that you can call by using +its ``bin/simple-phpunit`` command. It has the following features: + +* Does not embed ``symfony/yaml`` nor ``prophecy`` to prevent any conflicts with + these dependencies; +* Uses PHPUnit 4.8 when run with PHP <=5.5 and PHPUnit 5.1 when run with PHP >=5.6; +* Collects and replays skipped tests when the ``SYMFONY_PHPUNIT_SKIPPED_TESTS`` + env var is defined: the env var should specify a file name that will be used for + storing skipped tests on a first run, and replay them on the second run; +* Parallelizes test suites execution when given a directory as argument, scanning + this directory for ``phpunit.xml.dist`` files up to ``SYMFONY_PHPUNIT_MAX_DEPTH`` + levels (specified as an env var, defaults to ``3``); + +The script writes the modified PHPUnit it builds in a directory that can be +configured by the ``SYMFONY_PHPUNIT_DIR`` env var, or in the same directory as +the ``simple-phpunit`` if it is not provided. + +If you have installed the bridge through composer, you can run it by calling e.g.: + +.. code-block:: bash + + $ vendor/bin/simple-phpunit + .. _PHPUnit: https://phpunit.de .. _`PHPUnit event listener`: https://phpunit.de/manual/current/en/extending-phpunit.html#extending-phpunit.PHPUnit_Framework_TestListener .. _`PHP error handler`: http://php.net/manual/en/book.errorfunc.php From c600921f06ba19a933edd1e4c1a8d6180a60e18f Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Wed, 14 Sep 2016 21:47:25 -0400 Subject: [PATCH 14/25] Making changes thanks to Javier! --- components/phpunit_bridge.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/phpunit_bridge.rst b/components/phpunit_bridge.rst index 191fab8c13e..10bab433341 100644 --- a/components/phpunit_bridge.rst +++ b/components/phpunit_bridge.rst @@ -335,7 +335,7 @@ Modified PHPUnit script .. versionadded:: 3.2 The modified PHPUnit script script was introduced in Symfony 3.2. -This bridges provides a modified version of phpunit that you can call by using +This bridge provides a modified version of PHPUnit that you can call by using its ``bin/simple-phpunit`` command. It has the following features: * Does not embed ``symfony/yaml`` nor ``prophecy`` to prevent any conflicts with @@ -352,7 +352,7 @@ The script writes the modified PHPUnit it builds in a directory that can be configured by the ``SYMFONY_PHPUNIT_DIR`` env var, or in the same directory as the ``simple-phpunit`` if it is not provided. -If you have installed the bridge through composer, you can run it by calling e.g.: +If you have installed the bridge through Composer, you can run it by calling e.g.: .. code-block:: bash From 9ad9fba4b726575ae08b64c390bea7f95d7de9c5 Mon Sep 17 00:00:00 2001 From: Andrey Bolonin Date: Mon, 31 Oct 2016 23:27:54 +0200 Subject: [PATCH 15/25] fixed app/console --- console/input.rst | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/console/input.rst b/console/input.rst index 82a147b86d9..d689cc4b04f 100644 --- a/console/input.rst +++ b/console/input.rst @@ -54,10 +54,10 @@ The command can now be used in either of the following ways: .. code-block:: bash - $ php app/console app:greet Fabien + $ php bin/console app:greet Fabien Hi Fabien! - $ php app/console app:greet Fabien Potencier + $ php bin/console app:greet Fabien Potencier Hi Fabien Potencier! It is also possible to let an argument take a list of values (imagine you want @@ -75,7 +75,7 @@ To use this, just specify as many names as you want: .. code-block:: bash - $ php app/console app:greet Fabien Ryan Bernhard + $ php bin/console app:greet Fabien Ryan Bernhard You can access the ``names`` argument as an array:: @@ -140,10 +140,10 @@ flag: .. code-block:: bash # no --iterations provided, the default (1) is used - $ php app/console app:greet Fabien + $ php bin/console app:greet Fabien Hi Fabien! - $ php app/console app:greet Fabien --iterations=5 + $ php bin/console app:greet Fabien --iterations=5 Hi Fabien Hi Fabien Hi Fabien @@ -151,9 +151,9 @@ flag: Hi Fabien # the order of options isn't important - $ php app/console app:greet Fabien --iterations=5 --yell - $ php app/console app:greet Fabien --yell --iterations=5 - $ php app/console app:greet --yell --iterations=5 Fabien + $ php bin/console app:greet Fabien --iterations=5 --yell + $ php bin/console app:greet Fabien --yell --iterations=5 + $ php bin/console app:greet --yell --iterations=5 Fabien .. tip:: From 282da6145f724fb28679670cdd2739a7c632460b Mon Sep 17 00:00:00 2001 From: Robin Chalas Date: Sat, 28 May 2016 09:43:00 +0200 Subject: [PATCH 16/25] [Console] Adapt doc for easier testing of commands needing user inputs Fix missing colon Change userInputs to inputs Try to fix platformsh build Re-add useful use statements Fixed typo, use FQCN::method Rollback not useful diff Formatting Add more examples, precise documentation typo 'would have type' => 'would have typed' removing an ending dot in comment for consistency --- components/console/helpers/questionhelper.rst | 34 ++++++++++--------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/components/console/helpers/questionhelper.rst b/components/console/helpers/questionhelper.rst index 6ea453beeb7..006787c1da6 100644 --- a/components/console/helpers/questionhelper.rst +++ b/components/console/helpers/questionhelper.rst @@ -277,7 +277,7 @@ Testing a Command that Expects Input ------------------------------------ If you want to write a unit test for a command which expects some kind of input -from the command line, you need to set the helper input stream:: +from the command line, you need to set the inputs that the command expects:: use Symfony\Component\Console\Helper\QuestionHelper; use Symfony\Component\Console\Helper\HelperSet; @@ -289,26 +289,28 @@ from the command line, you need to set the helper input stream:: // ... $commandTester = new CommandTester($command); - $helper = $command->getHelper('question'); - $helper->setInputStream($this->getInputStream("Test\n")); // Equals to a user inputting "Test" and hitting ENTER - // If you need to enter a confirmation, "yes\n" will work + $commandTester->setInputs(array('Test')); + + // Equals to a user inputting "This", "That" and hitting ENTER + // This can be used for answering two separated questions for instance + $commandTester->setInputs(array('This', 'That')); + + // For simulating a positive answer to a confirmation question, adding an + // additional input saying "yes" will work + $commandTester->setInputs(array('yes')); $commandTester->execute(array('command' => $command->getName())); // $this->assertRegExp('/.../', $commandTester->getDisplay()); } - protected function getInputStream($input) - { - $stream = fopen('php://memory', 'r+', false); - fputs($stream, $input); - rewind($stream); - - return $stream; - } +By calling :method:`Symfony\\Component\\Console\\Tester\\CommandTester::setInputs`, +you imitate what the console would do internally with all user input through the CLI. +This method takes an array as only argument with, for each input that the command expects, +a string representing what the user would have typed. +This way you can test any user interaction (even complex ones) by passing the appropriate inputs. -By setting the input stream of the ``QuestionHelper``, you imitate what the -console would do internally with all user input through the CLI. This way -you can test any user interaction (even complex ones) by passing an appropriate -input stream. +.. note:: + The :class:`Symfony\\Component\\Console\\Tester\\CommandTester` automatically simulates a user + hitting ``ENTER`` after each input, no need for passing an additional input. From 6f3e28fd09c5424826309cf4542291453e276726 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Thu, 30 Jun 2016 18:59:29 +0200 Subject: [PATCH 17/25] [#6623] fix note directive --- components/console/helpers/questionhelper.rst | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/components/console/helpers/questionhelper.rst b/components/console/helpers/questionhelper.rst index 006787c1da6..9c9284f2768 100644 --- a/components/console/helpers/questionhelper.rst +++ b/components/console/helpers/questionhelper.rst @@ -312,5 +312,7 @@ a string representing what the user would have typed. This way you can test any user interaction (even complex ones) by passing the appropriate inputs. .. note:: - The :class:`Symfony\\Component\\Console\\Tester\\CommandTester` automatically simulates a user - hitting ``ENTER`` after each input, no need for passing an additional input. + + The :class:`Symfony\\Component\\Console\\Tester\\CommandTester` automatically + simulates a user hitting ``ENTER`` after each input, no need for passing + an additional input. From 798cffaf708f5f39f1a8d5e473d3afcaba20745e Mon Sep 17 00:00:00 2001 From: WouterJ Date: Sat, 2 Jul 2016 15:00:16 +0200 Subject: [PATCH 18/25] added June changelog --- changelog.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/changelog.rst b/changelog.rst index 39130134835..96c38c2b0ea 100644 --- a/changelog.rst +++ b/changelog.rst @@ -290,6 +290,7 @@ New Documentation ~~~~~~~~~~~~~~~~~ * `#6515 `_ Added the documentation for the Cache component (javiereguiluz) +* `#6623 `_ [Console] Adapt doc for easier testing of commands needing user inputs (chalasr) * `#6690 `_ Added an example for a different method of verbosity level usage. (smatyas) * `#6648 `_ Process: callbacks now allowed when output disabled (avindra) * `#6587 `_ Updating recommended email settings for monolog (jorgelbg) From 9dc94544468c57afacdb9a564f54fecef4f44119 Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Thu, 14 Jul 2016 15:38:06 -0400 Subject: [PATCH 19/25] bootstrapping workflow docs --- components/workflow.rst | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 components/workflow.rst diff --git a/components/workflow.rst b/components/workflow.rst new file mode 100644 index 00000000000..fab80080333 --- /dev/null +++ b/components/workflow.rst @@ -0,0 +1,19 @@ +.. index:: + single: Workflow + single: Components; Workflow + +The Workflow Component +====================== + + The Workflow component provides tools for managing a workflow or, finite state + machine. + +Installation +------------ + +You can install the component in 2 different ways: + +* :doc:`Install it via Composer ` (``symfony/workflow`` on `Packagist`_); +* Use the official Git repository (https://github.com/symfony/workflow). + +For more information, see the code in the Git Repository. From 59a528772945e9f3ffd78bea348778d981c29868 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Fri, 15 Jul 2016 12:00:05 +0200 Subject: [PATCH 20/25] Minor fixes for the workflow component --- components/workflow.rst | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/components/workflow.rst b/components/workflow.rst index fab80080333..1b479698e73 100644 --- a/components/workflow.rst +++ b/components/workflow.rst @@ -5,9 +5,12 @@ The Workflow Component ====================== - The Workflow component provides tools for managing a workflow or, finite state + The Workflow component provides tools for managing a workflow or finite state machine. +.. versionadded:: 2.8 + The Workflow component was introduced in Symfony 3.2. + Installation ------------ @@ -17,3 +20,5 @@ You can install the component in 2 different ways: * Use the official Git repository (https://github.com/symfony/workflow). For more information, see the code in the Git Repository. + +.. _Packagist: https://packagist.org/packages/symfony/workflow From 4904b12f298256fe675b5824b24a132842549302 Mon Sep 17 00:00:00 2001 From: Christian Flothmann Date: Fri, 15 Jul 2016 13:46:13 +0200 Subject: [PATCH 21/25] fix version number --- components/workflow.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/workflow.rst b/components/workflow.rst index 1b479698e73..656d37f2e65 100644 --- a/components/workflow.rst +++ b/components/workflow.rst @@ -8,7 +8,7 @@ The Workflow Component The Workflow component provides tools for managing a workflow or finite state machine. -.. versionadded:: 2.8 +.. versionadded:: 3.2 The Workflow component was introduced in Symfony 3.2. Installation From 9a99dcab74f76d0345454e1d3b9b6b721bae8b59 Mon Sep 17 00:00:00 2001 From: WouterJ Date: Fri, 5 Aug 2016 11:41:32 +0200 Subject: [PATCH 22/25] Added July changelog --- changelog.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/changelog.rst b/changelog.rst index 96c38c2b0ea..9d5ae8227e9 100644 --- a/changelog.rst +++ b/changelog.rst @@ -186,6 +186,7 @@ New Documentation * `#6744 `_ [Form] Ambiguous block prefixes render incorrectly (foaly-nr1) * `#6611 `_ Discourage the use of controllers as services (javiereguiluz) * `#5672 `_ Add constants to BC promise (WouterJ) +* `#6737 `_ Document the file() controller helper (javiereguiluz) * `#6707 `_ Describe serialization config location in cookbook (jcrombez, WouterJ) * `#6726 `_ Use getParameter method in controllers (peterkokot) * `#6727 `_ Updated the condition to display console name (mickaelandrieu) @@ -204,6 +205,7 @@ Fixed Documentation * `#6714 `_ UppercaseRot13Transformer wrong class name used (jevgenijusr) * `#6704 `_ Encountered an error when following the steps for contribution (chancegarcia) * `#6708 `_ Routes should be just imported, not mounted (OndraM) +* `#6708 `_ Routes should be just imported, not mounted (OndraM) Minor Documentation Changes ~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -224,6 +226,7 @@ Minor Documentation Changes * `#100 `_ Add file extension to SOAP article (WouterJ) * `#92 `_ Make usage of "The" in the edition list consistent (WouterJ) * `#91 `_ Create a section for "Getting Started" so we can generate a book (javiereguiluz) +* `#86 `_ bootstrapping Workflow component docs (weaverryan) * `#77 `_ Proofing the controller chapter (weaverryan) * `#90 `_ Fixed doc build issues (javiereguiluz) * `#82 `_ Bootstrapping property info doc (weaverryan) From 162ba203da9f716a29b3063f2a90898b9159f929 Mon Sep 17 00:00:00 2001 From: Maxime Steinhausser Date: Sat, 27 Aug 2016 20:58:38 +0200 Subject: [PATCH 23/25] [WCM][Config] Add ExprBuilder::ifEmpty() --- components/config/definition.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/components/config/definition.rst b/components/config/definition.rst index e7654c0c14c..c383fa5cd39 100644 --- a/components/config/definition.rst +++ b/components/config/definition.rst @@ -736,6 +736,7 @@ the following ways: - ``ifTrue()`` - ``ifString()`` - ``ifNull()`` +- ``ifEmpty()`` (since Symfony 3.2) - ``ifArray()`` - ``ifInArray()`` - ``ifNotInArray()`` From 6bb16d06f95c0c029c714c02c62127618355fedc Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Mon, 12 Sep 2016 17:50:12 +0200 Subject: [PATCH 24/25] [Bridge/PhpUnit] doc bin/simple-phpunit --- components/phpunit_bridge.rst | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/components/phpunit_bridge.rst b/components/phpunit_bridge.rst index ee6438649ed..191fab8c13e 100644 --- a/components/phpunit_bridge.rst +++ b/components/phpunit_bridge.rst @@ -20,13 +20,16 @@ It comes with the following features: * Provides a ``ClockMock`` helper class for time-sensitive tests. +* Provides a modified version of phpunit that does not embed ``symfony/yaml`` nor + ``prophecy`` to prevent any conflicts with these dependencies. + Installation ------------ You can install the component in 2 different ways: * :doc:`Install it via Composer ` - (``symfony/phpunit-bridge`` on `Packagist`_); as a dev dependency; + (``symfony/phpunit-bridge`` on `Packagist`_); as a ``dev`` dependency; * Use the official Git repository (https://github.com/symfony/phpunit-bridge). @@ -326,6 +329,35 @@ namespaces in the ``phpunit.xml`` file, as done for example in the +Modified PHPUnit script +----------------------- + +.. versionadded:: 3.2 + The modified PHPUnit script script was introduced in Symfony 3.2. + +This bridges provides a modified version of phpunit that you can call by using +its ``bin/simple-phpunit`` command. It has the following features: + +* Does not embed ``symfony/yaml`` nor ``prophecy`` to prevent any conflicts with + these dependencies; +* Uses PHPUnit 4.8 when run with PHP <=5.5 and PHPUnit 5.1 when run with PHP >=5.6; +* Collects and replays skipped tests when the ``SYMFONY_PHPUNIT_SKIPPED_TESTS`` + env var is defined: the env var should specify a file name that will be used for + storing skipped tests on a first run, and replay them on the second run; +* Parallelizes test suites execution when given a directory as argument, scanning + this directory for ``phpunit.xml.dist`` files up to ``SYMFONY_PHPUNIT_MAX_DEPTH`` + levels (specified as an env var, defaults to ``3``); + +The script writes the modified PHPUnit it builds in a directory that can be +configured by the ``SYMFONY_PHPUNIT_DIR`` env var, or in the same directory as +the ``simple-phpunit`` if it is not provided. + +If you have installed the bridge through composer, you can run it by calling e.g.: + +.. code-block:: bash + + $ vendor/bin/simple-phpunit + .. _PHPUnit: https://phpunit.de .. _`PHPUnit event listener`: https://phpunit.de/manual/current/en/extending-phpunit.html#extending-phpunit.PHPUnit_Framework_TestListener .. _`PHP error handler`: http://php.net/manual/en/book.errorfunc.php From 7f4a82fd92aad6a2a7a216de9e1a3c726c94f048 Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Wed, 14 Sep 2016 21:47:25 -0400 Subject: [PATCH 25/25] Making changes thanks to Javier! --- components/phpunit_bridge.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/phpunit_bridge.rst b/components/phpunit_bridge.rst index 191fab8c13e..10bab433341 100644 --- a/components/phpunit_bridge.rst +++ b/components/phpunit_bridge.rst @@ -335,7 +335,7 @@ Modified PHPUnit script .. versionadded:: 3.2 The modified PHPUnit script script was introduced in Symfony 3.2. -This bridges provides a modified version of phpunit that you can call by using +This bridge provides a modified version of PHPUnit that you can call by using its ``bin/simple-phpunit`` command. It has the following features: * Does not embed ``symfony/yaml`` nor ``prophecy`` to prevent any conflicts with @@ -352,7 +352,7 @@ The script writes the modified PHPUnit it builds in a directory that can be configured by the ``SYMFONY_PHPUNIT_DIR`` env var, or in the same directory as the ``simple-phpunit`` if it is not provided. -If you have installed the bridge through composer, you can run it by calling e.g.: +If you have installed the bridge through Composer, you can run it by calling e.g.: .. code-block:: bash