mirror of
https://github.com/shlinkio/shlink.git
synced 2026-03-06 23:33:13 +08:00
Allow individual real-time updates topics to be enabled
This commit is contained in:
@@ -12,6 +12,7 @@ use PHPUnit\Framework\TestCase;
|
||||
use Psr\Log\LoggerInterface;
|
||||
use Shlinkio\Shlink\Common\UpdatePublishing\PublishingHelperInterface;
|
||||
use Shlinkio\Shlink\Common\UpdatePublishing\Update;
|
||||
use Shlinkio\Shlink\Core\Config\Options\RealTimeUpdatesOptions;
|
||||
use Shlinkio\Shlink\Core\EventDispatcher\Event\ShortUrlCreated;
|
||||
use Shlinkio\Shlink\Core\EventDispatcher\Mercure\NotifyNewShortUrlToMercure;
|
||||
use Shlinkio\Shlink\Core\EventDispatcher\PublishingUpdatesGeneratorInterface;
|
||||
@@ -37,6 +38,7 @@ class NotifyNewShortUrlToMercureTest extends TestCase
|
||||
$this->updatesGenerator,
|
||||
$this->em,
|
||||
$this->logger,
|
||||
new RealTimeUpdatesOptions(),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@ use Psr\Log\LoggerInterface;
|
||||
use RuntimeException;
|
||||
use Shlinkio\Shlink\Common\UpdatePublishing\PublishingHelperInterface;
|
||||
use Shlinkio\Shlink\Common\UpdatePublishing\Update;
|
||||
use Shlinkio\Shlink\Core\Config\Options\RealTimeUpdatesOptions;
|
||||
use Shlinkio\Shlink\Core\EventDispatcher\Event\UrlVisited;
|
||||
use Shlinkio\Shlink\Core\EventDispatcher\Mercure\NotifyVisitToMercure;
|
||||
use Shlinkio\Shlink\Core\EventDispatcher\PublishingUpdatesGeneratorInterface;
|
||||
@@ -36,7 +37,13 @@ class NotifyVisitToMercureTest extends TestCase
|
||||
$this->em = $this->createMock(EntityManagerInterface::class);
|
||||
$this->logger = $this->createMock(LoggerInterface::class);
|
||||
|
||||
$this->listener = new NotifyVisitToMercure($this->helper, $this->updatesGenerator, $this->em, $this->logger);
|
||||
$this->listener = new NotifyVisitToMercure(
|
||||
$this->helper,
|
||||
$this->updatesGenerator,
|
||||
$this->em,
|
||||
$this->logger,
|
||||
new RealTimeUpdatesOptions(),
|
||||
);
|
||||
}
|
||||
|
||||
#[Test]
|
||||
|
||||
@@ -16,6 +16,7 @@ use RuntimeException;
|
||||
use Shlinkio\Shlink\Common\UpdatePublishing\PublishingHelperInterface;
|
||||
use Shlinkio\Shlink\Common\UpdatePublishing\Update;
|
||||
use Shlinkio\Shlink\Core\Config\Options\RabbitMqOptions;
|
||||
use Shlinkio\Shlink\Core\Config\Options\RealTimeUpdatesOptions;
|
||||
use Shlinkio\Shlink\Core\EventDispatcher\Event\ShortUrlCreated;
|
||||
use Shlinkio\Shlink\Core\EventDispatcher\PublishingUpdatesGeneratorInterface;
|
||||
use Shlinkio\Shlink\Core\EventDispatcher\RabbitMq\NotifyNewShortUrlToRabbitMq;
|
||||
@@ -115,6 +116,7 @@ class NotifyNewShortUrlToRabbitMqTest extends TestCase
|
||||
$this->updatesGenerator,
|
||||
$this->em,
|
||||
$this->logger,
|
||||
new RealTimeUpdatesOptions(),
|
||||
new RabbitMqOptions($enabled),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@ use RuntimeException;
|
||||
use Shlinkio\Shlink\Common\UpdatePublishing\PublishingHelperInterface;
|
||||
use Shlinkio\Shlink\Common\UpdatePublishing\Update;
|
||||
use Shlinkio\Shlink\Core\Config\Options\RabbitMqOptions;
|
||||
use Shlinkio\Shlink\Core\Config\Options\RealTimeUpdatesOptions;
|
||||
use Shlinkio\Shlink\Core\EventDispatcher\Event\UrlVisited;
|
||||
use Shlinkio\Shlink\Core\EventDispatcher\PublishingUpdatesGeneratorInterface;
|
||||
use Shlinkio\Shlink\Core\EventDispatcher\RabbitMq\NotifyVisitToRabbitMq;
|
||||
@@ -189,6 +190,7 @@ class NotifyVisitToRabbitMqTest extends TestCase
|
||||
$this->updatesGenerator,
|
||||
$this->em,
|
||||
$this->logger,
|
||||
new RealTimeUpdatesOptions(),
|
||||
$options ?? new RabbitMqOptions(enabled: true),
|
||||
);
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ use Psr\Log\LoggerInterface;
|
||||
use RuntimeException;
|
||||
use Shlinkio\Shlink\Common\UpdatePublishing\PublishingHelperInterface;
|
||||
use Shlinkio\Shlink\Common\UpdatePublishing\Update;
|
||||
use Shlinkio\Shlink\Core\Config\Options\RealTimeUpdatesOptions;
|
||||
use Shlinkio\Shlink\Core\EventDispatcher\Event\ShortUrlCreated;
|
||||
use Shlinkio\Shlink\Core\EventDispatcher\PublishingUpdatesGeneratorInterface;
|
||||
use Shlinkio\Shlink\Core\EventDispatcher\RedisPubSub\NotifyNewShortUrlToRedis;
|
||||
@@ -77,6 +78,13 @@ class NotifyNewShortUrlToRedisTest extends TestCase
|
||||
|
||||
private function createListener(bool $enabled = true): NotifyNewShortUrlToRedis
|
||||
{
|
||||
return new NotifyNewShortUrlToRedis($this->helper, $this->updatesGenerator, $this->em, $this->logger, $enabled);
|
||||
return new NotifyNewShortUrlToRedis(
|
||||
$this->helper,
|
||||
$this->updatesGenerator,
|
||||
$this->em,
|
||||
$this->logger,
|
||||
new RealTimeUpdatesOptions(),
|
||||
$enabled,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ use Psr\Log\LoggerInterface;
|
||||
use RuntimeException;
|
||||
use Shlinkio\Shlink\Common\UpdatePublishing\PublishingHelperInterface;
|
||||
use Shlinkio\Shlink\Common\UpdatePublishing\Update;
|
||||
use Shlinkio\Shlink\Core\Config\Options\RealTimeUpdatesOptions;
|
||||
use Shlinkio\Shlink\Core\EventDispatcher\Event\UrlVisited;
|
||||
use Shlinkio\Shlink\Core\EventDispatcher\PublishingUpdatesGeneratorInterface;
|
||||
use Shlinkio\Shlink\Core\EventDispatcher\RedisPubSub\NotifyVisitToRedis;
|
||||
@@ -76,6 +77,13 @@ class NotifyVisitToRedisTest extends TestCase
|
||||
|
||||
private function createListener(bool $enabled = true): NotifyVisitToRedis
|
||||
{
|
||||
return new NotifyVisitToRedis($this->helper, $this->updatesGenerator, $this->em, $this->logger, $enabled);
|
||||
return new NotifyVisitToRedis(
|
||||
$this->helper,
|
||||
$this->updatesGenerator,
|
||||
$this->em,
|
||||
$this->logger,
|
||||
new RealTimeUpdatesOptions(),
|
||||
$enabled,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user