diff --git a/CHANGELOG.md b/CHANGELOG.md index d08e170..9fa680c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,7 +2,12 @@ All notable changes to this project will be documented in this file. This project adheres to [Semantic Versioning](http://semver.org/). -## [0.7.0] / 2015-09-08 +## 0.7.1 / 2015-11-07 + +### Fixed: + - HTTP Client options where not forwarded to child classes. (PR #26) + +## 0.7.0 / 2015-09-08 ### Added: - Implemented webhooks endpoints. diff --git a/lib/Bitbucket/API/Api.php b/lib/Bitbucket/API/Api.php index 7597bbe..9e7a36c 100644 --- a/lib/Bitbucket/API/Api.php +++ b/lib/Bitbucket/API/Api.php @@ -295,6 +295,7 @@ protected function childFactory($name) /** @var Api $child */ $class = '\\Bitbucket\\API\\'.$name; $child = new $class($this->client); + $child->setClient($this->getClient()); if ($this->getClient()->hasListeners()) { $child->getClient()->setListeners($this->getClient()->getListeners()); diff --git a/lib/Bitbucket/API/Http/Client.php b/lib/Bitbucket/API/Http/Client.php index 4993e48..2c95df5 100644 --- a/lib/Bitbucket/API/Http/Client.php +++ b/lib/Bitbucket/API/Http/Client.php @@ -33,7 +33,7 @@ class Client extends ClientListener implements ClientInterface 'api_versions' => array('1.0', '2.0'), // supported versions 'format' => 'json', 'formats' => array('json', 'xml'), // supported response formats - 'user_agent' => 'bitbucket-api-php/0.7.0 (https://bitbucket.org/gentlero/bitbucket-api)', + 'user_agent' => 'bitbucket-api-php/0.7.1 (https://bitbucket.org/gentlero/bitbucket-api)', 'timeout' => 10, 'verify_peer' => false ); diff --git a/test/Bitbucket/Tests/API/Http/ClientTest.php b/test/Bitbucket/Tests/API/Http/ClientTest.php index 44049c2..532ea74 100644 --- a/test/Bitbucket/Tests/API/Http/ClientTest.php +++ b/test/Bitbucket/Tests/API/Http/ClientTest.php @@ -135,6 +135,18 @@ public function testShouldDoPatchRequestAndReturnResponseInstance() $this->assertInstanceOf('\Buzz\Message\MessageInterface', $response); } + public function testClientIsKeptWhenInvokingChildFactory() + { + $options = [ + 'base_url' => 'localhost' + ]; + $client = new Client($options); + $pullRequest = new \Bitbucket\API\Repositories\PullRequests(); + $pullRequest->setClient($client); + $comments = $pullRequest->comments(); + $this->assertSame($client, $comments->getClient()); + } + public function testAddListener() { $listener = $this->getListenerMock();