Skip to content

Commit

Permalink
Fix disconnection vs close issue
Browse files Browse the repository at this point in the history
  • Loading branch information
maikgreubel committed Aug 17, 2017
1 parent 2f84608 commit 5c694c7
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions src/Generics/Socket/ClientSocket.php
Expand Up @@ -62,6 +62,10 @@ public function connect()
*/
public function disconnect()
{
if (! $this->conntected) {
throw new SocketException("Socket is not connected");
}

$this->close();
}

Expand All @@ -81,10 +85,6 @@ public function isConnected()
*/
public function close()
{
if (! $this->conntected) {
throw new SocketException("Socket is not connected");
}

parent::close();
$this->conntected = false;
}
Expand Down
2 changes: 1 addition & 1 deletion tests/http-tests/HttpClientTest.php
Expand Up @@ -38,7 +38,7 @@ public function testRetrieveHeaders()

$http = new HttpClient($url);
$http->setHeader('Connection', '');
$http->setTimeout(1);
$http->setTimeout(5);

$headers = $http->retrieveHeaders();

Expand Down
4 changes: 2 additions & 2 deletions tests/util-tests/UrlParserTest.php
Expand Up @@ -32,7 +32,7 @@ public function testUrlParserSimpleUrl()

/**
* @expectedException \Generics\Socket\InvalidUrlException
* @expectedExceptionMessage This URL does not contain a host part
* @expectedExceptionMessage does not contain necessary parts
*/
public function testInvalidHost()
{
Expand All @@ -41,7 +41,7 @@ public function testInvalidHost()

/**
* @expectedException \Generics\Socket\InvalidUrlException
* @expectedExceptionMessage This URL does not contain a scheme part
* @expectedExceptionMessage does not contain necessary parts
*/
public function testInvalidScheme()
{
Expand Down

0 comments on commit 5c694c7

Please sign in to comment.