Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions tests/integration/IntegrationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -217,6 +217,21 @@ public function testUpsertUser()
$this->client->deleteUser($user["id"], ["user" => "hard", "messages" => "hard"]);
}

public function testUpsertUserWithTeam()
{
$user = [
"id" => $this->generateGuid(),
"team" => "blue",
"teams_role" => ["blue" => "admin"]
];
$response = $this->client->upsertUser($user);
$this->assertTrue(array_key_exists("users", (array)$response));
$this->assertTrue(array_key_exists($user["id"], $response["users"]));
$this->assertEquals("blue", $response["users"][$user["id"]]["team"]);
$this->assertEquals("admin", $response["users"][$user["id"]]["teams_role"]["blue"]);
$this->client->deleteUser($user["id"], ["user" => "hard", "messages" => "hard"]);
}

public function testUpsertUsers()
{
$user = ["id" => $this->generateGuid()];
Expand Down Expand Up @@ -1188,6 +1203,31 @@ public function testPartialUpdateUsers()
$this->client->deleteUser($wally["id"], ["user" => "hard", "messages" => "hard"]);
}

public function testPartialUpdateUserWithTeam()
{
$user = ["id" => $this->generateGuid(), "name" => "Test User"];
$response = $this->client->upsertUser($user);
$this->assertTrue(array_key_exists("users", (array)$response));
$this->assertTrue(array_key_exists($user["id"], $response["users"]));

// Partially update the user with team and teams_role
$response = $this->client->partialUpdateUser([
"id" => $user["id"],
"set" => [
"team" => "blue",
"teams_role" => ["blue" => "admin"]
]
]);

// Verify the changes
$response = $this->client->queryUsers(["id" => $user["id"]]);
$this->assertEquals("blue", $response["users"][0]["team"]);
$this->assertEquals("admin", $response["users"][0]["teams_role"]["blue"]);

// Clean up
$this->client->deleteUser($user["id"], ["user" => "hard", "messages" => "hard"]);
}

public function testChannelMuteUnmute()
{
// setup
Expand Down