Skip to content

Commit 6822d0a

Browse files
ziemkowskijosler
authored andcommitted
Allow conversation type as none (all), admin, or user
1 parent a2b7925 commit 6822d0a

File tree

2 files changed

+22
-5
lines changed

2 files changed

+22
-5
lines changed

src/Intercom/Service/config/intercom_public_conversation.json

+2-3
Original file line numberDiff line numberDiff line change
@@ -97,9 +97,8 @@
9797
"parameters": {
9898
"type": {
9999
"location": "query",
100-
"required": true,
101-
"static": true,
102-
"default": "user"
100+
"required": false,
101+
"type": "string"
103102
},
104103
"id": {
105104
"location": "query",

tests/Intercom/Resources/ConversationTest.php

+20-2
Original file line numberDiff line numberDiff line change
@@ -41,20 +41,38 @@ public function testGetConversation()
4141
$this->assertEquals(true, $response['open']);
4242
}
4343

44-
public function testGetConversations()
44+
public function testGetAllConversations()
4545
{
4646
$this->setMockResponse($this->client, 'Conversation/ConversationList.txt');
4747
$response = $this->client->getConversations();
4848
$conversations = $response->get('conversations');
4949

50-
$this->assertRequest('GET', '/conversations?type=user');
50+
$this->assertRequest('GET', '/conversations');
5151

5252
$this->assertInstanceOf('\Guzzle\Service\Resource\Model', $response);
5353
$this->assertEquals(1, count($conversations));
5454
$this->assertEquals(1400850973, $conversations['0']['created_at']);
5555
$this->assertEquals('536e564f316c83104c000020', $conversations['0']['user']['id']);
5656
$this->assertEquals('admin', $conversations['0']['assignee']['type']);
5757
}
58+
59+
public function testGetUserConversations()
60+
{
61+
$this->setMockResponse($this->client, 'Conversation/ConversationList.txt');
62+
$response = $this->client->getConversations(['type' => 'user']);
63+
$conversations = $response->get('conversations');
64+
65+
$this->assertRequest('GET', '/conversations?type=user');
66+
}
67+
68+
public function testGetAdminConversations()
69+
{
70+
$this->setMockResponse($this->client, 'Conversation/ConversationList.txt');
71+
$response = $this->client->getConversations(['type' => 'admin']);
72+
$conversations = $response->get('conversations');
73+
74+
$this->assertRequest('GET', '/conversations?type=admin');
75+
}
5876

5977
public function testReplyToConversation()
6078
{

0 commit comments

Comments
 (0)