Пример #1
0
 /**
  * @param IConfig $config
  * @param $string
  *
  * @return mixed
  */
 protected function parseString(IConfig $config, $string)
 {
     if ($this->isReference($string)) {
         $value = $config->get($this->parseReferencePath($string));
     } else {
         $value = preg_replace_callback($this->getInterpolationRegexPattern(), function ($matches) use($config) {
             $value = $config->get($matches[1]);
             if (!is_scalar($value)) {
                 return $matches[0];
             }
             return $value;
         }, $string);
     }
     return $value;
 }
Пример #2
0
	public function testUpgradeDifferentPrefix() {
		$oldTablePrefix = $this->config->getSystemValue('dbtableprefix', 'oc_');

		$this->config->setSystemValue('dbtableprefix', 'ownc_');
		$this->tableName = strtolower($this->getUniqueID($this->config->getSystemValue('dbtableprefix') . 'test_'));

		list($startSchema, $endSchema) = $this->getDuplicateKeySchemas();
		$migrator = $this->manager->getMigrator();
		$migrator->migrate($startSchema);

		$this->connection->insert($this->tableName, array('id' => 1, 'name' => 'foo'));
		$this->connection->insert($this->tableName, array('id' => 2, 'name' => 'bar'));
		$this->connection->insert($this->tableName, array('id' => 3, 'name' => 'qwerty'));

		$migrator->checkMigrate($endSchema);
		$migrator->migrate($endSchema);
		$this->assertTrue(true);

		$this->config->setSystemValue('dbtableprefix', $oldTablePrefix);
	}