Cleanup and fix test fixtures
Jan Sorgalla
8 years ago
3 | 3 |
|
4 | 4 |
class SimpleFulfilledTestPromise implements PromiseInterface
|
5 | 5 |
{
|
6 | |
public $cancelCalled = false;
|
7 | |
|
8 | 6 |
public function then(callable $onFulfilled = null, callable $onRejected = null, callable $onProgress = null)
|
9 | 7 |
{
|
10 | 8 |
try {
|
|
12 | 10 |
$onFulfilled('foo');
|
13 | 11 |
}
|
14 | 12 |
|
15 | |
return new self('foo');
|
|
13 |
return new self();
|
|
14 |
} catch (\Throwable $exception) {
|
|
15 |
return new RejectedPromise($exception);
|
16 | 16 |
} catch (\Exception $exception) {
|
17 | 17 |
return new RejectedPromise($exception);
|
18 | 18 |
}
|
19 | 19 |
}
|
20 | |
|
21 | |
public function cancel()
|
22 | |
{
|
23 | |
$this->cancelCalled = true;
|
24 | |
}
|
25 | 20 |
}
|
3 | 3 |
|
4 | 4 |
class SimpleFulfilledTestThenable
|
5 | 5 |
{
|
6 | |
public $cancelCalled = false;
|
7 | |
|
8 | 6 |
public function then(callable $onFulfilled = null, callable $onRejected = null, callable $onProgress = null)
|
9 | 7 |
{
|
10 | 8 |
try {
|
|
12 | 10 |
$onFulfilled('foo');
|
13 | 11 |
}
|
14 | 12 |
|
15 | |
return new self('foo');
|
|
13 |
return new self();
|
|
14 |
} catch (\Throwable $exception) {
|
|
15 |
return new RejectedPromise($exception);
|
16 | 16 |
} catch (\Exception $exception) {
|
17 | 17 |
return new RejectedPromise($exception);
|
18 | 18 |
}
|
19 | 19 |
}
|
20 | |
|
21 | |
public function cancel()
|
22 | |
{
|
23 | |
$this->cancelCalled = true;
|
24 | |
}
|
25 | 20 |
}
|
10 | 10 |
$onRejected('foo');
|
11 | 11 |
}
|
12 | 12 |
|
13 | |
return new self('foo');
|
|
13 |
return new self();
|
|
14 |
} catch (\Throwable $exception) {
|
|
15 |
return new RejectedPromise($exception);
|
14 | 16 |
} catch (\Exception $exception) {
|
15 | 17 |
return new RejectedPromise($exception);
|
16 | 18 |
}
|
7 | 7 |
|
8 | 8 |
public function then(callable $onFulfilled = null, callable $onRejected = null, callable $onProgress = null)
|
9 | 9 |
{
|
10 | |
try {
|
11 | |
return new self('foo');
|
12 | |
} catch (\Exception $exception) {
|
13 | |
return new RejectedPromise($exception);
|
14 | |
}
|
|
10 |
return new self();
|
15 | 11 |
}
|
16 | 12 |
|
17 | 13 |
public function cancel()
|