Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit838f36b

Browse files
committed
[Notifier] [Bridge] Store message id for slack transport's SendMessage
1 parent2ad08d5 commit838f36b

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

‎src/Symfony/Component/Notifier/Bridge/Slack/SlackTransport.php‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,9 @@ protected function doSend(MessageInterface $message): SentMessage
9191
thrownewTransportException(sprintf('Unable to post the Slack message: "%s".',$result['error']),$response);
9292
}
9393

94-
returnnewSentMessage($message, (string)$this);
94+
$sentMessage =newSentMessage($message, (string)$this);
95+
$sentMessage->setMessageId($result['ts']);
96+
97+
return$sentMessage;
9598
}
9699
}

‎src/Symfony/Component/Notifier/Bridge/Slack/Tests/SlackTransportTest.php‎

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ public function testSendWithOptions()
110110

111111
$response->expects($this->once())
112112
->method('getContent')
113-
->willReturn(json_encode(['ok' =>true]));
113+
->willReturn(json_encode(['ok' =>true,'ts' =>'1503435956.000247']));
114114

115115
$expectedBody =json_encode(['channel' =>$channel,'text' =>$message]);
116116

@@ -122,7 +122,9 @@ public function testSendWithOptions()
122122

123123
$transport =$this->createTransport($client,$channel);
124124

125-
$transport->send(newChatMessage('testMessage'));
125+
$sentMessage =$transport->send(newChatMessage('testMessage'));
126+
127+
$this->assertSame('1503435956.000247',$sentMessage->getMessageId());
126128
}
127129

128130
publicfunctiontestSendWithNotification()
@@ -138,7 +140,7 @@ public function testSendWithNotification()
138140

139141
$response->expects($this->once())
140142
->method('getContent')
141-
->willReturn(json_encode(['ok' =>true]));
143+
->willReturn(json_encode(['ok' =>true,'ts' =>'1503435956.000247']));
142144

143145
$notification =newNotification($message);
144146
$chatMessage = ChatMessage::fromNotification($notification);
@@ -158,7 +160,9 @@ public function testSendWithNotification()
158160

159161
$transport =$this->createTransport($client,$channel);
160162

161-
$transport->send($chatMessage);
163+
$sentMessage =$transport->send($chatMessage);
164+
165+
$this->assertSame('1503435956.000247',$sentMessage->getMessageId());
162166
}
163167

164168
publicfunctiontestSendWithInvalidOptions()

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp