/**
  * Set up service manager and database configuration.
  *
  * @see PHPUnit_Framework_TestCase::setUp()
  */
 protected function setUp()
 {
     $serviceManagerConfig = new Config(['factories' => ['SphinxSearch\\Db\\Adapter\\Adapter' => 'SphinxSearch\\Db\\Adapter\\AdapterServiceFactory'], 'alias' => ['sphinxql' => 'SphinxSearch\\Db\\Adapter\\Adapter']]);
     $this->serviceManager = new ServiceManager();
     $serviceManagerConfig->configureServiceManager($this->serviceManager);
     $this->serviceManager->setService('Config', ['sphinxql' => ['driver' => 'pdo_mysql']]);
 }
 public function setUp()
 {
     $this->serviceManager = new ServiceManager(new Config(array('factories' => array('SphinxSearch\\Db\\Adapter\\Adapter' => 'SphinxSearch\\Db\\Adapter\\AdapterServiceFactory'), 'aliases' => array('sphinxql' => 'SphinxSearch\\Db\\Adapter\\Adapter'))));
     $this->serviceManager->setService('Config', array('sphinxql' => $this->config));
     $this->adapter = $this->serviceManager->get('sphinxql');
     $this->search = new Search($this->adapter);
     $this->sql = $this->search->getSql();
 }
 public function setUp()
 {
     $serviceManagerConfig = new Config(['factories' => ['SphinxSearch\\Db\\Adapter\\Adapter' => 'SphinxSearch\\Db\\Adapter\\AdapterServiceFactory'], 'aliases' => ['sphinxql' => 'SphinxSearch\\Db\\Adapter\\Adapter']]);
     $this->serviceManager = new ServiceManager();
     $serviceManagerConfig->configureServiceManager($this->serviceManager);
     $this->serviceManager->setService('Config', ['sphinxql' => $this->config]);
     $this->adapter = $this->serviceManager->get('sphinxql');
     $this->search = new Search($this->adapter);
     $this->sql = $this->search->getSql();
 }
示例#4
0
 public function setSiteAccess()
 {
     // init session
     $this->serviceManager->get('session');
     // set user context
     $container = new Container('initialized');
     $this->serviceManager->setService('user', new User($container->userId));
     $this->siteAccess = SiteaccessFactory::factory($this->serviceManager, $this->routeMatch->getParam('context'));
     return $this;
 }
 /**
  * @param ServiceLocatorInterface $serviceLocator
  * @return MvcTranslator
  */
 public function createService(ServiceLocatorInterface $serviceLocator)
 {
     // Assume that if a user has registered a service for the
     // TranslatorInterface, it must be valid
     if ($serviceLocator->has('Zend\\I18n\\Translator\\TranslatorInterface')) {
         return new MvcTranslator($serviceLocator->get('Zend\\I18n\\Translator\\TranslatorInterface'));
     }
     // If ext/intl is not loaded, return a dummy translator
     if (!extension_loaded('intl')) {
         return new MvcTranslator(new DummyTranslator());
     }
     // Load a translator from configuration, if possible
     if ($serviceLocator->has('Config')) {
         $config = $serviceLocator->get('Config');
         // 'translator' => false
         if (array_key_exists('translator', $config) && $config['translator'] === false) {
             return new MvcTranslator(new DummyTranslator());
         }
         // 'translator' => array( ... translator options ... )
         if (array_key_exists('translator', $config) && (is_array($config['translator']) && !empty($config['translator']) || $config['translator'] instanceof Traversable)) {
             $i18nTranslator = Translator::factory($config['translator']);
             $serviceLocator->setService('Zend\\I18n\\Translator\\TranslatorInterface', $i18nTranslator);
             return new MvcTranslator($i18nTranslator);
         }
     }
     // For BC purposes (pre-2.3.0), use the I18n Translator
     return new MvcTranslator(new Translator());
 }
 /**
  * Set up service manager and database configuration.
  *
  * @see PHPUnit_Framework_TestCase::setUp()
  */
 protected function setUp()
 {
     $sManagerConfig = new Config(['abstract_factories' => ['SphinxSearch\\Db\\Adapter\\AdapterAbstractServiceFactory']]);
     $this->serviceManager = new ServiceManager();
     $sManagerConfig->configureServiceManager($this->serviceManager);
     $this->serviceManager->setService('Config', ['sphinxql' => ['adapters' => ['SphinxSearch\\Db\\Adapter\\One' => ['driver' => 'pdo_mysql'], 'SphinxSearch\\Db\\Adapter\\Two' => ['driver' => 'pdo_mysql']]]]);
 }
示例#7
0
 public function setServiceLocator(ServiceLocatorInterface $serviceLocator)
 {
     $this->services = $serviceLocator;
     // adding cache service
     if (!$this->services->has('cache')) {
         $cache = new \BaseXMS\Cache\Storage\Adapter\Filesystem();
         $cache->setOptions(array('cache_dir' => 'data/cache'));
         $this->services->setService('cache', $cache);
     }
 }
 /**
  * Set up LoggerAbstractServiceFactory and loggers configuration.
  *
  * @see PHPUnit_Framework_TestCase::setUp()
  */
 protected function setUp()
 {
     $this->serviceManager = new ServiceManager(new ServiceManagerConfig(array('abstract_factories' => array('Zend\\Log\\LoggerAbstractServiceFactory'))));
     $this->serviceManager->setService('Config', array('log' => array('Application\\Frontend' => array(), 'Application\\Backend' => array())));
 }
 /**
  * Set up service manager and database configuration.
  *
  * @see PHPUnit_Framework_TestCase::setUp()
  */
 protected function setUp()
 {
     $this->serviceManager = new ServiceManager(new ServiceManagerConfig(array('abstract_factories' => array('Zend\\Db\\Adapter\\AdapterAbstractServiceFactory'))));
     $this->serviceManager->setService('Config', array('db' => array('adapters' => array('Zend\\Db\\Adapter\\Writer' => array('driver' => 'mysqli'), 'Zend\\Db\\Adapter\\Reader' => array('driver' => 'mysqli')))));
 }
 /**
  * Set up service manager and database configuration.
  *
  * @see PHPUnit_Framework_TestCase::setUp()
  */
 protected function setUp()
 {
     $this->serviceManager = new ServiceManager(new Config(array('factories' => array('SphinxSearch\\Db\\Adapter\\Adapter' => 'SphinxSearch\\Db\\Adapter\\AdapterServiceFactory'), 'alias' => array('sphinxql' => 'SphinxSearch\\Db\\Adapter\\Adapter'))));
     $this->serviceManager->setService('Config', array('sphinxql' => array('driver' => 'pdo_mysql')));
 }
 /**
  * Set up service manager and database configuration.
  *
  * @see PHPUnit_Framework_TestCase::setUp()
  */
 protected function setUp()
 {
     $this->serviceManager = new ServiceManager(new Config(array('abstract_factories' => array('SphinxSearch\\Db\\Adapter\\AdapterAbstractServiceFactory'))));
     $this->serviceManager->setService('Config', array('sphinxql' => array('adapters' => array('SphinxSearch\\Db\\Adapter\\One' => array('driver' => 'pdo_mysql'), 'SphinxSearch\\Db\\Adapter\\Two' => array('driver' => 'pdo_mysql')))));
 }