@@ 23-44 (lines=22) @@ | ||
20 | * when: calledWithAValidConfigurationKey |
|
21 | * will: returnAValidConnection. |
|
22 | */ |
|
23 | public function test_createConnection_calledWithAValidConfigurationKey_returnAValidConnection() |
|
24 | { |
|
25 | $conf = [ |
|
26 | 'test_connection' => [ |
|
27 | 'host' => 'localhost', |
|
28 | 'port' => 4222, |
|
29 | 'user' => 'user', |
|
30 | 'password' => 'password', |
|
31 | 'verbose' => true, |
|
32 | 'reconnect' => true, |
|
33 | 'version' => '0.0.5', |
|
34 | 'pedantic' => true, |
|
35 | 'lang' => 'php', |
|
36 | ], |
|
37 | ]; |
|
38 | ||
39 | $logMock = $this->getMock('Octante\NatsBundle\Logger\NatsLogger'); |
|
40 | ||
41 | $sut = new ConnectionFactory($conf, $logMock); |
|
42 | $connection = $sut->createConnection('test_connection'); |
|
43 | $this->assertInstanceOf('Octante\NatsBundle\Connection\ConnectionWrapper', $connection); |
|
44 | } |
|
45 | ||
46 | /** |
|
47 | * method: createConnection |
|
@@ 70-90 (lines=21) @@ | ||
67 | * when: called |
|
68 | * will: setADefaultConnectionKey. |
|
69 | */ |
|
70 | public function test_createDefaultConnection_called_setADefaultConnectionKey() |
|
71 | { |
|
72 | $conf = [ |
|
73 | 'default_connection' => [ |
|
74 | 'host' => 'localhost', |
|
75 | 'port' => 4222, |
|
76 | 'user' => 'user', |
|
77 | 'password' => 'password', |
|
78 | 'verbose' => true, |
|
79 | 'reconnect' => true, |
|
80 | 'version' => '0.0.5', |
|
81 | 'pedantic' => true, |
|
82 | 'lang' => 'php', |
|
83 | ], |
|
84 | ]; |
|
85 | ||
86 | $logMock = $this->getMock('Octante\NatsBundle\Logger\NatsLogger'); |
|
87 | $sut = new ConnectionFactory($conf, $logMock); |
|
88 | $connection = $sut->createDefaultConnection(); |
|
89 | $this->assertInstanceOf('Nats\Connection', $connection); |
|
90 | } |
|
91 | } |
|
92 |