-
-
Notifications
You must be signed in to change notification settings - Fork 27
Expand file tree
/
Copy pathQueueWorkerInterfaceProxyTest.php
More file actions
33 lines (26 loc) · 1.08 KB
/
QueueWorkerInterfaceProxyTest.php
File metadata and controls
33 lines (26 loc) · 1.08 KB
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
<?php
declare(strict_types=1);
namespace Yiisoft\Queue\Tests\Unit\Debug;
use PHPUnit\Framework\TestCase;
use Yiisoft\Queue\Debug\QueueCollector;
use Yiisoft\Queue\Debug\QueueWorkerInterfaceProxy;
use Yiisoft\Queue\Message\Message;
use Yiisoft\Queue\Tests\App\DummyQueue;
use Yiisoft\Queue\Stubs\StubWorker;
final class QueueWorkerInterfaceProxyTest extends TestCase
{
public function testProcessDelegatesToWorker(): void
{
$message = new Message('handler', 'data');
$collector = new QueueCollector();
$collector->startup();
$proxy = new QueueWorkerInterfaceProxy(new StubWorker(), $collector);
$result = $proxy->process($message, new DummyQueue('chan'));
self::assertSame($message, $result);
$collected = $collector->getCollected();
self::assertArrayHasKey('processingMessages', $collected);
self::assertArrayHasKey('chan', $collected['processingMessages']);
self::assertCount(1, $collected['processingMessages']['chan']);
self::assertSame($message, $collected['processingMessages']['chan'][0]);
}
}