本文整理汇总了PHP中TestCase::getServiceManager方法的典型用法代码示例。如果您正苦于以下问题:PHP TestCase::getServiceManager方法的具体用法?PHP TestCase::getServiceManager怎么用?PHP TestCase::getServiceManager使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TestCase
的用法示例。
在下文中一共展示了TestCase::getServiceManager方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getServiceManager
/**
* Get a service manager.
*
* @return \Zend\ServiceManager\ServiceManager
*/
public function getServiceManager()
{
// Get parent service manager:
$sm = parent::getServiceManager();
// Add database service:
if (!$sm->has('VuFind\\DbTablePluginManager')) {
$dbFactory = new \VuFind\Db\AdapterFactory($sm->get('VuFind\\Config')->get('config'));
$sm->setService('VuFind\\DbAdapter', $dbFactory->getAdapter());
$factory = new \VuFind\Db\Table\PluginManager(new \Zend\ServiceManager\Config(['abstract_factories' => ['VuFind\\Db\\Table\\PluginFactory'], 'factories' => ['resource' => 'VuFind\\Db\\Table\\Factory::getResource', 'user' => 'VuFind\\Db\\Table\\Factory::getUser']]));
$factory->setServiceLocator($sm);
$sm->setService('VuFind\\DbTablePluginManager', $factory);
// Override the configuration so PostgreSQL tests can work:
$sm->setAllowOverride(true);
$sm->setService('config', ['vufind' => ['pgsql_seq_mapping' => ['comments' => ['id', 'comments_id_seq'], 'oai_resumption' => ['id', 'oai_resumption_id_seq'], 'resource' => ['id', 'resource_id_seq'], 'resource_tags' => ['id', 'resource_tags_id_seq'], 'search' => ['id', 'search_id_seq'], 'session' => ['id', 'session_id_seq'], 'tags' => ['id', 'tags_id_seq'], 'user' => ['id', 'user_id_seq'], 'user_list' => ['id', 'user_list_id_seq'], 'user_resource' => ['id', 'user_resource_id_seq']]]]);
}
return $sm;
}