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

Commit 575e285

Browse files
committed
Merge branch 'hotfix/43'
Close #44 Fixes #43
2 parents 364ce6d + 86741bd commit 575e285

File tree

3 files changed

+35
-6
lines changed

3 files changed

+35
-6
lines changed

CHANGELOG.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
All notable changes to this project will be documented in this file, in reverse chronological order by release.
44

5-
## 2.6.1 - TBD
5+
## 2.6.1 - 2016-02-18
66

77
### Added
88

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

1919
### Fixed
2020

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

2325
## 2.6.0 - 2016-02-17
2426

src/HelperPluginManager.php

Lines changed: 5 additions & 4 deletions
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

Lines changed: 26 additions & 0 deletions
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)