public function testCannotCreateProducerWhenConnectionPluginManagerIsMissing() { $config = array('humus_amqp_module' => array('default_connection' => 'default', 'connections' => array('default' => array('host' => 'localhost', 'port' => 5672, 'login' => 'guest', 'password' => 'guest', 'vhost' => '/')), 'exchanges' => array('demo-exchange' => array('name' => 'demo-exchange', 'type' => 'direct', 'durable' => false, 'autoDelete' => true)), 'queues' => array('test-queue' => array('name' => 'test-queue', 'exchange' => 'demo-exchange', 'autoDelete' => true)), 'producers' => array('test-producer' => array('connection' => 'default', 'exchange' => 'demo-exchange', 'auto_setup_fabric' => true), 'test-producer-2' => array('exchange' => 'demo-exchange', 'auto_setup_fabric' => true)))); $services = $this->services = new ServiceManager(); $services->setAllowOverride(true); $services->setService('Config', $config); $components = $this->components = new TestAsset\ProducerAbstractServiceFactory(); $services->setService('HumusAmqpModule\\PluginManager\\Producer', $producerManager = new ProducerPluginManager()); $producerManager->addAbstractFactory($components); $producerManager->setServiceLocator($services); try { $producerManager->get('test-producer'); } catch (\Zend\ServiceManager\Exception\ServiceNotCreatedException $e) { $p = $e->getPrevious()->getPrevious(); $this->assertInstanceOf('HumusAmqpModule\\Exception\\RuntimeException', $p); $this->assertEquals('HumusAmqpModule\\PluginManager\\Connection not found', $p->getMessage()); } }