Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[Notifier] [Line] Fix tests #48477

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 5, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

use Symfony\Component\HttpClient\MockHttpClient;
use Symfony\Component\Notifier\Bridge\LineNotify\LineNotifyTransport;
use Symfony\Component\Notifier\Exception\LengthException;
use Symfony\Component\Notifier\Exception\TransportException;
use Symfony\Component\Notifier\Message\ChatMessage;
use Symfony\Component\Notifier\Message\MessageInterface;
Expand Down Expand Up @@ -48,16 +47,6 @@ public function unsupportedMessagesProvider(): iterable
yield [$this->createMock(MessageInterface::class)];
}

public function testSendChatMessageWithMoreThan2000CharsThrowsLogicException()
{
$transport = $this->createTransport();

$this->expectException(LengthException::class);
$this->expectExceptionMessage('The subject length of a Line message must not exceed 1000 characters.');

$transport->send(new ChatMessage(str_repeat('囍', 1001)));
}
Comment on lines -51 to -59
Copy link
Contributor Author

@OskarStark OskarStark Dec 5, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This Test is obsolete, as we removed the check for the max subject length in the initial PR. Anyway, creating a ChatMessage with 1001 chars would never raise the limit of 2000 🤷

Lets remove this test


public function testSendWithErrorResponseThrows()
{
$response = $this->createMock(ResponseInterface::class);
Expand All @@ -66,7 +55,7 @@ public function testSendWithErrorResponseThrows()
->willReturn(400);
$response->expects($this->once())
->method('getContent')
->willReturn(json_encode(['message' => 'testDescription', 'code' => 'testErrorCode']));
->willReturn(json_encode(['message' => 'testDescription', 'code' => 'testErrorCode', 'status' => 'testStatus']));

$client = new MockHttpClient(static function () use ($response): ResponseInterface {
return $response;
Expand All @@ -75,7 +64,7 @@ public function testSendWithErrorResponseThrows()
$transport = $this->createTransport($client);

$this->expectException(TransportException::class);
$this->expectExceptionMessageMatches('/testDescription.+testErrorCode/');
$this->expectExceptionMessageMatches('/testMessage.+testDescription/');

$transport->send(new ChatMessage('testMessage'));
}
Expand Down