diff --git a/module/Core/test/EventDispatcher/CloseDbConnectionEventListenerDelegatorTest.php b/module/Core/test/EventDispatcher/CloseDbConnectionEventListenerDelegatorTest.php index 41fe94fa..60113fc7 100644 --- a/module/Core/test/EventDispatcher/CloseDbConnectionEventListenerDelegatorTest.php +++ b/module/Core/test/EventDispatcher/CloseDbConnectionEventListenerDelegatorTest.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace ShlinkioApiTest\Shlink\Rest\EventDispatcher; +namespace ShlinkioTest\Shlink\Rest\EventDispatcher; use PHPUnit\Framework\TestCase; use Prophecy\Prophecy\ObjectProphecy; diff --git a/module/Core/test/EventDispatcher/CloseDbConnectionEventListenerTest.php b/module/Core/test/EventDispatcher/CloseDbConnectionEventListenerTest.php index 349e7724..acc1784f 100644 --- a/module/Core/test/EventDispatcher/CloseDbConnectionEventListenerTest.php +++ b/module/Core/test/EventDispatcher/CloseDbConnectionEventListenerTest.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace ShlinkioApiTest\Shlink\Core\EventDispatcher; +namespace ShlinkioTest\Shlink\Core\EventDispatcher; use Doctrine\DBAL\Connection; use PHPUnit\Framework\TestCase; diff --git a/module/Core/test/EventDispatcher/NotifyVisitToMercureTest.php b/module/Core/test/EventDispatcher/NotifyVisitToMercureTest.php index ff5fb7c3..07f8bd1c 100644 --- a/module/Core/test/EventDispatcher/NotifyVisitToMercureTest.php +++ b/module/Core/test/EventDispatcher/NotifyVisitToMercureTest.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace ShlinkioApiTest\Shlink\Core\EventDispatcher; +namespace ShlinkioTest\Shlink\Core\EventDispatcher; use Doctrine\ORM\EntityManagerInterface; use PHPUnit\Framework\TestCase; diff --git a/module/Core/test/Mercure/MercureUpdatesGeneratorTest.php b/module/Core/test/Mercure/MercureUpdatesGeneratorTest.php new file mode 100644 index 00000000..361d3b2f --- /dev/null +++ b/module/Core/test/Mercure/MercureUpdatesGeneratorTest.php @@ -0,0 +1,56 @@ +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())); + } +} diff --git a/module/Rest/test/Action/MercureInfoActionTest.php b/module/Rest/test/Action/MercureInfoActionTest.php index 5300fbaa..df4b7260 100644 --- a/module/Rest/test/Action/MercureInfoActionTest.php +++ b/module/Rest/test/Action/MercureInfoActionTest.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace ShlinkioApiTest\Shlink\Rest\Action; +namespace ShlinkioTest\Shlink\Rest\Action; use Cake\Chronos\Chronos; use Laminas\Diactoros\Response\JsonResponse; diff --git a/module/Rest/test/Middleware/ShortUrl/DefaultShortCodesLengthMiddlewareTest.php b/module/Rest/test/Middleware/ShortUrl/DefaultShortCodesLengthMiddlewareTest.php index 38d875d9..c14a2f5c 100644 --- a/module/Rest/test/Middleware/ShortUrl/DefaultShortCodesLengthMiddlewareTest.php +++ b/module/Rest/test/Middleware/ShortUrl/DefaultShortCodesLengthMiddlewareTest.php @@ -2,7 +2,7 @@ declare(strict_types=1); -namespace ShlinkioApiTest\Shlink\Rest\Middleware\ShortUrl; +namespace ShlinkioTest\Shlink\Rest\Middleware\ShortUrl; use Laminas\Diactoros\Response; use Laminas\Diactoros\ServerRequestFactory;