コード例 #1
0
 public function testGetLastRefreshTimestamp()
 {
     $timestamp = CachingService::getLastRefreshTimestamp();
     $this->assertEquals(0, $timestamp);
     CachingService::refreshMessageCache();
     $refreshTime = time();
     $timestamp = CachingService::getLastRefreshTimestamp();
     $this->assertEquals($refreshTime, $timestamp);
 }
コード例 #2
0
 public function createJsMessages()
 {
     $messages = CachingService::getMessagesJson();
     $messages = $this->ensureBackwardsCompatibility($messages);
     $contents = 'Lang.addMessages(' . $messages . ');';
     $contents .= 'Lang.setLocale("' . Lang::locale() . '");';
     $lastModified = new DateTime();
     $lastModified->setTimestamp(CachingService::getLastRefreshTimestamp());
     return Response::make($contents)->header('Content-Type', 'text/javascript')->setLastModified($lastModified);
 }