Commit 03705ed2 authored by Fabien Potencier's avatar Fabien Potencier

Merge branch '1.3'

* 1.3:
  fixed CS
  Update usage.rst
  tweaks the testing docs

Conflicts:
	src/Silex/Application.php
	src/Silex/Application/SecurityTrait.php
	src/Silex/Provider/TwigServiceProvider.php
parents 21632f0e 4422f429
...@@ -70,6 +70,11 @@ use it by making your test extend it:: ...@@ -70,6 +70,11 @@ use it by making your test extend it::
... ...
} }
.. caution::
If you need to override the ``setUp()`` method, don't forget to call the
parent (``parent::setUp()``) to call the Silex default setup.
.. note:: .. note::
If you want to use the Symfony ``WebTestCase`` class you will need to If you want to use the Symfony ``WebTestCase`` class you will need to
...@@ -80,10 +85,11 @@ use it by making your test extend it:: ...@@ -80,10 +85,11 @@ use it by making your test extend it::
composer require --dev symfony/browser-kit symfony/css-selector composer require --dev symfony/browser-kit symfony/css-selector
For your WebTestCase, you will have to implement a ``createApplication`` For your WebTestCase, you will have to implement a ``createApplication``
method, which returns your application. It will probably look like this:: method, which returns your application instance::
public function createApplication() public function createApplication()
{ {
// app.php must return an Application instance
return require __DIR__.'/path/to/app.php'; return require __DIR__.'/path/to/app.php';
} }
......
...@@ -182,7 +182,7 @@ Other methods ...@@ -182,7 +182,7 @@ Other methods
~~~~~~~~~~~~~ ~~~~~~~~~~~~~
You can create controllers for most HTTP methods. Just call one of these You can create controllers for most HTTP methods. Just call one of these
methods on your application: ``get``, ``post``, ``put``, ``delete``:: methods on your application: ``get``, ``post``, ``put``, ``delete``, ``patch``, ``options``::
$app->put('/blog/{id}', function ($id) { $app->put('/blog/{id}', function ($id) {
// ... // ...
...@@ -513,8 +513,8 @@ setting a more specific type hint for the Closure argument:: ...@@ -513,8 +513,8 @@ setting a more specific type hint for the Closure argument::
return new Response('Error', 404 /* ignored */, array('X-Status-Code' => 200)); return new Response('Error', 404 /* ignored */, array('X-Status-Code' => 200));
If you want to use a separate error handler for logging, make sure you register If you want to use a separate error handler for logging, make sure you register
it before the response error handlers, because once a response is returned, the it with a higher priority then response error handlers, because once a response
following handlers are ignored. is returned, the following handlers are ignored.
.. note:: .. note::
...@@ -551,6 +551,8 @@ early:: ...@@ -551,6 +551,8 @@ early::
return new Response(...); return new Response(...);
}); });
You can convert errors to ``Exceptions``, check out the cookbook :doc:`chapter <cookbook/error_handler>` for details.
View Handlers View Handlers
------------- -------------
...@@ -764,7 +766,7 @@ Cross-Site-Scripting attacks. ...@@ -764,7 +766,7 @@ Cross-Site-Scripting attacks.
}); });
If you use the Twig template engine, you should use its escaping or even If you use the Twig template engine, you should use its escaping or even
auto-escaping mechanisms. auto-escaping mechanisms. Check out the *Providers* :doc:`chapter <providers/twig>` for details.
* **Escaping JSON**: If you want to provide data in JSON format you should * **Escaping JSON**: If you want to provide data in JSON format you should
use the Silex ``json`` function:: use the Silex ``json`` function::
......
...@@ -84,5 +84,4 @@ class ViewListenerWrapper ...@@ -84,5 +84,4 @@ class ViewListenerWrapper
return true; return true;
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment