protected function setUp() { $this->connection = $this->createMock(ConnectionInterface::class); $this->channel = $this->createMock(ChannelInterface::class); $this->connection->expects($this->any())->method('channel')->willReturn($this->channel); $this->invoker = new Invoker($this->connection); }
/** * @return ChannelInterface */ protected function getChannel() { if (!$this->channel) { $this->channel = $this->connection->channel(1); } return $this->channel; }
protected function setUp() { $this->connection = $this->createMock(ConnectionInterface::class); $this->channel = $this->createMock(ChannelInterface::class); $this->invoker = $this->createMock(Invoker::class); $this->exchange = 'whatever'; $this->driver = new Driver($this->connection, $this->exchange, new JsonEncoder(), $this->invoker); $this->connection->expects($this->any())->method('channel')->willReturn($this->channel); }
/** * {@inheritdoc} */ protected function setUp() { if (!isset($_SERVER['AMQP_URL'])) { $this->markTestSkipped('This test require AMQP Server, use AMQP_URL environment variables to set connection details'); } $this->exchange = uniqid('phpunit.'); $env = function ($key, $default = null) { return isset($_SERVER[$key]) ? $_SERVER[$key] : $default; }; $this->connection = ConnectionBuilder::make()->create($env('AMQP_URL', '')); $this->handler = $this->createMock(HandlerInterface::class); $this->channel = $this->connection->channel(); $this->consumer = new Consumer($this->connection, $this->handler); }
/** * {@inheritdoc} */ protected function setUp() { if (!isset($_SERVER['AMQP_URL'])) { $this->markTestSkipped('This test require AMQP Server, use AMQP_URL environment variables to set connection details'); } $this->exchange = uniqid('phpunit.'); $env = function ($key, $default = null) { return isset($_SERVER[$key]) ? $_SERVER[$key] : $default; }; $this->connection = ConnectionBuilder::make()->create($env('AMQP_URL', '')); $this->channel = $this->connection->channel(); $this->channel->exchange($this->exchange)->define('fanout'); $this->client = new ServiceBus(new ArrayDiscovery([new Endpoint(new Identity('calc', ['amqp://localhost/?exchange=' . $this->exchange]), new Driver($this->connection, ''))]), new Broadcaster($this->connection, $this->exchange)); $this->initialize(); }