From dc6b7465d4d0635f756760d579213fe8da759ada Mon Sep 17 00:00:00 2001 From: Zowac Date: Mon, 19 Aug 2019 14:43:15 +0200 Subject: [PATCH] Fix : Throw a better message if http-client is not installed --- .../Bundle/DependencyInjection/ApiPlatformExtension.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Bridge/Symfony/Bundle/DependencyInjection/ApiPlatformExtension.php b/src/Bridge/Symfony/Bundle/DependencyInjection/ApiPlatformExtension.php index 6f73c4cb259..bcb832e39b5 100644 --- a/src/Bridge/Symfony/Bundle/DependencyInjection/ApiPlatformExtension.php +++ b/src/Bridge/Symfony/Bundle/DependencyInjection/ApiPlatformExtension.php @@ -46,6 +46,7 @@ use Symfony\Component\DependencyInjection\Loader\XmlFileLoader; use Symfony\Component\DependencyInjection\Reference; use Symfony\Component\Finder\Finder; +use Symfony\Component\HttpClient\HttpClient; use Symfony\Component\HttpKernel\DependencyInjection\Extension; use Symfony\Component\Validator\Validator\ValidatorInterface; use Symfony\Component\Yaml\Yaml; @@ -129,6 +130,10 @@ public function load(array $configs, ContainerBuilder $container): void ->addTag('api_platform.filter'); if ($container->hasParameter('test.client.parameters') && class_exists(AbstractBrowser::class)) { + if (!class_exists(HttpClient::class)) { + throw new RuntimeException('Run "composer require --dev symfony/http-client" to use the test client"'); + } + $loader->load('test.xml'); } }