Skip to content

Commit

Permalink
TASK: Improve unit test code coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
robertlemke committed Aug 20, 2020
1 parent c927eb3 commit 9cf6ba1
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions Tests/Unit/EventListener/EventListenerInvokerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,17 @@ public function setUp(): void
$this->mockEventNormalizer = $this->getMockBuilder(EventNormalizer::class)->disableOriginalConstructor()->getMock();
}

/**
* @test
*/
public function withMaximumSequenceNumberRejectsSequenceNumbersSmallerThanZero(): void
{
$this->eventListenerInvoker = new EventListenerInvoker($this->mockEventStore, $this->mockEventListener, $this->mockConnection);

$this->expectExceptionCode(1597821711);
$this->eventListenerInvoker->withMaximumSequenceNumber(-1);
}

/**
* @test
* @throws
Expand Down Expand Up @@ -146,6 +157,21 @@ public function catchUpPassesRespectsStreamAwareEventListenerInterface(): void
$this->eventListenerInvoker->catchUp();
}

/**
* @test
* @throws
*/
public function replaySetsHighestAppliedSequenceNumberToMinusOneAndCallsCatchup(): void
{
$this->mockAppliedEventsStorage->expects($this->once())->method('saveHighestAppliedSequenceNumber')->with(...-1);

$eventListenerInvokerPartialMock = $this->createPartialMock(EventListenerInvoker::class, ['catchUp']);
$eventListenerInvokerPartialMock->__construct($this->mockEventStore, $this->mockEventListener, $this->mockConnection);
$eventListenerInvokerPartialMock->expects($this->once())->method('catchUp');

$eventListenerInvokerPartialMock->replay();
}

/**
* @param StreamName|null $streamName
* @return EventListenerInterface
Expand Down

0 comments on commit 9cf6ba1

Please sign in to comment.