Skip to content

Commit 52ac68b

Browse files
[11.11] Add support for Users::removeUserIdentity (#762)
Co-authored-by: Philipp Kolmann <[email protected]>
1 parent 738aca3 commit 52ac68b

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

src/Api/Users.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -592,4 +592,17 @@ public function events(int $user_id, array $parameters = [])
592592

593593
return $this->get('users/'.self::encodePath($user_id).'/events', $resolver->resolve($parameters));
594594
}
595+
596+
/**
597+
* Deletes a user’s authentication identity using the provider name associated with that identity.
598+
*
599+
* @param int $user_id
600+
* @param string $provider
601+
*
602+
* @return mixed
603+
*/
604+
public function removeUserIdentity(int $user_id, string $provider)
605+
{
606+
return $this->delete('users/'.self::encodePath($user_id).'/identities/'.self::encodePath($provider));
607+
}
595608
}

tests/Api/UsersTest.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -980,4 +980,22 @@ public function shouldGetEventsWithPagination(): void
980980

981981
$this->assertEquals($expectedArray, $api->events(1, ['page' => 2, 'per_page' => 15]));
982982
}
983+
984+
/**
985+
* @test
986+
*/
987+
public function getRemoveUserIdentity(): void
988+
{
989+
$expectedArray = [
990+
['id' => 1, 'identities' => []],
991+
];
992+
993+
$api = $this->getApiMock();
994+
$api->expects($this->once())
995+
->method('delete')
996+
->with('users/1/identities/test')
997+
->will($this->returnValue($expectedArray));
998+
999+
$this->assertEquals($expectedArray, $api->removeUserIdentity(1, 'test'));
1000+
}
9831001
}

0 commit comments

Comments
 (0)