/**
  * Builds the class loading information and writes it to the cache. It handles Locking for this cache.
  *
  * Caution: The function loadClass can be called "recursively" by spl_autoloader. This needs to be observed when
  * locking for cache access. Only the first call to loadClass may acquire and release the lock!
  *
  * @param string $cacheEntryIdentifier Cache identifier for this class
  * @param string $className Name of class this information is for
  *
  * @return array|FALSE The class information, empty array if class is unkown or FALSE if class information was not found in cache.
  */
 protected function buildCachedClassLoadingInformation($cacheEntryIdentifier, $className)
 {
     // We do not need locking if we are in earlyCache mode
     $didLock = FALSE;
     if (!$this->isEarlyCache) {
         $didLock = $this->acquireLock();
     }
     // Look again into the cache after we got the lock, data might have been generated meanwhile
     $classLoadingInformation = $this->getClassLoadingInformationFromCache($cacheEntryIdentifier);
     // Handle repeated cache miss
     if ($classLoadingInformation === FALSE) {
         // Generate class information
         $classLoadingInformation = $this->buildClassLoadingInformation($className);
         if ($classLoadingInformation !== FALSE) {
             // If we found class information, cache it
             $this->classesCache->set($cacheEntryIdentifier, implode("ÿ", $classLoadingInformation), $this->isEarlyCache ? array('early') : array());
         } elseif (!$this->isEarlyCache) {
             if ($this->context->isProduction()) {
                 // Cache that the class is unknown
                 $this->classesCache->set($cacheEntryIdentifier, '');
             }
         }
     }
     $this->releaseLock($didLock);
     return $classLoadingInformation;
 }
 /**
  * @test
  * @dataProvider isMethods
  */
 public function contextMethodsReturnTheCorrectValues($contextName, $isDevelopment, $isProduction, $isTesting, $parentContext)
 {
     $context = new ApplicationContext($contextName);
     $this->assertSame($isDevelopment, $context->isDevelopment());
     $this->assertSame($isProduction, $context->isProduction());
     $this->assertSame($isTesting, $context->isTesting());
     $this->assertSame((string) $parentContext, (string) $context->getParent());
 }