mirror of
https://github.com/alchemy-fr/Phraseanet.git
synced 2025-10-10 11:33:17 +00:00
Refactor Configuration
This commit is contained in:
@@ -79,11 +79,7 @@ class appbox extends base
|
||||
$this->registry = $registry;
|
||||
$this->session = Session_Handler::getInstance($this);
|
||||
|
||||
$handler = new \Alchemy\Phrasea\Core\Configuration\Handler(
|
||||
new \Alchemy\Phrasea\Core\Configuration\Application(),
|
||||
new \Alchemy\Phrasea\Core\Configuration\Parser\Yaml()
|
||||
);
|
||||
$configuration = new \Alchemy\Phrasea\Core\Configuration($handler);
|
||||
$configuration = \Alchemy\Phrasea\Core\Configuration::build();
|
||||
|
||||
$choosenConnexion = $configuration->getPhraseanet()->get('database');
|
||||
|
||||
@@ -420,7 +416,7 @@ class appbox extends base
|
||||
* @param type $write_file
|
||||
* @return type
|
||||
*/
|
||||
public static function create(registryInterface &$registry, connection_interface $conn, $dbname, $write_file = false)
|
||||
public static function create(\Alchemy\Phrasea\Core $Core, registryInterface &$registry, connection_interface $conn, $dbname, $write_file = false)
|
||||
{
|
||||
$credentials = $conn->get_credentials();
|
||||
|
||||
@@ -441,6 +437,8 @@ class appbox extends base
|
||||
$key = $key == 'hostname' ? 'host' : $key;
|
||||
$connexionINI[$key] = (string) $value;
|
||||
}
|
||||
|
||||
$Core->getConfiguration()->initialize();
|
||||
$connexionINI['driver'] = 'pdo_mysql';
|
||||
$connexionINI['charset'] = 'UTF8';
|
||||
|
||||
@@ -448,42 +446,6 @@ class appbox extends base
|
||||
|
||||
$root = __DIR__ . '/../../';
|
||||
|
||||
//copy config sample
|
||||
$configSampleFile = $root . "config/config.sample.yml";
|
||||
$configFile = $root . "config/config.yml";
|
||||
|
||||
if (!copy($configSampleFile, $configFile))
|
||||
{
|
||||
throw new \Exception(sprintf("Unable to copy %s", $configSampleFile));
|
||||
}
|
||||
|
||||
//copy service sample
|
||||
$serviceSampleFile = $root . "config/services.sample.yml";
|
||||
$serviceFile = $root . "config/services.yml";
|
||||
|
||||
if (!copy($serviceSampleFile, $serviceFile))
|
||||
{
|
||||
throw new \Exception(sprintf("Unable to copy %s", $serviceSampleFile));
|
||||
}
|
||||
|
||||
//copy connexion sample
|
||||
$connexionSampleFile = $root . "config/connexions.sample.yml";
|
||||
$connexionFile = $root . "config/connexions.yml";
|
||||
|
||||
if (!copy($connexionSampleFile, $connexionFile))
|
||||
{
|
||||
throw new \Exception(sprintf("Unable to copy %s", $serviceSampleFile));
|
||||
}
|
||||
|
||||
//get configuration object
|
||||
$appConf = new \Alchemy\Phrasea\Core\Configuration\Application();
|
||||
$parser = new \Alchemy\Phrasea\Core\Configuration\Parser\Yaml();
|
||||
$handler = new \Alchemy\Phrasea\Core\Configuration\Handler($appConf, $parser);
|
||||
$configuration = new \Alchemy\Phrasea\Core\Configuration($handler);
|
||||
|
||||
//write credentials to config file
|
||||
$connexionFile = $appConf->getConnexionFile();
|
||||
|
||||
$connexion = array(
|
||||
'main_connexion' => $connexionINI,
|
||||
'test_connexion' => array(
|
||||
@@ -503,16 +465,9 @@ class appbox extends base
|
||||
$cacheService = "xcache_cache";
|
||||
}
|
||||
|
||||
$yaml = $configuration->getConfigurationHandler()->getParser()->dump($connexion, 2);
|
||||
$Core->getConfiguration()->setConnexions($connexion);
|
||||
|
||||
if (!file_put_contents($connexionFile->getPathname(), $yaml) !== false)
|
||||
{
|
||||
throw new \Exception(sprintf(_('Impossible d\'ecrire dans le fichier %s'), $connexionFile->getPathname()));
|
||||
}
|
||||
|
||||
//rewrite service file
|
||||
$serviceFile = $appConf->getServiceFile();
|
||||
$services = $configuration->getConfigurationHandler()->getParser()->parse($serviceFile);
|
||||
$services = $Core->getConfiguration()->getConfigurations();
|
||||
|
||||
foreach ($services as $serviceName => $service)
|
||||
{
|
||||
@@ -526,16 +481,9 @@ class appbox extends base
|
||||
);
|
||||
}
|
||||
}
|
||||
$Core->getConfiguration()->setConfigurations($services);
|
||||
|
||||
$yaml = $configuration->getConfigurationHandler()->getParser()->dump($services, 5);
|
||||
|
||||
if (!file_put_contents($serviceFile->getPathname(), $yaml) !== false)
|
||||
{
|
||||
throw new \Exception(sprintf(_('Impossible d\'ecrire dans le fichier %s'), $serviceFile->getPathname()));
|
||||
}
|
||||
|
||||
//rewrite servername in main config file
|
||||
$arrayConf = $configuration->all();
|
||||
$arrayConf = $Core->getConfiguration()->getConfigurations();
|
||||
|
||||
foreach ($arrayConf as $key => $value)
|
||||
{
|
||||
@@ -550,16 +498,7 @@ class appbox extends base
|
||||
}
|
||||
}
|
||||
|
||||
$configuration->write($arrayConf);
|
||||
|
||||
|
||||
|
||||
if (function_exists('chmod'))
|
||||
{
|
||||
chmod($configuration->getFile()->getPathname(), 0700);
|
||||
chmod($serviceFile->getPathname(), 0700);
|
||||
chmod($connexionFile->getPathname(), 0700);
|
||||
}
|
||||
$Core->getConfiguration()->setConfigurations($arrayConf);
|
||||
}
|
||||
try
|
||||
{
|
||||
@@ -588,7 +527,7 @@ class appbox extends base
|
||||
|
||||
try
|
||||
{
|
||||
$appbox = self::get_instance($registry);
|
||||
$appbox = self::get_instance($Core, $registry);
|
||||
$appbox->insert_datas();
|
||||
}
|
||||
catch (Exception $e)
|
||||
|
@@ -136,13 +136,7 @@ class connection
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
|
||||
$handler = new \Alchemy\Phrasea\Core\Configuration\Handler(
|
||||
new \Alchemy\Phrasea\Core\Configuration\Application(),
|
||||
new \Alchemy\Phrasea\Core\Configuration\Parser\Yaml()
|
||||
);
|
||||
$configuration = new \Alchemy\Phrasea\Core\Configuration($handler);
|
||||
$configuration = \Alchemy\Phrasea\Core\Configuration::build();
|
||||
|
||||
$choosenConnexion = $configuration->getPhraseanet()->get('database');
|
||||
|
||||
|
@@ -78,11 +78,7 @@ class module_console_fileConfigCheck extends Command
|
||||
|
||||
private function initTests(OutputInterface $output)
|
||||
{
|
||||
$spec = new Core\Configuration\Application();
|
||||
$parser = new Core\Configuration\Parser\Yaml();
|
||||
$handler = new Core\Configuration\Handler($spec, $parser);
|
||||
|
||||
$this->configuration = new Core\Configuration($handler, $this->env);
|
||||
$this->configuration = Core\Configuration::build();
|
||||
|
||||
if (!$this->configuration->isInstalled())
|
||||
{
|
||||
@@ -146,39 +142,19 @@ class module_console_fileConfigCheck extends Command
|
||||
|
||||
private function checkParse(OutputInterface $output)
|
||||
{
|
||||
$parser = $this
|
||||
->configuration
|
||||
->getConfigurationHandler()
|
||||
->getParser();
|
||||
$fileConfig = $this
|
||||
->configuration
|
||||
->getConfigurationHandler()
|
||||
->getSpecification()
|
||||
->getConfigurationFile();
|
||||
$fileService = $this
|
||||
->configuration
|
||||
->getConfigurationHandler()
|
||||
->getSpecification()
|
||||
->getServiceFile();
|
||||
$fileConnexion = $this
|
||||
->configuration
|
||||
->getConfigurationHandler()
|
||||
->getSpecification()
|
||||
->getConnexionFile();
|
||||
|
||||
try
|
||||
if (!$this->configuration->getConfigurations())
|
||||
{
|
||||
$parser->parse($fileConfig);
|
||||
$parser->parse($fileService);
|
||||
$parser->parse($fileConnexion);
|
||||
throw new \Exception("Unable to load configurations\n");
|
||||
}
|
||||
catch (\Exception $e)
|
||||
if (!$this->configuration->getConnexions())
|
||||
{
|
||||
$message = str_replace("\\", "", $e->getMessage());
|
||||
$e = new \Exception($message);
|
||||
throw new \Exception(sprintf("Check parsing file\n"), null, $e);
|
||||
throw new \Exception("Unable to load connexions\n");
|
||||
}
|
||||
if (!$this->configuration->getServices())
|
||||
{
|
||||
throw new \Exception("Unable to load services\n");
|
||||
}
|
||||
$output->writeln("<info>Parsing File OK</info>");
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -200,11 +176,7 @@ class module_console_fileConfigCheck extends Command
|
||||
|
||||
private function checkGetSelectedEnvironementFromFile(OutputInterface $output)
|
||||
{
|
||||
$spec = new Core\Configuration\Application();
|
||||
$parser = new Core\Configuration\Parser\Yaml();
|
||||
$handler = new Core\Configuration\Handler($spec, $parser);
|
||||
|
||||
$configuration = new Core\Configuration($handler);
|
||||
$configuration = Core\Configuration::build();
|
||||
|
||||
try
|
||||
{
|
||||
|
@@ -59,7 +59,6 @@ class module_console_fileEnsureProductionSetting extends Command
|
||||
|
||||
public function execute(InputInterface $input, OutputInterface $output)
|
||||
{
|
||||
|
||||
$this->initTests($output);
|
||||
|
||||
$this->prepareTests($output);
|
||||
@@ -72,11 +71,7 @@ class module_console_fileEnsureProductionSetting extends Command
|
||||
|
||||
private function initTests(OutputInterface $output)
|
||||
{
|
||||
$spec = new Core\Configuration\Application();
|
||||
$parser = new Core\Configuration\Parser\Yaml();
|
||||
$handler = new Core\Configuration\Handler($spec, $parser);
|
||||
|
||||
$this->configuration = new Core\Configuration($handler);
|
||||
$this->configuration = Core\Configuration::build();
|
||||
|
||||
if (!$this->configuration->isInstalled())
|
||||
{
|
||||
@@ -175,35 +170,18 @@ class module_console_fileEnsureProductionSetting extends Command
|
||||
|
||||
private function checkParse(OutputInterface $output)
|
||||
{
|
||||
$parser = $this
|
||||
->configuration
|
||||
->getConfigurationHandler()
|
||||
->getParser();
|
||||
$fileConfig = $this
|
||||
->configuration
|
||||
->getConfigurationHandler()
|
||||
->getSpecification()
|
||||
->getConfigurationFile();
|
||||
$fileService = $this
|
||||
->configuration
|
||||
->getConfigurationHandler()
|
||||
->getSpecification()
|
||||
->getServiceFile();
|
||||
$fileConnexion = $this
|
||||
->configuration
|
||||
->getConfigurationHandler()
|
||||
->getSpecification()
|
||||
->getConnexionFile();
|
||||
|
||||
try
|
||||
if (!$this->configuration->getConfigurations())
|
||||
{
|
||||
$parser->parse($fileConfig);
|
||||
$parser->parse($fileService);
|
||||
$parser->parse($fileConnexion);
|
||||
throw new \Exception("Unable to load configurations\n");
|
||||
}
|
||||
catch (\Exception $e)
|
||||
if (!$this->configuration->getConnexions())
|
||||
{
|
||||
throw new \Exception("Error parsing file\n", null, $e);
|
||||
throw new \Exception("Unable to load connexions\n");
|
||||
}
|
||||
if (!$this->configuration->getServices())
|
||||
{
|
||||
throw new \Exception("Unable to load services\n");
|
||||
}
|
||||
|
||||
return;
|
||||
@@ -237,11 +215,7 @@ class module_console_fileEnsureProductionSetting extends Command
|
||||
|
||||
private function checkGetSelectedEnvironementFromFile(OutputInterface $output)
|
||||
{
|
||||
$spec = new Core\Configuration\Application();
|
||||
$parser = new Core\Configuration\Parser\Yaml();
|
||||
$handler = new Core\Configuration\Handler($spec, $parser);
|
||||
|
||||
$configuration = new Core\Configuration($handler);
|
||||
$configuration = Core\Configuration::build();
|
||||
|
||||
try
|
||||
{
|
||||
@@ -262,26 +236,48 @@ class module_console_fileEnsureProductionSetting extends Command
|
||||
{
|
||||
$phraseanet = $this->configuration->getPhraseanet();
|
||||
|
||||
$this->printConf($output, 'phraseanet', $phraseanet->all());
|
||||
|
||||
$url = $phraseanet->get("servername");
|
||||
|
||||
if (empty($url))
|
||||
foreach($phraseanet->all() as $conf=>$value)
|
||||
{
|
||||
throw new \Exception("phraseanet:servername connot be empty");
|
||||
}
|
||||
|
||||
if (!filter_var($url, FILTER_VALIDATE_URL))
|
||||
switch($conf)
|
||||
{
|
||||
throw new \Exception(sprintf("%s url is not valid", $url));
|
||||
}
|
||||
default:
|
||||
$this->printConf($output, $conf, $value);
|
||||
break;
|
||||
case 'servername':
|
||||
$url = $value;
|
||||
|
||||
$parseUrl = parse_url($url);
|
||||
|
||||
if ($parseUrl["scheme"] !== "https")
|
||||
if (empty($url))
|
||||
{
|
||||
$output->writeln(sprintf("<comment>/!\ %s url scheme should be https</comment>", $url));
|
||||
$message = "<error>should not be empty</error>";
|
||||
}
|
||||
elseif (!filter_var($url, FILTER_VALIDATE_URL))
|
||||
{
|
||||
$message = "<error>not valid</error>";
|
||||
}
|
||||
elseif ($parseUrl["scheme"] !== "https")
|
||||
{
|
||||
$message = "<comment>should be https</comment>";
|
||||
}
|
||||
else
|
||||
{
|
||||
$message = "<info>OK</info>";
|
||||
}
|
||||
$this->printConf($output, $conf, $value, false, $message);
|
||||
break;
|
||||
case 'maintenance':
|
||||
case 'debug':
|
||||
case 'display_errors':
|
||||
$message = $value ? '<error>Should be false</error>' : '<info>OK</info>';
|
||||
$this->printConf($output, $conf, $value, false, $message);
|
||||
break;
|
||||
}
|
||||
}
|
||||
// $this->printConf($output, 'phraseanet', $phraseanet->all());
|
||||
|
||||
// $url = $phraseanet->get("servername");
|
||||
|
||||
|
||||
|
||||
if (!$phraseanet->has("debug"))
|
||||
@@ -624,7 +620,7 @@ class module_console_fileEnsureProductionSetting extends Command
|
||||
}
|
||||
}
|
||||
|
||||
private function printConf($output, $scope, $value, $scopage = false)
|
||||
private function printConf($output, $scope, $value, $scopage = false, $message = '')
|
||||
{
|
||||
if (is_array($value))
|
||||
{
|
||||
@@ -632,24 +628,24 @@ class module_console_fileEnsureProductionSetting extends Command
|
||||
{
|
||||
if ($scopage)
|
||||
$key = $scope . ":" . $key;
|
||||
$this->printConf($output, $key, $val, $scopage);
|
||||
$this->printConf($output, $key, $val, $scopage, '');
|
||||
}
|
||||
}
|
||||
elseif (is_bool($value))
|
||||
{
|
||||
if ($value === false)
|
||||
{
|
||||
$value = '0';
|
||||
$value = 'false';
|
||||
}
|
||||
elseif ($value === true)
|
||||
{
|
||||
$value = '1';
|
||||
$value = 'true';
|
||||
}
|
||||
$output->writeln(sprintf("\t%s: %s", $scope, $value));
|
||||
$output->writeln(sprintf("\t%s: %s %s", $scope, $value, $message));
|
||||
}
|
||||
elseif (!empty($value))
|
||||
{
|
||||
$output->writeln(sprintf("\t%s: %s", $scope, $value));
|
||||
$output->writeln(sprintf("\t%s: %s %s", $scope, $value, $message));
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -65,11 +65,7 @@ class module_console_systemUpgrade extends Command
|
||||
|
||||
$credentials = $conn->get_credentials();
|
||||
|
||||
$handler = new \Alchemy\Phrasea\Core\Configuration\Handler(
|
||||
new \Alchemy\Phrasea\Core\Configuration\Application(),
|
||||
new \Alchemy\Phrasea\Core\Configuration\Parser\Yaml()
|
||||
);
|
||||
$configuration = new \Alchemy\Phrasea\Core\Configuration($handler);
|
||||
$configuration = \Alchemy\Phrasea\Core\Configuration::build();
|
||||
|
||||
$connexionINI = array();
|
||||
|
||||
|
@@ -105,11 +105,7 @@ class phrasea
|
||||
|
||||
public static function start()
|
||||
{
|
||||
$handler = new \Alchemy\Phrasea\Core\Configuration\Handler(
|
||||
new \Alchemy\Phrasea\Core\Configuration\Application(),
|
||||
new \Alchemy\Phrasea\Core\Configuration\Parser\Yaml()
|
||||
);
|
||||
$configuration = new \Alchemy\Phrasea\Core\Configuration($handler);
|
||||
$configuration = \Alchemy\Phrasea\Core\Configuration::build();
|
||||
|
||||
$choosenConnexion = $configuration->getPhraseanet()->get('database');
|
||||
|
||||
|
@@ -59,11 +59,7 @@ class registry implements registryInterface
|
||||
{
|
||||
$this->cache = new Alchemy\Phrasea\Cache\ArrayCache();
|
||||
|
||||
$handler = new \Alchemy\Phrasea\Core\Configuration\Handler(
|
||||
new \Alchemy\Phrasea\Core\Configuration\Application(),
|
||||
new \Alchemy\Phrasea\Core\Configuration\Parser\Yaml()
|
||||
);
|
||||
$configuration = new \Alchemy\Phrasea\Core\Configuration($handler);
|
||||
$configuration = \Alchemy\Phrasea\Core\Configuration::build();
|
||||
|
||||
$this->cache->save('GV_RootPath', dirname(dirname(__DIR__)) . '/');
|
||||
if ($configuration->isInstalled())
|
||||
|
@@ -70,21 +70,9 @@ class setup
|
||||
|
||||
public static function is_installed()
|
||||
{
|
||||
$appConf = new \Alchemy\Phrasea\Core\Configuration\Application();
|
||||
$installed = false;
|
||||
try
|
||||
{
|
||||
$appConf->getConfigurationFile();
|
||||
$appConf->getConnexionFile();
|
||||
$appConf->getServiceFile();
|
||||
$installed = true;
|
||||
}
|
||||
catch (\Exception $e)
|
||||
{
|
||||
$appConf = new \Alchemy\Phrasea\Core\Configuration\ApplicationSpecification();
|
||||
|
||||
}
|
||||
|
||||
return $installed;
|
||||
return $appConf->isSetup();
|
||||
}
|
||||
|
||||
public static function needUpgradeConfigurationFile()
|
||||
@@ -817,37 +805,9 @@ class setup
|
||||
}
|
||||
}
|
||||
|
||||
$appConf = new \Alchemy\Phrasea\Core\Configuration\Application();
|
||||
$appConf = new \Alchemy\Phrasea\Core\Configuration\ApplicationSpecification();
|
||||
|
||||
try
|
||||
{
|
||||
$configFile = $appConf->getConfigurationFile();
|
||||
unlink($configFile->getPathname());
|
||||
}
|
||||
catch (\Exception $e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
$serviceFile = $appConf->getServiceFile();
|
||||
unlink($serviceFile->getPathname());
|
||||
}
|
||||
catch (\Exception $e)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
$connexionfFile = $appConf->getConnexionFile();
|
||||
unlink($connexionfFile->getPathname());
|
||||
}
|
||||
catch (\Exception $e)
|
||||
{
|
||||
|
||||
}
|
||||
$appConf->delete();
|
||||
|
||||
return;
|
||||
}
|
||||
|
@@ -61,37 +61,38 @@ class ConfigurationTest extends \PhraseanetPHPUnitAbstract
|
||||
|
||||
public function setUp()
|
||||
{
|
||||
$this->markTestSkipped('To rewrite');
|
||||
parent::setUp();
|
||||
|
||||
$specNotInstalled = $this->getMock(
|
||||
'\Alchemy\Phrasea\Core\Configuration\Application'
|
||||
, array('getConfigurationFile')
|
||||
, array('getConfigurationsFile')
|
||||
);
|
||||
|
||||
$specNotInstalled->expects($this->any())
|
||||
->method('getConfigurationFile')
|
||||
->method('getConfigurationsFile')
|
||||
->will(
|
||||
$this->throwException(new Exception)
|
||||
);
|
||||
|
||||
$specExperience = $this->getMock(
|
||||
'\Alchemy\Phrasea\Core\Configuration\Application'
|
||||
, array('getConfigurationFile')
|
||||
, array('getConfigurationsFile')
|
||||
);
|
||||
|
||||
$specExperience->expects($this->any())
|
||||
->method('getConfigurationFile')
|
||||
->method('getConfigurationsFile')
|
||||
->will(
|
||||
$this->returnValue(
|
||||
new \SplFileObject(__DIR__ . '/confTestFiles/config.yml')
|
||||
)
|
||||
);
|
||||
|
||||
$handler = new Configuration\Handler($specNotInstalled, new Configuration\Parser\Yaml());
|
||||
$handler = new Configuration\Handler($specNotInstalled);
|
||||
$this->confNotInstalled = new PhraseaCore\Configuration($handler);
|
||||
|
||||
|
||||
$handler = new Configuration\Handler($specExperience, new Configuration\Parser\Yaml());
|
||||
$handler = new Configuration\Handler($specExperience);
|
||||
$this->object = new PhraseaCore\Configuration($handler);
|
||||
}
|
||||
|
||||
@@ -289,7 +290,7 @@ class ConfigurationTest extends \PhraseanetPHPUnitAbstract
|
||||
$this->returnValue($file->getPathname())
|
||||
);
|
||||
|
||||
$handler = new Configuration\Handler($stub, new Configuration\Parser\Yaml());
|
||||
$handler = new Configuration\Handler($stub);
|
||||
|
||||
$configuration = new PhraseaCore\Configuration($handler);
|
||||
|
||||
@@ -327,7 +328,7 @@ class ConfigurationTest extends \PhraseanetPHPUnitAbstract
|
||||
$this->returnValue("unknow_path")
|
||||
);
|
||||
|
||||
$handler = new Configuration\Handler($stub, new Configuration\Parser\Yaml());
|
||||
$handler = new Configuration\Handler($stub);
|
||||
|
||||
$configuration = new PhraseaCore\Configuration($handler);
|
||||
|
||||
@@ -367,7 +368,7 @@ class ConfigurationTest extends \PhraseanetPHPUnitAbstract
|
||||
$this->returnValue($file->getPathname())
|
||||
);
|
||||
|
||||
$handler = new Configuration\Handler($stub, new Configuration\Parser\Yaml());
|
||||
$handler = new Configuration\Handler($stub);
|
||||
|
||||
$configuration = new PhraseaCore\Configuration($handler);
|
||||
|
||||
@@ -393,7 +394,7 @@ class ConfigurationTest extends \PhraseanetPHPUnitAbstract
|
||||
$this->returnValue("unknow_path")
|
||||
);
|
||||
|
||||
$handler = new Configuration\Handler($stub, new Configuration\Parser\Yaml());
|
||||
$handler = new Configuration\Handler($stub);
|
||||
|
||||
$configuration = new PhraseaCore\Configuration($handler);
|
||||
|
||||
@@ -469,7 +470,7 @@ class ConfigurationTest extends \PhraseanetPHPUnitAbstract
|
||||
$this->returnValue($file->getPathname())
|
||||
);
|
||||
|
||||
$handler = new Configuration\Handler($stub, new Configuration\Parser\Yaml());
|
||||
$handler = new Configuration\Handler($stub);
|
||||
|
||||
$configuration = new PhraseaCore\Configuration($handler);
|
||||
|
||||
@@ -480,7 +481,7 @@ class ConfigurationTest extends \PhraseanetPHPUnitAbstract
|
||||
|
||||
try
|
||||
{
|
||||
$configuration->getConfiguration();//it is not loaded
|
||||
$configuration->getConfiguration(); //it is not loaded
|
||||
$this->fail("should raise an exception");
|
||||
}
|
||||
catch (\Exception $e)
|
||||
@@ -495,23 +496,5 @@ class ConfigurationTest extends \PhraseanetPHPUnitAbstract
|
||||
unlink(__DIR__ . "/confTestFiles/yamlWriteTest.yml");
|
||||
}
|
||||
|
||||
public function testSetHandler()
|
||||
{
|
||||
$handler = new Configuration\Handler(new Configuration\Application(), new Configuration\Parser\Yaml());
|
||||
$this->object->setConfigurationHandler($handler);
|
||||
$this->assertEquals($handler, $this->object->getConfigurationHandler());
|
||||
}
|
||||
|
||||
public function testGetHandler()
|
||||
{
|
||||
$stub = $this->getMock(
|
||||
'\Alchemy\Phrasea\Core\Configuration\Application'
|
||||
, array('getConfigurationFile')
|
||||
);
|
||||
|
||||
$handler = new Configuration\Handler($stub, new Configuration\Parser\Yaml());
|
||||
|
||||
$this->assertEquals($handler, $this->object->getConfigurationHandler());
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -64,12 +64,6 @@ no_display_errors:
|
||||
cache: array_cache
|
||||
|
||||
missing_phraseanet:
|
||||
##phraseanet:
|
||||
##servername: 'http://dev.phrasea.net/'
|
||||
##maintenance: false
|
||||
##debug: true
|
||||
##display_errors: true
|
||||
##database: main_connexion
|
||||
template_engine: twig_debug
|
||||
orm: doctrine_test
|
||||
cache: array_cache
|
||||
|
@@ -114,14 +114,12 @@ class CoreTest extends PhraseanetPHPUnitAbstract
|
||||
|
||||
set_new_overload(array($this, 'newCallback'));
|
||||
|
||||
$handler = new \Alchemy\Phrasea\Core\Configuration\Handler(
|
||||
new \Alchemy\Phrasea\Core\Configuration\Application()
|
||||
, new \Alchemy\Phrasea\Core\Configuration\Parser\Yaml()
|
||||
);
|
||||
$specification = new \Alchemy\Phrasea\Core\Configuration\ApplicationSpecification();
|
||||
|
||||
$class = $this->getMock(
|
||||
'\Alchemy\Phrasea\Core\Configuration'
|
||||
, array('isInstalled')
|
||||
, array($handler)
|
||||
, array($specification)
|
||||
, 'ConfMock'
|
||||
);
|
||||
|
||||
|
@@ -814,11 +814,7 @@ abstract class PhraseanetPHPUnitAbstract extends WebTestCase
|
||||
*/
|
||||
protected function resetTwig()
|
||||
{
|
||||
$handler = new \Alchemy\Phrasea\Core\Configuration\Handler(
|
||||
new \Alchemy\Phrasea\Core\Configuration\Application(),
|
||||
new \Alchemy\Phrasea\Core\Configuration\Parser\Yaml()
|
||||
);
|
||||
$configuration = new \Alchemy\Phrasea\Core\Configuration($handler);
|
||||
$configuration = \Alchemy\Phrasea\Core\Configuration::build();
|
||||
|
||||
$serviceName = $configuration->getTemplating();
|
||||
$confService = $configuration->getService($serviceName);
|
||||
|
Reference in New Issue
Block a user