Skip to content

Commit 028a490

Browse files
committed
implemented Teams::following (API 2.0)
1 parent 8449003 commit 028a490

File tree

3 files changed

+37
-0
lines changed

3 files changed

+37
-0
lines changed

docs/teams.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@ $team->members($team_name);
2424
$team->followers($team_name);
2525
```
2626

27+
### Get a list of accounts the team is following: (API 2.0)
28+
```php
29+
$team->following($team_name);
30+
```
31+
2732
----
2833

2934
#### Related:

lib/Bitbucket/API/Teams.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,4 +59,18 @@ public function followers($name)
5959
sprintf('teams/%s/followers', $name)
6060
);
6161
}
62+
63+
/**
64+
* Get a list of accounts the team is following.
65+
*
66+
* @access public
67+
* @param string $name The team's name.
68+
* @return MessageInterface
69+
*/
70+
public function following($name)
71+
{
72+
return $this->getClient()->setApiVersion('2.0')->get(
73+
sprintf('teams/%s/following', $name)
74+
);
75+
}
6276
}

test/Bitbucket/Tests/API/TeamsTest.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,4 +59,22 @@ public function testGetTeamFollowers()
5959

6060
$this->assertEquals($expectedResult, $actual);
6161
}
62+
63+
public function testGetTeamFollowing()
64+
{
65+
$endpoint = 'teams/gentle-web/following';
66+
$expectedResult = $this->fakeResponse(array('dummy'));
67+
68+
$client = $this->getHttpClientMock();
69+
$client->expects($this->once())
70+
->method('get')
71+
->with($endpoint)
72+
->will($this->returnValue($expectedResult));
73+
74+
/** @var \Bitbucket\API\Teams $team */
75+
$team = $this->getClassMock('Bitbucket\API\Teams', $client);
76+
$actual = $team->following('gentle-web');
77+
78+
$this->assertEquals($expectedResult, $actual);
79+
}
6280
}

0 commit comments

Comments
 (0)