-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This pulls the code from #208 It keeps just the hydrating embedded threads while removing the part that added withEmbed to conversation filters. Co-authored-by: Ammeded by Matt Harrison <[email protected]>
- Loading branch information
1 parent
da2db3f
commit 10305d1
Showing
3 changed files
with
69 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -239,4 +239,5 @@ public function withQuery(string $query): ConversationFilters | |
|
||
return $filters; | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -163,6 +163,58 @@ public function testHydrateWhenCustomerExistsButIsNull() | |
$this->assertFalse($conversation->wasCreatedByUser()); | ||
} | ||
|
||
public function testHydrateEmbedded() | ||
{ | ||
$conversation = new Conversation(); | ||
$embeddedFixation = [ | ||
'threads' => [ | ||
[ | ||
'id' => 2198262392, | ||
'assignedTo' => null, | ||
'status' => 'active', | ||
'createdAt' => '2019-02-28T15:48:20Z', | ||
'createdBy' => [ | ||
'id' => 179783313, | ||
'firstName' => 'John', | ||
'lastName' => 'Smith', | ||
'email' => '[email protected]', | ||
'type' => 'customer', | ||
], | ||
'source' => [ | ||
'type' => 'email', | ||
'via' => 'customer', | ||
], | ||
'actionType' => null, | ||
'actionSourceId' => 0, | ||
'fromMailbox' => null, | ||
'type' => 'customer', | ||
'state' => 'published', | ||
'customer' => [ | ||
'id' => 179783313, | ||
'firstName' => 'Casey', | ||
'lastName' => 'Lockwood', | ||
'email' => '[email protected]', | ||
'type' => 'customer', | ||
], | ||
'body' => 'Are you still interested in a demo?', | ||
'to' => [ | ||
'[email protected]', | ||
], | ||
'cc' => null, | ||
'bcc' => null, | ||
'attachments' => null, | ||
], | ||
], | ||
]; | ||
$conversation->hydrate(['threads' => 1], $embeddedFixation); | ||
|
||
$this->assertSame(1, $conversation->getThreadCount()); | ||
|
||
$thread = $conversation->getThreads()[0]; | ||
$this->assertInstanceOf(CustomerThread::class, $thread); | ||
$this->assertSame(2198262392, $thread->getId()); | ||
} | ||
|
||
public function testExtractsCreatedByUser() | ||
{ | ||
$conversation = new Conversation(); | ||
|