protected function prepare($config)
 {
     $services = $this->services = new ServiceManager();
     $services->setAllowOverride(true);
     $services->setService('Config', $config);
     $connection = $this->getMock('AMQPConnection', array(), array(), '', false);
     $channel = $this->getMock('AMQPChannel', array(), array(), '', false);
     $channel->expects($this->any())->method('getPrefetchCount')->will($this->returnValue(10));
     $queue = $this->getMock('AMQPQueue', array(), array(), '', false);
     $queue->expects($this->any())->method('getChannel')->will($this->returnValue($channel));
     $queueFactory = $this->getMock('HumusAmqpModule\\QueueFactory');
     $queueFactory->expects($this->any())->method('create')->will($this->returnValue($queue));
     $connectionManager = $this->getMock('HumusAmqpModule\\PluginManager\\Connection');
     $connectionManager->expects($this->any())->method('get')->with('default')->willReturn($connection);
     $dependentComponent = new ConnectionAbstractServiceFactory();
     $this->services->setService('HumusAmqpModule\\PluginManager\\Connection', $cm = new ConnectionPluginManager());
     $cm->addAbstractFactory($dependentComponent);
     $cm->setServiceLocator($this->services);
     $components = $this->components = new TestAsset\RpcClientAbstractServiceFactory();
     $components->setChannelMock($channel);
     $components->setQueueFactory($queueFactory);
     $this->services->setService('HumusAmqpModule\\PluginManager\\RpcClient', $rpccm = new RpcClientPluginManager());
     $rpccm->addAbstractFactory($components);
     $rpccm->setServiceLocator($this->services);
 }
 /**
  * @expectedException HumusAmqpModule\Exception\RuntimeException
  */
 public function testInvalidPlugin()
 {
     $manager = new RpcClientPluginManager();
     $manager->validatePlugin('foo');
 }