| @@ 42-57 (lines=16) @@ | ||
| 39 | /** |
|
| 40 | * Test reject. |
|
| 41 | */ |
|
| 42 | public function testReject() |
|
| 43 | { |
|
| 44 | $this |
|
| 45 | ->given( |
|
| 46 | $reason = new \Exception(), |
|
| 47 | $rejectCallback = $this->delegateMock(), |
|
| 48 | /** @var \Cubiche\Core\Async\Promise\ObservableResolver $resolver */ |
|
| 49 | $resolver = $this->newTestedInstance(null, $rejectCallback) |
|
| 50 | ) |
|
| 51 | ->when($resolver->reject($reason)) |
|
| 52 | ->then() |
|
| 53 | ->delegateCall($rejectCallback) |
|
| 54 | ->withArguments($reason) |
|
| 55 | ->once() |
|
| 56 | ; |
|
| 57 | } |
|
| 58 | ||
| 59 | /** |
|
| 60 | * Test notify. |
|
| @@ 51-65 (lines=15) @@ | ||
| 48 | /** |
|
| 49 | * @param callable $when |
|
| 50 | */ |
|
| 51 | protected function innerFailureTest(callable $when) |
|
| 52 | { |
|
| 53 | $this |
|
| 54 | ->given( |
|
| 55 | $reason = new \Exception(), |
|
| 56 | $callback = $this->delegateMockWithException($reason), |
|
| 57 | $rejectCallback = $this->delegateMock() |
|
| 58 | ) |
|
| 59 | ->when($when($callback, $rejectCallback)) |
|
| 60 | ->then() |
|
| 61 | ->delegateCall($rejectCallback) |
|
| 62 | ->withArguments($reason) |
|
| 63 | ->once() |
|
| 64 | ; |
|
| 65 | } |
|
| 66 | } |
|
| 67 | ||