27 $this->assertEquals(1,
$start);
46 $this->assertEquals(3,
$start);
65 $start += $e->getMessage();
71 $this->assertEquals(3,
$start);
90 $start += $e->getMessage();
96 $this->assertEquals(3,
$start);
115 $this->assertTrue(strpos($e->getMessage(),
'Promise was rejected with') === 0);
121 $this->assertEquals(3,
$start);
137 $this->assertEquals(1,
$start);
142 $this->assertEquals(3,
$start);
158 $start += $e->getMessage();
163 $this->assertEquals(1,
$start);
168 $this->assertEquals(3,
$start);
180 throw new \Exception(
'4');
182 })->error(
function($e) use (&
$start) {
184 $start += $e->getMessage();
189 $this->assertEquals(7,
$start);
202 })->error(
function($e) use (&
$start) {
204 $start += $e->getMessage();
208 $this->assertEquals(1,
$start);
213 $this->assertEquals(3,
$start);
226 })->then(
function($value) use (&
$ok) {
227 $this->assertEquals(2, $value);
229 })->error(
function($reason) {
230 $this->fail($reason);
234 $this->assertTrue(
$ok);
250 })->then(
function($value) use (&
$ok) {
252 $this->fail($reason);
258 $this->assertEquals(
'omg it worked',
$ok);
testRejectedPromiseException()
testFulfilledPromiseAsync()
An implementation of the Promise pattern.
$promise
This example shows demonstrates the Promise api.
coroutine(callable $gen)
Turn asynchronous promise-based code into something that looks synchronous again, through the use of ...
testResolveToLastYieldPromise()
testRejectedPromiseArray()
testRejectedPromiseAsync()