[HttpFoundation] fixed locale accessor after session clear

This commit is contained in:
Kris Wallsmith 2011-05-19 11:45:12 -07:00
parent a538344b3b
commit ed8ecab7ea
2 changed files with 10 additions and 0 deletions

View File

@ -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'];
}

View File

@ -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());