1 | <?php |
||
11 | class ConnectionTest extends \PHPUnit_Framework_TestCase |
||
12 | { |
||
13 | public function testGetterAndSetter() |
||
14 | { |
||
15 | $configuration = [ |
||
16 | 'type' => 'test-type', |
||
17 | 'host' => 'test-host', |
||
18 | 'port' => 1234, |
||
19 | 'username' => 'test-username', |
||
20 | 'password' => 'test-password', |
||
21 | 'vhost' => 'test-vhost', |
||
22 | 'insist' => true, |
||
23 | 'login_method' => 'test-login_method', |
||
24 | 'locale' => 'test-locale', |
||
25 | 'read_write_timeout' => 12, |
||
26 | 'keep_alive' => true, |
||
27 | 'heartbeat' => 234, |
||
28 | 'connection_timeout' => 432, |
||
29 | 'ssl_options' => [ |
||
30 | 'opt1' => 'value1', |
||
31 | 'opt2' => 'value2', |
||
32 | ], |
||
33 | ]; |
||
34 | |||
35 | $options = new Options(); |
||
36 | $options->setFromArray($configuration); |
||
37 | |||
38 | static::assertEquals($configuration['type'], $options->getType()); |
||
39 | static::assertEquals($configuration['host'], $options->getHost()); |
||
40 | static::assertEquals($configuration['port'], $options->getPort()); |
||
41 | static::assertEquals($configuration['username'], $options->getUsername()); |
||
42 | static::assertEquals($configuration['password'], $options->getPassword()); |
||
43 | static::assertEquals($configuration['vhost'], $options->getVhost()); |
||
44 | static::assertEquals($configuration['insist'], $options->isInsist()); |
||
45 | static::assertEquals($configuration['login_method'], $options->getLoginMethod()); |
||
46 | static::assertEquals($configuration['locale'], $options->getLocale()); |
||
47 | static::assertEquals($configuration['read_write_timeout'], $options->getReadWriteTimeout()); |
||
48 | static::assertEquals($configuration['keep_alive'], $options->isKeepAlive()); |
||
49 | static::assertEquals($configuration['heartbeat'], $options->getHeartbeat()); |
||
50 | static::assertEquals($configuration['connection_timeout'], $options->getConnectionTimeout()); |
||
51 | static::assertEquals($configuration['ssl_options'], $options->getSslOptions()); |
||
52 | } |
||
53 | } |
||
54 |