@@ 116-129 (lines=14) @@ | ||
113 | $this->thenFirstErrorHasMessageParams($response, TestTranslatableDomainErrorDomainEvent::TEST_ERROR_MESSAGE_PARAMS); |
|
114 | } |
|
115 | ||
116 | public function testRecordOn_FunctionDispatchingTwoErrorDomainEventAndThrowingException_ShouldReturnResponseWith2EventsAnd3Errors( |
|
117 | ): void |
|
118 | { |
|
119 | $testPayload = ['test_payload']; |
|
120 | $testErrorDomainEvent = new TestTranslatableDomainErrorDomainEvent($testPayload); |
|
121 | ||
122 | $eventBus = $this->eventBus; |
|
123 | $response = $this->whenRecordOnFunctionThat( |
|
124 | $this->dispatchMessageTwoTimesAndThrowException($testErrorDomainEvent, $eventBus) |
|
125 | ); |
|
126 | ||
127 | $this->thenCountOfErrorsOnResponseIs($response, 3); |
|
128 | $this->thenCountOfDomainEventsIs($response, 2); |
|
129 | } |
|
130 | ||
131 | public function testRecordOn_FunctionDispatchingStringEvent_ShouldReturnEmptyResponse(): void |
|
132 | { |
|
@@ 145-158 (lines=14) @@ | ||
142 | $this->thenCountOfDomainEventsIs($response, 0); |
|
143 | } |
|
144 | ||
145 | public function testRecordOn_FunctionDispatchingEvent_ShouldReturnResponseWithEvent(): void |
|
146 | { |
|
147 | $testPayload = ['test_payload']; |
|
148 | $testDomainEvent = new TestDomainEvent($testPayload); |
|
149 | ||
150 | $eventBus = $this->eventBus; |
|
151 | $response = $this->whenRecordOnFunctionThat( |
|
152 | $this->dispatchMessageEventOnce($testDomainEvent, $eventBus) |
|
153 | ); |
|
154 | ||
155 | $this->thenCountOfErrorsOnResponseIs($response, 0); |
|
156 | $this->thenCountOfDomainEventsIs($response, 1); |
|
157 | $this->thenEventIsTestDomainEventWithPayoad($response, $testPayload); |
|
158 | } |
|
159 | ||
160 | private function whenRecordOnFunctionThat(Closure $doSomething): BasicMutationResponse |
|
161 | { |