File tree Expand file tree Collapse file tree
tests/Unit/Subscription/Engine Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -644,7 +644,7 @@ function (SubscriptionCollection $subscriptions): Result {
644644 }
645645
646646 if ($ subscription ->hasCleanupTasks ()) {
647- $ error = $ this ->cleanup ($ subscription );
647+ $ error = $ this ->cleanup ($ subscription, true );
648648
649649 if ($ error ) {
650650 $ errors [] = $ error ;
@@ -1319,7 +1319,7 @@ private function retryStrategy(Subscription $subscription): RetryStrategy
13191319 return $ this ->retryStrategyRepository ->get ($ retryStrategy );
13201320 }
13211321
1322- private function cleanup (Subscription $ subscription ): Error |null
1322+ private function cleanup (Subscription $ subscription, bool $ force = false ): Error |null
13231323 {
13241324 if (!$ this ->cleaner ) {
13251325 throw new CleanerNotConfigured ();
@@ -1342,6 +1342,15 @@ private function cleanup(Subscription $subscription): Error|null
13421342 ),
13431343 );
13441344
1345+ if ($ force ) {
1346+ $ this ->subscriptionManager ->remove ($ subscription );
1347+
1348+ $ this ->logger ?->info(sprintf (
1349+ 'Subscription Engine: Subscription "%s" removed. ' ,
1350+ $ subscription ->id (),
1351+ ));
1352+ }
1353+
13451354 return new Error (
13461355 $ subscription ->id (),
13471356 $ e ->getMessage (),
Original file line number Diff line number Diff line change @@ -3785,15 +3785,15 @@ public function testRemoveWithCleanupHandlerError(): void
37853785
37863786 $ task = new DropTableTask ('test ' );
37873787
3788- $ subscriptionStore = new DummySubscriptionStore ([
3789- new Subscription (
3790- $ subscriptionId ,
3791- Subscription:: DEFAULT_GROUP ,
3792- RunMode::FromBeginning ,
3793- Status::Detached ,
3794- cleanupTasks: [ $ task ],
3795- ),
3796- ]);
3788+ $ subscription = new Subscription (
3789+ $ subscriptionId ,
3790+ Subscription:: DEFAULT_GROUP ,
3791+ RunMode::FromBeginning ,
3792+ Status::Detached ,
3793+ cleanupTasks: [ $ task ] ,
3794+ );
3795+
3796+ $ subscriptionStore = new DummySubscriptionStore ([ $ subscription ]);
37973797
37983798 $ streamableStore = $ this ->createMock (Store::class);
37993799
@@ -3818,7 +3818,7 @@ public function testRemoveWithCleanupHandlerError(): void
38183818 self ::assertEquals ($ subscriptionId , $ error ->subscriptionId );
38193819 self ::assertInstanceOf (CleanupFailed::class, $ error ->throwable );
38203820
3821- $ subscriptionStore ->assertNoChanges ( );
3821+ $ subscriptionStore ->assertRemoved ( $ subscription );
38223822 }
38233823
38243824 public function testReactiveDiscoverNewSubscribers (): void
You can’t perform that action at this time.
0 commit comments