Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
matyhtf committed Nov 20, 2023
1 parent d0622c5 commit c4ab75c
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions tests/swoole_coroutine/bailout/co_redis_in_shutdown_function.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,21 @@ require __DIR__ . '/../../include/bootstrap.php';

use Swoole\Event;

Co\run(function (){
$redis = new \redis();
$redis->connect(REDIS_SERVER_HOST, REDIS_SERVER_PORT);
Co\run(function () {
$redis = new \redis();
$redis->connect(REDIS_SERVER_HOST, REDIS_SERVER_PORT);
register_shutdown_function(function () use ($redis) {
try {
$redis->get('key');
}catch (Exception $e) {
var_dump($e);
}
$redis->get('key');
});
usleep(10000);
});

Event::wait();
?>
--EXPECTF--
Fatal error: Uncaught Swoole\Error: API must be called in the coroutine in %s:%d
Stack trace:
#0 %s(%d): Redis->get('key')
#1 [internal function]: {closure}()
#2 {main}
thrown in %s on line %d

0 comments on commit c4ab75c

Please sign in to comment.