Skip to content

Commit d30effc

Browse files
committed
Merge branch '2.0'
2 parents d65c84b + 38748ef commit d30effc

File tree

3 files changed

+20
-9
lines changed

3 files changed

+20
-9
lines changed

appveyor.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
build: false
22
platform: x86
3-
clone_folder: c:\projects\dunglas\api-bundle
3+
clone_folder: c:\projects\api-platform\core
44

55
cache:
66
- '%LOCALAPPDATA%\Composer\files'
77

88
init:
9-
- SET PATH=c:\tools\php;%PATH%
9+
- SET PATH=c:\tools\php71;%PATH%
1010

1111
install:
12-
- cinst -y php -i
13-
- cd c:\tools\php
12+
- ps: Set-Service wuauserv -StartupType Manual
13+
- cinst -y php
14+
- cd c:\tools\php71
1415
- copy php.ini-production php.ini /Y
1516
- echo date.timezone="UTC" >> php.ini
1617
- echo extension_dir=ext >> php.ini

src/Bridge/Symfony/Bundle/DependencyInjection/ApiPlatformExtension.php

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,11 +38,21 @@ public function prepend(ContainerBuilder $container)
3838
return;
3939
}
4040

41-
if (!isset($frameworkConfiguration['serializer'], $frameworkConfiguration['serializer']['enabled'])) {
41+
foreach ($frameworkConfiguration as $frameworkParameters) {
42+
if (isset($frameworkParameters['serializer'])) {
43+
$serializerConfig = $serializerConfig ?? $frameworkParameters['serializer'];
44+
}
45+
46+
if (isset($frameworkParameters['property_info'])) {
47+
$propertyInfoConfig = $propertyInfoConfig ?? $frameworkParameters['property_info'];
48+
}
49+
}
50+
51+
if (!isset($serializerConfig['enabled'])) {
4252
$container->prependExtensionConfig('framework', ['serializer' => ['enabled' => true]]);
4353
}
4454

45-
if (!isset($frameworkConfiguration['property_info'], $frameworkConfiguration['property_info']['enabled'])) {
55+
if (!isset($propertyInfoConfig['enabled'])) {
4656
$container->prependExtensionConfig('framework', ['property_info' => ['enabled' => true]]);
4757
}
4858
}

tests/Bridge/Symfony/Bundle/DependencyInjection/ApiPlatformExtensionTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ public function testNotPrependWhenNull()
7676
public function testNotPrependSerializerWhenConfigExist()
7777
{
7878
$containerBuilderProphecy = $this->prophesize(ContainerBuilder::class);
79-
$containerBuilderProphecy->getExtensionConfig('framework')->willReturn(['serializer' => ['enabled' => false]])->shouldBeCalled();
79+
$containerBuilderProphecy->getExtensionConfig('framework')->willReturn([0 => ['serializer' => ['enabled' => false]]])->shouldBeCalled();
8080
$containerBuilderProphecy->prependExtensionConfig('framework', Argument::any())->willReturn(null)->shouldBeCalled();
8181
$containerBuilderProphecy->prependExtensionConfig('framework', Argument::that(function (array $config) {
8282
return array_key_exists('serializer', $config);
@@ -89,7 +89,7 @@ public function testNotPrependSerializerWhenConfigExist()
8989
public function testNotPrependPropertyInfoWhenConfigExist()
9090
{
9191
$containerBuilderProphecy = $this->prophesize(ContainerBuilder::class);
92-
$containerBuilderProphecy->getExtensionConfig('framework')->willReturn(['property_info' => ['enabled' => false]])->shouldBeCalled();
92+
$containerBuilderProphecy->getExtensionConfig('framework')->willReturn([0 => ['property_info' => ['enabled' => false]]])->shouldBeCalled();
9393
$containerBuilderProphecy->prependExtensionConfig('framework', Argument::any())->willReturn(null)->shouldBeCalled();
9494
$containerBuilderProphecy->prependExtensionConfig('framework', Argument::that(function (array $config) {
9595
return array_key_exists('property_info', $config);
@@ -112,7 +112,7 @@ public function testPrependWhenNotConfigured()
112112
public function testPrependWhenNotEnabled()
113113
{
114114
$containerBuilderProphecy = $this->prophesize(ContainerBuilder::class);
115-
$containerBuilderProphecy->getExtensionConfig('framework')->willReturn(['serializer' => []])->shouldBeCalled();
115+
$containerBuilderProphecy->getExtensionConfig('framework')->willReturn([0 => ['serializer' => []]])->shouldBeCalled();
116116
$containerBuilderProphecy->prependExtensionConfig('framework', Argument::type('array'))->shouldBeCalled();
117117
$containerBuilder = $containerBuilderProphecy->reveal();
118118

0 commit comments

Comments
 (0)