Skip to content

Fixes after tonight's merge round #6898

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Aug 21, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 11 additions & 10 deletions console.rst
Original file line number Diff line number Diff line change
Expand Up @@ -216,21 +216,16 @@ console::
namespace Tests\AppBundle\Command;

use AppBundle\Command\CreateUserCommand;
use Symfony\Component\Console\Application;
// use this if you're in the Symfony Framework
//use Symfony\Bundle\FrameworkBundle\Console\Application;
use Symfony\Bundle\FrameworkBundle\Console\Application;
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase;
use Symfony\Component\Console\Tester\CommandTester;

class CreateUserCommandTest extends \PHPUnit_Framework_TestCase
class CreateUserCommandTest extends KernelTestCase
{
public function testExecute()
{
$application = new Application();

// if you're in the Symfony framework, do this instead
// extend the KernelTestCase class
// self::bootKernel();
// $application = new Application(self::$kernel);
self::bootKernel();
$application = new Application(self::$kernel);

$application->add(new CreateUserCommand());

Expand Down Expand Up @@ -259,6 +254,12 @@ console::
You can also test a whole console application by using
:class:`Symfony\\Component\\Console\\Tester\\ApplicationTester`.

.. note::

When using the Console component in a standalone project, use
:class:`Symfony\\Component\\Console\\Application <Symfony\\Component\\Console\\Application>`
and extend the normal ``\PHPUnit_Framework_TestCase``.

To be able to use the fully set up service container for your console tests
you can extend your test from
:class:`Symfony\\Bundle\\FrameworkBundle\\Test\\KernelTestCase`::
Expand Down
4 changes: 2 additions & 2 deletions contributing/documentation/overview.rst
Original file line number Diff line number Diff line change
Expand Up @@ -261,10 +261,10 @@ link displayed for Platform.sh service.
Build the Documentation Locally
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Alternatively you can build the documentation in your own computer for testing
Alternatively you can build the documentation on your own computer for testing
purposes following these steps:

#. Install `pip`_ as explained in the `pip installation`_ article.
#. Install `pip`_ as explained in the `pip installation`_ article;

#. Install `Sphinx`_ and `Sphinx Extensions for PHP and Symfony`_
(depending on your system, you may need to execute this command as root user):
Expand Down
33 changes: 19 additions & 14 deletions routing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -256,13 +256,13 @@ expressions - see :doc:`/routing/requirements`.
Giving {placeholders} a Default Value
-------------------------------------

In the previous example, the ``blog_list`` has a path of ``/blog/{page}``. If the
user goes to ``/blog/1``, it will match. But if the user goes to ``/blog``, it will
**not** match. As soon as you add a ``{placeholder}`` to a route, it *must* have
a value.
In the previous example, the ``blog_list`` has a path of ``/blog/{page}``. If
the user visits ``/blog/1``, it will match. But if they visit ``/blog``, it
will **not** match. As soon as you add a ``{placeholder}`` to a route, it
*must* have a value.

So how can we make ``/blog_list`` once again match when the user goes to ``/blog``?
By adding a *default* value:
So how can you make ``blog_list`` once again match when the user visits
``/blog``? By adding a *default* value:

.. configuration-block::

Expand Down Expand Up @@ -309,6 +309,7 @@ By adding a *default* value:
<route id="blog_list" path="/blog/{page}">
<default key="_controller">AppBundle:Blog:list</default>
<default key="page">1</default>

<requirement key="page">\d+</requirement>
</route>

Expand All @@ -322,19 +323,23 @@ By adding a *default* value:
use Symfony\Component\Routing\Route;

$collection = new RouteCollection();
$collection->add('blog_list', new Route('/blog/{page}', array(
'_controller' => 'AppBundle:Blog:list',
'page' => 1,
), array(
'page' => '\d+'
)));
$collection->add('blog_list', new Route(
'/blog/{page}',
array(
'_controller' => 'AppBundle:Blog:list',
'page' => 1,
),
array(
'page' => '\d+'
)
));

// ...

return $collection;

Now, when the user goes to ``/blog``, the ``blog_list`` route will match and ``$page``
will default to a value of ``1``.
Now, when the user visits ``/blog``, the ``blog_list`` route will match and
``$page`` will default to a value of ``1``.

.. index::
single: Routing; Advanced example
Expand Down
2 changes: 1 addition & 1 deletion templating.rst
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ with alternating ``odd``, ``even`` classes:
.. code-block:: html+twig

{% for i in 1..10 %}
<div class="{{ cycle(['odd', 'even'], i) }}">
<div class="{{ cycle(['even', 'odd'], i) }}">
<!-- some HTML here -->
</div>
{% endfor %}
Expand Down