DummyHub example

use Symfony\Component\Notifier\Test\TransportTestCase;
use Symfony\Component\Notifier\Tests\Transport\DummyMessage;
use Symfony\Contracts\HttpClient\HttpClientInterface;

/** * @author Mathias Arlaud <mathias.arlaud@gmail.com> */
final class MercureTransportTest extends TransportTestCase
{
    public static function createTransport(HttpClientInterface $client = null, HubInterface $hub = null, string $hubId = 'hubId', $topics = null): MercureTransport
    {
        $hub ??= new DummyHub();

        return new MercureTransport($hub$hubId$topics);
    }

    public static function toStringProvider(): iterable
    {
        yield ['mercure://hubId?topic=https%3A%2F%2Fsymfony.com%2Fnotifier', self::createTransport()];
        yield ['mercure://customHubId?topic=%2Ftopic', self::createTransport(null, null, 'customHubId', '/topic')];
        yield ['mercure://customHubId?topic%5B0%5D=%2Ftopic%2F1&topic%5B1%5D%5B0%5D=%2Ftopic%2F2', self::createTransport(null, null, 'customHubId', ['/topic/1', ['/topic/2']])];
    }

    
Home | Imprint | This part of the site doesn't use cookies.