Skip to content

Commit 0354379

Browse files
soyukaalanpoulain
authored andcommitted
Fix inexistant parameter when graphql is disabled (#3057)
1 parent 32a2f62 commit 0354379

File tree

2 files changed

+2
-3
lines changed

2 files changed

+2
-3
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -377,13 +377,13 @@ private function registerGraphQlConfiguration(ContainerBuilder $container, array
377377
$container->setParameter('api_platform.graphql.enabled', $enabled);
378378
$container->setParameter('api_platform.graphql.graphiql.enabled', $enabled && $this->isConfigEnabled($container, $config['graphql']['graphiql']));
379379
$container->setParameter('api_platform.graphql.graphql_playground.enabled', $enabled && $this->isConfigEnabled($container, $config['graphql']['graphql_playground']));
380+
$container->setParameter('api_platform.graphql.collection.pagination', $config['graphql']['collection']['pagination']);
380381

381382
if (!$enabled) {
382383
return;
383384
}
384385

385386
$container->setParameter('api_platform.graphql.default_ide', $config['graphql']['default_ide']);
386-
$container->setParameter('api_platform.graphql.collection.pagination', $config['graphql']['collection']['pagination']);
387387

388388
$loader->load('graphql.xml');
389389

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

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -366,8 +366,7 @@ public function testDisableGraphQl()
366366
$containerBuilderProphecy->setParameter('api_platform.graphql.enabled', false)->shouldBeCalled();
367367
$containerBuilderProphecy->setParameter('api_platform.graphql.default_ide', 'graphiql')->shouldNotBeCalled();
368368
$containerBuilderProphecy->setParameter('api_platform.graphql.default_ide', Argument::any())->shouldNotBeCalled();
369-
$containerBuilderProphecy->setParameter('api_platform.graphql.collection.pagination', ['enabled' => true])->shouldNotBeCalled();
370-
$containerBuilderProphecy->setParameter('api_platform.graphql.collection.pagination', Argument::any())->shouldNotBeCalled();
369+
$containerBuilderProphecy->setParameter('api_platform.graphql.collection.pagination', ['enabled' => true])->shouldBeCalled();
371370
$containerBuilderProphecy->setParameter('api_platform.graphql.graphiql.enabled', true)->shouldNotBeCalled();
372371
$containerBuilderProphecy->setParameter('api_platform.graphql.graphiql.enabled', false)->shouldBeCalled();
373372
$containerBuilderProphecy->setParameter('api_platform.graphql.graphql_playground.enabled', true)->shouldNotBeCalled();

0 commit comments

Comments
 (0)