File tree Expand file tree Collapse file tree 3 files changed +37
-0
lines changed Expand file tree Collapse file tree 3 files changed +37
-0
lines changed Original file line number Diff line number Diff line change @@ -24,6 +24,11 @@ $user->followers($username);
2424$user->following($username);
2525```
2626
27+ ### Get the list of the user's repositories: (API 2.0)
28+ ``` php
29+ $user->repositories($username);
30+ ```
31+
2732----
2833
2934#### Related:
Original file line number Diff line number Diff line change @@ -63,6 +63,20 @@ public function following($username)
6363 );
6464 }
6565
66+ /**
67+ * Get the list of the user's repositories
68+ *
69+ * @access public
70+ * @param string $username
71+ * @return MessageInterface
72+ */
73+ public function repositories ($ username )
74+ {
75+ return $ this ->getClient ()->setApiVersion ('2.0 ' )->get (
76+ sprintf ('repositories/%s ' , $ username )
77+ );
78+ }
79+
6680 /**
6781 * Get account
6882 *
Original file line number Diff line number Diff line change @@ -74,6 +74,24 @@ public function testGetUserFollowing()
7474 $ this ->assertEquals ($ expectedResult , $ actual );
7575 }
7676
77+ public function testGetUserRepositories ()
78+ {
79+ $ endpoint = 'repositories/john-doe ' ;
80+ $ expectedResult = $ this ->fakeResponse (array ('dummy ' ));
81+
82+ $ client = $ this ->getHttpClientMock ();
83+ $ client ->expects ($ this ->once ())
84+ ->method ('get ' )
85+ ->with ($ endpoint )
86+ ->will ($ this ->returnValue ($ expectedResult ));
87+
88+ /** @var \Bitbucket\API\Users $user */
89+ $ user = $ this ->getClassMock ('Bitbucket\API\Users ' , $ client );
90+ $ actual = $ user ->repositories ('john-doe ' );
91+
92+ $ this ->assertEquals ($ expectedResult , $ actual );
93+ }
94+
7795 public function testGetAccountInstance ()
7896 {
7997 $ this ->assertInstanceOf ('\Bitbucket\API\Users\Account ' , $ this ->users ->account ());
You can’t perform that action at this time.
0 commit comments