Fix configuration usage

This commit is contained in:
Romain Neutron
2014-02-21 17:45:07 +01:00
parent 8a9b6d5d3c
commit de13d874a3
36 changed files with 92 additions and 127 deletions

View File

@@ -11,7 +11,6 @@
namespace Alchemy\Phrasea\Border;
use Alchemy\Phrasea\Core\Configuration\ConfigurationInterface;
use Alchemy\Phrasea\Core\Configuration\PropertyAccess;
use MediaVorus\Utils\AudioMimeTypeGuesser;
use MediaVorus\Utils\PostScriptMimeTypeGuesser;
@@ -24,12 +23,10 @@ class MimeGuesserConfiguration
{
/** @var PropertyAccess */
private $conf;
private $store;
public function __construct(PropertyAccess $conf, ConfigurationInterface $store)
public function __construct(PropertyAccess $conf)
{
$this->conf = $conf;
$this->store = $store;
}
/**
@@ -45,8 +42,6 @@ class MimeGuesserConfiguration
$guesser->register(new AudioMimeTypeGuesser());
$guesser->register(new VideoMimeTypeGuesser());
if ($this->store->isSetup()) {
$guesser->register(new CustomExtensionGuesser($this->conf->get(['border-manager', 'extension-mapping'], [])));
}
}
}

View File

@@ -65,8 +65,11 @@ class RegenerateSqliteDb extends Command
}
try {
$dbParams = $this->container['configuration.store']->getTestConnectionParameters();
$dbParams['path'] = $source;
$dbParams = [
'driver' => 'pdo_sqlite',
'path' => $source,
'charset' => 'UTF8',
];
$this->container->register(new ORMServiceProvider());
$this->container['EM.dbal-conf'] = $dbParams;

View File

@@ -183,7 +183,7 @@ class TaskManager implements ControllerProviderInterface
$task = $app['manipulator.task']->create(
$job->getName(),
$job->getJobId(),
$job->getEditor()->getDefaultSettings($app['configuration.store']),
$job->getEditor()->getDefaultSettings($app['conf']),
$job->getEditor()->getDefaultPeriod()
);

View File

@@ -185,7 +185,10 @@ class Configuration implements ConfigurationInterface
$this->delete();
$this->dumpFile($this->config, $this->loadFile(__DIR__ . static::CONFIG_REF), 0600);
return $this->getConfig();
// force rewrite
$this->getConfig();
return $this;
}
/**
@@ -201,15 +204,6 @@ class Configuration implements ConfigurationInterface
return $this->autoReload;
}
public function getTestConnectionParameters()
{
return [
'driver' => 'pdo_sqlite',
'path' => '/tmp/db.sqlite',
'charset' => 'UTF8',
];
}
private function loadDefaultConfiguration()
{
return $this->parser->parse($this->loadFile(__DIR__ . static::CONFIG_REF));

View File

@@ -11,7 +11,6 @@
namespace Alchemy\Phrasea\Core\Event\Subscriber;
use Alchemy\Phrasea\Application;
use Alchemy\Phrasea\Core\Configuration\HostConfiguration;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
use Symfony\Component\HttpKernel\Event\FinishRequestEvent;

View File

@@ -100,12 +100,14 @@ class BorderManagerServiceProvider implements ServiceProviderInterface
});
$app['border-manager.mime-guesser-configuration'] = $app->share(function (Application $app) {
return new MimeGuesserConfiguration($app['conf'], $app['configuration.store']);
return new MimeGuesserConfiguration($app['conf']);
});
}
public function boot(Application $app)
{
if ($app['configuration.store']->isSetup()) {
$app['border-manager.mime-guesser-configuration']->register();
}
}
}

View File

@@ -49,7 +49,7 @@ class TasksServiceProvider implements ServiceProviderInterface
});
$app['task-manager.status'] = $app->share(function (Application $app) {
return new TaskManagerStatus($app['configuration.store']);
return new TaskManagerStatus($app['conf']);
});
$app['task-manager.live-information'] = $app->share(function (Application $app) {

View File

@@ -40,9 +40,7 @@ abstract class AbstractConfigurationPanel implements ConfigurationPanelInterface
*/
public function saveConfiguration(array $configuration)
{
$conf = $this->conf->getConfig();
$conf['main']['search-engine']['options'] = $configuration;
$this->conf->setConfig($conf);
$this->conf->set(['main', 'search-engine', 'options'], $configuration);
return $this;
}

View File

@@ -12,15 +12,15 @@
namespace Alchemy\Phrasea\SearchEngine\Elastic;
use Alchemy\Phrasea\Application;
use Alchemy\Phrasea\Core\Configuration\PropertyAccess;
use Alchemy\Phrasea\SearchEngine\AbstractConfigurationPanel;
use Symfony\Component\HttpFoundation\Request;
use Alchemy\Phrasea\Core\Configuration\ConfigurationInterface;
class ConfigurationPanel extends AbstractConfigurationPanel
{
private $searchEngine;
public function __construct(ElasticSearchEngine $engine, ConfigurationInterface $conf)
public function __construct(ElasticSearchEngine $engine, PropertyAccess $conf)
{
$this->searchEngine = $engine;
$this->conf = $conf;
@@ -62,6 +62,6 @@ class ConfigurationPanel extends AbstractConfigurationPanel
*/
public function getConfiguration()
{
return isset($this->conf['main']['search-engine']['options']) ? $this->conf['main']['search-engine']['options'] : [];
return $this->conf->get(['main', 'search-engine', 'options'], []);
}
}

View File

@@ -94,7 +94,7 @@ class ElasticSearchEngine implements SearchEngineInterface
public function getConfigurationPanel()
{
if (!$this->configurationPanel) {
$this->configurationPanel = new ConfigurationPanel($this, $this->app['configuration.store']);
$this->configurationPanel = new ConfigurationPanel($this, $this->app['conf']);
}
return $this->configurationPanel;

View File

@@ -12,16 +12,16 @@
namespace Alchemy\Phrasea\SearchEngine\Phrasea;
use Alchemy\Phrasea\Application;
use Alchemy\Phrasea\Core\Configuration\PropertyAccess;
use Alchemy\Phrasea\SearchEngine\AbstractConfigurationPanel;
use Symfony\Component\HttpFoundation\Request;
use Alchemy\Phrasea\Core\Configuration\ConfigurationInterface;
class ConfigurationPanel extends AbstractConfigurationPanel
{
protected $charsets;
protected $searchEngine;
public function __construct(PhraseaEngine $engine, ConfigurationInterface $conf)
public function __construct(PhraseaEngine $engine, PropertyAccess $conf)
{
$this->searchEngine = $engine;
$this->conf = $conf;
@@ -75,7 +75,7 @@ class ConfigurationPanel extends AbstractConfigurationPanel
*/
public function getConfiguration()
{
$configuration = isset($this->conf['main']['search-engine']['options']) ? $this->conf['main']['search-engine']['options'] : [];
$configuration = $this->conf->get(['main', 'search-engine', 'options'], []);
if (!is_array($configuration)) {
$configuration = [];

View File

@@ -223,7 +223,7 @@ class PhraseaEngine implements SearchEngineInterface
public function getConfigurationPanel()
{
if (!$this->configurationPanel) {
$this->configurationPanel = new ConfigurationPanel($this, $this->app['configuration.store']);
$this->configurationPanel = new ConfigurationPanel($this, $this->app['conf']);
}
return $this->configurationPanel;

View File

@@ -11,11 +11,11 @@
namespace Alchemy\Phrasea\SearchEngine\SphinxSearch;
use Alchemy\Phrasea\Core\Configuration\PropertyAccess;
use Alchemy\Phrasea\SearchEngine\AbstractConfigurationPanel;
use Alchemy\Phrasea\Application;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\Finder\Finder;
use Alchemy\Phrasea\Core\Configuration\ConfigurationInterface;
class ConfigurationPanel extends AbstractConfigurationPanel
{
@@ -24,7 +24,7 @@ class ConfigurationPanel extends AbstractConfigurationPanel
protected $charsets;
protected $searchEngine;
public function __construct(SphinxSearchEngine $engine, ConfigurationInterface $conf)
public function __construct(SphinxSearchEngine $engine, PropertyAccess $conf)
{
$this->searchEngine = $engine;
$this->conf = $conf;
@@ -86,23 +86,11 @@ class ConfigurationPanel extends AbstractConfigurationPanel
*/
public function getConfiguration()
{
$configuration = isset($this->conf['main']['search-engine']['options']) ? $this->conf['main']['search-engine']['options'] : [];
$configuration = $this->conf->get(['main', 'search-engine', 'options'], []);
return self::populateConfiguration($configuration);
}
/**
* {@inheritdoc}
*/
public function saveConfiguration(array $configuration)
{
$conf = $this->conf->getConfig();
$conf['main']['search-engine']['options'] = $configuration;
$this->conf->setConfig($conf);
return $this;
}
/**
* Returns all the charset Sphinx Search supports
*

View File

@@ -173,7 +173,7 @@ class SphinxSearchEngine implements SearchEngineInterface
public function getConfigurationPanel()
{
if (!$this->configurationPanel) {
$this->configurationPanel = new ConfigurationPanel($this, $this->app['configuration.store']);
$this->configurationPanel = new ConfigurationPanel($this, $this->app['conf']);
}
return $this->configurationPanel;

View File

@@ -95,7 +95,7 @@ class Installer
$this->app['manipulator.task']->create(
$job->getName(),
$job->getJobId(),
$job->getEditor()->getDefaultSettings($this->app['configuration.store']),
$job->getEditor()->getDefaultSettings($this->app['conf']),
$job->getEditor()->getDefaultPeriod()
);
}
@@ -171,7 +171,7 @@ class Installer
private function createConfigFile($abConn, $serverName, $binaryData)
{
$config = $this->app['configuration.store']->initialize();
$config = $this->app['configuration.store']->initialize()->getConfig();
foreach ($abConn->get_credentials() as $key => $value) {
$key = $key == 'hostname' ? 'host' : $key;

View File

@@ -12,6 +12,7 @@
namespace Alchemy\Phrasea\Setup\Version\Migration;
use Alchemy\Phrasea\Application;
use Alchemy\Phrasea\Core\Configuration\Configuration;
class Migration35 implements MigrationInterface
{
@@ -29,7 +30,7 @@ class Migration35 implements MigrationInterface
throw new \LogicException('Required config files not found');
}
$config = $this->app['configuration.store']->initialize();
$config = $this->app['configuration.store']->initialize()->getConfig();
foreach ($config['registration-fields'] as $key => $field) {
$config['registration-fields'][$key]['required'] = (boolean) $field['required'];

View File

@@ -11,7 +11,7 @@
namespace Alchemy\Phrasea\TaskManager\Editor;
use Alchemy\Phrasea\Core\Configuration\ConfigurationInterface;
use Alchemy\Phrasea\Core\Configuration\PropertyAccess;
class ArchiveEditor extends AbstractEditor
{
@@ -34,7 +34,7 @@ class ArchiveEditor extends AbstractEditor
/**
* {@inheritdoc}
*/
public function getDefaultSettings(ConfigurationInterface $config = null)
public function getDefaultSettings(PropertyAccess $config = null)
{
return <<<EOF
<?xml version="1.0" encoding="UTF-8"?>

View File

@@ -11,7 +11,7 @@
namespace Alchemy\Phrasea\TaskManager\Editor;
use Alchemy\Phrasea\Core\Configuration\ConfigurationInterface;
use Alchemy\Phrasea\Core\Configuration\PropertyAccess;
class DefaultEditor extends AbstractEditor
{
@@ -34,7 +34,7 @@ class DefaultEditor extends AbstractEditor
/**
* {@inheritdoc}
*/
public function getDefaultSettings(ConfigurationInterface $config = null)
public function getDefaultSettings(PropertyAccess $config = null)
{
return <<<EOF
<?xml version="1.0" encoding="UTF-8"?>

View File

@@ -12,7 +12,7 @@
namespace Alchemy\Phrasea\TaskManager\Editor;
use Alchemy\Phrasea\Application;
use Alchemy\Phrasea\Core\Configuration\ConfigurationInterface;
use Alchemy\Phrasea\Core\Configuration\PropertyAccess;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
@@ -53,11 +53,11 @@ interface EditorInterface
* Configuration is used to populate the default configuration with
* configuration values.
*
* @param Configuration $config
* @param PropertyAccess $config
*
* @return string An XML string
*/
public function getDefaultSettings(ConfigurationInterface $config = null);
public function getDefaultSettings(PropertyAccess $config = null);
/**
* Returns the default period of the job.

View File

@@ -11,7 +11,7 @@
namespace Alchemy\Phrasea\TaskManager\Editor;
use Alchemy\Phrasea\Core\Configuration\ConfigurationInterface;
use Alchemy\Phrasea\Core\Configuration\PropertyAccess;
class FtpEditor extends AbstractEditor
{
@@ -34,7 +34,7 @@ class FtpEditor extends AbstractEditor
/**
* {@inheritdoc}
*/
public function getDefaultSettings(ConfigurationInterface $config = null)
public function getDefaultSettings(PropertyAccess $config = null)
{
return <<<EOF
<?xml version="1.0" encoding="UTF-8"?>

View File

@@ -11,7 +11,7 @@
namespace Alchemy\Phrasea\TaskManager\Editor;
use Alchemy\Phrasea\Core\Configuration\ConfigurationInterface;
use Alchemy\Phrasea\Core\Configuration\PropertyAccess;
class FtpPullEditor extends AbstractEditor
{
@@ -34,7 +34,7 @@ class FtpPullEditor extends AbstractEditor
/**
* {@inheritdoc}
*/
public function getDefaultSettings(ConfigurationInterface $config = null)
public function getDefaultSettings(PropertyAccess $config = null)
{
return <<<EOF
<?xml version="1.0" encoding="UTF-8"?>

View File

@@ -11,7 +11,7 @@
namespace Alchemy\Phrasea\TaskManager\Editor;
use Alchemy\Phrasea\Core\Configuration\ConfigurationInterface;
use Alchemy\Phrasea\Core\Configuration\PropertyAccess;
class PhraseanetIndexerEditor extends AbstractEditor
{
@@ -35,18 +35,16 @@ class PhraseanetIndexerEditor extends AbstractEditor
/**
* {@inheritdoc}
*/
public function getDefaultSettings(ConfigurationInterface $config = null)
public function getDefaultSettings(PropertyAccess $config = null)
{
if (null !== $config) {
$database = $config['main']['database'];
return '<?xml version="1.0" encoding="UTF-8"?>
<tasksettings>
<host>'.$database['host'].'</host>
<port>'.$database['port'].'</port>
<base>'.$database['dbname'].'</base>
<user>'.$database['user'].'</user>
<password>'.$database['password'].'</password>
<host>'.$config->get(['main', 'database', 'host']).'</host>
<port>'.$config->get(['main', 'database', 'port']).'</port>
<base>'.$config->get(['main', 'database', 'dbname']).'</base>
<user>'.$config->get(['main', 'database', 'user']).'</user>
<password>'.$config->get(['main', 'database', 'password']).'</password>
<socket>25200</socket>
<nolog>0</nolog>
<clng></clng>

View File

@@ -12,7 +12,7 @@
namespace Alchemy\Phrasea\TaskManager\Editor;
use Alchemy\Phrasea\Application;
use Alchemy\Phrasea\Core\Configuration\ConfigurationInterface;
use Alchemy\Phrasea\Core\Configuration\PropertyAccess;
use Alchemy\Phrasea\TaskManager\Job\RecordMoverJob;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
@@ -74,7 +74,7 @@ class RecordMoverEditor extends AbstractEditor
/**
* {@inheritdoc}
*/
public function getDefaultSettings(ConfigurationInterface $config = null)
public function getDefaultSettings(PropertyAccess $config = null)
{
return <<<EOF
<?xml version="1.0" encoding="UTF-8"?>

View File

@@ -11,7 +11,7 @@
namespace Alchemy\Phrasea\TaskManager\Editor;
use Alchemy\Phrasea\Core\Configuration\ConfigurationInterface;
use Alchemy\Phrasea\Core\Configuration\PropertyAccess;
class SubdefsEditor extends AbstractEditor
{
@@ -34,7 +34,7 @@ class SubdefsEditor extends AbstractEditor
/**
* {@inheritdoc}
*/
public function getDefaultSettings(ConfigurationInterface $config = null)
public function getDefaultSettings(PropertyAccess $config = null)
{
return <<<EOF
<?xml version="1.0" encoding="UTF-8"?>

View File

@@ -11,7 +11,7 @@
namespace Alchemy\Phrasea\TaskManager\Editor;
use Alchemy\Phrasea\Core\Configuration\ConfigurationInterface;
use Alchemy\Phrasea\Core\Configuration\PropertyAccess;
class WriteMetadataEditor extends AbstractEditor
{
@@ -34,7 +34,7 @@ class WriteMetadataEditor extends AbstractEditor
/**
* {@inheritdoc}
*/
public function getDefaultSettings(ConfigurationInterface $config = null)
public function getDefaultSettings(PropertyAccess $config = null)
{
return <<<EOF
<?xml version="1.0" encoding="UTF-8"?>

View File

@@ -11,7 +11,7 @@
namespace Alchemy\Phrasea\TaskManager;
use Alchemy\Phrasea\Core\Configuration\ConfigurationInterface;
use Alchemy\Phrasea\Core\Configuration\PropertyAccess;
/**
* Gets and Sets the Task Manager status
@@ -24,7 +24,7 @@ class TaskManagerStatus
const STATUS_STARTED = 'started';
const STATUS_STOPPED = 'stopped';
public function __construct(ConfigurationInterface $conf)
public function __construct(PropertyAccess $conf)
{
$this->conf = $conf;
}
@@ -64,34 +64,26 @@ class TaskManagerStatus
{
$this->ensureConfigurationSchema();
return $this->conf['main']['task-manager']['status'];
return $this->conf->get(['main', 'task-manager', 'status']);
}
private function setStatus($status)
{
$this->ensureConfigurationSchema();
$mainConf = $this->conf['main'];
$mainConf['task-manager']['status'] = $status;
$this->conf['main'] = $mainConf;
$this->conf->set(['main', 'task-manager', 'status'], $status);
}
private function ensureConfigurationSchema()
{
if (!isset($this->conf['main']['task-manager'])) {
$mainConf = $this->conf['main'];
$mainConf['task-manager'] = ['status' => static::STATUS_STARTED];
$this->conf['main'] = $mainConf;
if (!$this->conf->has(['main', 'task-manager'])) {
$this->conf->set(['main', 'task-manager'], ['status' => static::STATUS_STARTED]);
return;
}
if (!isset($this->conf['main']['task-manager']['status'])) {
$mainConf = $this->conf['main'];
$mainConf['task-manager']['status'] = static::STATUS_STARTED;
$this->conf['main'] = $mainConf;
} elseif (!$this->isValidStatus($this->conf['main']['task-manager']['status'])) {
$mainConf = $this->conf['main'];
$mainConf['task-manager']['status'] = static::STATUS_STARTED;
$this->conf['main'] = $mainConf;
if (!$this->conf->has(['main', 'task-manager', 'status'])) {
$this->conf->set(['main', 'task-manager', 'status'], static::STATUS_STARTED);
} elseif (!$this->isValidStatus($this->conf->get(['main', 'task-manager', 'status']))) {
$this->conf->set(['main', 'task-manager'], ['status' => static::STATUS_STARTED]);
}
}

View File

@@ -199,9 +199,7 @@ class API_V1_result
$this->app['dispatcher']->dispatch(PhraseaEvents::API_RESULT, new ApiResultEvent());
$conf = $this->app['configuration.store'];
if (isset($conf['main']['api-timers']) && true === $conf['main']['api-timers']) {
if ($this->app['conf']->get(['main', 'api-timers'], false)) {
$ret['timers'] = $this->app['api.timers']->toArray();
}

View File

@@ -56,7 +56,10 @@ class patch_380alpha3b implements patchInterface
*/
public function apply(base $appbox, Application $app)
{
$app['configuration.store']->setDefault('main', 'search-engine');
$app['conf']->set(['main', 'search-engine'], [
'type' => 'Alchemy\Phrasea\SearchEngine\Phrasea\PhraseaEngine',
'options' => [],
]);
return true;
}

View File

@@ -13,7 +13,6 @@ use Alchemy\Phrasea\Application;
use Alchemy\Phrasea\Model\Entities\FtpExport;
use Alchemy\Phrasea\Model\Entities\FtpExportElement;
use Gedmo\Timestampable\TimestampableListener;
use Doctrine\ORM\NoResultException;
class patch_390alpha6a extends patchAbstract
{

View File

@@ -23,16 +23,4 @@ class ConfigurationTest extends ConfigurationTestCase
return new Configuration($yaml, $compiler, $confFile, $compiledFile, $autoreload);
}
public function testGetTestConnectionConf()
{
$configFile = __DIR__ . '/Fixtures/configuration.yml';
$conf = $this->provideConfiguration($configFile, null, null, null, true);
$data = $conf->getTestConnectionParameters();
$this->assertArrayHasKey('driver', $data);
$this->assertArrayHasKey('path', $data);
$this->assertArrayHasKey('charset', $data);
}
}

View File

@@ -55,7 +55,8 @@ abstract class ConfigurationTestCase extends \PhraseanetTestCase
$compiled = $this->compiled;
$conf = $this->provideConfiguration($configFile);
$config = $conf->initialize();
$this->assertSame($conf, $conf->initialize());
$config = $conf->getConfig();
$this->assertArrayHasKey('main', $config);
$this->assertFileExists($compiled);

View File

@@ -9,6 +9,6 @@ class PhraseaConfigurationPanelTest extends ConfigurationPanelAbstractTest
{
public function getPanel()
{
return new ConfigurationPanel(new PhraseaEngine(self::$DI['app']), self::$DI['app']['configuration.store']);
return new ConfigurationPanel(new PhraseaEngine(self::$DI['app']), self::$DI['app']['conf']);
}
}

View File

@@ -9,7 +9,7 @@ class SphinxSearchConfigurationPanelTest extends ConfigurationPanelAbstractTest
{
public function getPanel()
{
return new ConfigurationPanel(new SphinxSearchEngine(self::$DI['app'], 'localhost', 9306, 'localhost', 9308), self::$DI['app']['configuration.store']);
return new ConfigurationPanel(new SphinxSearchEngine(self::$DI['app'], 'localhost', 9306, 'localhost', 9308), self::$DI['app']['conf']);
}
public function testGetAVailableCharsets()

View File

@@ -43,7 +43,7 @@ abstract class EditorTestCase extends \PhraseanetTestCase
$editor = $this->getEditor();
$dom = new \DOMDocument();
$dom->strictErrorChecking = true;
$this->assertTrue(false !== $dom->loadXML($editor->getDefaultSettings(self::$DI['app']['configuration.store'])));
$this->assertTrue(false !== $dom->loadXML($editor->getDefaultSettings(self::$DI['app']['conf'])));
}
public function testGetDefaultSettingsWithoutConfiguration()

View File

@@ -2,6 +2,7 @@
namespace Alchemy\Tests\Phrasea\TaskManager;
use Alchemy\Phrasea\Core\Configuration\PropertyAccess;
use Alchemy\Phrasea\TaskManager\TaskManagerStatus;
use Alchemy\Tests\Phrasea\MockArrayConf;
@@ -16,7 +17,7 @@ class TaskManagerStatusTest extends \PhraseanetTestCase
$expected = $conf->getConfig();
$expected['main']['task-manager']['status'] = TaskManagerStatus::STATUS_STARTED;
$status = new TaskManagerStatus($conf);
$status = new TaskManagerStatus(new PropertyAccess($conf));
$status->start();
$this->assertEquals($expected, $conf->getConfig());
@@ -45,7 +46,7 @@ class TaskManagerStatusTest extends \PhraseanetTestCase
$expected = $conf->getConfig();
$expected['main']['task-manager']['status'] = TaskManagerStatus::STATUS_STOPPED;
$status = new TaskManagerStatus($conf);
$status = new TaskManagerStatus(new PropertyAccess($conf));
$status->stop();
$this->assertEquals($expected, $conf->getConfig());
@@ -56,7 +57,7 @@ class TaskManagerStatusTest extends \PhraseanetTestCase
*/
public function testIsRunning($data, $expectedStatus, $isRunning)
{
$conf = new MockArrayConf($data);
$conf = new PropertyAccess(new MockArrayConf($data));
$status = new TaskManagerStatus($conf);
$this->assertEquals($isRunning, $status->isRunning());
}
@@ -77,7 +78,7 @@ class TaskManagerStatusTest extends \PhraseanetTestCase
*/
public function testGetStatus($data, $expectedStatus, $isRunning)
{
$conf = new MockArrayConf($data);
$conf = new PropertyAccess(new MockArrayConf($data));
$status = new TaskManagerStatus($conf);
$this->assertEquals($expectedStatus, $status->getStatus());
}

View File

@@ -15,10 +15,15 @@ class patch_380alpha3bTest extends \PhraseanetTestCase
$app = self::$DI['app'];
$app['configuration.store'] = $this->getMock('Alchemy\Phrasea\Core\Configuration\ConfigurationInterface');
$app['configuration.store']->expects($this->once())
->method('setDefault')
->with('main', 'search-engine');
$app['conf'] = $this->getMockBuilder('Alchemy\Phrasea\Core\Configuration\PropertyAccess')
->disableOriginalConstructor()
->getMock();
$app['conf']->expects($this->once())
->method('set')
->with(['main', 'search-engine'], [
'type' => 'Alchemy\Phrasea\SearchEngine\Phrasea\PhraseaEngine',
'options' => [],
]);
$this->assertTrue($patch->apply($appbox, $app));
}