File tree Expand file tree Collapse file tree 2 files changed +13
-0
lines changed
test/Bitbucket/Tests/API/Http Expand file tree Collapse file tree 2 files changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -295,6 +295,7 @@ protected function childFactory($name)
295295 /** @var Api $child */
296296 $ class = '\\Bitbucket \\API \\' .$ name ;
297297 $ child = new $ class ($ this ->client );
298+ $ child ->setClient ($ this ->getClient ());
298299
299300 if ($ this ->getClient ()->hasListeners ()) {
300301 $ child ->getClient ()->setListeners ($ this ->getClient ()->getListeners ());
Original file line number Diff line number Diff line change @@ -135,6 +135,18 @@ public function testShouldDoPatchRequestAndReturnResponseInstance()
135135 $ this ->assertInstanceOf ('\Buzz\Message\MessageInterface ' , $ response );
136136 }
137137
138+ public function testClientIsKeptWhenInvokingChildFactory ()
139+ {
140+ $ options = [
141+ 'base_url ' => 'localhost '
142+ ];
143+ $ client = new Client ($ options );
144+ $ pullRequest = new \Bitbucket \API \Repositories \PullRequests ();
145+ $ pullRequest ->setClient ($ client );
146+ $ comments = $ pullRequest ->comments ();
147+ $ this ->assertSame ($ client , $ comments ->getClient ());
148+ }
149+
138150 public function testAddListener ()
139151 {
140152 $ listener = $ this ->getListenerMock ();
You can’t perform that action at this time.
0 commit comments