@@ -893,7 +893,7 @@ public function testCreateOrganizationMembership()
893893 $ params = [
894894 "organization_id " => $ orgId ,
895895 "user_id " => $ userId ,
896- "role_slug " => $ roleSlug
896+ "role_slug " => $ roleSlug,
897897 ];
898898
899899 $ this ->mockRequest (
@@ -912,6 +912,37 @@ public function testCreateOrganizationMembership()
912912 $ this ->assertSame ($ organizationMembership , $ response ->toArray ());
913913 }
914914
915+ public function testCreateOrganizationMembershipWithRoleSlugs ()
916+ {
917+ $ userId = "user_01H7X1M4TZJN5N4HG4XXMA1234 " ;
918+ $ orgId = "org_01EHQMYV6MBK39QC5PZXHY59C3 " ;
919+ $ roleSlugs = ["admin " ];
920+ $ path = "user_management/organization_memberships " ;
921+
922+ $ result = $ this ->organizationMembershipResponseFixture ();
923+
924+ $ params = [
925+ "organization_id " => $ orgId ,
926+ "user_id " => $ userId ,
927+ "role_slugs " => $ roleSlugs ,
928+ ];
929+
930+ $ this ->mockRequest (
931+ Client::METHOD_POST ,
932+ $ path ,
933+ null ,
934+ $ params ,
935+ true ,
936+ $ result
937+ );
938+
939+ $ organizationMembership = $ this ->organizationMembershipFixture ();
940+
941+ $ response = $ this ->userManagement ->createOrganizationMembership ($ userId , $ orgId , null , $ roleSlugs );
942+
943+ $ this ->assertSame ($ organizationMembership , $ response ->toArray ());
944+ }
945+
915946 public function testGetOrganizationMembership ()
916947 {
917948 $ organizationMembershipId = "om_01E4ZCR3C56J083X43JQXF3JK5 " ;
@@ -1080,6 +1111,28 @@ public function testUpdateOrganizationMembership()
10801111 $ this ->assertSame ($ this ->organizationMembershipFixture (), $ response ->toArray ());
10811112 }
10821113
1114+ public function testUpdateOrganizationMembershipWithRoleSlugs ()
1115+ {
1116+ $ organizationMembershipId = "om_01E4ZCR3C56J083X43JQXF3JK5 " ;
1117+ $ roleSlugs = ["admin " ];
1118+ $ path = "user_management/organization_memberships/ {$ organizationMembershipId }" ;
1119+
1120+ $ result = $ this ->organizationMembershipResponseFixture ();
1121+
1122+ $ this ->mockRequest (
1123+ Client::METHOD_PUT ,
1124+ $ path ,
1125+ null ,
1126+ ["role_slugs " => $ roleSlugs ],
1127+ true ,
1128+ $ result
1129+ );
1130+
1131+ $ response = $ this ->userManagement ->updateOrganizationMembership ($ organizationMembershipId , null , $ roleSlugs );
1132+ $ this ->assertSame ($ this ->organizationMembershipFixture (), $ response ->toArray ());
1133+ }
1134+
1135+
10831136 public function testDeactivateOrganizationMembership ()
10841137 {
10851138 $ organizationMembershipId = "om_01E4ZCR3C56J083X43JQXF3JK5 " ;
@@ -1396,6 +1449,11 @@ private function organizationMembershipResponseFixture($status = "active")
13961449 "role " => [
13971450 "slug " => "admin " ,
13981451 ],
1452+ "roles " => [
1453+ [
1454+ "slug " => "admin " ,
1455+ ],
1456+ ],
13991457 "status " => $ status ,
14001458 "created_at " => "2021-06-25T19:07:33.155Z " ,
14011459 "updated_at " => "2021-06-25T19:07:33.155Z " ,
@@ -1415,6 +1473,11 @@ private function organizationMembershipListResponseFixture()
14151473 "role " => [
14161474 "slug " => "admin " ,
14171475 ],
1476+ "roles " => [
1477+ [
1478+ "slug " => "admin " ,
1479+ ]
1480+ ],
14181481 "status " => "active " ,
14191482 "created_at " => "2021-06-25T19:07:33.155Z " ,
14201483 "updated_at " => "2021-06-25T19:07:33.155Z " ,
@@ -1438,6 +1501,11 @@ private function organizationMembershipFixture()
14381501 "role " => [
14391502 "slug " => "admin " ,
14401503 ],
1504+ "roles " => [
1505+ [
1506+ "slug " => "admin " ,
1507+ ],
1508+ ],
14411509 "status " => "active " ,
14421510 "createdAt " => "2021-06-25T19:07:33.155Z " ,
14431511 "updatedAt " => "2021-06-25T19:07:33.155Z " ,
0 commit comments