Skip to content

Commit cf71647

Browse files
committed
implemented Teams::repositories (API 2.0)
1 parent 028a490 commit cf71647

File tree

3 files changed

+38
-0
lines changed

3 files changed

+38
-0
lines changed

docs/teams.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,12 @@ $team->followers($team_name);
2929
$team->following($team_name);
3030
```
3131

32+
### Get the team's repositories: (API 2.0)
33+
```php
34+
$team->repositories($team_name);
35+
```
36+
37+
3238
----
3339

3440
#### Related:

lib/Bitbucket/API/Teams.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,4 +73,18 @@ public function following($name)
7373
sprintf('teams/%s/following', $name)
7474
);
7575
}
76+
77+
/**
78+
* Get the team's repositories.
79+
*
80+
* @access public
81+
* @param string $name The team's name.
82+
* @return MessageInterface
83+
*/
84+
public function repositories($name)
85+
{
86+
return $this->getClient()->setApiVersion('2.0')->get(
87+
sprintf('teams/%s/repositories', $name)
88+
);
89+
}
7690
}

test/Bitbucket/Tests/API/TeamsTest.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,4 +77,22 @@ public function testGetTeamFollowing()
7777

7878
$this->assertEquals($expectedResult, $actual);
7979
}
80+
81+
public function testGetTeamRepositories()
82+
{
83+
$endpoint = 'teams/gentle-web/repositories';
84+
$expectedResult = $this->fakeResponse(array('dummy'));
85+
86+
$client = $this->getHttpClientMock();
87+
$client->expects($this->once())
88+
->method('get')
89+
->with($endpoint)
90+
->will($this->returnValue($expectedResult));
91+
92+
/** @var \Bitbucket\API\Teams $team */
93+
$team = $this->getClassMock('Bitbucket\API\Teams', $client);
94+
$actual = $team->repositories('gentle-web');
95+
96+
$this->assertEquals($expectedResult, $actual);
97+
}
8098
}

0 commit comments

Comments
 (0)