lithium\test\Fixture::_init()
Overrides
lithium\core\ObjectDeprecated::_init()
Initializer function called by the constructor unless the constructor
Source
protected function _init() {
parent::_init();
if (!$this->_connection) {
throw new ConfigException("The `'connection'` option must be set.");
}
if (!$this->_source && !$this->_model) {
throw new ConfigException("The `'model'` or `'source'` option must be set.");
}
$connections = $this->_classes['connections'];
$db = $connections::get($this->_connection);
if ($model = $this->_model) {
$model::config(['meta' => ['connection' => $this->_connection]]);
$this->_source = $this->_source ? : $model::meta('source');
$this->_locked = ($this->_locked === null) ? $model::meta('locked') : $this->_locked;
}
if ($this->_locked === null) {
if ($db::enabled('schema')) {
$this->_locked = true;
} else {
$this->_locked = false;
}
}
foreach ($this->_config['alters'] as $mode => $values) {
foreach ($values as $key => $value) {
$this->alter($mode, $key, $value);
}
}
}