generator = new MercureUpdatesGenerator([]); } /** @test */ public function visitIsProperlySerializedIntoUpdate(): void { $shortUrl = new ShortUrl(''); $visit = new Visit($shortUrl, Visitor::emptyInstance()); $update = $this->generator->newVisitUpdate($visit); $this->assertEquals(['https://shlink.io/new_visit'], $update->getTopics()); $this->assertEquals([ 'shortUrl' => [ 'shortCode' => $shortUrl->getShortCode(), 'shortUrl' => 'http:/' . $shortUrl->getShortCode(), 'longUrl' => '', 'dateCreated' => $shortUrl->getDateCreated()->toAtomString(), 'visitsCount' => 0, 'tags' => [], 'meta' => [ 'validSince' => null, 'validUntil' => null, 'maxVisits' => null, ], 'domain' => null, ], 'visit' => [ 'referer' => '', 'userAgent' => '', 'visitLocation' => null, 'date' => $visit->getDate()->toAtomString(), ], ], json_decode($update->getData())); } }