Skip to content

Commit 2d7b3db

Browse files
committed
Merge branch '2.1' into 2.2
Conflicts: components/console/helpers/dialoghelper.rst
2 parents bab16bf + 5ca26e1 commit 2d7b3db

File tree

5 files changed

+102
-5
lines changed

5 files changed

+102
-5
lines changed

book/installation.rst

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ you should have a directory that looks something like this:
7575

7676
.. code-block:: text
7777
78-
path/to/webroot/ <- your web root directory
78+
path/to/webroot/ <- your web server directory (sometimes named htdocs or public)
7979
Symfony/ <- the new directory
8080
app/
8181
cache/
@@ -123,6 +123,22 @@ next section.
123123
:doc:`/cookbook/configuration/override_dir_structure` for more
124124
information.
125125

126+
All public files and the front controller that handles incoming requests in
127+
a Symfony2 application live in the ``Symfony/web/`` directory. So, assuming
128+
you unpacked the archive into your web server's or virtual host's document root,
129+
your application's URLs will start with ``http://localhost/Symfony/web/``.
130+
To get nice and short URLs you should point the document root of your web
131+
server or virtual host to the ``Symfony/web/`` directory. Though this is not
132+
required for development it is recommended when your application goes into
133+
production as all system and configuration files become inaccessible to clients.
134+
For information on configuring your specific web server document root, see
135+
the following documentation: `Apache`_ | `Nginx`_ .
136+
137+
.. note::
138+
139+
The following examples assume you don't touch the document root settings
140+
so all URLs start with ``http://localhost/Symfony/web/``
141+
126142
.. _installation-updating-vendors:
127143

128144
Updating Vendors

book/internals.rst

Lines changed: 42 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,10 @@ variables:
4444
:class:`Symfony\\Component\\HttpFoundation\\SessionStorage\\SessionStorageInterface`
4545
interface abstract session management ``session_*()`` functions.
4646

47+
.. note::
48+
49+
Read more about the :doc:`HttpFoundation Component </components/http_foudation/introduction>`.
50+
4751
``HttpKernel`` Component
4852
~~~~~~~~~~~~~~~~~~~~~~~~
4953

@@ -58,7 +62,8 @@ Dependency Injection component and a powerful plugin system (bundles).
5862

5963
.. seealso::
6064

61-
Read more about :doc:`Dependency Injection </book/service_container>` and
65+
Read more about the :doc:`HttpKernel Component </components/http_kernel/introduction>`,
66+
:doc:`Dependency Injection </book/service_container>` and
6267
:doc:`Bundles </cookbook/bundles/best_practices>`.
6368

6469
``FrameworkBundle`` Bundle
@@ -256,6 +261,10 @@ uses a :class:`Symfony\\Component\\Routing\\RouterInterface` object to match
256261
the ``Request`` and determine the Controller name (stored in the
257262
``_controller`` ``Request`` attribute).
258263

264+
.. seealso::
265+
266+
Read more on the :ref:`kernel.request event <component-http-kernel-kernel-request>`.
267+
259268
.. index::
260269
single: Event; kernel.controller
261270

@@ -278,6 +287,10 @@ to modify the controller that should be executed::
278287
$event->setController($controller);
279288
}
280289

290+
.. seealso::
291+
292+
Read more on the :ref:`kernel.controller event <component-http-kernel-kernel-controller>`.
293+
281294
.. index::
282295
single: Event; kernel.view
283296

@@ -307,6 +320,10 @@ The value returned by the Controller is accessible via the
307320
$event->setResponse($response);
308321
}
309322

323+
.. seealso::
324+
325+
Read more on the :ref:`kernel.view event <component-http-kernel-kernel-view>`.
326+
310327
.. index::
311328
single: Event; kernel.response
312329

@@ -340,6 +357,26 @@ The ``FrameworkBundle`` registers several listeners:
340357
``Surrogate-Control`` HTTP header when the Response needs to be parsed for
341358
ESI tags.
342359

