File tree Expand file tree Collapse file tree 3 files changed +36
-0
lines changed Expand file tree Collapse file tree 3 files changed +36
-0
lines changed Original file line number Diff line number Diff line change @@ -19,6 +19,10 @@ $user->get($username);
1919$user->followers($username);
2020```
2121
22+ ### Get a list of accounts the user is following: (API 2.0)
23+ ``` php
24+ $user->following($username);
25+ ```
2226
2327----
2428
Original file line number Diff line number Diff line change @@ -49,6 +49,20 @@ public function followers($username)
4949 );
5050 }
5151
52+ /**
53+ * Get a list of accounts the user is following
54+ *
55+ * @access public
56+ * @param string $username
57+ * @return MessageInterface
58+ */
59+ public function following ($ username )
60+ {
61+ return $ this ->getClient ()->setApiVersion ('2.0 ' )->get (
62+ sprintf ('users/%s/following ' , $ username )
63+ );
64+ }
65+
5266 /**
5367 * Get account
5468 *
Original file line number Diff line number Diff line change @@ -56,6 +56,24 @@ public function testGetUserFollowers()
5656 $ this ->assertEquals ($ expectedResult , $ actual );
5757 }
5858
59+ public function testGetUserFollowing ()
60+ {
61+ $ endpoint = 'users/john-doe/following ' ;
62+ $ expectedResult = $ this ->fakeResponse (array ('dummy ' ));
63+
64+ $ client = $ this ->getHttpClientMock ();
65+ $ client ->expects ($ this ->once ())
66+ ->method ('get ' )
67+ ->with ($ endpoint )
68+ ->will ($ this ->returnValue ($ expectedResult ));
69+
70+ /** @var \Bitbucket\API\Users $user */
71+ $ user = $ this ->getClassMock ('Bitbucket\API\Users ' , $ client );
72+ $ actual = $ user ->following ('john-doe ' );
73+
74+ $ this ->assertEquals ($ expectedResult , $ actual );
75+ }
76+
5977 public function testGetAccountInstance ()
6078 {
6179 $ this ->assertInstanceOf ('\Bitbucket\API\Users\Account ' , $ this ->users ->account ());
You can’t perform that action at this time.
0 commit comments