Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use reactphp/async instead of clue/reactphp-block #135

Closed
wants to merge 1 commit into from
Closed
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
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"react/socket": "^1.12"
},
"require-dev": {
"clue/block-react": "^1.5",
"react/async": "^4 || ^3",
"phpunit/phpunit": "^9.3 || ^7.5"
},
"autoload": {
Expand Down
17 changes: 8 additions & 9 deletions tests/FunctionalTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
use React\EventLoop\StreamSelectLoop;
use React\Promise\Deferred;
use React\Promise\PromiseInterface;
use function Clue\React\Block\await;

class FunctionalTest extends TestCase
{
Expand All @@ -33,7 +32,7 @@ public function testPing()
$promise = $redis->ping();
$this->assertInstanceOf(PromiseInterface::class, $promise);

$ret = await($promise, $this->loop);
$ret = \React\Async\await($promise);

$this->assertEquals('PONG', $ret);
}
Expand All @@ -45,7 +44,7 @@ public function testPingLazy()
$promise = $redis->ping();
$this->assertInstanceOf(PromiseInterface::class, $promise);

$ret = await($promise, $this->loop);
$ret = \React\Async\await($promise);

$this->assertEquals('PONG', $ret);
}
Expand Down Expand Up @@ -83,7 +82,7 @@ public function testMgetIsNotInterpretedAsSubMessage()
$promise = $redis->mget('message', 'channel', 'payload')->then($this->expectCallableOnce());
$redis->on('message', $this->expectCallableNever());

await($promise, $this->loop);
\React\Async\await($promise);
}

public function testPipeline()
Expand All @@ -95,7 +94,7 @@ public function testPipeline()
$redis->incr('a')->then($this->expectCallableOnceWith(3));
$promise = $redis->get('a')->then($this->expectCallableOnceWith('3'));

await($promise, $this->loop);
\React\Async\await($promise);
}

public function testInvalidCommand()
Expand All @@ -108,7 +107,7 @@ public function testInvalidCommand()
} else {
$this->setExpectedException('Exception');
}
await($promise, $this->loop);
\React\Async\await($promise);
}

public function testMultiExecEmpty()
Expand All @@ -117,7 +116,7 @@ public function testMultiExecEmpty()
$redis->multi()->then($this->expectCallableOnceWith('OK'));
$promise = $redis->exec()->then($this->expectCallableOnceWith([]));

await($promise, $this->loop);
\React\Async\await($promise);
}

public function testMultiExecQueuedExecHasValues()
Expand All @@ -131,7 +130,7 @@ public function testMultiExecQueuedExecHasValues()
$redis->ttl('b')->then($this->expectCallableOnceWith('QUEUED'));
$promise = $redis->exec()->then($this->expectCallableOnceWith(['OK', 1, 12, 20]));

await($promise, $this->loop);
\React\Async\await($promise);
}

public function testPubSub()
Expand All @@ -152,7 +151,7 @@ public function testPubSub()
})->then($this->expectCallableOnce());

// expect "message" event to take no longer than 0.1s
await($deferred->promise(), $this->loop, 0.1);
\React\Async\await($deferred->promise());
}

public function testClose()
Expand Down