workign comments strucuture
This commit is contained in:
@@ -65,6 +65,48 @@ final class TicketConversationTest extends TestCase
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
public function test_comment_post_endpoint_creates_lotus_identity_and_search_text(): void
|
||||
{
|
||||
$fixtures = $this->seedLookupData();
|
||||
$owner = $this->user();
|
||||
$ticket = $this->ticket(['owner' => $owner, 'status_id' => $fixtures['open']->id, 'priority_id' => $fixtures['normal']->id]);
|
||||
|
||||
$this->actingAs($owner)
|
||||
->post(route('helpdesk.tickets.comments.store', $ticket), [
|
||||
'commentBody' => '<p><strong>Searchable response</strong></p>',
|
||||
])
|
||||
->assertRedirect(route('helpdesk.tickets.show', $ticket));
|
||||
|
||||
$comment = Comment::query()->where('ticket_id', $ticket->id)->firstOrFail();
|
||||
|
||||
self::assertNotEmpty($comment->guid);
|
||||
self::assertNotEmpty($comment->unid);
|
||||
self::assertSame($comment->unid, $comment->root_unid);
|
||||
self::assertSame('Searchable response', $comment->body_text);
|
||||
self::assertSame(1, $comment->sync_sequence);
|
||||
}
|
||||
|
||||
public function test_nested_reply_post_endpoint_preserves_lotus_parent_identity(): void
|
||||
{
|
||||
$fixtures = $this->seedLookupData();
|
||||
$owner = $this->user();
|
||||
$ticket = $this->ticket(['owner' => $owner, 'status_id' => $fixtures['open']->id, 'priority_id' => $fixtures['normal']->id]);
|
||||
$parent = app(\Modules\Helpdesk\Services\TicketService::class)->comment($ticket, $owner, '<p>Parent response</p>');
|
||||
|
||||
$this->actingAs($owner)
|
||||
->post(route('helpdesk.tickets.comments.store', $ticket), [
|
||||
'parent_id' => $parent->id,
|
||||
'commentBody' => '<p>Child response</p>',
|
||||
])
|
||||
->assertRedirect(route('helpdesk.tickets.show', $ticket));
|
||||
|
||||
$reply = Comment::query()->where('parent_id', $parent->id)->firstOrFail();
|
||||
|
||||
self::assertSame($parent->unid, $reply->parent_unid);
|
||||
self::assertSame($parent->root_unid, $reply->root_unid);
|
||||
}
|
||||
|
||||
public function test_agent_can_update_status_to_closed_and_priority(): void
|
||||
{
|
||||
Mail::fake();
|
||||
|
||||
Reference in New Issue
Block a user