Codebase list php-react-promise / 13db3f5
Cleanup and fix test fixtures Jan Sorgalla 8 years ago
4 changed file(s) with 10 addition(s) and 22 deletion(s). Raw diff Collapse all Expand all
33
44 class SimpleFulfilledTestPromise implements PromiseInterface
55 {
6 public $cancelCalled = false;
7
86 public function then(callable $onFulfilled = null, callable $onRejected = null, callable $onProgress = null)
97 {
108 try {
1210 $onFulfilled('foo');
1311 }
1412
15 return new self('foo');
13 return new self();
14 } catch (\Throwable $exception) {
15 return new RejectedPromise($exception);
1616 } catch (\Exception $exception) {
1717 return new RejectedPromise($exception);
1818 }
1919 }
20
21 public function cancel()
22 {
23 $this->cancelCalled = true;
24 }
2520 }
33
44 class SimpleFulfilledTestThenable
55 {
6 public $cancelCalled = false;
7
86 public function then(callable $onFulfilled = null, callable $onRejected = null, callable $onProgress = null)
97 {
108 try {
1210 $onFulfilled('foo');
1311 }
1412
15 return new self('foo');
13 return new self();
14 } catch (\Throwable $exception) {
15 return new RejectedPromise($exception);
1616 } catch (\Exception $exception) {
1717 return new RejectedPromise($exception);
1818 }
1919 }
20
21 public function cancel()
22 {
23 $this->cancelCalled = true;
24 }
2520 }
1010 $onRejected('foo');
1111 }
1212
13 return new self('foo');
13 return new self();
14 } catch (\Throwable $exception) {
15 return new RejectedPromise($exception);
1416 } catch (\Exception $exception) {
1517 return new RejectedPromise($exception);
1618 }
77
88 public function then(callable $onFulfilled = null, callable $onRejected = null, callable $onProgress = null)
99 {
10 try {
11 return new self('foo');
12 } catch (\Exception $exception) {
13 return new RejectedPromise($exception);
14 }
10 return new self();
1511 }
1612
1713 public function cancel()