Skip to content

Commit 0323702

Browse files
fix: test
1 parent 3497519 commit 0323702

File tree

1 file changed

+57
-27
lines changed

1 file changed

+57
-27
lines changed

tests/integration/IntegrationTest.php

Lines changed: 57 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1308,38 +1308,68 @@ public function testChannelPin()
13081308

13091309
// Pin the channel
13101310
$now = new \DateTime();
1311-
$member = $this->channel->pin($users[0]['id']);
1312-
$this->assertNotNull($member->channelMember->pinned_at);
1313-
$this->assertGreaterThanOrEqual($now->getTimestamp(), strtotime($member->channelMember->pinned_at));
1314-
1315-
// // Query for pinned channel
1316-
$queryChannResp = $client->queryChannels([
1317-
'user_id' => $users[0]['id'],
1318-
'filter' => [
1319-
'pinned' => true,
1320-
'cid' => $this->channel->getCID(),
1321-
],
1322-
]);Deze pas is niet gekoppeld. Ben je een zakelijke gebruiker? Neem dat contact op met jouw beheerder. Zo niet, neem dan contact op met de Rabobank. (908)
1323-
1324-
$channels = $queryChannResp['channels'];
1325-
$this->assertCount(1, $channels);
1326-
$this->assertEquals($channels[0]['cid'], $channel->getCID());
1311+
$response = $this->channel->pin($this->user1["id"]);
1312+
$this->assertNotNull($response["channel_member"]["pinned_at"]);
1313+
$this->assertGreaterThanOrEqual($now->getTimestamp(), strtotime($response["channel_member"]["pinned_at"]));
1314+
1315+
// Query for pinned channel
1316+
$response = $this->client->queryChannels([
1317+
"pinned" => true,
1318+
"cid" => $this->channel->getCID(),
1319+
], null, [
1320+
"user_id" => $this->user1["id"]
1321+
]);
1322+
$this->assertCount(1, $response["channels"]);
1323+
$this->assertEquals($this->channel->getCID(), $response["channels"][0]["channel"]["cid"]);
13271324

13281325
// Unpin the channel
1329-
$member = $channel->unpin($users[0]['id']);
1330-
$this->assertNull($member->channelMember->pinned_at);
1326+
$response = $this->channel->unpin($this->user1["id"]);
1327+
$this->assertArrayNotHasKey("pinned_at", $response["channel_member"]);
13311328

13321329
// Query for unpinned channel
1333-
$queryChannResp = $client->queryChannels([
1334-
'user_id' => $users[0]['id'],
1335-
'filter' => [
1336-
'pinned' => false,
1337-
'cid' => $this->channel->getCID(),
1338-
],
1330+
$response = $this->client->queryChannels([
1331+
"pinned" => false,
1332+
"cid" => $this->channel->getCID(),
1333+
], null, [
1334+
"user_id" => $this->user1["id"]
13391335
]);
1336+
$this->assertCount(1, $response["channels"]);
1337+
$this->assertEquals($this->channel->getCID(), $response["channels"][0]["channel"]["cid"]);
1338+
}
1339+
1340+
public function testChannelArchive()
1341+
{
1342+
$this->channel->addMembers([$this->user1["id"]]);
1343+
$this->channel->addMembers([$this->user2["id"]]);
13401344

1341-
$channels = $queryChannResp['channels'];
1342-
$this->assertCount(1, $channels);
1343-
$this->assertEquals($channels[0]['cid'], $channel->getCID());
1345+
// Archive the channel
1346+
$now = new \DateTime();
1347+
$response = $this->channel->archive($this->user1["id"]);
1348+
$this->assertNotNull($response["channel_member"]["archived_at"]);
1349+
$this->assertGreaterThanOrEqual($now->getTimestamp(), strtotime($response["channel_member"]["archived_at"]));
1350+
1351+
// Query for archived channel
1352+
$response = $this->client->queryChannels([
1353+
"archived" => true,
1354+
"cid" => $this->channel->getCID(),
1355+
], null, [
1356+
"user_id" => $this->user1["id"]
1357+
]);
1358+
$this->assertCount(1, $response["channels"]);
1359+
$this->assertEquals($this->channel->getCID(), $response["channels"][0]["channel"]["cid"]);
1360+
1361+
// Unarchive the channel
1362+
$response = $this->channel->unarchive($this->user1["id"]);
1363+
$this->assertArrayNotHasKey("archived_at", $response["channel_member"]);
1364+
1365+
// Query for unarchived channel
1366+
$response = $this->client->queryChannels([
1367+
"archived" => false,
1368+
"cid" => $this->channel->getCID(),
1369+
], null, [
1370+
"user_id" => $this->user1["id"]
1371+
]);
1372+
$this->assertCount(1, $response["channels"]);
1373+
$this->assertEquals($this->channel->getCID(), $response["channels"][0]["channel"]["cid"]);
13441374
}
13451375
}

0 commit comments

Comments
 (0)