createMock(\Redis::class); $redisMock ->expects($this->once()) ->method('lPush'); $handler = new AddCheepToTimelineProjectionHandler($redisMock); $handler(new AddCheepToTimelineProjection( CheepId::nextIdentity()->toString(), AuthorId::nextIdentity()->toString(), CheepMessage::write('Hello World!')->message(), (new CheepDate( (new DateTimeImmutable( 'now', new \DateTimeZone('UTC') ))->format('Y-m-d H:i:s') ))->date() )); } }