| @@ 115-132 (lines=18) @@ | ||
| 112 | /** |
|
| 113 | * Test notify. |
|
| 114 | */ |
|
| 115 | public function testNotify() |
|
| 116 | { |
|
| 117 | $this |
|
| 118 | ->given( |
|
| 119 | /** @var \Cubiche\Core\Async\Promise\DeferredInterface $deferred */ |
|
| 120 | $deferred = $this->newDefaultTestedInstance(), |
|
| 121 | $onNotify = $this->delegateMock() |
|
| 122 | ) |
|
| 123 | ->when(function () use ($deferred, $onNotify) { |
|
| 124 | $deferred->promise()->then(null, null, $onNotify); |
|
| 125 | $deferred->notify('foo'); |
|
| 126 | }) |
|
| 127 | ->then() |
|
| 128 | ->delegateCall($onNotify) |
|
| 129 | ->withArguments('foo') |
|
| 130 | ->once() |
|
| 131 | ; |
|
| 132 | } |
|
| 133 | ||
| 134 | /** |
|
| 135 | * @param DeferredInterface $deferred |
|
| @@ 115-131 (lines=17) @@ | ||
| 112 | /** |
|
| 113 | * Test notify. |
|
| 114 | */ |
|
| 115 | public function testNotify() |
|
| 116 | { |
|
| 117 | $this |
|
| 118 | ->given( |
|
| 119 | $promise = $this->newDefaultTestedInstance(), |
|
| 120 | $onNotify = $this->delegateMock() |
|
| 121 | ) |
|
| 122 | ->when(function () use ($promise, $onNotify) { |
|
| 123 | $promise->then(null, null, $onNotify); |
|
| 124 | $this->notify('foo'); |
|
| 125 | }) |
|
| 126 | ->then() |
|
| 127 | ->delegateCall($onNotify) |
|
| 128 | ->withArguments('foo') |
|
| 129 | ->once() |
|
| 130 | ; |
|
| 131 | } |
|
| 132 | ||
| 133 | /** |
|
| 134 | * {@inheritdoc} |
|