File: FunctionAnyTestRejectedShouldReportUnhandled.phpt

package info (click to toggle)
php-react-promise 3.3.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 832 kB
  • sloc: php: 3,457; makefile: 22
file content (28 lines) | stat: -rw-r--r-- 725 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
--TEST--
Calling any() with rejected promises should report unhandled rejection
--INI--
# suppress legacy PHPUnit 7 warning for Xdebug 3
xdebug.default_enable=
--FILE--
<?php

use function React\Promise\any;
use function React\Promise\reject;

require __DIR__ . '/../vendor/autoload.php';

any([
    reject(new RuntimeException('foo')),
    reject(new RuntimeException('bar'))
]);

?>
--EXPECTF--
Unhandled promise rejection with React\Promise\Exception\CompositeException: All promises rejected. in %s:%d
Stack trace:
#0 %s/Promise.php(%d): %S{closure%S}(%S)
#1 %s/Promise.php(%d): React\Promise\Promise->call(%S)
#2 %s/functions.php(%d): React\Promise\Promise->__construct(%S)
#3 %s(%d): React\Promise\any(%S)
#4 %A{main}