FunctionAnyTestRejectedShouldReportUnhandled.phpt 747 B

12345678910111213141516171819202122232425262728
  1. --TEST--
  2. Calling any() with rejected promises should 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\any;
  9. use function React\Promise\reject;
  10. require __DIR__ . '/../vendor/autoload.php';
  11. any([
  12. reject(new RuntimeException('foo')),
  13. reject(new RuntimeException('bar'))
  14. ]);
  15. ?>
  16. --EXPECTF--
  17. Unhandled promise rejection with React\Promise\Exception\CompositeException: All promises rejected. in %s:%d
  18. Stack trace:
  19. #0 %s/src/Promise.php(%d): React\Promise\{closure}(%S)
  20. #1 %s/src/Promise.php(%d): React\Promise\Promise->call(%S)
  21. #2 %s/src/functions.php(%d): React\Promise\Promise->__construct(%S)
  22. #3 %s(%d): React\Promise\any(%S)
  23. #4 %A{main}