diff --git a/tests/Bot/Tests/ClientListTest.php b/tests/Bot/Tests/ClientListTest.php index 6e30dd2..7fc0b62 100644 --- a/tests/Bot/Tests/ClientListTest.php +++ b/tests/Bot/Tests/ClientListTest.php @@ -75,6 +75,27 @@ class ClientListTest extends TestCase static::assertInstanceOf(Chat::class, $response[0], "Incorrect chat instance"); } + /** + * @group("list") + * @throws \Exception + */ + public function testGetChatsByCustomerId(): void + { + $client = self::getApiClient( + null, + null, + false, + $this->getJsonResponse('chatsByCustomerId') + ); + + $request = new Request\ChatsRequest(); + $request->setCustomerId(39); + + $response = $client->chats($request); + static::assertCount(1, $response, "Incorrect chats count"); + static::assertInstanceOf(Chat::class, $response[0], "Incorrect chat instance"); + } + /** * @group("list") * @throws \Exception diff --git a/tests/Resources/chatsByCustomerId.json b/tests/Resources/chatsByCustomerId.json new file mode 100644 index 0000000..5437215 --- /dev/null +++ b/tests/Resources/chatsByCustomerId.json @@ -0,0 +1,63 @@ +[ + { + "id": 30, + "avatar": "", + "name": "", + "channel": { + "id": 72, + "avatar": "", + "transport_id": 4, + "type": "fbmessenger", + "settings": { + "status": { + "delivered": "send" + }, + "text": { + "creating": "both", + "editing": "both", + "quoting": "both", + "deleting": "receive", + "max_chars_count": 4096 + }, + "product": { + "creating": "receive", + "editing": "receive" + }, + "order": { + "creating": "receive", + "editing": "receive" + }, + "image": { + "creating": "both", + "editing": "both", + "quoting": "both", + "deleting": "receive", + "max_items_count": 10 + }, + "file": { + "creating": "both", + "editing": "both", + "quoting": "both", + "deleting": "receive", + "max_items_count": 1 + } + }, + "name": "testbot", + "is_active": true + }, + "members": null, + "customer": { + "id": 39, + "type": "customer", + "avatar": "", + "name": "Иван", + "username": "Иван", + "first_name": "Иван" + }, + "author_id": 0, + "last_message": null, + "last_activity": "2019-06-11T17:36:20+03:00", + "created_at": "2019-06-11T12:49:26.938879Z", + "updated_at": "2019-06-14T14:40:28.7111Z" + } +] \ No newline at end of file