public function testNotUpdateSessionSameLocale()
 {
     $this->session->setLocale('el');
     $listener = $this->getLocaleUpdateListener(array('session'));
     $reflectionClass = new \ReflectionClass($listener);
     $property = $reflectionClass->getProperty('locale');
     $property->setAccessible(true);
     $property->setValue($listener, 'el');
     $this->assertFalse($listener->updateSession());
 }
예제 #2
0
 /**
  * Update Session section
  *
  * @return bool
  */
 public function updateSession()
 {
     if ($this->session && $this->checkGuesser('session') && $this->session->hasLocaleChanged($this->locale)) {
         if (null !== $this->logger) {
             $this->logger->info(sprintf('Session var \'%s\' set to [ %s ]', $this->session->getSessionVar(), $this->locale));
         }
         $this->session->setLocale($this->locale);
         return true;
     }
     return false;
 }
 public function testGetSessionVar()
 {
     $localeSession = new LocaleSession($this->getMockSession());
     $this->assertEquals('lunetics_locale', $localeSession->getSessionVar());
 }