Exemple #1
0
 function testFromFailureHandler()
 {
     $ok = 0;
     $promise = new Promise();
     $promise->error(function ($reason) {
         $this->assertEquals('foo', $reason);
         throw new \Exception('hi');
     })->then(function () use(&$ok) {
         $ok = -1;
     }, function () use(&$ok) {
         $ok = 1;
     });
     $this->assertEquals(0, $ok);
     $promise->reject('foo');
     $this->assertEquals(1, $ok);
 }