/** * Set up test model */ public static function setUpBeforeClass() { //init config Config::initInstance(['file' => PROJECT_ROOT . '/config/root.xml']); Config::setSrcRootDir(PROJECT_ROOT); Config::mergeExtraConfig(); }
/** * Set up test model */ public static function setUpBeforeClass() { //init config object Config::initInstance(['file' => PROJECT_ROOT . '/config/root.xml']); Config::setSrcRootDir(PROJECT_ROOT); Config::mergeExtraConfig(); $vcsAdapter = self::getVcsAdapterMock(); /** @var Processor\PreCommit $processor */ $processor = Processor::factory('pre-commit', ['vcs' => $vcsAdapter]); $processor->setCodePath(PROJECT_ROOT)->setFiles([self::$fileTest]); $processor->process(); self::$model = $processor; }
<?php // @codingStandardsIgnoreFile /** * @license https://raw.githubusercontent.com/andkirby/commithook/master/LICENSE.md */ define('PROJECT_ROOT', realpath(__DIR__ . '/../..')); !defined('GIT_BIN') && define('GIT_BIN', 'git'); /** @var Composer\Autoload\ClassLoader $autoloader */ require realpath(__DIR__ . '/../../..') . '/bin/autoload-init.php'; //load config try { \PreCommit\Config::setSrcRootDir(__DIR__ . '/../../'); $config = \PreCommit\Config::initInstance(array('file' => __DIR__ . '/root.xml')); \PreCommit\Config::mergeExtraConfig(); } catch (\Exception $e) { echo $e; exit(1); }
/** * Get base config (without project files) * * @return Config */ public function getConfigBase() { static $config; if (null === $config) { //TODO Make single load $config = Config::initInstance(['file' => $this->commithookDir . DIRECTORY_SEPARATOR . 'src' . DIRECTORY_SEPARATOR . 'config' . DIRECTORY_SEPARATOR . 'root.xml']); if (!Config::loadCache()) { Config::mergeExtraConfig(); } $config = Config::getInstance(); } return $config; }