FunctionRejectTestCatchMatchingShouldNotReportUnhandled.phpt 482 B

12345678910111213141516171819
  1. --TEST--
  2. Calling reject() and then catch() with matching type should not report unhandled rejection
  3. --INI--
  4. # suppress legacy PHPUnit 7 warning for Xdebug 3
  5. xdebug.default_enable=
  6. --FILE--
  7. <?php
  8. use function React\Promise\reject;
  9. require __DIR__ . '/../vendor/autoload.php';
  10. reject(new RuntimeException('foo'))->catch(function (RuntimeException $e): void {
  11. echo 'Handled ' . get_class($e) . ': ' . $e->getMessage() . PHP_EOL;
  12. });
  13. ?>
  14. --EXPECT--
  15. Handled RuntimeException: foo