Lines
80.00%
12 / 15
Methods
75.00%
9 / 12
Classes
0.00%
0 / 1
| Name | Lines | Methods | CRAP | ||||
|---|---|---|---|---|---|---|---|
| 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 | ||
| [Stewart\Testing\Exposure\RecordingExposure] __construct | 100.00% | 1 / 1 | 100.00% | 1 / 1 | 1 | ||
| [Stewart\Testing\Exposure\RecordingExposure] getKey | 100.00% | 1 / 1 | 100.00% | 1 / 1 | 1 | ||
| [Stewart\Testing\Exposure\RecordingExposure] cancelCommandSubscriptions | 0.00% | 0 / 1 | 0.00% | 0 / 1 | 2 | ||
| [Stewart\Testing\Exposure\RecordingExposure] remove | 100.00% | 2 / 2 | 100.00% | 1 / 1 | 1 | ||
| [Stewart\Testing\Exposure\RecordingExposure] recordConfig | 100.00% | 2 / 2 | 100.00% | 1 / 1 | 1 | ||
| [Stewart\Testing\Exposure\RecordingExposure] watchPushedCommands | 100.00% | 1 / 1 | 100.00% | 1 / 1 | 1 | ||
| [Stewart\Testing\Exposure\RecordingExposure] deliverCommand | 100.00% | 1 / 1 | 100.00% | 1 / 1 | 1 | ||
| [Stewart\Testing\Exposure\RecordingExposure] assertNotRemoved | 100.00% | 2 / 2 | 100.00% | 1 / 1 | 2 | ||
| 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 | } |
Inherited from Stewart\Testing\Exposure\RecordingExposure
| 26 | public function __construct( | |
| 27 | private readonly ExposedEntityKey $key, | |
| 28 | public private(set) ExposureConfig $config, | |
| 29 | private readonly ManualTimers $timers, | |
| 30 | ) { | |
| 31 | $this->commands = new PushSource($timers->handlerFibers); | |
| 32 | } |
| 34 | public function getKey(): ExposedEntityKey | |
| 35 | { | |
| 36 | return $this->key; | |
| 37 | } |
| 39 | public function cancelCommandSubscriptions(): void | |
| 40 | { | |
| 41 | $this->commands->cancelAttachments(); | |
| 42 | } |
| 44 | public function remove(): void | |
| 45 | { | |
| 46 | $this->assertNotRemoved(); | |
| 47 | $this->removed = true; | |
| 48 | } |
| 54 | protected function recordConfig(ExposureConfig $config): void | |
| 55 | { | |
| 56 | $this->assertNotRemoved(); | |
| 57 | $this->config = $config; | |
| 58 | } |
| 61 | protected function watchPushedCommands(): EventStream | |
| 62 | { | |
| 63 | return new OperatorStream($this->commands, $this->timers); | |
| 64 | } |
| 67 | protected function deliverCommand(ExposedCommand $command): void | |
| 68 | { | |
| 69 | $this->commands->push($command); | |
| 70 | } |
| 73 | protected function assertNotRemoved(): void | |
| 74 | { | |
| 75 | if ($this->removed) { | |
| 76 | throw ExposureException::removed($this->key); | |
| 77 | } | |
| 78 | } |