Skip to content
This repository was archived by the owner on Oct 30, 2024. It is now read-only.

Commit 7f26b27

Browse files
committed
check for connect and disconnect
1 parent 8aa66bb commit 7f26b27

2 files changed

Lines changed: 10 additions & 1 deletion

File tree

spec/Nats/ConnectionSpec.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,4 +40,13 @@ function it_is_disconnected()
4040
{
4141
$this->isConnected()->shouldBe(false);
4242
}
43+
44+
function it_can_connect_and_disconnect_with_default_options()
45+
{
46+
$this->connect();
47+
$this->shouldHaveType('Nats\Connection');
48+
$this->isConnected()->shouldBe(true);
49+
$this->close();
50+
$this->isConnected()->shouldBe(false);
51+
}
4352
}

src/Nats/Connection.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,7 @@ public function isConnected()
233233
*/
234234
public function connect($timeout = null)
235235
{
236+
236237
$this->timeout = $timeout;
237238
$this->streamSocket = $this->getStream($this->options->getAddress(), $timeout);
238239

@@ -456,7 +457,6 @@ public function setStreamTimeout($seconds)
456457
}
457458
}
458459
}
459-
460460
return false;
461461
}
462462

0 commit comments

Comments
 (0)