/** * Load a config file and its `.local` file if it exists. * * @param \MiniAsset\AssetConfig $config The config object to update. * @param string $path The config file to load. * @param string $prefix The prefix to use. * @return void */ protected function _load($config, $path, $prefix = '') { if (file_exists($path)) { $config->load($path, $prefix); } $localConfig = preg_replace('/(.*)\\.ini$/', '$1.local.ini', $path); if (file_exists($localConfig)) { $config->load($localConfig, $prefix); } }
public function setUp() { parent::setUp(); $config = new AssetConfig([]); $config->load(APP . 'config/integration.ini'); $this->factory = new Factory($config); }
/** * Get the injected config or build a config object from the CLI option. * * @return \MiniAsset\AssetConfig */ public function config() { if (!$this->config) { $config = new AssetConfig(); $config->load($this->cli->arguments->get('config')); $this->config = $config; } return $this->config; }
public function testExtendedConfig() { $config = new AssetConfig(); $config->load($this->extendConfig); $expected = ['classes/base_class.js', 'classes/template.js', 'library_file.js']; $this->assertEquals($expected, $config->files('extended.js')); $expected = ['classes/base_class.js', 'classes/template.js', 'library_file.js', 'local_script.js']; $this->assertEquals($expected, $config->files('more.js')); $expected = ['classes/base_class.js', 'classes/template.js', 'library_file.js', 'lots_of_comments.js']; $this->assertEquals($expected, $config->files('second.js')); $expected = ['Sprockets', 'JsMinFilter']; $this->assertEquals($expected, $config->targetFilters('extended.js')); $this->assertEquals($expected, $config->targetFilters('more.js')); $this->assertTrue($config->isThemed('theme.js')); }
public function load($path, $prefix = '') { parent::$_extensionTypes = array_merge(parent::$_extensionTypes, $this->extensions()); return parent::load($path, $prefix); }