|
15 | 15 | use Tests\Fixtures\TestActivity; |
16 | 16 | use Tests\Fixtures\TestProbeBackToBackWorkflow; |
17 | 17 | use Tests\Fixtures\TestProbeChildFailureWorkflow; |
| 18 | +use Tests\Fixtures\TestProbeNowSignalWorkflow; |
18 | 19 | use Tests\Fixtures\TestProbeParallelChildWorkflow; |
19 | 20 | use Tests\Fixtures\TestProbeRetryActivity; |
20 | 21 | use Tests\Fixtures\TestSagaActivity; |
@@ -237,6 +238,35 @@ public function testProbeReplayShortCircuitsWhenWorkflowClassAutoloadThrows(): v |
237 | 238 | } |
238 | 239 | } |
239 | 240 |
|
| 241 | + public function testProbeReplayUsesCarbonNowBeforeWorkflowHandleResetsContext(): void |
| 242 | + { |
| 243 | + TestProbeNowSignalWorkflow::$signalSawCarbonNow = false; |
| 244 | + |
| 245 | + $workflow = WorkflowStub::load(WorkflowStub::make(TestProbeNowSignalWorkflow::class)->id()); |
| 246 | + $storedWorkflow = StoredWorkflow::findOrFail($workflow->id()); |
| 247 | + $storedWorkflow->update([ |
| 248 | + 'arguments' => Serializer::serialize([]), |
| 249 | + 'status' => WorkflowRunningStatus::$name, |
| 250 | + ]); |
| 251 | + $storedWorkflow->signals() |
| 252 | + ->create([ |
| 253 | + 'method' => 'recordNowType', |
| 254 | + 'arguments' => Serializer::serialize([]), |
| 255 | + ]); |
| 256 | + |
| 257 | + $exception = new Exception(0, now()->toDateTimeString(), $storedWorkflow, [ |
| 258 | + 'class' => BaseException::class, |
| 259 | + 'message' => 'probe now type', |
| 260 | + 'code' => 0, |
| 261 | + ], connection: 'redis', queue: 'default'); |
| 262 | + |
| 263 | + $method = new ReflectionMethod(Exception::class, 'probeReplayDecision'); |
| 264 | + $method->setAccessible(true); |
| 265 | + $method->invoke($exception); |
| 266 | + |
| 267 | + $this->assertTrue(TestProbeNowSignalWorkflow::$signalSawCarbonNow); |
| 268 | + } |
| 269 | + |
240 | 270 | public function testSkipsWriteWhenProbeDoesNotReachCandidateException(): void |
241 | 271 | { |
242 | 272 | $workflow = WorkflowStub::load(WorkflowStub::make(TestProbeParallelChildWorkflow::class)->id()); |
|
0 commit comments