Skip to content

Commit 32c11d7

Browse files
committed
Remove all references to Server (split to clue/redis-server)
Fixes clue#5
1 parent a719d94 commit 32c11d7

File tree

3 files changed

+0
-131
lines changed

3 files changed

+0
-131
lines changed

src/Clue/Redis/React/Factory.php

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -56,21 +56,6 @@ function($error) use ($client) {
5656
});
5757
}
5858

59-
public function createServer($address)
60-
{
61-
$parts = $this->parseUrl($address);
62-
63-
$socket = new ServerSocket($this->loop);
64-
try {
65-
$socket->listen($parts['port'], $parts['host']);
66-
}
67-
catch (Exception $e) {
68-
return When::reject($e);
69-
}
70-
71-
return When::resolve(new Server($socket, $this->loop));
72-
}
73-
7459
public function createProtocol()
7560
{
7661
return ProtocolFactory::create();

src/Clue/Redis/React/Server.php

Lines changed: 0 additions & 60 deletions
This file was deleted.

tests/FactoryTest.php

Lines changed: 0 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -83,66 +83,10 @@ public function testClientInvalidAddress()
8383
$this->expectPromiseReject($promise);
8484
}
8585

86-
public function testServerSuccess()
87-
{
88-
$promise = $this->factory->createServer('tcp://localhost:1337');
89-
90-
$this->expectPromiseResolve($promise)->then(function (Server $server) {
91-
$server->close();
92-
});
93-
}
94-
9586
public function testClientRequiresConnector()
9687
{
9788
$factory = new Factory($this->loop);
9889

9990
$this->expectPromiseReject($factory->createClient());
10091
}
101-
102-
public function testPairAuthRejectDisconnects()
103-
{
104-
$server = null;
105-
106-
$address = '127.0.0.1:1337';
107-
108-
// start a server that only sends ERR messages.
109-
$this->factory->createServer('tcp://' . $address)->then(function (Server $s) use (&$server) {
110-
$server = $s;
111-
});
112-
113-
$this->assertNotNull($server);
114-
115-
// we expect a single single client
116-
$server->on('connection', $this->expectCallableOnce());
117-
118-
$once = $this->expectCallableOnce();
119-
$server->on('connection', function(ConnectionInterface $connection) use ($once, $server) {
120-
// we expect the client to close the connection once he receives an ERR messages.
121-
$connection->on('close', $once);
122-
123-
// end the loop (stop ticking)
124-
$connection->on('close', function() use ($server) {
125-
$server->close();
126-
});
127-
});
128-
129-
// we expect the factory to fail because of the ERR message.
130-
$this->expectPromiseReject($this->factory->createClient('tcp://auth@' . $address));
131-
132-
$this->loop->run();
133-
}
134-
135-
public function testServerAddressInvalidFail()
136-
{
137-
$promise = $this->factory->createServer('invalid address');
138-
139-
$this->expectPromiseReject($promise);
140-
}
141-
142-
public function testServerAddressInUseFail()
143-
{
144-
$promise = $this->factory->createServer('tcp://localhost:6379');
145-
146-
$this->expectPromiseReject($promise);
147-
}
14892
}

0 commit comments

Comments
 (0)