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

Commitbb881c9

Browse files
committed
Make 'headers' key optional for encoded messages
1 parent675c458 commitbb881c9

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

‎src/Symfony/Component/Messenger/Tests/Transport/AmqpExt/AmqpSenderTest.php‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,19 @@ public function testItSendsTheEncodedMessage()
3737
$sender =newAmqpSender($connection,$serializer);
3838
$sender->send($envelope);
3939
}
40+
41+
publicfunctiontestItSendsTheEncodedMessageWithoutHeaders()
42+
{
43+
$envelope =newEnvelope(newDummyMessage('Oy'));
44+
$encoded = ['body' =>'...'];
45+
46+
$serializer =$this->getMockBuilder(SerializerInterface::class)->getMock();
47+
$serializer->method('encode')->with($envelope)->willReturnOnConsecutiveCalls($encoded);
48+
49+
$connection =$this->getMockBuilder(Connection::class)->disableOriginalConstructor()->getMock();
50+
$connection->expects($this->once())->method('publish')->with($encoded['body'], []);
51+
52+
$sender =newAmqpSender($connection,$serializer);
53+
$sender->send($envelope);
54+
}
4055
}

‎src/Symfony/Component/Messenger/Transport/AmqpExt/AmqpSender.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public function send(Envelope $envelope): Envelope
4141
{
4242
$encodedMessage =$this->serializer->encode($envelope);
4343

44-
$this->connection->publish($encodedMessage['body'],$encodedMessage['headers']);
44+
$this->connection->publish($encodedMessage['body'],$encodedMessage['headers'] ?? []);
4545

4646
return$envelope;
4747
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp