diff --git a/CHANGELOG.md b/CHANGELOG.md index 0e908090..73037511 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,13 @@ The change log describes what is "Added", "Removed", "Changed" or "Fixed" between each release. -## Unreleased +## 1.8.1 - 2017-12-06 + +### Fixed + +- `PluginClientFactory` name conflict with PHP 5.x. + +## 1.8.0 - 2017-11-30 ### Added diff --git a/Collector/PluginClientFactoryListener.php b/Collector/PluginClientFactoryListener.php index 6dbf3056..ce96301e 100644 --- a/Collector/PluginClientFactoryListener.php +++ b/Collector/PluginClientFactoryListener.php @@ -2,8 +2,7 @@ namespace Http\HttplugBundle\Collector; -use Http\Client\Common\PluginClientFactory; -use Http\HttplugBundle\Collector\PluginClientFactory as CollectorPluginClientFactory; +use Http\Client\Common\PluginClientFactory as DefaultPluginClientFactory; use Symfony\Component\EventDispatcher\Event; use Symfony\Component\EventDispatcher\EventSubscriberInterface; @@ -19,14 +18,14 @@ final class PluginClientFactoryListener implements EventSubscriberInterface { /** - * @var CollectorPluginClientFactory + * @var PluginClientFactory */ private $factory; /** - * @param CollectorPluginClientFactory $factory + * @param PluginClientFactory $factory */ - public function __construct(CollectorPluginClientFactory $factory) + public function __construct(PluginClientFactory $factory) { $this->factory = $factory; } @@ -38,7 +37,7 @@ public function __construct(CollectorPluginClientFactory $factory) */ public function onEvent(Event $e) { - PluginClientFactory::setFactory([$this->factory, 'createClient']); + DefaultPluginClientFactory::setFactory([$this->factory, 'createClient']); } /** diff --git a/Tests/Unit/Collector/PluginClientFactoryListenerTest.php b/Tests/Unit/Collector/PluginClientFactoryListenerTest.php new file mode 100644 index 00000000..7db38697 --- /dev/null +++ b/Tests/Unit/Collector/PluginClientFactoryListenerTest.php @@ -0,0 +1,31 @@ +getMockBuilder(Collector::class)->getMock(); + $formatter = $this->getMockBuilder(Formatter::class)->disableOriginalConstructor()->getMock(); + $stopwatch = $this->getMockBuilder(Stopwatch::class)->getMock(); + + $factory = new PluginClientFactory($collector, $formatter, $stopwatch); + + $listener = new PluginClientFactoryListener($factory); + + $listener->onEvent(new Event()); + + $this->assertTrue(is_callable(NSA::getProperty(DefaultPluginClientFactory::class, 'factory'))); + } +}