File tree Expand file tree Collapse file tree 4 files changed +32
-3
lines changed
test/Bitbucket/Tests/API/Http Expand file tree Collapse file tree 4 files changed +32
-3
lines changed Original file line number Diff line number Diff line change 22All notable changes to this project will be documented in this file.
33This 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:
Original file line number Diff line number Diff 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 );
Original file line number Diff line number Diff 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 ;
Original file line number Diff line number Diff line change 22
33namespace Bitbucket \Tests \API \Http ;
44
5+ use Bitbucket \API \Http \Listener \NormalizeArrayListener ;
6+ use Bitbucket \API \Http \Listener \OAuthListener ;
57use Bitbucket \Tests \API as Tests ;
68use Bitbucket \API \Http \Client ;
79use 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 ' );
You can’t perform that action at this time.
0 commit comments