Use dedicated assignee notification payload
linter / quality (pull_request) Successful in 1m26s
tests / ci (8.4) (pull_request) Successful in 1m32s

This commit is contained in:
2026-05-20 14:12:09 +00:00
parent 9a93828f7d
commit eb58853ee0
7 changed files with 147 additions and 53 deletions
@@ -558,10 +558,6 @@ class DeliverNotificationActionTest extends TestCase
* project: array{id: int, key: string, name: string},
* ticket: array{id: int, key: string, title: string},
* actor: array{id: int, name: string},
* assignee: array{
* from: array{id: int, name: string}|null,
* to: array{id: int, name: string}|null
* },
* from: array{id: int, label: string},
* to: array{id: int, label: string},
* ticket_url: string,
@@ -586,10 +582,6 @@ class DeliverNotificationActionTest extends TestCase
'id' => 7,
'name' => 'Erica Example',
],
'assignee' => [
'from' => null,
'to' => null,
],
'from' => [
'id' => 1,
'label' => 'Backlog',
@@ -3,8 +3,8 @@
namespace Tests\Feature\Notifications;
use App\Actions\Notifications\RenderDiscordMessageTemplate;
use App\Actions\Notifications\TicketStatusChanged;
use App\Actions\Notifications\TicketStatusChangedPayload;
use App\Actions\Notifications\TicketAssigneeChanged;
use App\Actions\Notifications\TicketAssigneeChangedPayload;
use Carbon\CarbonImmutable;
use PHPUnit\Framework\Attributes\DataProvider;
use Tests\TestCase;
@@ -80,9 +80,9 @@ class RenderDiscordMessageTemplateTest extends TestCase
$this->assertSame('[CORE-42] $unknown moved to Doing', $renderedMessage);
}
private function event(): TicketStatusChanged
private function event(): TicketAssigneeChanged
{
return new TicketStatusChanged(new TicketStatusChangedPayload(
return new TicketAssigneeChanged(new TicketAssigneeChangedPayload(
projectId: 10,
projectKey: 'CORE',
projectName: 'Core Platform',
@@ -3,6 +3,7 @@
namespace Tests\Feature\Notifications;
use App\Actions\Notifications\DeliverNotificationAction;
use App\Actions\Notifications\TicketAssigneeChangedPayload;
use App\Actions\ProjectTicketMetadata\InitializeProjectTicketMetadata;
use App\Actions\Tickets\Support\AcceptanceCriteriaChecklistMapper;
use App\Enums\NotificationDeliveryStatus;
@@ -158,6 +159,7 @@ class TicketAssigneeChangedNotificationDispatchTest extends TestCase
$payload = $job->event->payload();
return $job->notificationActionId === $webhookAction->id
&& $payload instanceof TicketAssigneeChangedPayload
&& $payload->projectId === $project->id
&& $payload->projectKey === 'CORE'
&& $payload->projectName === 'Core Platform'
@@ -175,7 +177,7 @@ class TicketAssigneeChangedNotificationDispatchTest extends TestCase
&& $payload->fromAssigneeName === 'Alex Analyst'
&& $payload->toAssigneeId === $toAssignee->id
&& $payload->toAssigneeName === 'Priya Planner'
&& $payload->eventType === NotificationEventType::TicketAssigneeChanged
&& $payload->toArray()['event_type'] === NotificationEventType::TicketAssigneeChanged->value
&& $job->notificationDeliveryLogId !== null;
});
Queue::assertPushed(DeliverNotificationAction::class, fn (DeliverNotificationAction $job): bool => $job->notificationActionId === $discordAction->id