From 387246aaddddab36c08bb121970c1de7bf16dfc3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Deruss=C3=A9?= Date: Wed, 3 Nov 2021 16:41:23 +0100 Subject: [PATCH] Fix tests --- .../Transport/InMemoryTransportFactoryTest.php | 5 +++-- .../Tests/Transport/InMemoryTransportTest.php | 15 ++++++++------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/src/Symfony/Component/Messenger/Tests/Transport/InMemoryTransportFactoryTest.php b/src/Symfony/Component/Messenger/Tests/Transport/InMemoryTransportFactoryTest.php index adb089efaa533..d29ab10639da2 100644 --- a/src/Symfony/Component/Messenger/Tests/Transport/InMemoryTransportFactoryTest.php +++ b/src/Symfony/Component/Messenger/Tests/Transport/InMemoryTransportFactoryTest.php @@ -13,6 +13,7 @@ use PHPUnit\Framework\TestCase; use Symfony\Component\Messenger\Envelope; +use Symfony\Component\Messenger\Stamp\TransportMessageIdStamp; use Symfony\Component\Messenger\Tests\Fixtures\DummyMessage; use Symfony\Component\Messenger\Transport\InMemoryTransport; use Symfony\Component\Messenger\Transport\InMemoryTransportFactory; @@ -61,7 +62,7 @@ public function testCreateTransportWithoutSerializer() $message = Envelope::wrap(new DummyMessage('Hello.')); $transport->send($message); - $this->assertSame([$message], $transport->get()); + $this->assertEquals([$message->with(new TransportMessageIdStamp(1))], $transport->get()); } public function testCreateTransportWithSerializer() @@ -72,7 +73,7 @@ public function testCreateTransportWithSerializer() $serializer ->expects($this->once()) ->method('encode') - ->with($this->equalTo($message)) + ->with($this->equalTo($message->with(new TransportMessageIdStamp(1)))) ; $transport = $this->factory->createTransport('in-memory://?serialize=true', [], $serializer); $transport->send($message); diff --git a/src/Symfony/Component/Messenger/Tests/Transport/InMemoryTransportTest.php b/src/Symfony/Component/Messenger/Tests/Transport/InMemoryTransportTest.php index 0a77bca1179de..1b10a6165823a 100644 --- a/src/Symfony/Component/Messenger/Tests/Transport/InMemoryTransportTest.php +++ b/src/Symfony/Component/Messenger/Tests/Transport/InMemoryTransportTest.php @@ -13,6 +13,7 @@ use PHPUnit\Framework\TestCase; use Symfony\Component\Messenger\Envelope; +use Symfony\Component\Messenger\Stamp\TransportMessageIdStamp; use Symfony\Component\Messenger\Tests\Fixtures\AnEnvelopeStamp; use Symfony\Component\Messenger\Tests\Fixtures\DummyMessage; use Symfony\Component\Messenger\Transport\InMemoryTransport; @@ -49,7 +50,7 @@ public function testSend() { $envelope = new Envelope(new \stdClass()); $this->transport->send($envelope); - $this->assertSame([$envelope], $this->transport->getSent()); + $this->assertEquals([$envelope->with(new TransportMessageIdStamp(1))], $this->transport->getSent()); } public function testSendWithSerialization() @@ -58,7 +59,7 @@ public function testSendWithSerialization() $envelopeDecoded = Envelope::wrap(new DummyMessage('Hello.')); $this->serializer ->method('encode') - ->with($this->equalTo($envelope)) + ->with($this->equalTo($envelope->with(new TransportMessageIdStamp(1)))) ->willReturn(['foo' => 'ba']) ; $this->serializer @@ -89,7 +90,7 @@ public function testQueueWithSerialization() $envelopeDecoded = Envelope::wrap(new DummyMessage('Hello.')); $this->serializer ->method('encode') - ->with($this->equalTo($envelope)) + ->with($this->equalTo($envelope->with(new TransportMessageIdStamp(1)))) ->willReturn(['foo' => 'ba']) ; $this->serializer @@ -128,7 +129,7 @@ public function testAckWithSerialization() $envelopeDecoded = Envelope::wrap(new DummyMessage('Hello.')); $this->serializer ->method('encode') - ->with($this->equalTo($envelope)) + ->with($this->equalTo($envelope->with(new TransportMessageIdStamp(1)))) ->willReturn(['foo' => 'ba']) ; $this->serializer @@ -136,7 +137,7 @@ public function testAckWithSerialization() ->with(['foo' => 'ba']) ->willReturn($envelopeDecoded) ; - $this->serializeTransport->ack($envelope); + $this->serializeTransport->ack($envelope->with(new TransportMessageIdStamp(1))); $this->assertSame([$envelopeDecoded], $this->serializeTransport->getAcknowledged()); } @@ -154,7 +155,7 @@ public function testRejectWithSerialization() $envelopeDecoded = Envelope::wrap(new DummyMessage('Hello.')); $this->serializer ->method('encode') - ->with($this->equalTo($envelope)) + ->with($this->equalTo($envelope->with(new TransportMessageIdStamp(1)))) ->willReturn(['foo' => 'ba']) ; $this->serializer @@ -162,7 +163,7 @@ public function testRejectWithSerialization() ->with(['foo' => 'ba']) ->willReturn($envelopeDecoded) ; - $this->serializeTransport->reject($envelope); + $this->serializeTransport->reject($envelope->with(new TransportMessageIdStamp(1))); $this->assertSame([$envelopeDecoded], $this->serializeTransport->getRejected()); } 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