Skip to content

Commit

Permalink
Added tests for default and custom vhost configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
cerpusoddarne committed Feb 4, 2019
1 parent e90d4fd commit f802a0e
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion tests/ConnectionTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ public function test_set_default_configurations_values()
$this->assertAttributeEquals(15, 'heartbeat', $connection);
$this->assertAttributeEquals(30, 'readWriteTimeout', $connection);
$this->assertAttributeEquals(30, 'connectionTimeout', $connection);
$this->assertAttributeEquals('/', 'vhost', $connection);
}

public function test_set_altered_configurations_values()
Expand All @@ -75,6 +76,7 @@ public function test_set_altered_configurations_values()
Config::set('queue.connections.rabbitmq.read_write_timeout', 60);
Config::set('queue.connections.rabbitmq.connection_timeout', 60);
Config::set('queue.connections.rabbitmq.heartbeat', 30);
Config::set('queue.connections.rabbitmq.vhost', '/test-vhost');

$mAMQPStreamConnection = M::mock(AMQPStreamConnection::class);
$this->app->bind(AMQPStreamConnection::class, function () use ($mAMQPStreamConnection) {
Expand All @@ -85,11 +87,12 @@ public function test_set_altered_configurations_values()
$mAMQPStreamConnection->shouldReceive('channel')->once()->withNoArgs()->andReturn($mChannel);
$mAMQPStreamConnection->shouldReceive('close')->once()->withNoArgs();
$mChannel->shouldReceive('close')->once()->withNoArgs();

$connection = $this->app[Connection::class];

$this->assertAttributeEquals(30, 'heartbeat', $connection);
$this->assertAttributeEquals(60, 'readWriteTimeout', $connection);
$this->assertAttributeEquals(60, 'connectionTimeout', $connection);
$this->assertAttributeEquals('/test-vhost', 'vhost', $connection);
}
}

0 comments on commit f802a0e

Please sign in to comment.