/** * @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; }
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'); }