Skip to content
This repository was archived by the owner on Jan 29, 2020. It is now read-only.

Commit 96d5f26

Browse files
committed
Re-introduce 'ServiceManager' factory
Returns provided container on invocation. Added to remove a BC break.
1 parent d4661db commit 96d5f26

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

src/Service/ServiceManagerConfig.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,10 @@ class ServiceManagerConfig extends Config
7676
*/
7777
public function __construct(array $config = [])
7878
{
79+
$this->config['factories']['ServiceManager'] = function ($container) {
80+
return $container;
81+
};
82+
7983
$this->config['factories']['SharedEventManager'] = function () {
8084
return new SharedEventManager();
8185
};

test/Service/ServiceManagerConfigTest.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,4 +212,17 @@ public function testEventManagerInitializerCanBeReplaced()
212212

213213
$serviceManager->get('EventManagerAware');
214214
}
215+
216+
/**
217+
* @group 101
218+
*/
219+
public function testCreatesAFactoryForTheServiceManagerThatReturnsIt()
220+
{
221+
$serviceManager = new ServiceManager();
222+
$config = new ServiceManagerConfig();
223+
$config->configureServiceManager($serviceManager);
224+
225+
$this->assertTrue($serviceManager->has('ServiceManager'), 'Missing ServiceManager service!');
226+
$this->assertSame($serviceManager, $serviceManager->get('ServiceManager'));
227+
}
215228
}

0 commit comments

Comments
 (0)