Skip to content

Commit 16b4dea

Browse files
authored
[11.3] Add support for a single inherited member (#625)
1 parent 8c05bd8 commit 16b4dea

File tree

4 files changed

+54
-0
lines changed

4 files changed

+54
-0
lines changed

src/Api/Groups.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,17 @@ public function member($group_id, int $user_id)
155155
return $this->get('groups/'.self::encodePath($group_id).'/members/'.self::encodePath($user_id));
156156
}
157157

158+
/**
159+
* @param int|string $group_id
160+
* @param int $user_id
161+
*
162+
* @return mixed
163+
*/
164+
public function allMember($group_id, int $user_id)
165+
{
166+
return $this->get('groups/'.self::encodePath($group_id).'/members/all/'.self::encodePath($user_id));
167+
}
168+
158169
/**
159170
* @param int|string $group_id
160171
* @param int $user_id

src/Api/Projects.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -508,6 +508,17 @@ public function member($project_id, int $user_id)
508508
return $this->get($this->getProjectPath($project_id, 'members/'.self::encodePath($user_id)));
509509
}
510510

511+
/**
512+
* @param int|string $project_id
513+
* @param int $user_id
514+
*
515+
* @return mixed
516+
*/
517+
public function allMember($project_id, int $user_id)
518+
{
519+
return $this->get($this->getProjectPath($project_id, 'members/all/'.self::encodePath($user_id)));
520+
}
521+
511522
/**
512523
* @param int|string $project_id
513524
* @param int $user_id

tests/Api/GroupsTest.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,22 @@ public function shouldGetAllMembers(): void
220220
$this->assertEquals($expectedArray, $api->allMembers(1));
221221
}
222222

223+
/**
224+
* @test
225+
*/
226+
public function shouldGetAllMember(): void
227+
{
228+
$expectedArray = ['id' => 2, 'name' => 'Bob'];
229+
230+
$api = $this->getApiMock();
231+
$api->expects($this->once())
232+
->method('get')
233+
->with('groups/1/members/all/2')
234+
->will($this->returnValue($expectedArray));
235+
236+
$this->assertEquals($expectedArray, $api->allMember(1, 2));
237+
}
238+
223239
/**
224240
* @test
225241
*/

tests/Api/ProjectsTest.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -945,6 +945,22 @@ public function shouldGetAllMembers(): void
945945
$this->assertEquals($expectedArray, $api->allMembers(1));
946946
}
947947

948+
/**
949+
* @test
950+
*/
951+
public function shouldGetAllMember(): void
952+
{
953+
$expectedArray = ['id' => 2, 'name' => 'Bob'];
954+
955+
$api = $this->getApiMock();
956+
$api->expects($this->once())
957+
->method('get')
958+
->with('projects/1/members/all/2')
959+
->will($this->returnValue($expectedArray));
960+
961+
$this->assertEquals($expectedArray, $api->allMember(1, 2));
962+
}
963+
948964
/**
949965
* @test
950966
*/

0 commit comments

Comments
 (0)