Пример #1
0
 public function __construct($name, SystemContext $context, $dir)
 {
     $this->_context = new Context($context, $dir);
     // ConfigPathを設定
     $configPath = $this->_context->getFilePath('config');
     // Configを作成
     $this->_config = Configuration::build('module.' . $name, $configPath, $context->getVal('env'), $useCache = false);
     // AutoLoader
     $ns = $this->_config->read('namespace', $context->getService('config')->read('module.namespace') . '\\' . ucfirst($name));
     $this->_context->setVal('ns', $ns);
     $context->getService('autoloader')->register([$ns . '\\Controller' => $this->_context->getFilePath('controller'), $this->_context->getFilePath('lib')]);
 }
Пример #2
0
 /**
  * セットアップ
  */
 public function configure($name, $root, $env, $options)
 {
     $this->_root = realpath($root);
     $options['root'] = $this->_root;
     $options['env'] = $env;
     $options['name'] = $name;
     $this->Context()->setVal($options);
     // CachePathを設定
     $this->Context()->setCachePath($this->getFilePath($this->Context()->getVal('cache', '/tmp/cache')));
     // ConfigPathを設定
     $configPath = $this->getFilePath($this->Context()->getVal('config', 'config'));
     // Configを作成
     $this->_config = Configuration::build($name, $configPath, $env, $useCache = false);
     return $this;
 }
Пример #3
0
 public function testBuild()
 {
     $c = Configuration::build('hoge', TEST_DIR . '/config/test', ['all', 'dev', 'hoge']);
     $this->assertEquals($c->read('database.connection.default.user'), 'hoge');
 }