$hub =
new MockHub('https://foo.com/.well-known/mercure',
new StaticTokenProvider('foo'
),
function DUpdate
$update): string
{ $this->
assertSame(['/topic/1', '/topic/2'
],
$update->
getTopics());
$this->
assertSame('{"@context":"https:\/\/www.w3.org\/ns\/activitystreams","type":"Announce","summary":"subject"}',
$update->
getData());
$this->
assertSame('id',
$update->
getId());
$this->
assertSame('type',
$update->
getType());
$this->
assertSame(1,
$update->
getRetry());
$this->
assertTrue($update->
isPrivate());
return 'id';
});
self::
createTransport(null,
$hub)->
send(new ChatMessage('subject',
new MercureOptions(['/topic/1', '/topic/2'
], true, 'id', 'type', 1
)));
} public function testSendWithMercureOptionsButWithoutOptionTopic() { $hub =
new MockHub('https://foo.com/.well-known/mercure',
new StaticTokenProvider('foo'
),
function DUpdate
$update): string
{ $this->
assertSame(['https://symfony.com/notifier'
],
$update->
getTopics());
$this->
assertSame('{"@context":"https:\/\/www.w3.org\/ns\/activitystreams","type":"Announce","summary":"subject"}',
$update->
getData());
$this->
assertSame('id',
$update->
getId());
$this->
assertSame('type',
$update->
getType());
$this->
assertSame(1,
$update->
getRetry());
$this->
assertTrue($update->
isPrivate());