/**
  * @test
  */
 public function parentContextIsConnectedRecursively()
 {
     $context = new ApplicationContext('Production/Foo/Bar');
     $parentContext = $context->getParent();
     $this->assertSame('Production/Foo', (string) $parentContext);
     $rootContext = $parentContext->getParent();
     $this->assertSame('Production', (string) $rootContext);
 }
 /**
  * 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;
 }