1 | <?php |
||
14 | class RpcClientFactoryTest extends \PHPUnit_Framework_TestCase |
||
15 | { |
||
16 | public function testCreateService() |
||
17 | { |
||
18 | $factory = new RpcClientFactory('foo'); |
||
19 | $serviceManager = new ServiceManager(); |
||
20 | $serviceManager->setService( |
||
21 | 'Configuration', |
||
22 | [ |
||
23 | 'rabbitmq_module' => [ |
||
24 | 'rpc_client' => [ |
||
25 | 'foo' => [ |
||
26 | 'connection' => 'foo', |
||
27 | 'serializer' => 'PhpSerialize', |
||
28 | ], |
||
29 | ], |
||
30 | ], |
||
31 | ] |
||
32 | ); |
||
33 | |||
34 | $connection = static::getMockBuilder(AbstractConnection::class) |
||
35 | ->disableOriginalConstructor() |
||
36 | ->getMockForAbstractClass(); |
||
37 | $serviceManager->setService('rabbitmq_module.connection.foo', $connection); |
||
38 | |||
39 | /** @var RpcClient $service */ |
||
40 | $service = $factory($serviceManager, 'temp'); |
||
41 | |||
42 | static::assertInstanceOf(RpcClient::class, $service); |
||
43 | static::assertInstanceOf(AdapterInterface::class, $service->getSerializer()); |
||
44 | } |
||
45 | } |
||
46 |