Skip to content

Commit 62396ce

Browse files
committed
Rename internal method getConnection() to createConnection()
1 parent b3469a1 commit 62396ce

4 files changed

Lines changed: 15 additions & 14 deletions

File tree

src/Client.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,8 +174,9 @@ public function createConnector()
174174
* @param int $port
175175
* @return Promise Promise<Stream,Exception>
176176
* @internal use self::createConnector() instead
177+
* @see self::createConnector()
177178
*/
178-
public function getConnection($host, $port)
179+
public function createConnection($host, $port)
179180
{
180181
if (strlen($host) > 255 || $port > 65535 || $port < 0) {
181182
$deferred = new Deferred();

src/Connector.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,6 @@ public function __construct(Client $socksClient)
3434

3535
public function create($host, $port)
3636
{
37-
return $this->client->getConnection($host, $port);
37+
return $this->client->createConnection($host, $port);
3838
}
3939
}

tests/ClientTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,9 +151,9 @@ public function testCreateSecureConnector()
151151
/**
152152
* @dataProvider providerAddress
153153
*/
154-
public function testGetConnection($host, $port)
154+
public function testCreateConnection($host, $port)
155155
{
156-
$this->assertInstanceOf('\React\Promise\PromiseInterface', $this->client->getConnection($host, $port));
156+
$this->assertInstanceOf('\React\Promise\PromiseInterface', $this->client->createConnection($host, $port));
157157
}
158158

159159
public function providerAddress()

tests/FunctionalTest.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,78 +25,78 @@ public function setUp()
2525

2626
public function testConnection()
2727
{
28-
$this->assertResolveStream($this->client->getConnection('www.google.com', 80));
28+
$this->assertResolveStream($this->client->createConnection('www.google.com', 80));
2929
}
3030

3131
public function testConnectionSocks4()
3232
{
3333
$this->server->setProtocolVersion(4);
3434
$this->client->setProtocolVersion(4);
3535

36-
$this->assertResolveStream($this->client->getConnection('www.google.com', 80));
36+
$this->assertResolveStream($this->client->createConnection('www.google.com', 80));
3737
}
3838

3939
public function testConnectionSocks5()
4040
{
4141
$this->server->setProtocolVersion(5);
4242
$this->client->setProtocolVersion(5);
4343

44-
$this->assertResolveStream($this->client->getConnection('www.google.com', 80));
44+
$this->assertResolveStream($this->client->createConnection('www.google.com', 80));
4545
}
4646

4747
public function testConnectionInvalidSocks4aRemote()
4848
{
4949
$this->client->setProtocolVersion('4a');
5050
$this->client->setResolveLocal(false);
5151

52-
$this->assertResolveStream($this->client->getConnection('www.google.com', 80));
52+
$this->assertResolveStream($this->client->createConnection('www.google.com', 80));
5353
}
5454

5555
public function testConnectionSocks5Remote()
5656
{
5757
$this->client->setProtocolVersion(5);
5858
$this->client->setResolveLocal(false);
5959

60-
$this->assertResolveStream($this->client->getConnection('www.google.com', 80));
60+
$this->assertResolveStream($this->client->createConnection('www.google.com', 80));
6161
}
6262

6363
public function testConnectionAuthentication()
6464
{
6565
$this->server->setAuthArray(array('name' => 'pass'));
6666
$this->client->setAuth('name', 'pass');
6767

68-
$this->assertResolveStream($this->client->getConnection('www.google.com', 80));
68+
$this->assertResolveStream($this->client->createConnection('www.google.com', 80));
6969
}
7070

7171
public function testConnectionAuthenticationUnused()
7272
{
7373
$this->client->setAuth('name', 'pass');
7474

75-
$this->assertResolveStream($this->client->getConnection('www.google.com', 80));
75+
$this->assertResolveStream($this->client->createConnection('www.google.com', 80));
7676
}
7777

7878
public function testConnectionInvalidProtocolMismatch()
7979
{
8080
$this->server->setProtocolVersion(5);
8181
$this->client->setProtocolVersion(4);
8282

83-
$this->assertRejectPromise($this->client->getConnection('www.google.com', 80));
83+
$this->assertRejectPromise($this->client->createConnection('www.google.com', 80));
8484
}
8585

8686
public function testConnectionInvalidNoAuthentication()
8787
{
8888
$this->server->setAuthArray(array('name' => 'pass'));
8989
$this->client->setProtocolVersion(5);
9090

91-
$this->assertRejectPromise($this->client->getConnection('www.google.com', 80));
91+
$this->assertRejectPromise($this->client->createConnection('www.google.com', 80));
9292
}
9393

9494
public function testConnectionInvalidAuthenticationMismatch()
9595
{
9696
$this->server->setAuthArray(array('name' => 'pass'));
9797
$this->client->setAuth('user', 'other');
9898

99-
$this->assertRejectPromise($this->client->getConnection('www.google.com', 80));
99+
$this->assertRejectPromise($this->client->createConnection('www.google.com', 80));
100100
}
101101

102102
public function testConnectorOkay()

0 commit comments

Comments
 (0)