Skip to content

Commit d898302

Browse files
author
Masiukevich Maksim
committed
fix tests
1 parent 8499009 commit d898302

File tree

3 files changed

+58
-0
lines changed

3 files changed

+58
-0
lines changed

tests/Configuration/DefaultEventProcessorTest.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,8 @@ function (): \Generator
124124

125125
self::assertInstanceOf(SecondEventWithKey::class, $event, get_class($event));
126126
self::assertSame($id->toString(), $event->key);
127+
128+
Loop::stop();
127129
}
128130
);
129131
}
@@ -158,6 +160,8 @@ function (): \Generator
158160

159161
self::assertInstanceOf(SecondEventWithKey::class, $event);
160162
self::assertSame('qwerty', $event->key);
163+
164+
Loop::stop();
161165
}
162166
);
163167
}
@@ -191,6 +195,8 @@ function (): \Generator
191195
'The value of the "saga-correlation-id" header key can\'t be empty, since it is the saga id',
192196
$records[0]['context']['throwableMessage']
193197
);
198+
199+
Loop::stop();
194200
}
195201
);
196202
}
@@ -224,6 +230,8 @@ function (): \Generator
224230
'Attempt to apply event to non-existent saga (ID: 1b6d89ec-cf60-4e48-a253-fd57f844c07d)',
225231
$records[0]['context']['throwableMessage']
226232
);
233+
234+
Loop::stop();
227235
}
228236
);
229237
}
@@ -259,6 +267,8 @@ function (): \Generator
259267
'A property that contains an identifier ("requestId") was not found in class "ServiceBus\\Sagas\\Tests\\stubs\\EmptyEvent"',
260268
$records[0]['context']['throwableMessage']
261269
);
270+
271+
Loop::stop();
262272
}
263273
);
264274
}
@@ -294,6 +304,8 @@ function (): \Generator
294304
'The value of the "key" property of the "ServiceBus\\Sagas\\Tests\\stubs\\EventWithKey" event can\'t be empty, since it is the saga id',
295305
$records[0]['context']['throwableMessage']
296306
);
307+
308+
Loop::stop();
297309
}
298310
);
299311
}
@@ -331,6 +343,8 @@ function (): \Generator
331343
'Attempt to apply event to completed saga (ID: 1b6d89ec-cf60-4e48-a253-fd57f844c07d)',
332344
$records[0]['context']['throwableMessage']
333345
);
346+
347+
Loop::stop();
334348
}
335349
);
336350
}
@@ -365,6 +379,8 @@ function (): \Generator
365379
);
366380

367381
self::assertFalse($stored);
382+
383+
Loop::stop();
368384
}
369385
);
370386
}
@@ -412,6 +428,8 @@ function (): \Generator
412428
'Identifier class "SomeUnknownClass" specified in the saga "ServiceBus\Sagas\Tests\stubs\CorrectSaga" not found',
413429
$record['message']
414430
);
431+
432+
Loop::stop();
415433
}
416434
);
417435
}
@@ -459,6 +477,8 @@ function (): \Generator
459477
'Saga identifier mus be type of "ServiceBus\Sagas\SagaId". "ServiceBus\Sagas\Tests\stubs\IncorrectSagaIdType" type specified',
460478
$record['message']
461479
);
480+
481+
Loop::stop();
462482
}
463483
);
464484
}

tests/SagasProviderTest.php

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,8 @@ function (): \Generator
130130
$testSaga = new TestSaga(TestSagaId::new(TestSaga::class));
131131

132132
yield $this->sagaProvider->save($testSaga, new TestContext());
133+
134+
Loop::stop();
133135
}
134136
);
135137
}
@@ -147,6 +149,8 @@ function (): \Generator
147149
$id = TestSagaId::new(TestSaga::class);
148150

149151
yield $this->sagaProvider->start($id, new TestCommand(), new TestContext());
152+
153+
Loop::stop();
150154
}
151155
);
152156
}
@@ -169,6 +173,8 @@ function (): \Generator
169173
self::assertNotNull($saga);
170174
self::assertInstanceOf(TestSaga::class, $saga);
171175
self::assertSame($id, $saga->id());
176+
177+
Loop::stop();
172178
}
173179
);
174180
}
@@ -189,6 +195,8 @@ function (): \Generator
189195

190196
yield $this->sagaProvider->start($id, new TestCommand(), new TestContext());
191197
yield $this->sagaProvider->start($id, new TestCommand(), new TestContext());
198+
199+
Loop::stop();
192200
}
193201
);
194202
}
@@ -208,6 +216,8 @@ function (): \Generator
208216
$this->containerBuilder->get(Router::class);
209217

