-
Notifications
You must be signed in to change notification settings - Fork 0
/
MessageQueueAssertTrait.php
56 lines (48 loc) · 1.32 KB
/
MessageQueueAssertTrait.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<?php
namespace Oro\Bundle\MessageQueueBundle\Test\Unit;
use Oro\Bundle\MessageQueueBundle\Test\Assert\AbstractMessageQueueAssertTrait;
use Oro\Bundle\MessageQueueBundle\Test\MessageCollector;
/**
* Provides useful assertion methods for the message queue related unit tests.
*/
trait MessageQueueAssertTrait
{
use AbstractMessageQueueAssertTrait;
/**
* @var MessageCollector|null
*/
private static $messageCollector;
/**
* Unsets the message collector if needed.
*
* @afterClass
*/
public static function tearDownAfterClassMessageCollector()
{
if (isset(self::$messageCollector)) {
self::$messageCollector = null;
}
}
/**
* Gets an object responsible to collect all sent messages.
*
* @return MessageCollector
*/
protected static function getMessageCollector()
{
if (!isset(self::$messageCollector)) {
self::$messageCollector = new MessageCollector();
}
return self::$messageCollector;
}
/**
* Gets the message producer.
* Use this alias for "getMessageCollector" method in case if it makes your tests more intuitive.
*
* @return MessageCollector
*/
protected static function getMessageProducer()
{
return self::getMessageCollector();
}
}