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

Commit d8fab30

Browse files
committed
Merge branch 'hotfix/43' into develop
Forward port #44
2 parents d0c0ca5 + 86741bd commit d8fab30

File tree

3 files changed

+35
-6
lines changed

3 files changed

+35
-6
lines changed

CHANGELOG.md

+4-2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ All notable changes to this project will be documented in this file, in reverse
2020

2121
- Nothing.
2222

23-
## 2.6.1 - TBD
23+
## 2.6.1 - 2016-02-18
2424

2525
### Added
2626

@@ -36,7 +36,9 @@ All notable changes to this project will be documented in this file, in reverse
3636

3737
### Fixed
3838

39-
- Nothing.
39+
- [#44](https://github.com/zendframework/zend-view/pull/44) fixes the
40+
constructor of `HelperPluginManager` to ensure it is backwards compatible
41+
with zend-servicemanager v2.
4042

4143
## 2.6.0 - 2016-02-17
4244

src/HelperPluginManager.php

+5-4
Original file line numberDiff line numberDiff line change
@@ -235,15 +235,16 @@ class HelperPluginManager extends AbstractPluginManager
235235
* Adds initializers to inject the attached renderer and translator, if
236236
* any, to the currently requested helper.
237237
*
238-
* @param ContainerInterface $container
239-
* @param array $config
238+
* @param null|ConfigInterface|ContainerInterface $configOrContainerInstance
239+
* @param array $v3config If $configOrContainerInstance is a container, this
240+
* value will be passed to the parent constructor.
240241
*/
241-
public function __construct(ContainerInterface $container, array $config = [])
242+
public function __construct($configOrContainerInstance = null, array $v3config = [])
242243
{
243244
$this->initializers[] = [$this, 'injectRenderer'];
244245
$this->initializers[] = [$this, 'injectTranslator'];
245246

246-
parent::__construct($container, $config);
247+
parent::__construct($configOrContainerInstance, $v3config);
247248
}
248249

249250
/**

test/HelperPluginManagerTest.php

+26
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,32 @@ public function setUp()
3030
$this->helpers = new HelperPluginManager(new ServiceManager());
3131
}
3232

33+
/**
34+
* @group 43
35+
*/
36+
public function testConstructorArgumentsAreOptionalUnderV2()
37+
{
38+
if (method_exists($this->helpers, 'configure')) {
39+
$this->markTestSkipped('zend-servicemanager v3 plugin managers require a container argument');
40+
}
41+
42+
$helpers = new HelperPluginManager();
43+
$this->assertInstanceOf(HelperPluginManager::class, $helpers);
44+
}
45+
46+
/**
47+
* @group 43
48+
*/
49+
public function testConstructorAllowsConfigInstanceAsFirstArgumentUnderV2()
50+
{
51+
if (method_exists($this->helpers, 'configure')) {
52+
$this->markTestSkipped('zend-servicemanager v3 plugin managers require a container argument');
53+
}
54+
55+
$helpers = new HelperPluginManager(new Config([]));
56+
$this->assertInstanceOf(HelperPluginManager::class, $helpers);
57+
}
58+
3359
public function testViewIsNullByDefault()
3460
{
3561
$this->assertNull($this->helpers->getRenderer());

0 commit comments

Comments
 (0)