Skip to content

Commit d23c880

Browse files
committed
Add test for connection refused
1 parent a880353 commit d23c880

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

test/ClientTest.php

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?php
2+
3+
namespace Rx\Websocket\Test;
4+
5+
use React\EventLoop\Factory;
6+
7+
class ClientTest extends \PHPUnit_Framework_TestCase
8+
{
9+
public function testErrorBeforeRequest()
10+
{
11+
$loop = Factory::create();
12+
13+
$client = new \Rx\Websocket\Client('ws://127.0.0.1:12340/', false, [], $loop);
14+
15+
$errored = false;
16+
17+
$client->subscribe(
18+
null,
19+
function ($err) use (&$errored) {
20+
$errored = true;
21+
}
22+
);
23+
24+
$loop->run();
25+
26+
$this->assertTrue($errored);
27+
}
28+
}

0 commit comments

Comments
 (0)