Lines
50.00%
2 / 4
Functions and Methods
50.00%
2 / 4
Classes and Traits
0.00%
0 / 1
| Name | Lines | Functions and Methods | CRAP | Classes and Traits | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| RecordingExposedAction | 50.00% | 2 / 4 | 50.00% | 2 / 4 | 6.00 | 0.00% | 0 / 1 | |||
| getConfig | 0.00% | 0 / 1 | 0.00% | 0 / 1 | 2 | |||||
| updateConfig | 0.00% | 0 / 1 | 0.00% | 0 / 1 | 2 | |||||
| watchCalls | 100.00% | 1 / 1 | 100.00% | 1 / 1 | 1 | |||||
| pushCall | 100.00% | 1 / 1 | 100.00% | 1 / 1 | 1 | |||||
| 1 | <?php | |
| 2 | ||
| 3 | declare(strict_types=1); | |
| 4 | ||
| 5 | namespace Stewart\Testing\Exposure; | |
| 6 | ||
| 7 | use Stewart\Contracts\EventStream; | |
| 8 | use Stewart\Contracts\Exception\CommandException; | |
| 9 | use Stewart\Contracts\Exposure\Action\ActionCall; | |
| 10 | use Stewart\Contracts\Exposure\Action\ActionConfig; | |
| 11 | use Stewart\Contracts\Exposure\Action\ExposedAction; | |
| 12 | use Stewart\Contracts\State\EventContext; | |
| 13 | ||
| 14 | /** @extends RecordingExposure<ActionConfig> */ | |
| 15 | final class RecordingExposedAction extends RecordingExposure implements ExposedAction | |
| 16 | { | |
| 17 | public function getConfig(): ActionConfig | |
| 18 | { | |
| 19 | return $this->config; | |
| 20 | } | |
| 21 | ||
| 22 | public function updateConfig(ActionConfig $config): void | |
| 23 | { | |
| 24 | $this->recordConfig($config); | |
| 25 | } | |
| 26 | ||
| 27 | public function watchCalls(): EventStream | |
| 28 | { | |
| 29 | /** @var EventStream<ActionCall> */ | |
| 30 | return $this->watchPushedCommands(); | |
| 31 | } | |
| 32 | ||
| 33 | /** | |
| 34 | * @param array<string, mixed> $data | |
| 35 | * @throws CommandException | |
| 36 | */ | |
| 37 | public function pushCall(array $data): void | |
| 38 | { | |
| 39 | $this->deliverCommand(new ActionCall($data, EventContext::unknown())); | |
| 40 | } | |
| 41 | } |