|
30 | 30 | use Symfony\Component\DependencyInjection\Loader\ClosureLoader;
|
31 | 31 | use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag;
|
32 | 32 | use Symfony\Component\DependencyInjection\Reference;
|
| 33 | +use Symfony\Component\DependencyInjection\TypedReference; |
33 | 34 | use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
34 | 35 | use Symfony\Component\PropertyAccess\PropertyAccessor;
|
35 | 36 | use Symfony\Component\Serializer\Mapping\Loader\AnnotationLoader;
|
|
42 | 43 | use Symfony\Component\Serializer\Normalizer\JsonSerializableNormalizer;
|
43 | 44 | use Symfony\Component\Translation\DependencyInjection\TranslatorPass;
|
44 | 45 | use Symfony\Component\Validator\DependencyInjection\AddConstraintValidatorsPass;
|
| 46 | +use Symfony\Component\Worker\Loop\Loop; |
45 | 47 |
|
46 | 48 | abstract class FrameworkExtensionTest extends TestCase
|
47 | 49 | {
|
@@ -981,6 +983,7 @@ public function testAmqpEmpty()
|
981 | 983 |
|
982 | 984 | $this->assertTrue($container->hasAlias('amqp.broker'));
|
983 | 985 | $this->assertSame('amqp.broker.default', (string) $container->getAlias('amqp.broker'));
|
| 986 | + $this->assertEquals(new Reference('amqp.broker'), $container->getDefinition('amqp.command.move')->getArgument(0)); |
984 | 987 | }
|
985 | 988 |
|
986 | 989 | public function testAmqpFull()
|
@@ -1034,11 +1037,14 @@ public function testAmqpFull()
|
1034 | 1037 |
|
1035 | 1038 | $this->assertTrue($container->hasAlias('amqp.broker'));
|
1036 | 1039 | $this->assertSame('amqp.broker.queue_prod', (string) $container->getAlias('amqp.broker'));
|
| 1040 | + $this->assertEquals(new Reference('amqp.broker'), $container->getDefinition('amqp.command.move')->getArgument(0)); |
1037 | 1041 | }
|
1038 | 1042 |
|
1039 | 1043 | public function testWorkerEmpty()
|
1040 | 1044 | {
|
1041 | 1045 | $container = $this->createContainerFromFile('worker_empty');
|
| 1046 | + |
| 1047 | + $this->assertSame(array(), $container->getDefinition('worker.command.list')->getArgument(0)); |
1042 | 1048 | }
|
1043 | 1049 |
|
1044 | 1050 | public function testWorkerFull()
|
@@ -1134,6 +1140,17 @@ public function testWorkerFull()
|
1134 | 1140 | $this->assertInstanceOf(Reference::class, $worker->getArgument(2));
|
1135 | 1141 | $this->assertSame('logger', (string) $worker->getArgument(2));
|
1136 | 1142 | $this->assertSame('worker_service_a', $worker->getArgument(3));
|
| 1143 | + $workerLocator = $container->getDefinition('worker.worker_locator'); |
| 1144 | + $this->assertEquals(array('worker_d' => new TypedReference('worker.worker.worker_d', Loop::class), 'worker_service_a' => new TypedReference('worker.worker.worker_service_a', Loop::class)), $workerLocator->getArgument(0)); |
| 1145 | + |
| 1146 | + /* worker:list command */ |
| 1147 | + $this->assertSame(array('worker_d', 'worker_service_a'), $container->getDefinition('worker.command.list')->getArgument(0)); |
| 1148 | + |
| 1149 | + /* worker:run command */ |
| 1150 | + $workerRunCommand = $container->getDefinition('worker.command.run'); |
| 1151 | + $this->assertEquals(new Reference('worker.worker_locator'), $workerRunCommand->getArgument(0)); |
| 1152 | + $this->assertEquals('foobar', $workerRunCommand->getArgument(1), 'worker:run expects the "worker.cli_title_prefix" config value as 2nd argument'); |
| 1153 | + $this->assertSame(array('worker_d', 'worker_service_a'), $workerRunCommand->getArgument(2)); |
1137 | 1154 | }
|
1138 | 1155 |
|
1139 | 1156 | protected function createContainer(array $data = array())
|
|
0 commit comments