File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1313use Illuminate \Support \Facades \Cache ;
1414use Throwable ;
1515use Workflow \Exceptions \TransitionNotFound ;
16+ use Workflow \Middleware \WithoutOverlappingMiddleware ;
1617use Workflow \Models \StoredWorkflow ;
1718use Workflow \Models \StoredWorkflowLog ;
1819use Workflow \Serializers \Serializer ;
@@ -81,7 +82,14 @@ public function handle()
8182
8283 public function middleware ()
8384 {
84- return [];
85+ return [
86+ new WithoutOverlappingMiddleware (
87+ $ this ->storedWorkflow ->id ,
88+ WithoutOverlappingMiddleware::WORKFLOW ,
89+ 0 ,
90+ 15
91+ ),
92+ ];
8593 }
8694
8795 private function shouldPersistAfterProbeReplay (): bool
Original file line number Diff line number Diff line change 2121use Tests \Fixtures \TestWorkflow ;
2222use Tests \TestCase ;
2323use Workflow \Exception ;
24+ use Workflow \Middleware \WithoutOverlappingMiddleware ;
2425use Workflow \Models \StoredWorkflow ;
2526use Workflow \Serializers \Serializer ;
2627use Workflow \States \WorkflowRunningStatus ;
@@ -34,7 +35,13 @@ public function testMiddleware(): void
3435 'Test exception '
3536 ));
3637
37- $ this ->assertSame ([], $ exception ->middleware ());
38+ $ middleware = collect ($ exception ->middleware ())
39+ ->values ();
40+
41+ $ this ->assertCount (1 , $ middleware );
42+ $ this ->assertSame (WithoutOverlappingMiddleware::class, $ middleware [0 ]::class);
43+ $ this ->assertSame (WithoutOverlappingMiddleware::WORKFLOW , $ middleware [0 ]->type );
44+ $ this ->assertSame (15 , $ middleware [0 ]->expiresAfter );
3845 }
3946
4047 public function testExceptionWorkflowRunning (): void
You can’t perform that action at this time.
0 commit comments