360+
.. seealso::
361+
362+
Read more on the :ref:`kernel.response event <component-http-kernel-kernel-response>`.
363+
364+
.. index::
365+
single: Event; kernel.terminate
366+
367+
``kernel.terminate`` Event
368+
..........................
369+
370+
.. versionadded:: 2.1
371+
The ``kernel.terminate`` event is new since Symfony 2.1.
372+
373+
The purpose of this event is to perform "heavier" tasks after the response
374+
was already served to the client.
375+
376+
.. seealso::
377+
378+
Read more on the :ref:`kernel.terminate event <component-http-kernel-kernel-terminate>`.
379+
343380
.. index::
344381
single: Event; kernel.exception
345382

@@ -393,6 +430,10 @@ The event dispatcher is a standalone component that is responsible for much
393430
of the underlying logic and flow behind a Symfony request. For more information,
394431
see the :doc:`Event Dispatcher Component Documentation</components/event_dispatcher/introduction>`.
395432

433+
.. seealso::
434+
435+
Read more on the :ref:`kernel.exception event <component-http-kernel-kernel-exception>`.
436+
396437
.. index::
397438
single: Profiler
398439

components/console/helpers/dialoghelper.rst

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,3 +188,42 @@ is asked to provide the answer another time, until she enters a valid string
188188
or the maximum attempts is reached (which you can define in the fifth
189189
parameter). The default value for the attempts is ``false``, which means infinite
190190
attempts. You can define your own error message in the sixth parameter.
191+
192+
Testing a Command which expects input
193+
-------------------------------------
194+
195+
If you want to write a unit test for a command which expects some kind of input
196+
from the command line, you need to overwrite the HelperSet used by the command::
197+
198+
use Symfony\Component\Console\Helper\DialogHelper;
199+
use Symfony\Component\Console\Helper\HelperSet;
200+
201+
// ...
202+
public function testExecute()
203+
{
204+
// ...
205+
$commandTester = new CommandTester($command);
206+
207+
$dialog = $command->getHelper('dialog');
208+
$dialog->setInputStream($this->getInputStream('Test\n'));
209+
// Equals to a user inputing "Test" and hitting ENTER
210+
// If you need to enter a confirmation, "yes\n" will work
211+
212+
$commandTester->execute(array('command' => $command->getName()));
213+
214+
// $this->assertRegExp('/.../', $commandTester->getDisplay());
215+
}
216+
217+
protected function getInputStream($input)
218+
{
219+
$stream = fopen('php://memory', 'r+', false);
220+
fputs($stream, $input);
221+
rewind($stream);
222+
223+
return $stream;
224+
}
225+
226+
By setting the inputStream of the ``DialogHelper``, you imitate what the
227+
console would do internally with all user input through the cli. This way
228+
you can test any user interaction (even complex ones) by passing an appropriate
229+
input stream.

components/http_kernel/introduction.rst

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,8 @@ will be called after another event - ``kernel.controller`` - is dispatched.
259259
There are also a few other variations on the above process (e.g. if
260260
you're registering your controllers as services).
261261

262+
.. _component-http-kernel-kernel-controller:
263+
262264
3) The ``kernel.controller`` event
263265
----------------------------------
264266

@@ -444,6 +446,8 @@ method, which sends the headers and prints the ``Response`` content.
444446
serializes the current user's information into the
445447
session so that it can be reloaded on the next request.
446448

449+
.. _component-http-kernel-kernel-terminate:
450+
447451
8) The ``kernel.terminate`` event
448452
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
449453

reference/forms/types/repeated.rst

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ accuracy.
2424
+-------------+------------------------------------------------------------------------+
2525
| Inherited | - `invalid_message`_ |
2626
| options | - `invalid_message_parameters`_ |
27-
| | - `error_bubbling`_ |
2827
+-------------+------------------------------------------------------------------------+
2928
| Parent type | :doc:`field</reference/forms/types/form>` |
3029
+-------------+------------------------------------------------------------------------+
@@ -187,5 +186,3 @@ These options inherit from the :doc:`field</reference/forms/types/field>` type:
187186
.. include:: /reference/forms/types/options/invalid_message.rst.inc
188187

189188
.. include:: /reference/forms/types/options/invalid_message_parameters.rst.inc
190-
191-
.. include:: /reference/forms/types/options/error_bubbling.rst.inc

0 commit comments

Comments
 (0)