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

Commit 8b94517

Browse files
committed
Merge branch 'hotfix/612-config-injection-array-cast'
Close #612 Fixes #611
2 parents 99feabe + 2cc3f33 commit 8b94517

File tree

3 files changed

+33
-26
lines changed

3 files changed

+33
-26
lines changed

Diff for: CHANGELOG.md

+7-24
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-
## 3.1.0 - TBD
5+
## 3.0.2 - 2018-04-10
66

77
### Added
88

@@ -22,29 +22,12 @@ All notable changes to this project will be documented in this file, in reverse
2222

2323
### Fixed
2424

25-
- Nothing.
26-
27-
## 3.0.2 - TBD
28-
29-
### Added
30-
31-
- Nothing.
32-
33-
### Changed
34-
35-
- Nothing.
36-
37-
### Deprecated
38-
39-
- Nothing.
40-
41-
### Removed
42-
43-
- Nothing.
44-
45-
### Fixed
46-
47-
- Nothing.
25+
- [#612](https://github.com/zendframework/zend-expressive/pull/612) updates the
26+
`ApplicationConfigInjectionDelegator` delegator factory logic to cast the
27+
`$config` value to an array before passing it to its
28+
`injectPipelineFromConfig()` and `injectRoutesFromConfig()` methods, ensuring
29+
it will work correctly with containers that store the `config` service as an
30+
`ArrayObject` instead of an `array`.
4831

4932
## 3.0.1 - 2018-03-19
5033

Diff for: src/Container/ApplicationConfigInjectionDelegator.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ public function __invoke(ContainerInterface $container, string $serviceName, cal
5858
return $application;
5959
}
6060

61-
self::injectPipelineFromConfig($application, $config);
62-
self::injectRoutesFromConfig($application, $config);
61+
self::injectPipelineFromConfig($application, (array) $config);
62+
self::injectRoutesFromConfig($application, (array) $config);
6363

6464
return $application;
6565
}

Diff for: test/Container/ApplicationConfigInjectionDelegatorTest.php

+24
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
namespace ZendTest\Expressive\Container;
1111

12+
use ArrayObject;
1213
use PHPUnit\Framework\Assert;
1314
use PHPUnit\Framework\TestCase;
1415
use Prophecy\Prophecy\ObjectProphecy;
@@ -449,4 +450,27 @@ public function testInjectPipelineFromConfigRaisesExceptionForSpecsOmittingMiddl
449450
$this->expectExceptionMessage('Invalid pipeline specification received');
450451
ApplicationConfigInjectionDelegator::injectPipelineFromConfig($app, $config);
451452
}
453+
454+
public function testConfigCanBeArrayObject()
455+
{
456+
$config = new ArrayObject([
457+
'routes' => [
458+
'home' => [
459+
'name' => 'homepage',
460+
'path' => '/',
461+
'middleware' => new TestAsset\InteropMiddleware(),
462+
],
463+
],
464+
]);
465+
466+
$this->container->has('config')->willReturn(true);
467+
$this->container->get('config')->willReturn($config);
468+
469+
$delegator = new ApplicationConfigInjectionDelegator();
470+
$application = $delegator($this->container->reveal(), '', function () {
471+
return $this->createApplication();
472+
});
473+
474+
$this->assertCount(1, $application->getRoutes());
475+
}
452476
}

0 commit comments

Comments
 (0)