Skip to content

Commit

Permalink
Merge pull request #57 from SimonFrings/async
Browse files Browse the repository at this point in the history
Update test suite to use new reactphp/async package instead of clue/reactphp-block
  • Loading branch information
clue authored Apr 10, 2024
2 parents c5f8a2c + cd22f20 commit 936180e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
5 changes: 3 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,11 @@
"ringcentral/psr7": "^1.2"
},
"require-dev": {
"clue/block-react": "^1.5",
"phpunit/phpunit": "^9.6 || ^5.7 || ^4.8.36",
"react/async": "^4 || ^3 || ^2",
"react/event-loop": "^1.2",
"react/http": "^1.5"
"react/http": "^1.5",
"react/promise-timer": "^1.10"
},
"autoload": {
"psr-4": {
Expand Down
10 changes: 4 additions & 6 deletions tests/FunctionalTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@

namespace Clue\Tests\React\HttpProxy;

use Clue\React\Block;
use Clue\React\HttpProxy\ProxyConnector;
use React\EventLoop\Loop;

/** @group internet */
class FunctionalTest extends AbstractTestCase
Expand All @@ -20,7 +18,7 @@ public function testNonListeningSocketRejectsConnection()
'Connection to tcp://google.com:80 failed because connection to proxy failed (ECONNREFUSED)',
defined('SOCKET_ECONNREFUSED') ? SOCKET_ECONNREFUSED : 111
);
Block\await($promise, Loop::get(), 3.0);
\React\Async\await(\React\Promise\Timer\timeout($promise, 3.0));
}

public function testPlainGoogleDoesNotAcceptConnectMethod()
Expand All @@ -34,7 +32,7 @@ public function testPlainGoogleDoesNotAcceptConnectMethod()
'Connection to tcp://google.com:80 failed because proxy refused connection with HTTP error code 405 (Method Not Allowed) (ECONNREFUSED)',
defined('SOCKET_ECONNREFUSED') ? SOCKET_ECONNREFUSED : 111
);
Block\await($promise, Loop::get(), 3.0);
\React\Async\await(\React\Promise\Timer\timeout($promise, 3.0));
}

public function testSecureGoogleDoesNotAcceptConnectMethod()
Expand All @@ -52,7 +50,7 @@ public function testSecureGoogleDoesNotAcceptConnectMethod()
'Connection to tcp://google.com:80 failed because proxy refused connection with HTTP error code 405 (Method Not Allowed) (ECONNREFUSED)',
defined('SOCKET_ECONNREFUSED') ? SOCKET_ECONNREFUSED : 111
);
Block\await($promise, Loop::get(), 3.0);
\React\Async\await(\React\Promise\Timer\timeout($promise, 3.0));
}

public function testSecureGoogleDoesNotAcceptPlainStream()
Expand All @@ -66,7 +64,7 @@ public function testSecureGoogleDoesNotAcceptPlainStream()
'Connection to tcp://google.com:80 failed because connection to proxy was lost while waiting for response (ECONNRESET)',
defined('SOCKET_ECONNRESET') ? SOCKET_ECONNRESET : 104
);
Block\await($promise, Loop::get(), 3.0);
\React\Async\await(\React\Promise\Timer\timeout($promise, 3.0));
}

/**
Expand Down

0 comments on commit 936180e

Please sign in to comment.