diff --git a/DependencyInjection/HttplugExtension.php b/DependencyInjection/HttplugExtension.php index e8afe492..1a010185 100644 --- a/DependencyInjection/HttplugExtension.php +++ b/DependencyInjection/HttplugExtension.php @@ -14,6 +14,7 @@ use Http\Message\Authentication\Wsse; use Psr\Http\Message\UriInterface; use Symfony\Component\Config\FileLocator; +use Symfony\Component\DependencyInjection\Alias; use Symfony\Component\DependencyInjection\ChildDefinition; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Definition; @@ -50,7 +51,7 @@ public function load(array $configs, ContainerBuilder $container) // Set main aliases foreach ($config['main_alias'] as $type => $id) { - $container->setAlias(sprintf('httplug.%s', $type), $id); + $container->setAlias(sprintf('httplug.%s', $type), new Alias($id, true)); } // Configure toolbar @@ -103,7 +104,7 @@ private function configureClients(ContainerBuilder $container, array $config) // If we do not have a client named 'default' if (!isset($config['clients']['default'])) { // Alias the first client to httplug.client.default - $container->setAlias('httplug.client.default', 'httplug.client.'.$first); + $container->setAlias('httplug.client.default', new Alias('httplug.client.'.$first, true)); } } } @@ -297,6 +298,7 @@ private function configureClient(ContainerBuilder $container, $clientName, array $container ->register($serviceId, PluginClient::class) + ->setPublic(true) ->setFactory([new Reference(PluginClientFactory::class), 'createClient']) ->addArgument(new Reference($serviceId.'.client')) ->addArgument( diff --git a/Resources/config/services.xml b/Resources/config/services.xml index 194921b8..89738ab3 100644 --- a/Resources/config/services.xml +++ b/Resources/config/services.xml @@ -4,44 +4,44 @@ xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd"> - + - + - + - + - + - + - + - + diff --git a/Tests/Resources/app/config/config_test.yml b/Tests/Resources/app/config/config_test.yml index 52288d6f..599b062a 100644 --- a/Tests/Resources/app/config/config_test.yml +++ b/Tests/Resources/app/config/config_test.yml @@ -26,3 +26,6 @@ httplug: services: app.http.plugin.custom: class: Http\Client\Common\Plugin\RedirectPlugin + public: true + # plugin services usually do not need to be public. + # this one is made public so that we can do functional tests on the service diff --git a/composer.json b/composer.json index 887d7365..d34deb7c 100644 --- a/composer.json +++ b/composer.json @@ -23,14 +23,14 @@ "php-http/cache-plugin": "^1.4", "php-http/logger-plugin": "^1.0", "php-http/stopwatch-plugin": "^1.0", - "symfony/options-resolver": "^2.8 || ^3.0", - "symfony/event-dispatcher": "^2.8 || ^3.0", - "symfony/framework-bundle": "^2.8 || ^3.0", + "symfony/options-resolver": "^2.8 || ^3.0 || ^4.0", + "symfony/event-dispatcher": "^2.8 || ^3.0 || ^4.0", + "symfony/framework-bundle": "^2.8 || ^3.0 || ^4.0", "php-http/message": "^1.4", "php-http/discovery": "^1.0", "twig/twig": "^1.18 || ^2.0", - "symfony/asset": "^2.8 || ^3.0", - "symfony/dependency-injection": "^2.8.3 || ^3.0.3" + "symfony/asset": "^2.8 || ^3.0 || ^4.0", + "symfony/dependency-injection": "^2.8.3 || ^3.0.3 || ^4.0" }, "require-dev": { "phpunit/php-token-stream": "^1.1.8", @@ -41,13 +41,13 @@ "php-http/buzz-adapter": "^0.3", "php-http/mock-client": "^1.0", "symfony/phpunit-bridge": "^3.3 || ^4.0", - "symfony/twig-bundle": "^2.8 || ^3.0", - "symfony/twig-bridge": "^2.8 || ^3.0", - "symfony/web-profiler-bundle": "^2.8 || ^3.0", - "symfony/finder": "^2.7 || ^3.0", - "symfony/cache": "^3.1", - "symfony/browser-kit": "^2.8 || ^3.0", - "symfony/dom-crawler": "^2.8 || ^3.0", + "symfony/twig-bundle": "^2.8 || ^3.0 || ^4.0", + "symfony/twig-bridge": "^2.8 || ^3.0 || ^4.0", + "symfony/web-profiler-bundle": "^2.8 || ^3.0 || ^4.0", + "symfony/finder": "^2.7 || ^3.0 || ^4.0", + "symfony/cache": "^3.1 || ^4.0", + "symfony/browser-kit": "^2.8 || ^3.0 || ^4.0", + "symfony/dom-crawler": "^2.8 || ^3.0 || ^4.0", "polishsymfonycommunity/symfony-mocker-container": "^1.0", "matthiasnoback/symfony-dependency-injection-test": "^1.1 || ^2.0", "nyholm/nsa": "^1.1"