Completed
Push — master ( f129a6...32f3bd )
by Tomáš
02:23
created

thenShouldPublishExpectedMessageToExpectedProducerRouteKey()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 11
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 11
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 8
nc 1
nop 1
1
<?php declare(strict_types = 1);
2
3
namespace TomCizek\SymfonyProoph\Tests\AsynchronousMessages;
4
5
use TomCizek\SymfonyProoph\Tests\AsynchronousMessages\FakeImplementations\TestAsynchronousMessageProducerBridge;
6
use TomCizek\SymfonyProoph\Tests\Configurators\ProophTestCase;
7
use TomCizek\SymfonyProoph\Tests\EventSourcing\FakeImplementations\TestAggregateCreated;
8
9
abstract class AbstractAsynchronousMessagesTestCase extends ProophTestCase
10
{
11
	protected function thenShouldPublishExpectedMessageToExpectedProducerRouteKey($expectedProducerRouteKey): void
12
	{
13
		$publishedMessagesDump = $this->getPublishedEventsFromTestBridge();
14
15
		self::assertCount(1, $publishedMessagesDump);
16
		$publishedProducerRouteKey = $publishedMessagesDump[0][TestAsynchronousMessageProducerBridge::KEY_ROUTING_KEY];
17
		$publishedMessageData = $publishedMessagesDump[0][TestAsynchronousMessageProducerBridge::KEY_DATA];
18
		self::assertEquals($publishedProducerRouteKey, $expectedProducerRouteKey);
19
		self::assertEquals($publishedMessageData['message_name'], TestAggregateCreated::class);
20
		self::assertEquals($publishedMessageData['payload'], TestAggregateCreated::TEST_PAYLOAD);
21
	}
22
23
	abstract protected function getPublishedEventsFromTestBridge(): array;
24
}
25