Skip to content

Commit e1eff58

Browse files
[11.5] Added functions to change the active state for gitlab users (#642)
1 parent e49fba7 commit e1eff58

File tree

2 files changed

+54
-0
lines changed

2 files changed

+54
-0
lines changed

src/Api/Users.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,26 @@ public function unblock(int $id)
244244
return $this->post('users/'.self::encodePath($id).'/unblock');
245245
}
246246

247+
/**
248+
* @param int $id
249+
*
250+
* @return mixed
251+
*/
252+
public function activate(int $id)
253+
{
254+
return $this->post('users/'.self::encodePath($id).'/activate');
255+
}
256+
257+
/**
258+
* @param int $id
259+
*
260+
* @return mixed
261+
*/
262+
public function deactivate(int $id)
263+
{
264+
return $this->post('users/'.self::encodePath($id).'/deactivate');
265+
}
266+
247267
/**
248268
* @return mixed
249269
*/

tests/Api/UsersTest.php

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -407,6 +407,40 @@ public function shouldUnblockUser(): void
407407
$this->assertEquals($expectedBool, $api->unblock(1));
408408
}
409409

410+
/**
411+
* @test
412+
*/
413+
public function shouldActivateUser(): void
414+
{
415+
$expectedBool = true;
416+
417+
$api = $this->getApiMock();
418+
$api->expects($this->once())
419+
->method('post')
420+
->with('users/1/activate')
421+
->will($this->returnValue($expectedBool))
422+
;
423+
424+
$this->assertEquals($expectedBool, $api->activate(1));
425+
}
426+
427+
/**
428+
* @test
429+
*/
430+
public function shouldDeactivateUser(): void
431+
{
432+
$expectedBool = true;
433+
434+
$api = $this->getApiMock();
435+
$api->expects($this->once())
436+
->method('post')
437+
->with('users/1/deactivate')
438+
->will($this->returnValue($expectedBool))
439+
;
440+
441+
$this->assertEquals($expectedBool, $api->deactivate(1));
442+
}
443+
410444
/**
411445
* @test
412446
*/

0 commit comments

Comments
 (0)