Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
"react/promise-timer": "^1.9"
},
"require-dev": {
"clue/block-react": "^1.2",
"phpunit/phpunit": "^9.3 || ^4.8.35"
"phpunit/phpunit": "^9.3 || ^4.8.35",
"react/async": "^4 || ^3 || ^2"
},
"autoload": {
"psr-4": { "React\\Dns\\": "src" }
Expand Down
26 changes: 13 additions & 13 deletions tests/Query/TcpTransportExecutorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -266,9 +266,9 @@ function ($e) use (&$exception) {
}
);

\Clue\React\Block\sleep(0.01);
\React\Async\await(\React\Promise\Timer\sleep(0.01));
if ($exception === null) {
\Clue\React\Block\sleep(0.2);
\React\Async\await(\React\Promise\Timer\sleep(0.2));
}

/** @var \RuntimeException $exception */
Expand Down Expand Up @@ -437,9 +437,9 @@ function ($e) use (&$exception) {
}
);

\Clue\React\Block\sleep(0.01);
\React\Async\await(\React\Promise\Timer\sleep(0.01));
if ($exception === null) {
\Clue\React\Block\sleep(0.2);
\React\Async\await(\React\Promise\Timer\sleep(0.2));
}

/** @var \RuntimeException $exception */
Expand Down Expand Up @@ -476,7 +476,7 @@ function ($e) use (&$wait) {
}
);

\Clue\React\Block\sleep(0.2);
\React\Async\await(\React\Promise\Timer\sleep(0.2));
$this->assertTrue($wait);

$this->assertNotNull($client);
Expand Down Expand Up @@ -513,7 +513,7 @@ function ($e) use (&$wait) {
}
);

\Clue\React\Block\sleep(0.2);
\React\Async\await(\React\Promise\Timer\sleep(0.2));
$this->assertTrue($wait);

$this->assertNotNull($client);
Expand Down Expand Up @@ -548,9 +548,9 @@ function ($e) use (&$exception) {
}
);

\Clue\React\Block\sleep(0.01);
\React\Async\await(\React\Promise\Timer\sleep(0.01));
if ($exception === null) {
\Clue\React\Block\sleep(0.2);
\React\Async\await(\React\Promise\Timer\sleep(0.2));
}

/** @var \RuntimeException $exception */
Expand Down Expand Up @@ -600,9 +600,9 @@ function ($e) use (&$exception) {
}
);

\Clue\React\Block\sleep(0.01);
\React\Async\await(\React\Promise\Timer\sleep(0.01));
if ($exception === null) {
\Clue\React\Block\sleep(0.2);
\React\Async\await(\React\Promise\Timer\sleep(0.2));
}

/** @var \RuntimeException $exception */
Expand Down Expand Up @@ -652,9 +652,9 @@ function ($e) use (&$exception) {
}
);

\Clue\React\Block\sleep(0.01);
\React\Async\await(\React\Promise\Timer\sleep(0.01));
if ($exception === null) {
\Clue\React\Block\sleep(0.2);
\React\Async\await(\React\Promise\Timer\sleep(0.2));
}

/** @var \RuntimeException $exception */
Expand Down Expand Up @@ -687,7 +687,7 @@ public function testQueryResolvesIfServerSendsValidResponse()
$query = new Query('google.com', Message::TYPE_A, Message::CLASS_IN);

$promise = $executor->query($query);
$response = \Clue\React\Block\await($promise, null, 0.2);
$response = \React\Async\await(\React\Promise\Timer\timeout($promise, 0.2));

$this->assertInstanceOf('React\Dns\Model\Message', $response);
}
Expand Down
3 changes: 2 additions & 1 deletion tests/Query/TimeoutExecutorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,8 @@ public function testWrappedWillBeCancelledOnTimeout()
$this->assertEquals(0, $cancelled);

try {
\Clue\React\Block\await($promise);
\React\Async\await(\React\Promise\Timer\sleep(0));
\React\Async\await($promise);
$this->fail();
} catch (TimeoutException $exception) {
$this->assertEquals('DNS query for igor.io (A) timed out' , $exception->getMessage());
Expand Down
8 changes: 4 additions & 4 deletions tests/Query/UdpTransportExecutorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ function ($e) use (&$wait) {
}
);

\Clue\React\Block\sleep(0.2);
\React\Async\await(\React\Promise\Timer\sleep(0.2));
$this->assertTrue($wait);

$promise->cancel();
Expand Down Expand Up @@ -311,7 +311,7 @@ function ($e) use (&$wait) {
}
);

\Clue\React\Block\sleep(0.2);
\React\Async\await(\React\Promise\Timer\sleep(0.2));
$this->assertTrue($wait);

$promise->cancel();
Expand Down Expand Up @@ -347,7 +347,7 @@ public function testQueryRejectsIfServerSendsTruncatedResponse()
'DNS query for google.com (A) failed: The DNS server udp://' . $address . ' returned a truncated result for a UDP query',
defined('SOCKET_EMSGSIZE') ? SOCKET_EMSGSIZE : 90
);
\Clue\React\Block\await($promise, null, 0.1);
\React\Async\await(\React\Promise\Timer\timeout($promise, 0.1));
}

public function testQueryResolvesIfServerSendsValidResponse()
Expand All @@ -373,7 +373,7 @@ public function testQueryResolvesIfServerSendsValidResponse()
$query = new Query('google.com', Message::TYPE_A, Message::CLASS_IN);

$promise = $executor->query($query);
$response = \Clue\React\Block\await($promise, null, 0.2);
$response = \React\Async\await(\React\Promise\Timer\timeout($promise, 0.2));

$this->assertInstanceOf('React\Dns\Model\Message', $response);
}
Expand Down