Пример #1
0
 /**
  * Reads the environment file either by parsing it directly or from a cached file
  */
 public function read()
 {
     if ($this->cache->isEnabled()) {
         if ($this->cache->hasCache()) {
             $this->cache->loadCache();
         } else {
             $superGlobalEnvBackup = $_ENV;
             $this->parseEnvironmentVariables();
             $writtenEnvVars = array_diff_assoc($_ENV, $superGlobalEnvBackup);
             $this->cache->storeCache($this->getCachedCode($writtenEnvVars));
         }
     } else {
         $this->parseEnvironmentVariables();
     }
 }
Пример #2
0
 /**
  * @test
  */
 public function isEnabledReturnsTrueWhenDirIsWritable()
 {
     $cacheDir = __DIR__ . '/Fixtures/cache';
     $cache = new Cache($cacheDir, __DIR__ . '/Fixtures/env');
     $this->assertTrue($cache->isEnabled());
 }