Skip to content
Snippets Groups Projects
Commit ca02497a authored by Demian Katz's avatar Demian Katz
Browse files

Update service manager setup.

parent d22977f9
Branches
Tags
No related merge requests found
......@@ -51,35 +51,33 @@ abstract class DbTestCase extends TestCase
protected function addTableManager(ServiceManager $sm)
{
$factory = new \VuFind\Db\Table\PluginManager(
new \Zend\ServiceManager\Config(
[
'abstract_factories' =>
['VuFind\Db\Table\PluginFactory'],
'factories' => [
'changetracker' =>
'VuFind\Db\Table\Factory::getChangeTracker',
'comments' => 'VuFind\Db\Table\Factory::getComments',
'externalsession' =>
'VuFind\Db\Table\Factory::getExternalSession',
'oairesumption' =>
'VuFind\Db\Table\Factory::getOaiResumption',
'record' => 'VuFind\Db\Table\Factory::getRecord',
'resource' => 'VuFind\Db\Table\Factory::getResource',
'resourcetags' =>
'VuFind\Db\Table\Factory::getResourceTags',
'search' => 'VuFind\Db\Table\Factory::getSearch',
'session' => 'VuFind\Db\Table\Factory::getSession',
'tags' => 'VuFind\Db\Table\Factory::getTags',
'user' => 'VuFind\Db\Table\Factory::getUser',
'usercard' => 'VuFind\Db\Table\Factory::getUserCard',
'userlist' => 'VuFind\Db\Table\Factory::getUserList',
'userresource' =>
'VuFind\Db\Table\Factory::getUserResource',
],
]
)
$sm,
[
'abstract_factories' =>
['VuFind\Db\Table\PluginFactory'],
'factories' => [
'changetracker' =>
'VuFind\Db\Table\Factory::getChangeTracker',
'comments' => 'VuFind\Db\Table\Factory::getComments',
'externalsession' =>
'VuFind\Db\Table\Factory::getExternalSession',
'oairesumption' =>
'VuFind\Db\Table\Factory::getOaiResumption',
'record' => 'VuFind\Db\Table\Factory::getRecord',
'resource' => 'VuFind\Db\Table\Factory::getResource',
'resourcetags' =>
'VuFind\Db\Table\Factory::getResourceTags',
'search' => 'VuFind\Db\Table\Factory::getSearch',
'session' => 'VuFind\Db\Table\Factory::getSession',
'tags' => 'VuFind\Db\Table\Factory::getTags',
'user' => 'VuFind\Db\Table\Factory::getUser',
'usercard' => 'VuFind\Db\Table\Factory::getUserCard',
'userlist' => 'VuFind\Db\Table\Factory::getUserList',
'userresource' =>
'VuFind\Db\Table\Factory::getUserResource',
],
]
);
$factory->setServiceLocator($sm);
$sm->setService('VuFind\DbTablePluginManager', $factory);
}
......@@ -93,29 +91,27 @@ abstract class DbTestCase extends TestCase
protected function addRowManager(ServiceManager $sm)
{
$factory = new \VuFind\Db\Row\PluginManager(
new \Zend\ServiceManager\Config(
[
'factories' => [
'changetracker' => 'VuFind\Db\Row\Factory::getChangeTracker',
'comments' => 'VuFind\Db\Row\Factory::getComments',
'externalsession' =>
'VuFind\Db\Row\Factory::getExternalSession',
'oairesumption' => 'VuFind\Db\Row\Factory::getOaiResumption',
'record' => 'VuFind\Db\Row\Factory::getRecord',
'resource' => 'VuFind\Db\Row\Factory::getResource',
'resourcetags' => 'VuFind\Db\Row\Factory::getResourceTags',
'search' => 'VuFind\Db\Row\Factory::getSearch',
'session' => 'VuFind\Db\Row\Factory::getSession',
'tags' => 'VuFind\Db\Row\Factory::getTags',
'user' => 'VuFind\Db\Row\Factory::getUser',
'usercard' => 'VuFind\Db\Row\Factory::getUserCard',
'userlist' => 'VuFind\Db\Row\Factory::getUserList',
'userresource' => 'VuFind\Db\Row\Factory::getUserResource',
],
]
)
$sm,
[
'factories' => [
'changetracker' => 'VuFind\Db\Row\Factory::getChangeTracker',
'comments' => 'VuFind\Db\Row\Factory::getComments',
'externalsession' =>
'VuFind\Db\Row\Factory::getExternalSession',
'oairesumption' => 'VuFind\Db\Row\Factory::getOaiResumption',
'record' => 'VuFind\Db\Row\Factory::getRecord',
'resource' => 'VuFind\Db\Row\Factory::getResource',
'resourcetags' => 'VuFind\Db\Row\Factory::getResourceTags',
'search' => 'VuFind\Db\Row\Factory::getSearch',
'session' => 'VuFind\Db\Row\Factory::getSession',
'tags' => 'VuFind\Db\Row\Factory::getTags',
'user' => 'VuFind\Db\Row\Factory::getUser',
'usercard' => 'VuFind\Db\Row\Factory::getUserCard',
'userlist' => 'VuFind\Db\Row\Factory::getUserList',
'userresource' => 'VuFind\Db\Row\Factory::getUserResource',
],
]
);
$factory->setServiceLocator($sm);
$sm->setService('VuFind\DbRowPluginManager', $factory);
}
......
......@@ -142,48 +142,41 @@ abstract class TestCase extends \PHPUnit_Framework_TestCase
if (!$this->serviceManager) {
$this->serviceManager = new \Zend\ServiceManager\ServiceManager();
$optionsFactory = new \VuFind\Search\Options\PluginManager(
new \Zend\ServiceManager\Config(
[
'abstract_factories' =>
['VuFind\Search\Options\PluginFactory'],
]
)
$this->serviceManager,
[
'abstract_factories' =>
['VuFind\Search\Options\PluginFactory'],
]
);
$optionsFactory->setServiceLocator($this->serviceManager);
$this->serviceManager->setService(
'VuFind\SearchOptionsPluginManager', $optionsFactory
);
$paramsFactory = new \VuFind\Search\Params\PluginManager(
new \Zend\ServiceManager\Config(
[
'abstract_factories' =>
['VuFind\Search\Params\PluginFactory'],
]
)
$this->serviceManager,
[
'abstract_factories' =>
['VuFind\Search\Params\PluginFactory'],
]
);
$paramsFactory->setServiceLocator($this->serviceManager);
$this->serviceManager->setService(
'VuFind\SearchParamsPluginManager', $paramsFactory
);
$resultsFactory = new \VuFind\Search\Results\PluginManager(
new \Zend\ServiceManager\Config(
[
'abstract_factories' =>
['VuFind\Search\Results\PluginFactory'],
]
)
$this->serviceManager,
[
'abstract_factories' =>
['VuFind\Search\Results\PluginFactory'],
]
);
$resultsFactory->setServiceLocator($this->serviceManager);
$this->serviceManager->setService(
'VuFind\SearchResultsPluginManager', $resultsFactory
);
$recordDriverFactory = new \VuFind\RecordDriver\PluginManager(
new \Zend\ServiceManager\Config(
[
'abstract_factories' =>
['VuFind\RecordDriver\PluginFactory']
]
)
$this->serviceManager,
[
'abstract_factories' =>
['VuFind\RecordDriver\PluginFactory']
]
);
$this->serviceManager->setService(
'VuFind\RecordDriverPluginManager', $recordDriverFactory
......@@ -198,11 +191,10 @@ abstract class TestCase extends \PHPUnit_Framework_TestCase
'VuFind\Http', new \VuFindHttp\HttpService()
);
$this->setupSearchService();
$cfg = new \Zend\ServiceManager\Config(
['abstract_factories' => ['VuFind\Config\PluginFactory']]
);
$cfg = ['abstract_factories' => ['VuFind\Config\PluginFactory']];
$this->serviceManager->setService(
'VuFind\Config', new \VuFind\Config\PluginManager($cfg)
'VuFind\Config',
new \VuFind\Config\PluginManager($this->serviceManager, $cfg)
);
$this->serviceManager->setService(
'SharedEventManager', new \Zend\EventManager\SharedEventManager()
......@@ -232,13 +224,8 @@ abstract class TestCase extends \PHPUnit_Framework_TestCase
$sm = $this->getServiceManager();
if (!$sm->has('VuFind\AuthPluginManager')) {
$authManager = new \VuFind\Auth\PluginManager(
new \Zend\ServiceManager\Config(
[
'abstract_factories' => ['VuFind\Auth\PluginFactory'],
]
)
$sm, ['abstract_factories' => ['VuFind\Auth\PluginFactory']]
);
$authManager->setServiceLocator($sm);
$sm->setService('VuFind\AuthPluginManager', $authManager);
}
return $sm->get('VuFind\AuthPluginManager');
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment