Skip to content

Commit cc901b6

Browse files
committed
Rename ReponseApi to RequestApi :)
1 parent a14bb1c commit cc901b6

File tree

6 files changed

+34
-34
lines changed

6 files changed

+34
-34
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ local redis server and send some requests:
1313

1414
$factory = new Factory($connector);
1515
$factory->createClient()->then(function (Client $client) use ($loop) {
16-
$api = new ResponseApi($client);
16+
$api = new RequestApi($client);
1717

1818
$api->set('greeting', 'Hello world');
1919
$api->append('greeting', '!');

example/incr.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
use Clue\React\Redis\Client;
44
use Clue\React\Redis\Factory;
5-
use Clue\React\Redis\ResponseApi;
5+
use Clue\React\Redis\RequestApi;
66

77
require __DIR__ . '/../vendor/autoload.php';
88

@@ -13,7 +13,7 @@
1313
$factory = new Factory($connector);
1414

1515
$factory->createClient()->then(function (Client $client) {
16-
$api = new ResponseApi($client);
16+
$api = new RequestApi($client);
1717

1818
$api->incr('test');
1919

src/Factory.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public function createClient($target = null)
4343

4444
if ($auth !== null) {
4545
$promise = $promise->then(function (Client $client) use ($auth) {
46-
$api = new ResponseApi($client);
46+
$api = new RequestApi($client);
4747
return $api->auth($auth)->then(
4848
function () use ($client) {
4949
return $client;
@@ -58,7 +58,7 @@ function ($error) use ($client) {
5858

5959
if ($db !== null) {
6060
$promise = $promise->then(function (Client $client) use ($db) {
61-
$api = new ResponseApi($client);
61+
$api = new RequestApi($client);
6262
return $api->select($db)->then(
6363
function () use ($client) {
6464
return $client;

src/ResponseApi.php renamed to src/RequestApi.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
use React\Promise\Deferred;
99
use Clue\Redis\Protocol\Model\ErrorReply;
1010

11-
class ResponseApi
11+
class RequestApi
1212
{
1313
private $client;
1414
private $requests = array();

tests/FunctionalTest.php

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
use Clue\React\Redis\Factory;
88

99
use Clue\React\Redis\Client;
10-
use Clue\React\Redis\ResponseApi;
10+
use Clue\React\Redis\RequestApi;
1111

1212
class FunctionalTest extends TestCase
1313
{
@@ -41,10 +41,10 @@ public function testPing()
4141

4242
/**
4343
*
44-
* @param ResponseApi $client
44+
* @param RequestApi $client
4545
* @depends testPing
4646
*/
47-
public function testPipeline(ResponseApi $client)
47+
public function testPipeline(RequestApi $client)
4848
{
4949
$this->assertFalse($client->isBusy());
5050

@@ -62,10 +62,10 @@ public function testPipeline(ResponseApi $client)
6262

6363
/**
6464
*
65-
* @param ResponseApi $client
65+
* @param RequestApi $client
6666
* @depends testPipeline
6767
*/
68-
public function testInvalidCommand(ResponseApi $client)
68+
public function testInvalidCommand(RequestApi $client)
6969
{
7070
$client->doesnotexist(1, 2, 3)->then($this->expectCallableNever());
7171

@@ -76,10 +76,10 @@ public function testInvalidCommand(ResponseApi $client)
7676

7777
/**
7878
*
79-
* @param ResponseApi $client
79+
* @param RequestApi $client
8080
* @depends testInvalidCommand
8181
*/
82-
public function testMultiExecEmpty(ResponseApi $client)
82+
public function testMultiExecEmpty(RequestApi $client)
8383
{
8484
$client->multi()->then($this->expectCallableOnce('OK'));
8585
$client->exec()->then($this->expectCallableOnce(array()));
@@ -91,10 +91,10 @@ public function testMultiExecEmpty(ResponseApi $client)
9191

9292
/**
9393
*
94-
* @param ResponseApi $client
94+
* @param RequestApi $client
9595
* @depends testMultiExecEmpty
9696
*/
97-
public function testMultiExecQueuedExecHasValues(ResponseApi $client)
97+
public function testMultiExecQueuedExecHasValues(RequestApi $client)
9898
{
9999
$client->multi()->then($this->expectCallableOnce('OK'));
100100
$client->set('b', 10)->then($this->expectCallableOnce('QUEUED'));
@@ -127,7 +127,7 @@ public function testPubSub()
127127
public function testClose()
128128
{
129129
$client = $this->createClient();
130-
$api = new ResponseApi($client);
130+
$api = new RequestApi($client);
131131

132132
$api->get('willBeCanceledAnyway')->then(null, $this->expectCallableOnce());
133133

@@ -139,7 +139,7 @@ public function testClose()
139139
public function testInvalidProtocol()
140140
{
141141
$client = $this->createClientResponse("communication does not conform to protocol\r\n");
142-
$api = new ResponseApi($client);
142+
$api = new RequestApi($client);
143143

144144
$client->on('error', $this->expectCallableOnce());
145145
$client->on('close', $this->expectCallableOnce());
@@ -152,7 +152,7 @@ public function testInvalidProtocol()
152152
public function testAdditionalServerRepliesAreBeingIgnored()
153153
{
154154
$client = $this->createClientResponse("+OK\r\n-ERR invalid\r\n");
155-
$api = new ResponseApi($client);
155+
$api = new RequestApi($client);
156156

157157
$api->set('a', 0)->then($this->expectCallableOnce('OK'));
158158

@@ -186,7 +186,7 @@ protected function createClient()
186186

187187
protected function createClientApi()
188188
{
189-
return new ResponseApi($this->createClient());
189+
return new RequestApi($this->createClient());
190190
}
191191

192192
protected function createClientResponse($response)
@@ -207,7 +207,7 @@ protected function createServer($response)
207207

208208
}
209209

210-
protected function waitFor(ResponseApi $client)
210+
protected function waitFor(RequestApi $client)
211211
{
212212
$this->assertTrue($client->isBusy());
213213

tests/ResponseApiTest.php

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,29 @@
11
<?php
22

3-
use Clue\React\Redis\ResponseApi;
3+
use Clue\React\Redis\RequestApi;
44
use Clue\Redis\Protocol\Model\BulkReply;
55
use Clue\Redis\Protocol\Model\ErrorReply;
66
use Clue\React\Redis\Client;
77

8-
class ResponseApiTest extends TestCase
8+
class RequestApiTest extends TestCase
99
{
1010
private $stream;
1111
private $client;
12-
private $responseApi;
12+
private $RequestApi;
1313

1414
public function setUp()
1515
{
1616
//$this->stream = $this->getMock('React\Stream\Stream');
1717
//$this->client = new Client($this->stream);
1818
$this->client = $this->getMockBuilder('Clue\React\Redis\Client')->disableOriginalConstructor()->setMethods(array('sendRequest', 'close'))->getMock();
19-
$this->responseApi = new ResponseApi($this->client);
19+
$this->RequestApi = new RequestApi($this->client);
2020
}
2121

2222
public function testPingPong()
2323
{
2424
$this->client->expects($this->once())->method('sendRequest')->with($this->equalTo('ping'));
2525

26-
$promise = $this->responseApi->ping();
26+
$promise = $this->RequestApi->ping();
2727

2828
$this->client->emit('message', array(new BulkReply('PONG')));
2929

@@ -33,7 +33,7 @@ public function testPingPong()
3333

3434
public function testErrorReply()
3535
{
36-
$promise = $this->responseApi->invalid();
36+
$promise = $this->RequestApi->invalid();
3737

3838
$err = new ErrorReply('ERR invalid command');
3939
$this->client->emit('message', array($err));
@@ -44,29 +44,29 @@ public function testErrorReply()
4444

4545
public function testClosingClientRejectsAllRemainingRequests()
4646
{
47-
$promise = $this->responseApi->ping();
48-
$this->assertTrue($this->responseApi->isBusy());
47+
$promise = $this->RequestApi->ping();
48+
$this->assertTrue($this->RequestApi->isBusy());
4949

5050
$this->client->emit('close');
5151

5252
$this->expectPromiseReject($promise);
53-
$this->assertFalse($this->responseApi->isBusy());
53+
$this->assertFalse($this->RequestApi->isBusy());
5454
}
5555

5656
public function testClosedClientRejectsAllNewRequests()
5757
{
58-
$promise = $this->responseApi->ping();
58+
$promise = $this->RequestApi->ping();
5959

6060
$this->client->emit('close');
6161

6262
$this->expectPromiseReject($promise);
63-
$this->assertFalse($this->responseApi->isBusy());
63+
$this->assertFalse($this->RequestApi->isBusy());
6464
}
6565

6666
public function testEndingNonBusyClosesClient()
6767
{
6868
$this->client->expects($this->once())->method('close');
69-
$this->responseApi->end();
69+
$this->RequestApi->end();
7070
}
7171

7272
public function testEndingBusyClosesClientWhenNotBusyAnymore()
@@ -77,10 +77,10 @@ public function testEndingBusyClosesClientWhenNotBusyAnymore()
7777
++$closed;
7878
}));
7979

80-
$promise = $this->responseApi->ping();
80+
$promise = $this->RequestApi->ping();
8181
$this->assertEquals(0, $closed);
8282

83-
$this->responseApi->end();
83+
$this->RequestApi->end();
8484
$this->assertEquals(0, $closed);
8585

8686
$this->client->emit('message', array(new BulkReply('PONG')));

0 commit comments

Comments
 (0)