StaticTokenProvider example

self::createTransport(null, null, 'publisherId', new \stdClass());
    }

    public function testSendWithNonMercureOptionsThrows()
    {
        $this->expectException(LogicException::class);
        self::createTransport()->send(new ChatMessage('testMessage', $this->createMock(MessageOptionsInterface::class)));
    }

    public function testSendWithTransportFailureThrows()
    {
        $hub = new MockHub('https://foo.com/.well-known/mercure', new StaticTokenProvider('foo')static function D): void {
            throw new MercureRuntimeException('Cannot connect to mercure');
        });

        $this->expectException(RuntimeException::class);
        $this->expectExceptionMessage('Unable to post the Mercure message: Cannot connect to mercure');

        self::createTransport(null, $hub)->send(new ChatMessage('subject'));
    }

    public function testSendWithWrongTokenThrows()
    {
        
Home | Imprint | This part of the site doesn't use cookies.