diff --git a/src/Symfony/Component/Notifier/Bridge/Discord/DiscordTransport.php b/src/Symfony/Component/Notifier/Bridge/Discord/DiscordTransport.php index 012d5acde9a7..afa98f77d6b3 100644 --- a/src/Symfony/Component/Notifier/Bridge/Discord/DiscordTransport.php +++ b/src/Symfony/Component/Notifier/Bridge/Discord/DiscordTransport.php @@ -66,7 +66,7 @@ protected function doSend(MessageInterface $message): SentMessage $content = $message->getSubject(); if (\strlen($content) > 2000) { - throw new LogicException(sprintf('The subject length of "%s" transport must be less than 2000 characters.', __CLASS__)); + throw new LogicException('The subject length of a Discord message must not exceed 2000 characters.'); } $endpoint = sprintf('https://%s/api/webhooks/%s/%s', $this->getEndpoint(), $this->webhookId, $this->token); diff --git a/src/Symfony/Component/Notifier/Bridge/Discord/Tests/DiscordTransportTest.php b/src/Symfony/Component/Notifier/Bridge/Discord/Tests/DiscordTransportTest.php index 097b1ad25caf..154a795530fb 100644 --- a/src/Symfony/Component/Notifier/Bridge/Discord/Tests/DiscordTransportTest.php +++ b/src/Symfony/Component/Notifier/Bridge/Discord/Tests/DiscordTransportTest.php @@ -49,6 +49,16 @@ public function testSendNonChatMessageThrows() $transport->send($this->createMock(MessageInterface::class)); } + public function testSendChatMessageWithMoreThan2000CharsThrowsLogicException() + { + $transport = new DiscordTransport('testToken', 'testChannel', $this->createMock(HttpClientInterface::class)); + + $this->expectException(LogicException::class); + $this->expectExceptionMessage('The subject length of a Discord message must not exceed 2000 characters.'); + + $transport->send(new ChatMessage(str_repeat('d', 2001))); + } + public function testSendWithErrorResponseThrows() { $this->expectException(TransportException::class); pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy