ui updates for ticket layout
This commit is contained in:
@@ -5,9 +5,13 @@ declare(strict_types=1);
|
||||
namespace Modules\Helpdesk\Tests\Feature;
|
||||
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use App\Models\Company;
|
||||
use Illuminate\Http\UploadedFile;
|
||||
use Illuminate\Support\Facades\Mail;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Livewire\Livewire;
|
||||
use Modules\Helpdesk\Livewire\TicketShow;
|
||||
use Modules\Helpdesk\Models\Attachment;
|
||||
use Modules\Helpdesk\Models\Comment;
|
||||
use Modules\Helpdesk\Tests\Concerns\BuildsHelpdeskFixtures;
|
||||
use Tests\TestCase;
|
||||
@@ -111,6 +115,54 @@ final class TicketConversationTest extends TestCase
|
||||
self::assertSame('RE: Parent response', $reply->subject);
|
||||
}
|
||||
|
||||
|
||||
public function test_post_endpoint_accepts_multiple_comment_attachments(): void
|
||||
{
|
||||
Storage::fake((string) config('helpdesk.disk', 'public'));
|
||||
|
||||
$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), [
|
||||
'subject' => 'Attachments attached',
|
||||
'commentBody' => '<p>Files attached.</p>',
|
||||
'attachments' => [
|
||||
UploadedFile::fake()->create('first-log.txt', 8, 'text/plain'),
|
||||
UploadedFile::fake()->create('second-log.txt', 8, 'text/plain'),
|
||||
],
|
||||
])
|
||||
->assertRedirect(route('helpdesk.tickets.show', $ticket));
|
||||
|
||||
$comment = Comment::query()->where('ticket_id', $ticket->id)->firstOrFail();
|
||||
|
||||
self::assertSame(2, Attachment::query()->where('comment_id', $comment->id)->count());
|
||||
}
|
||||
|
||||
public function test_mpba_platform_admin_can_delete_comment(): void
|
||||
{
|
||||
$fixtures = $this->seedLookupData();
|
||||
$company = Company::query()->create([
|
||||
'name' => 'MPBA Limited',
|
||||
'slug' => 'mpba-limited',
|
||||
'status' => 'active',
|
||||
'timezone' => 'Europe/London',
|
||||
'is_system_company' => true,
|
||||
]);
|
||||
$admin = $this->user(['company_id' => $company->id, 'is_platform_admin' => true]);
|
||||
$owner = $this->user(['company_id' => $company->id]);
|
||||
$ticket = $this->ticket(['owner' => $owner, 'status_id' => $fixtures['open']->id, 'priority_id' => $fixtures['normal']->id]);
|
||||
$comment = app(\Modules\Helpdesk\Services\TicketService::class)->comment($ticket, $owner, '<p>Delete me</p>');
|
||||
|
||||
$this->actingAs($admin)
|
||||
->delete(route('helpdesk.tickets.comments.destroy', [$ticket, $comment]))
|
||||
->assertRedirect(route('helpdesk.tickets.show', $ticket));
|
||||
|
||||
$comment->refresh();
|
||||
self::assertNotNull($comment->tombstoned_at);
|
||||
}
|
||||
|
||||
public function test_agent_can_update_status_to_closed_and_priority(): void
|
||||
{
|
||||
Mail::fake();
|
||||
|
||||
Reference in New Issue
Block a user