public function testFormat() { $formatter = new PhpFormatter(); $data = 'test'; $this->assertEquals("<?php\nreturn 'test';\n", $formatter->format($data)); }
/** * Enables apppropriate cache types in app/etc/env.php based on the passed in $cacheTypes array * TODO: to be removed in scope of MAGETWO-53476 * * @param string[] * * @return void */ private function enableCacheTypes($cacheTypes) { if (empty($cacheTypes)) { return; } $envPath = $this->getEnvPath(); if ($this->write->isReadable($this->write->getRelativePath($envPath))) { $envData = (include $envPath); foreach ($cacheTypes as $cacheType) { if (isset($envData['cache_types'][$cacheType])) { $envData['cache_types'][$cacheType] = 1; } } $formatter = new PhpFormatter(); $contents = $formatter->format($envData); $this->write->writeFile($this->write->getRelativePath($envPath), $contents); if (function_exists('opcache_invalidate')) { opcache_invalidate($this->write->getAbsolutePath($envPath)); } } }