Repository navigation
Expand file tree
/
Copy pathConversationTest.php
More file actions
52 lines (40 loc) · 1.55 KB
/
Copy pathConversationTest.php
File metadata and controls
52 lines (40 loc) · 1.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<?php
namespace Tests\Feature;
use Tests\ConversationsTestCase;
use Typesense\Conversation;
class ConversationTest extends ConversationsTestCase
{
private $id = '123';
public function testCanRetrieveAConversation(): void
{
$this->mockApiCall()->allows()->get($this->endPointPath(), [])->andReturns([]);
$response = $this->mockConversations()[$this->id]->retrieve();
$this->assertEquals([], $response);
}
public function testCanUpdateAConversation(): void
{
$data = [
"ttl" => 3600
];
$this->mockApiCall()->allows()->put($this->endPointPath(), $data)->andReturns([]);
$response = $this->mockConversations()[$this->id]->update($data);
$this->assertEquals([], $response);
}
public function testCanDeleteAConversation(): void
{
$this->mockApiCall()->allows()->delete($this->endPointPath())->andReturns([]);
$response = $this->mockConversations()[$this->id]->delete();
$this->assertEquals([], $response);
}
public function testPrivateFieldNamesResolveToConversations(): void
{
$conversations = $this->mockConversations();
$this->assertInstanceOf(Conversation::class, $conversations->apiCall);
$this->assertSame($conversations['apiCall'], $conversations->apiCall);
$this->assertSame($conversations['individualConversations'], $conversations->individualConversations);
}
private function endPointPath(): string
{
return sprintf('%s/%s', "/conversations", $this->id);
}
}