|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Cmobi\RabbitmqBundle\Tests\DependencyInjection\Compiler; |
|
4
|
|
|
|
|
5
|
|
|
use Cmobi\RabbitmqBundle\Connection\ConnectionManager; |
|
6
|
|
|
use Cmobi\RabbitmqBundle\DependencyInjection\CmobiRabbitmqExtension; |
|
7
|
|
|
use Cmobi\RabbitmqBundle\DependencyInjection\Compiler\RpcServerPass; |
|
8
|
|
|
use Cmobi\RabbitmqBundle\Queue\BaseQueueService; |
|
9
|
|
|
use Cmobi\RabbitmqBundle\Queue\QueueServiceInterface; |
|
10
|
|
|
use Cmobi\RabbitmqBundle\Tests\BaseTestCase; |
|
11
|
|
|
use Symfony\Component\DependencyInjection\ContainerBuilder; |
|
12
|
|
|
|
|
13
|
|
|
class RpcServerPassTest extends BaseTestCase |
|
14
|
|
|
{ |
|
15
|
|
|
public function testProcess() |
|
16
|
|
|
{ |
|
17
|
|
|
$container = new ContainerBuilder(); |
|
18
|
|
|
$this->declareServiceMock($container); |
|
19
|
|
|
$container->register('cmobi_rabbitmq.message.handler', BaseQueueService::class) |
|
20
|
|
|
->setPublic(false); |
|
21
|
|
|
$container->register('cmobi_rabbitmq.connection.manager', ConnectionManager::class) |
|
22
|
|
|
->setPublic(false); |
|
23
|
|
|
|
|
24
|
|
|
$this->process($container); |
|
25
|
|
|
|
|
26
|
|
|
$this->assertTrue($container->hasDefinition('cmobi_rabbitmq.rpc.test')); |
|
27
|
|
|
} |
|
28
|
|
|
|
|
29
|
|
|
private function declareServiceMock(ContainerBuilder $container) |
|
30
|
|
|
{ |
|
31
|
|
|
$container->registerExtension(new CmobiRabbitmqExtension()); |
|
32
|
|
|
$container->register('cmobi_rabbitmq.rpc.test') |
|
33
|
|
|
->setPublic(false); |
|
34
|
|
|
$container->register('cmobi_rabbitmq.connection.default') |
|
35
|
|
|
->setPublic(false); |
|
36
|
|
|
$container->register('cmobi_rabbitmq.logger') |
|
37
|
|
|
->setPublic(false); |
|
38
|
|
|
} |
|
39
|
|
|
|
|
40
|
|
|
protected function process(ContainerBuilder $container) |
|
41
|
|
|
{ |
|
42
|
|
|
$rpcServerPass = new RpcServerPass( |
|
43
|
|
|
'test', |
|
44
|
|
|
'cmobi_rabbitmq.connection.default', |
|
45
|
|
|
'cmobi_rabbitmq.message.handler', |
|
46
|
|
|
1, |
|
47
|
|
|
false, |
|
48
|
|
|
true, |
|
49
|
|
|
[] |
|
50
|
|
|
); |
|
51
|
|
|
$rpcServerPass->process($container); |
|
52
|
|
|
} |
|
53
|
|
|
} |