210218
yield $this->sagaProvider->start(TestSagaId::new(TestSaga::class), new TestCommand(), new TestContext());
219+
220+
Loop::stop();
211221
}
212222
);
213223
}
@@ -226,6 +236,8 @@ function (): \Generator
226236

227237
yield $this->adapter->execute('DROP TABLE sagas_store');
228238
yield $this->sagaProvider->obtain(TestSagaId::new(TestSaga::class), new TestContext());
239+
240+
Loop::stop();
229241
}
230242
);
231243
}
@@ -245,6 +257,8 @@ function (): \Generator
245257
$testSaga = new TestSaga(TestSagaId::new(TestSaga::class));
246258

247259
yield $this->sagaProvider->save($testSaga, new TestContext());
260+
261+
Loop::stop();
248262
}
249263
);
250264
}
@@ -260,6 +274,8 @@ function (): \Generator
260274
self::assertNull(
261275
yield $this->sagaProvider->obtain(TestSagaId::new(TestSaga::class), new TestContext())
262276
);
277+
278+
Loop::stop();
263279
}
264280
);
265281
}
@@ -291,6 +307,8 @@ function (): \Generator
291307

292308
yield $this->adapter->execute($query->sql(), $query->params());
293309
yield $this->sagaProvider->obtain($id, $context);
310+
311+
Loop::stop();
294312
}
295313
);
296314
}
@@ -318,6 +336,8 @@ function (): \Generator
318336
$loadedSaga = yield $this->sagaProvider->obtain($id, $context);
319337

320338
self::assertSame($saga->id()->id, $loadedSaga->id()->id);
339+
340+
Loop::stop();
321341
}
322342
);
323343
}
@@ -365,6 +385,8 @@ function (): \Generator
365385
$newExpireDate->format('Y-m-d H:i:s'),
366386
$loadedSaga->expireDate()->format('Y-m-d H:i:s')
367387
);
388+
389+
Loop::stop();
368390
}
369391
);
370392
}
@@ -388,6 +410,8 @@ function (): \Generator
388410

389411
yield $this->sagaProvider->start($id, new TestCommand(), $context);
390412
yield $this->sagaProvider->reopen($id, $context, datetimeInstantiator('+1 day'), 'testing');
413+
414+
Loop::stop();
391415
}
392416
);
393417
}
@@ -410,6 +434,8 @@ function (): \Generator
410434
$id = new TestSagaId('ccfd1b8e-be8b-4f69-b1ca-c92a14379558', TestSaga::class);
411435

412436
yield $this->sagaProvider->reopen($id, $context, datetimeInstantiator('+1 day'), 'testing');
437+
438+
Loop::stop();
413439
}
414440
);
415441
}

tests/Store/SQLSagaStoreTest.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,8 @@ function (): \Generator
8585
self::assertNotNull($loadedSaga);
8686
self::assertInstanceOf(CorrectSaga::class, $loadedSaga);
8787
self::assertSame($id->id, $loadedSaga->id()->id);
88+
89+
Loop::stop();
8890
}
8991
);
9092
}
@@ -107,6 +109,8 @@ function (): \Generator
107109
$loadedSaga = yield $this->store->obtain($id);
108110

109111
self::assertNull($loadedSaga);
112+
113+
Loop::stop();
110114
}
111115
);
112116
}
@@ -120,6 +124,8 @@ public function removeUnExistsSaga(): void
120124
function (): \Generator
121125
{
122126
yield $this->store->remove(TestSagaId::new(CorrectSaga::class));
127+
128+
Loop::stop();
123129
}
124130
);
125131
}
@@ -139,6 +145,8 @@ function (): \Generator
139145

140146
yield $this->store->save($saga);
141147
yield $this->store->save($saga);
148+
149+
Loop::stop();
142150
}
143151
);
144152
}
@@ -164,6 +172,8 @@ function (): \Generator
164172
$loadedSaga = yield $this->store->obtain($id);
165173

166174
self::assertSame($loadedSaga->value(), 'qwerty');
175+
176+
Loop::stop();
167177
}
168178
);
169179
}
@@ -180,6 +190,8 @@ function (): \Generator
180190
$saga = new CorrectSaga($id);
181191

182192
yield $this->store->update($saga);
193+
194+
Loop::stop();
183195
}
184196
);
185197
}

0 commit comments

Comments
 (0)