Skip to content

Commit

Permalink
Use reactphp/async instead of clue/reactphp-block
Browse files Browse the repository at this point in the history
  • Loading branch information
dinooo13 committed Oct 1, 2022
1 parent 90e8340 commit ebac860
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
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 || ^2",
"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

0 comments on commit ebac860

Please sign in to comment.