| 1 | <?php |
||
| 20 | class TestContainerPass implements CompilerPassInterface |
||
| 21 | { |
||
| 22 | /** |
||
| 23 | * An array of service id's which should be public in a test scenario. |
||
| 24 | * |
||
| 25 | * @var array |
||
| 26 | */ |
||
| 27 | private $services = []; |
||
| 28 | |||
| 29 | public function __construct(array $services = []) |
||
| 30 | { |
||
| 31 | $this->services = $services; |
||
| 32 | } |
||
| 33 | |||
| 34 | public function process(ContainerBuilder $container) |
||
| 35 | { |
||
| 36 | foreach ($container->getDefinitions() as $id => $definition) { |
||
| 37 | if (in_array($id, $this->services, true)) { |
||
| 38 | $definition->setPublic(true); |
||
| 39 | } |
||
| 40 | } |
||
| 41 | } |
||
| 42 | } |
||
| 43 |