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

Commit c11d189

Browse files
committed
Fixed failing tests and incorrect factories
- Because we register services under both the names 'application' and 'Application' normally, we need to do both in tests as well. - The various factories in ViewHelperManagerFactory were incorrect; `$services` as passed to each is guaranteed to be the application service manager instance, so the conditionals that were pulling the parent were unnecessary.
1 parent b8bf785 commit c11d189

File tree

2 files changed

+1
-15
lines changed

2 files changed

+1
-15
lines changed

src/Service/ViewHelperManagerFactory.php

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -129,11 +129,6 @@ private function injectOverrideFactories(HelperPluginManager $plugins, Container
129129
private function createUrlHelperFactory(ContainerInterface $services)
130130
{
131131
return function () use ($services) {
132-
// zend-servicemanager v2: fetch parent locator
133-
if (method_exists($services, 'getServiceLocator') && ! method_exists($services, 'configure')) {
134-
$services = $services->getServiceLocator() ?: $services;
135-
}
136-
137132
$helper = new ViewHelper\Url;
138133
$router = Console::isConsole() ? 'HttpRouter' : 'Router';
139134
$helper->setRouter($services->get($router));
@@ -162,11 +157,6 @@ private function createUrlHelperFactory(ContainerInterface $services)
162157
private function createBasePathHelperFactory(ContainerInterface $services)
163158
{
164159
return function () use ($services) {
165-
// zend-servicemanager v2: fetch parent locator
166-
if (method_exists($services, 'getServiceLocator') && ! method_exists($services, 'configure')) {
167-
$services = $services->getServiceLocator() ?: $services;
168-
}
169-
170160
$config = $services->has('config') ? $services->get('config') : [];
171161
$helper = new ViewHelper\BasePath;
172162

@@ -204,11 +194,6 @@ private function createBasePathHelperFactory(ContainerInterface $services)
204194
private function createDoctypeHelperFactory(ContainerInterface $services)
205195
{
206196
return function () use ($services) {
207-
// zend-servicemanager v2: fetch parent locator
208-
if (method_exists($services, 'getServiceLocator') && ! method_exists($services, 'configure')) {
209-
$services = $services->getServiceLocator() ?: $services;
210-
}
211-
212197
$config = $services->has('config') ? $services->get('config') : [];
213198
$config = isset($config['view_manager']) ? $config['view_manager'] : [];
214199
$helper = new ViewHelper\Doctype;

test/Service/ViewHelperManagerFactoryTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ public function testUrlHelperFactoryCanBeInvokedViaShortNameOrFullClassName($nam
124124
$this->services->setService('HttpRouter', $router);
125125
$this->services->setService('Router', $router);
126126
$this->services->setService('application', $application->reveal());
127+
$this->services->setService('Application', $application->reveal());
127128
$this->services->setService('config', []);
128129

129130
$manager = $this->factory->createService($this->services);

0 commit comments

Comments
 (0)