示例#1
0
 /**
  * @param $name
  *
  * @throws HectorException
  *
  * @return Connection
  */
 public function createNamed($name)
 {
     if (!isset($this->configs[$name])) {
         throw new HectorException(sprintf('Unable to load config for connection %s', $name));
     }
     $connection = new Connection(new \AMQPConnection($this->configs[$name]), $name);
     $this->registry->addConnection($connection);
     return $connection;
 }
示例#2
0
 public function it_should_create_configured_connection(ConnectionRegistry $registry)
 {
     /** @var Connection $connection */
     $connection = $this->createNamed('default')->shouldReturnAnInstanceOf(Connection::class);
     $registry->addConnection($connection)->shouldHaveBeenCalled();
     Assertion::eq($connection->getWrappedConnection()->getVhost(), 'foo');
 }