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

Commit 37385bd

Browse files
committed
Adjust to latest ServiceManager changes
1 parent 019b92c commit 37385bd

File tree

8 files changed

+19
-17
lines changed

8 files changed

+19
-17
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
"zendframework/zend-servicemanager": "dev-develop as 2.6.0",
1919
"zendframework/zend-hydrator": "~1.0",
2020
"zendframework/zend-form": "~2.6",
21-
"zendframework/zend-stdlib": "~2.7",
21+
"zendframework/zend-stdlib": "dev-develop as 2.8.0",
2222
"zendframework/zend-psr7bridge": "^0.2",
2323
"container-interop/container-interop": "^1.1"
2424
},

src/Router/RoutePluginManager.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public function __construct(ContainerInterface $container, array $config = [])
6565
* before passing to the parent.
6666
*
6767
* @param array $config
68-
* @return void
68+
* @return self
6969
*/
7070
public function configure(array $config)
7171
{
@@ -86,7 +86,7 @@ public function configure(array $config)
8686
unset($config['invokables']);
8787
}
8888

89-
parent::configure($config);
89+
return parent::configure($config);
9090
}
9191

9292
/**

test/ApplicationTest.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,7 @@ public function testBootstrapRegistersConfiguredMvcEvent()
246246

247247
public function setupPathController($addService = true)
248248
{
249+
$this->serviceManager->setAllowOverride(true);
249250
$request = $this->serviceManager->get('Request');
250251
$request->setUri('http://example.local/path');
251252

@@ -257,7 +258,7 @@ public function setupPathController($addService = true)
257258
],
258259
]);
259260
$router->addRoute('path', $route);
260-
$services = $this->serviceManager->withConfig([
261+
$services = $this->serviceManager->configure([
261262
'aliases' => [
262263
'Router' => 'HttpRouter',
263264
],
@@ -268,7 +269,7 @@ public function setupPathController($addService = true)
268269

269270
$application = $this->setApplicationServiceManager($this->application, $services);
270271
if ($addService) {
271-
$services = $services->withConfig(['factories' => [
272+
$services = $services->configure(['factories' => [
272273
'ControllerManager' => function ($services) {
273274
return new ControllerManager($services, ['factories' => [
274275
'path' => function () {
@@ -299,7 +300,7 @@ public function setupActionController()
299300
]);
300301
$router->addRoute('sample', $route);
301302

302-
$services = $this->serviceManager->withConfig(['factories' => [
303+
$services = $this->serviceManager->configure(['factories' => [
303304
'ControllerManager' => function ($services) {
304305
return new ControllerManager($services, ['factories' => [
305306
'sample' => function () {
@@ -331,7 +332,7 @@ public function setupBadController($addService = true)
331332

332333
$application = $this->application;
333334
if ($addService) {
334-
$services = $this->serviceManager->withConfig(['factories' => [
335+
$services = $this->serviceManager->configure(['factories' => [
335336
'ControllerManager' => function ($services) {
336337
return new ControllerManager($services, ['factories' => [
337338
'bad' => function () {

test/Controller/Plugin/ForwardTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ public function testPluginWithoutControllerLocatorRaisesServiceNotCreatedExcepti
120120

121121
public function testDispatchRaisesDomainExceptionIfDiscoveredControllerIsNotDispatchable()
122122
{
123-
$controllers = $this->controllers->withConfig(['factories' => [
123+
$controllers = $this->controllers->configure(['factories' => [
124124
'bogus' => function () {
125125
return new stdClass;
126126
},

test/Service/ControllerManagerFactoryTest.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ public function testCannotLoadControllerFromPeer()
7979
public function testControllerLoadedCanBeInjectedWithValuesFromPeer()
8080
{
8181
$loader = $this->services->get('ControllerManager');
82-
$loader = $loader->withConfig(['invokables' => [
82+
$loader = $loader->configure(['invokables' => [
8383
'ZendTest\Dispatchable' => TestAsset\Dispatchable::class,
8484
]]);
8585

@@ -91,8 +91,9 @@ public function testControllerLoadedCanBeInjectedWithValuesFromPeer()
9191

9292
public function testCallPluginWithControllerPluginManager()
9393
{
94+
$this->services->setAllowOverride(true);
9495
$controllerPluginManager = $this->services->get('ControllerPluginManager');
95-
$controllerPluginManager = $controllerPluginManager->withConfig([
96+
$controllerPluginManager = $controllerPluginManager->configure([
9697
'invokables' => [
9798
'samplePlugin' => 'ZendTest\Mvc\Controller\Plugin\TestAsset\SamplePlugin',
9899
],
@@ -101,7 +102,7 @@ public function testCallPluginWithControllerPluginManager()
101102
$controller = new \ZendTest\Mvc\Controller\TestAsset\SampleController;
102103
$controllerPluginManager->setController($controller);
103104

104-
$services = $this->services->withConfig(['services' => [
105+
$services = $this->services->configure(['services' => [
105106
'ControllerPluginManager' => $controllerPluginManager,
106107
]]);
107108

test/Service/ServiceManagerConfigTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public function testEventManagerAwareInterfaceIsNotInjectedIfPresentButSharedMan
4848
$events = new EventManager($this->services->get('SharedEventManager'));
4949
TestAsset\EventManagerAwareObject::$defaultEvents = $events;
5050

51-
$services = $this->services->withConfig(['invokables' => [
51+
$services = $this->services->configure(['invokables' => [
5252
'EventManagerAwareObject' => TestAsset\EventManagerAwareObject::class,
5353
]]);
5454

test/Service/ViewHelperManagerFactoryTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public function emptyConfiguration()
4949
*/
5050
public function testDoctypeFactoryDoesNotRaiseErrorOnMissingConfiguration($config)
5151
{
52-
$services = $this->services->withConfig(['services' => [
52+
$services = $this->services->configure(['services' => [
5353
'config' => $config,
5454
]]);
5555
$manager = $this->factory->__invoke($services, 'ViewHelperManager');
@@ -60,7 +60,7 @@ public function testDoctypeFactoryDoesNotRaiseErrorOnMissingConfiguration($confi
6060

6161
public function testConsoleRequestsResultInSilentFailure()
6262
{
63-
$services = $this->services->withConfig(['services' => [
63+
$services = $this->services->configure(['services' => [
6464
'config' => [],
6565
'Request' => new ConsoleRequest(),
6666
]]);
@@ -88,7 +88,7 @@ public function testConsoleRequestWithBasePathConsole()
8888
$this->markTestSkipped('Cannot force console context; skipping test');
8989
}
9090

91-
$services = $this->services->withConfig(['services' => [
91+
$services = $this->services->configure(['services' => [
9292
'config' => [
9393
'view_manager' => [
9494
'base_path_console' => 'http://test.com',

test/View/Console/ViewManagerTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ public function testConsoleKeyWillOverrideDisplayExceptionAndExceptionMessage($c
124124
$request = new ConsoleRequest();
125125
$response = new ConsoleResponse();
126126

127-
$services = $this->services->withConfig(['services' => [
127+
$services = $this->services->configure(['services' => [
128128
'config' => $config,
129129
'Request' => $request,
130130
'EventManager' => $eventManager,
@@ -152,7 +152,7 @@ public function testConsoleDisplayExceptionIsTrue()
152152
$request = new ConsoleRequest();
153153
$response = new ConsoleResponse();
154154

155-
$services = $this->services->withConfig([
155+
$services = $this->services->configure([
156156
'services' => [
157157
'config' => [],
158158
'Request' => $request,

0 commit comments

Comments
 (0)