diff --git a/tests/Reducer/DispatcherTestCase.php b/tests/Reducer/DispatcherTestCase.php index 8ef5600a..e6caa2ba 100644 --- a/tests/Reducer/DispatcherTestCase.php +++ b/tests/Reducer/DispatcherTestCase.php @@ -28,6 +28,14 @@ protected function setUp(): void $this->bug->setSteps(array_map(fn () => $this->createMock(StepInterface::class), range(1, 11))); } + public function testDispatchTooShortSteps(): void + { + $this->bug->setSteps([$this->createMock(StepInterface::class)]); + $this->messageBus->expects($this->never())->method('dispatch'); + $this->assertSame(0, $this->dispatcher->dispatch($this->bug)); + $this->assertPairs(0); + } + public function testDispatch(): void { $this->messageBus @@ -63,8 +71,8 @@ protected function assertMessage(): Callback }); } - protected function assertPairs(): void + protected function assertPairs(int $count = 4): void { - $this->assertCount(4, $this->pairs); + $this->assertCount($count, $this->pairs); } } diff --git a/tests/Reducer/Split/SplitDispatcherTest.php b/tests/Reducer/Split/SplitDispatcherTest.php index 852ad0d1..54ab7f40 100644 --- a/tests/Reducer/Split/SplitDispatcherTest.php +++ b/tests/Reducer/Split/SplitDispatcherTest.php @@ -22,14 +22,16 @@ protected function setUp(): void $this->dispatcher = new SplitDispatcher($this->messageBus); } - protected function assertPairs(): void + protected function assertPairs(int $count = 4): void { - parent::assertPairs(); - $this->assertSame([ - [0, 3], - [3, 6], - [6, 9], - [9, 10], - ], $this->pairs); + parent::assertPairs($count); + if (4 === $count) { + $this->assertSame([ + [0, 3], + [3, 6], + [6, 9], + [9, 10], + ], $this->pairs); + } } }