Skip to content

[Messenger] Ignore stamps in in-memory transport #34474

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
Nov 21, 2019
Merged
Show file tree
Hide file tree
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
[Messenger] Ignore stamps in in-memory transport
  • Loading branch information
tienvx committed Nov 21, 2019
commit b435b1aab6bd19c5b9b2d3eb9ef6919f97ce83ae
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

use PHPUnit\Framework\TestCase;
use Symfony\Component\Messenger\Envelope;
use Symfony\Component\Messenger\Tests\Fixtures\AnEnvelopeStamp;
use Symfony\Component\Messenger\Transport\InMemoryTransport;

/**
Expand Down Expand Up @@ -50,6 +51,19 @@ public function testQueue()
$this->assertSame([], $this->transport->get());
}

public function testAcknowledgeSameMessageWithDifferentStamps()
{
$envelope1 = new Envelope(new \stdClass(), [new AnEnvelopeStamp()]);
$this->transport->send($envelope1);
$envelope2 = new Envelope(new \stdClass(), [new AnEnvelopeStamp()]);
$this->transport->send($envelope2);
$this->assertSame([$envelope1, $envelope2], $this->transport->get());
$this->transport->ack($envelope1->with(new AnEnvelopeStamp()));
$this->assertSame([$envelope2], $this->transport->get());
$this->transport->reject($envelope2->with(new AnEnvelopeStamp()));
$this->assertSame([], $this->transport->get());
}

public function testAck()
{
$envelope = new Envelope(new \stdClass());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public function get(): iterable
public function ack(Envelope $envelope): void
{
$this->acknowledged[] = $envelope;
$id = spl_object_hash($envelope);
$id = spl_object_hash($envelope->getMessage());
unset($this->queue[$id]);
}

Expand All @@ -65,7 +65,7 @@ public function ack(Envelope $envelope): void
public function reject(Envelope $envelope): void
{
$this->rejected[] = $envelope;
$id = spl_object_hash($envelope);
$id = spl_object_hash($envelope->getMessage());
unset($this->queue[$id]);
}

Expand All @@ -75,7 +75,7 @@ public function reject(Envelope $envelope): void
public function send(Envelope $envelope): Envelope
{
$this->sent[] = $envelope;
$id = spl_object_hash($envelope);
$id = spl_object_hash($envelope->getMessage());
$this->queue[$id] = $envelope;

return $envelope;
Expand Down
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