当前位置: 首页>>代码示例>>PHP>>正文


PHP TestCase::getServiceManager方法代码示例

本文整理汇总了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;
 }
开发者ID:tillk,项目名称:vufind,代码行数:22,代码来源:DbTestCase.php


注:本文中的TestCase::getServiceManager方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。