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

Commit

Permalink
Adjust to latest ServiceManager changes
Browse files Browse the repository at this point in the history
  • Loading branch information
mtymek committed Dec 2, 2015
1 parent 019b92c commit 37385bd
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 17 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"zendframework/zend-servicemanager": "dev-develop as 2.6.0",
"zendframework/zend-hydrator": "~1.0",
"zendframework/zend-form": "~2.6",
"zendframework/zend-stdlib": "~2.7",
"zendframework/zend-stdlib": "dev-develop as 2.8.0",
"zendframework/zend-psr7bridge": "^0.2",
"container-interop/container-interop": "^1.1"
},
Expand Down
4 changes: 2 additions & 2 deletions src/Router/RoutePluginManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public function __construct(ContainerInterface $container, array $config = [])
* before passing to the parent.
*
* @param array $config
* @return void
* @return self
*/
public function configure(array $config)
{
Expand All @@ -86,7 +86,7 @@ public function configure(array $config)
unset($config['invokables']);
}

parent::configure($config);
return parent::configure($config);
}

/**
Expand Down
9 changes: 5 additions & 4 deletions test/ApplicationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,7 @@ public function testBootstrapRegistersConfiguredMvcEvent()

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

Expand All @@ -257,7 +258,7 @@ public function setupPathController($addService = true)
],
]);
$router->addRoute('path', $route);
$services = $this->serviceManager->withConfig([
$services = $this->serviceManager->configure([
'aliases' => [
'Router' => 'HttpRouter',
],
Expand All @@ -268,7 +269,7 @@ public function setupPathController($addService = true)

$application = $this->setApplicationServiceManager($this->application, $services);
if ($addService) {
$services = $services->withConfig(['factories' => [
$services = $services->configure(['factories' => [
'ControllerManager' => function ($services) {
return new ControllerManager($services, ['factories' => [
'path' => function () {
Expand Down Expand Up @@ -299,7 +300,7 @@ public function setupActionController()
]);
$router->addRoute('sample', $route);

$services = $this->serviceManager->withConfig(['factories' => [
$services = $this->serviceManager->configure(['factories' => [
'ControllerManager' => function ($services) {
return new ControllerManager($services, ['factories' => [
'sample' => function () {
Expand Down Expand Up @@ -331,7 +332,7 @@ public function setupBadController($addService = true)

$application = $this->application;
if ($addService) {
$services = $this->serviceManager->withConfig(['factories' => [
$services = $this->serviceManager->configure(['factories' => [
'ControllerManager' => function ($services) {
return new ControllerManager($services, ['factories' => [
'bad' => function () {
Expand Down
2 changes: 1 addition & 1 deletion test/Controller/Plugin/ForwardTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ public function testPluginWithoutControllerLocatorRaisesServiceNotCreatedExcepti

public function testDispatchRaisesDomainExceptionIfDiscoveredControllerIsNotDispatchable()
{
$controllers = $this->controllers->withConfig(['factories' => [
$controllers = $this->controllers->configure(['factories' => [
'bogus' => function () {
return new stdClass;
},
Expand Down
7 changes: 4 additions & 3 deletions test/Service/ControllerManagerFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public function testCannotLoadControllerFromPeer()
public function testControllerLoadedCanBeInjectedWithValuesFromPeer()
{
$loader = $this->services->get('ControllerManager');
$loader = $loader->withConfig(['invokables' => [
$loader = $loader->configure(['invokables' => [
'ZendTest\Dispatchable' => TestAsset\Dispatchable::class,
]]);

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

public function testCallPluginWithControllerPluginManager()
{
$this->services->setAllowOverride(true);
$controllerPluginManager = $this->services->get('ControllerPluginManager');
$controllerPluginManager = $controllerPluginManager->withConfig([
$controllerPluginManager = $controllerPluginManager->configure([
'invokables' => [
'samplePlugin' => 'ZendTest\Mvc\Controller\Plugin\TestAsset\SamplePlugin',
],
Expand All @@ -101,7 +102,7 @@ public function testCallPluginWithControllerPluginManager()
$controller = new \ZendTest\Mvc\Controller\TestAsset\SampleController;
$controllerPluginManager->setController($controller);

$services = $this->services->withConfig(['services' => [
$services = $this->services->configure(['services' => [
'ControllerPluginManager' => $controllerPluginManager,
]]);

Expand Down
2 changes: 1 addition & 1 deletion test/Service/ServiceManagerConfigTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public function testEventManagerAwareInterfaceIsNotInjectedIfPresentButSharedMan
$events = new EventManager($this->services->get('SharedEventManager'));
TestAsset\EventManagerAwareObject::$defaultEvents = $events;

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

Expand Down
6 changes: 3 additions & 3 deletions test/Service/ViewHelperManagerFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public function emptyConfiguration()
*/
public function testDoctypeFactoryDoesNotRaiseErrorOnMissingConfiguration($config)
{
$services = $this->services->withConfig(['services' => [
$services = $this->services->configure(['services' => [
'config' => $config,
]]);
$manager = $this->factory->__invoke($services, 'ViewHelperManager');
Expand All @@ -60,7 +60,7 @@ public function testDoctypeFactoryDoesNotRaiseErrorOnMissingConfiguration($confi

public function testConsoleRequestsResultInSilentFailure()
{
$services = $this->services->withConfig(['services' => [
$services = $this->services->configure(['services' => [
'config' => [],
'Request' => new ConsoleRequest(),
]]);
Expand Down Expand Up @@ -88,7 +88,7 @@ public function testConsoleRequestWithBasePathConsole()
$this->markTestSkipped('Cannot force console context; skipping test');
}

$services = $this->services->withConfig(['services' => [
$services = $this->services->configure(['services' => [
'config' => [
'view_manager' => [
'base_path_console' => 'http://test.com',
Expand Down
4 changes: 2 additions & 2 deletions test/View/Console/ViewManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ public function testConsoleKeyWillOverrideDisplayExceptionAndExceptionMessage($c
$request = new ConsoleRequest();
$response = new ConsoleResponse();

$services = $this->services->withConfig(['services' => [
$services = $this->services->configure(['services' => [
'config' => $config,
'Request' => $request,
'EventManager' => $eventManager,
Expand Down Expand Up @@ -152,7 +152,7 @@ public function testConsoleDisplayExceptionIsTrue()
$request = new ConsoleRequest();
$response = new ConsoleResponse();

$services = $this->services->withConfig([
$services = $this->services->configure([
'services' => [
'config' => [],
'Request' => $request,
Expand Down

0 comments on commit 37385bd

Please sign in to comment.