merged branch acasademont/locale_request_collector (PR #5769)
This PR was merged into the master branch.
Commits
-------
20f19bf
Add the Request locale to the RequestDataCollector
Discussion
----------
[HttpKernel] Add the Request locale to the RequestDataCollector
Bug fix: no
Feature addition: yes
Backwards compatibility break: no
Symfony2 tests pass: [![Build Status](https://secure.travis-ci.org/acasademont/symfony.png)](http://travis-ci.org/acasademont/symfony)
Fixes the following tickets: -
Todo: -
License of the code: MIT
Documentation PR: -
---------------------------------------------------------------------------
by acasademont at 2012-10-17T09:01:32Z
Seems like some Twig tests are failing in the master branch
This commit is contained in:
commit
390f36a86b
@ -93,6 +93,7 @@ class RequestDataCollector extends DataCollector implements EventSubscriberInter
|
||||
'flashes' => $flashes,
|
||||
'path_info' => $request->getPathInfo(),
|
||||
'controller' => 'n/a',
|
||||
'locale' => $request->getLocale(),
|
||||
);
|
||||
|
||||
if (isset($this->controllers[$request])) {
|
||||
@ -189,6 +190,11 @@ class RequestDataCollector extends DataCollector implements EventSubscriberInter
|
||||
return $this->data['format'];
|
||||
}
|
||||
|
||||
public function getLocale()
|
||||
{
|
||||
return $this->data['locale'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the route name.
|
||||
*
|
||||
|
@ -43,6 +43,7 @@ class RequestDataCollectorTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertInstanceOf('Symfony\Component\HttpFoundation\ParameterBag',$c->getRequestQuery());
|
||||
$this->assertEquals('html',$c->getFormat());
|
||||
$this->assertEquals(array(),$c->getSessionAttributes());
|
||||
$this->assertEquals('en',$c->getLocale());
|
||||
|
||||
$this->assertInstanceOf('Symfony\Component\HttpFoundation\HeaderBag',$c->getResponseHeaders());
|
||||
$this->assertEquals(200,$c->getStatusCode());
|
||||
|
Reference in New Issue
Block a user