Skip to content

Commit 3916ff8

Browse files
committed
Merge branch 'release/0.6.2'
2 parents f3175f6 + 9f1f619 commit 3916ff8

File tree

4 files changed

+32
-3
lines changed

4 files changed

+32
-3
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,13 @@
22
All notable changes to this project will be documented in this file.
33
This project adheres to [Semantic Versioning](http://semver.org/).
44

5+
## [Unreleased][unreleased]
6+
7+
## 0.6.2 / 2015-05-18
8+
9+
### Fixed:
10+
- Client listener propagation to child classes. (PR #23)
11+
512
## 0.6.1 / 2015-03-24
613

714
### Changed:

lib/Bitbucket/API/Http/Client.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class Client extends ClientListener implements ClientInterface
3333
'api_versions' => array('1.0', '2.0'), // supported versions
3434
'format' => 'json',
3535
'formats' => array('json', 'xml'), // supported response formats
36-
'user_agent' => 'bitbucket-api-php/0.6.1 (https://bitbucket.org/gentlero/bitbucket-api)',
36+
'user_agent' => 'bitbucket-api-php/0.6.2 (https://bitbucket.org/gentlero/bitbucket-api)',
3737
'timeout' => 10,
3838
'verify_peer' => false
3939
);

lib/Bitbucket/API/Http/ClientListener.php

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,9 +101,12 @@ public function hasListeners()
101101
*/
102102
public function setListeners(array $listeners)
103103
{
104-
foreach ($listeners as $prio => $listener) {
104+
foreach ($listeners as $priority => $listener) {
105105
$listener = array_values($listener);
106-
$this->addListener($listener[0], $prio);
106+
107+
foreach ($listener as $samePriorityListener) {
108+
$this->addListener($samePriorityListener, $priority);
109+
}
107110
}
108111

109112
return $this;

test/Bitbucket/Tests/API/Http/ClientTest.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
namespace Bitbucket\Tests\API\Http;
44

5+
use Bitbucket\API\Http\Listener\NormalizeArrayListener;
6+
use Bitbucket\API\Http\Listener\OAuthListener;
57
use Bitbucket\Tests\API as Tests;
68
use Bitbucket\API\Http\Client;
79
use Buzz\Client\Curl;
@@ -163,6 +165,23 @@ public function testGetAbsentListener()
163165
$this->client->getListener('invalid');
164166
}
165167

168+
public function testSetListenersWorksWithMultipleListeners()
169+
{
170+
$listeners = array(
171+
'0' => array(
172+
new NormalizeArrayListener(),
173+
new OAuthListener(array()),
174+
)
175+
);
176+
177+
$this->client->setListeners($listeners);
178+
179+
$listeners = $this->client->getListeners();
180+
181+
$this->assertArrayHasKey('normalize_array', $listeners[0]);
182+
$this->assertArrayHasKey('oauth', $listeners[0]);
183+
}
184+
166185
private function getListenerMock($name = 'dummy')
167186
{
168187
$listener = $this->getMock('Bitbucket\API\Http\Listener\ListenerInterface');

0 commit comments

Comments
 (0)