コード例 #1
0
 /**
  * Create a queue
  *
  * @param  ServiceLocatorInterface $services
  * @param  string $name
  * @param  string $requestedName
  * @return Queue
  */
 public function createServiceWithName(ServiceLocatorInterface $services, $name, $requestedName)
 {
     $config = $this->getConfig($services);
     $config = $config[$requestedName];
     if (isset($config['adapter']) && is_string($config['adapter']) && $services->has($config['adapter'])) {
         $adapter = $services->get($config['adapter']);
         if ($adapter instanceof Adapter\AdapterInterface) {
             $config['adapter'] = $adapter;
         }
     }
     $queue = Queue::factory($config);
     return $queue;
 }
コード例 #2
0
ファイル: QueueTest.php プロジェクト: stakhanovist/queue
 public function testFactoryInvalidOptions()
 {
     $config = ['adapter' => ['adapter' => 'array', 'options' => ['dummyOption' => 'dummyValue']], 'options' => ['messageClass' => ZendMessage::class]];
     $this->setExpectedException(InvalidArgumentException::class);
     Queue::factory($config);
 }