1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace AMQPAL\Adapter\AMQP\Options; |
4
|
|
|
|
5
|
|
|
class ConnectionOptionsTest extends \PHPUnit_Framework_TestCase |
6
|
|
|
{ |
7
|
|
|
public function testGetterAndSetter() |
8
|
|
|
{ |
9
|
|
|
$configuration = [ |
10
|
|
|
'host' => 'test-host', |
11
|
|
|
'port' => 1234, |
12
|
|
|
'username' => 'test-username', |
13
|
|
|
'password' => 'test-password', |
14
|
|
|
'vhost' => 'test-vhost', |
15
|
|
|
'read_timeout' => 12, |
16
|
|
|
'write_timeout' => 13, |
17
|
|
|
'connect_timeout' => 432, |
18
|
|
|
'heartbeat' => 234, |
19
|
|
|
'channel_max' => 16, |
20
|
|
|
'frame_max' => 16, |
21
|
|
|
'persistent' => true, |
22
|
|
|
]; |
23
|
|
|
|
24
|
|
|
$options = new ConnectionOptions(); |
25
|
|
|
$options->setFromArray($configuration); |
26
|
|
|
|
27
|
|
|
static::assertEquals($configuration['host'], $options->getHost()); |
28
|
|
|
static::assertEquals($configuration['port'], $options->getPort()); |
29
|
|
|
static::assertEquals($configuration['username'], $options->getUsername()); |
30
|
|
|
static::assertEquals($configuration['password'], $options->getPassword()); |
31
|
|
|
static::assertEquals($configuration['vhost'], $options->getVhost()); |
32
|
|
|
static::assertEquals($configuration['read_timeout'], $options->getReadTimeout()); |
33
|
|
|
static::assertEquals($configuration['write_timeout'], $options->getWriteTimeout()); |
34
|
|
|
static::assertEquals($configuration['heartbeat'], $options->getHeartbeat()); |
35
|
|
|
static::assertEquals($configuration['connect_timeout'], $options->getConnectTimeout()); |
36
|
|
|
static::assertEquals($configuration['channel_max'], $options->getChannelMax()); |
37
|
|
|
static::assertEquals($configuration['frame_max'], $options->getFrameMax()); |
38
|
|
|
static::assertEquals($configuration['persistent'], $options->isPersistent()); |
39
|
|
|
} |
40
|
|
|
} |
41
|
|
|
|