Skip to content

Commit 8cad2ea

Browse files
committed
Add functional test for cancelling queries
1 parent 4265044 commit 8cad2ea

1 file changed

Lines changed: 17 additions & 0 deletions

File tree

tests/FunctionalResolverTest.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,21 @@ public function testResolveInvalidRejects()
3232

3333
$this->loop->run();
3434
}
35+
36+
public function testResolveCancelledRejectsImmediately()
37+
{
38+
if (!interface_exists('React\Promise\CancellablePromiseInterface')) {
39+
$this->markTestSkipped();
40+
}
41+
42+
$promise = $this->resolver->resolve('google.com');
43+
$promise->then($this->expectCallableNever(), $this->expectCallableOnce());
44+
$promise->cancel();
45+
46+
$time = microtime(true);
47+
$this->loop->run();
48+
$time = microtime(true) - $time;
49+
50+
$this->assertLessThan(0.1, $time);
51+
}
3552
}

0 commit comments

Comments
 (0)