Skip to content

Commit

Permalink
Merge branch '2.0' into 2.1
Browse files Browse the repository at this point in the history
Conflicts:
	book/installation.rst
  • Loading branch information
weaverryan committed Apr 26, 2013
2 parents d7e8a07 + a54b298 commit f191cc4
Show file tree
Hide file tree
Showing 5 changed files with 85 additions and 4 deletions.
18 changes: 17 additions & 1 deletion book/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ you should have a directory that looks something like this:

.. code-block:: text
path/to/webroot/ <- your web root directory
path/to/webroot/ <- your web server directory (sometimes named htdocs or public)
Symfony/ <- the new directory
app/
cache/
Expand Down Expand Up @@ -123,6 +123,22 @@ next section.
:doc:`/cookbook/configuration/override_dir_structure` for more
information.

All public files and the front controller that handles incoming requests in
a Symfony2 application live in the ``Symfony/web/`` directory. So, assuming
you unpacked the archive into your web server's or virtual host's document root,
your application's URLs will start with ``http://localhost/Symfony/web/``.
To get nice and short URLs you should point the document root of your web
server or virtual host to the ``Symfony/web/`` directory. Though this is not
required for development it is recommended when your application goes into
production as all system and configuration files become inaccessible to clients.
For information on configuring your specific web server document root, see
the following documentation: `Apache`_ | `Nginx`_ .

.. note::

The following examples assume you don't touch the document root settings
so all URLs start with ``http://localhost/Symfony/web/``

.. _installation-updating-vendors:

Updating Vendors
Expand Down
27 changes: 26 additions & 1 deletion book/internals.rst
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ variables:
:class:`Symfony\\Component\\HttpFoundation\\SessionStorage\\SessionStorageInterface`
interface abstract session management ``session_*()`` functions.

.. note::

Read more about the :doc:`HttpFoundation Component </components/http_foudation/introduction>`.

``HttpKernel`` Component
~~~~~~~~~~~~~~~~~~~~~~~~

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

.. seealso::

Read more about :doc:`Dependency Injection </book/service_container>` and
Read more about the :doc:`HttpKernel Component </components/http_kernel/introduction>`,
:doc:`Dependency Injection </book/service_container>` and
:doc:`Bundles </cookbook/bundles/best_practices>`.

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

.. seealso::

Read more on the :ref:`kernel.request event <component-http-kernel-kernel-request>`.

.. index::
single: Event; kernel.controller

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

.. seealso::

Read more on the :ref:`kernel.controller event <component-http-kernel-kernel-controller>`.

.. index::
single: Event; kernel.view

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

.. seealso::

Read more on the :ref:`kernel.view event <component-http-kernel-kernel-view>`.

.. index::
single: Event; kernel.response

Expand Down Expand Up @@ -340,6 +357,10 @@ The ``FrameworkBundle`` registers several listeners:
``Surrogate-Control`` HTTP header when the Response needs to be parsed for
ESI tags.

.. seealso::

Read more on the :ref:`kernel.response event <component-http-kernel-kernel-response>`.

.. index::
single: Event; kernel.exception

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

.. seealso::

Read more on the :ref:`kernel.exception event <component-http-kernel-kernel-exception>`.

.. index::
single: Profiler

Expand Down
41 changes: 40 additions & 1 deletion components/console/helpers/dialoghelper.rst
Original file line number Diff line number Diff line change
Expand Up @@ -97,4 +97,43 @@ You can set the max number of times to ask in the ``$attempts`` argument.
If you reach this max number it will use the default value, which is given
in the last argument. Using ``false`` means the amount of attempts is infinite.
The user will be asked as long as he provides an invalid answer and will only
be able to proceed if her input is valid.
be able to proceed if her input is valid.

Testing a Command which 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 overwrite the HelperSet used by the command::

use Symfony\Component\Console\Helper\DialogHelper;
use Symfony\Component\Console\Helper\HelperSet;
// ...
public function testExecute()
{
// ...
$commandTester = new CommandTester($command);
$dialog = $command->getHelper('dialog');
$dialog->setInputStream($this->getInputStream('Test\n'));
// Equals to a user inputing "Test" and hitting ENTER
// If you need to enter a confirmation, "yes\n" will work
$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 setting the inputStream of the ``DialogHelper``, 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.
2 changes: 2 additions & 0 deletions components/http_kernel/introduction.rst
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,8 @@ will be called after another event - ``kernel.controller`` - is dispatched.
There are also a few other variations on the above process (e.g. if
you're registering your controllers as services).

.. _component-http-kernel-kernel-controller:

3) The ``kernel.controller`` event
----------------------------------

Expand Down
1 change: 0 additions & 1 deletion reference/forms/types/repeated.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ accuracy.
+-------------+------------------------------------------------------------------------+
| Inherited | - `invalid_message`_ |
| options | - `invalid_message_parameters`_ |
| | - `error_bubbling`_ |
+-------------+------------------------------------------------------------------------+
| Parent type | :doc:`field</reference/forms/types/form>` |
+-------------+------------------------------------------------------------------------+
Expand Down

0 comments on commit f191cc4

Please sign in to comment.