[HttpFoundation] fixed locale accessor after session clear
This commit is contained in:
parent
a538344b3b
commit
ed8ecab7ea
@ -194,6 +194,10 @@ class Session implements \Serializable
|
||||
*/
|
||||
public function getLocale()
|
||||
{
|
||||
if (!isset($this->attributes['_locale'])) {
|
||||
$this->attributes['_locale'] = $this->defaultLocale;
|
||||
}
|
||||
|
||||
return $this->attributes['_locale'];
|
||||
}
|
||||
|
||||
|
@ -172,6 +172,12 @@ class SessionTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertSame('fr', $this->session->getLocale(), 'locale is fr');
|
||||
}
|
||||
|
||||
public function testLocaleAfterClear()
|
||||
{
|
||||
$this->session->clear();
|
||||
$this->assertEquals('en', $this->session->getLocale());
|
||||
}
|
||||
|
||||
public function testGetId()
|
||||
{
|
||||
$this->assertSame(null, $this->session->getId());
|
||||
|
Reference in New Issue
Block a user