* @license https://www.gnu.org/licenses/agpl-3.0.en.html/ GNU Affero General Public License v3.0 */ use App\Models\Group; use App\Models\Report; use App\Models\User; use App\Notifications\NewReportAssigned; test('assign a staff member to a report returns an ok response', function (): void { Notification::fake(); $report = Report::factory()->create(); $group = Group::factory()->create([ 'is_modo' => 1, ]); $staff1 = User::factory()->create([ 'group_id' => $group->id, ]); $staff2 = User::factory()->create([ 'group_id' => $group->id, ]); $response = $this->actingAs($staff1)->post(route('staff.reports.assignee.store', [$report]), [ 'assigned_to' => $staff2->id, ]); $response->assertRedirect(route('staff.reports.show', $report)); $this->assertDatabaseHas('reports', [ 'id' => $report->id, 'assigned_to' => $staff2->id, ]); Notification::assertSentTo( [$staff2], NewReportAssigned::class ); Notification::assertCount(1); });