FunctionRejectTestThenMatchingThatThrowsNewExceptionShouldReportUnhandledRejectionForNewExceptionOnly.phpt 614 B

1234567891011121314151617181920212223
  1. --TEST--
  2. Calling reject() and then then() should report unhandled rejection for new exception from handler
  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'))->then(null, function () {
  11. throw new \RuntimeException('bar');
  12. });
  13. ?>
  14. --EXPECTF--
  15. Unhandled promise rejection with RuntimeException: bar in %s:%d
  16. Stack trace:
  17. #0 %s/src/Internal/RejectedPromise.php(%d): {closure}(%S)
  18. #1 %s(%d): React\Promise\Internal\RejectedPromise->then(%S)
  19. #2 %A{main}