feat: consolidar desenvolvimentos do portal InvestMoz

This commit is contained in:
2026-11-03 23:32:32 +02:00
parent 1da273f1f3
commit 36c8cadb49
345 changed files with 110714 additions and 2799 deletions
+6 -6
View File
@@ -124,10 +124,10 @@ class CrmIntakeTest extends TestCase
$this->post('/management/crm/convert/'.$interest->id, $this->data($user))->assertRedirect();
$lead = Lead::firstOrFail();
$task = CrmTask::firstOrFail();
$this->patch('/management/crm/leads/'.$lead->id.'/tasks/'.$task->id, ['status' => 'done'])->assertSessionHasErrors('status');
$this->patch('/management/crm/leads/'.$lead->id.'/tasks/'.$task->id, ['version' => $task->fresh()->getAttribute('version_no'), 'status' => 'done'])->assertSessionHasErrors('status');
$this->post('/management/crm/leads/'.$lead->id.'/tasks', ['title' => 'Reunião', 'due_at' => now()->addDays(2)->toIso8601String(), 'assignee_user_id' => $user->id])->assertRedirect();
$this->patch('/management/crm/leads/'.$lead->id.'/tasks/'.$task->id, ['status' => 'done'])->assertRedirect();
$this->patch('/management/crm/leads/'.$lead->id, ['status' => 'qualified', 'owner_user_id' => $user->id, 'qualification_reason' => 'Informação confirmada pelo gestor.'])->assertRedirect();
$this->patch('/management/crm/leads/'.$lead->id.'/tasks/'.$task->id, ['version' => $task->fresh()->getAttribute('version_no'), 'status' => 'done'])->assertRedirect();
$this->patch('/management/crm/leads/'.$lead->id, ['version' => $lead->fresh()->getAttribute('version_no'), 'status' => 'qualified', 'owner_user_id' => $user->id, 'qualification_reason' => 'Informação confirmada pelo gestor.'])->assertRedirect();
$this->assertSame('qualified', $lead->fresh()->status);
$this->assertDatabaseHas('audit_events', ['entity_id' => $lead->id, 'action' => 'updated']);
}
@@ -141,10 +141,10 @@ class CrmIntakeTest extends TestCase
$contact = Contact::firstOrFail();
$this->get('/management/crm/investors')->assertOk();
$this->get('/management/crm/investors/'.$investor->id)->assertOk();
$this->patch('/management/crm/investors/'.$investor->id, ['legal_name' => 'Nome revisto', 'investor_type' => 'domestic', 'status' => 'active'])->assertRedirect();
$this->patch('/management/crm/investors/'.$investor->id, ['version' => $investor->fresh()->getAttribute('version_no'), 'legal_name' => 'Nome revisto', 'investor_type' => 'domestic', 'status' => 'active'])->assertRedirect();
$this->assertSame('Nome revisto', $investor->fresh()->legal_name);
$other = Contact::create(['full_name' => 'Outro', 'email' => 'other@example.invalid']);
$this->patch('/management/crm/investors/'.$investor->id.'/contacts/'.$contact->id, ['full_name' => 'Nome revisto', 'email' => 'OTHER@example.invalid'])->assertSessionHasErrors('email');
$this->patch('/management/crm/investors/'.$investor->id.'/contacts/'.$other->id, ['full_name' => 'Outro', 'email' => 'new@example.invalid'])->assertNotFound();
$this->patch('/management/crm/investors/'.$investor->id.'/contacts/'.$contact->id, ['version' => $contact->fresh()->getAttribute('version_no'), 'full_name' => 'Nome revisto', 'email' => 'OTHER@example.invalid'])->assertSessionHasErrors('email');
$this->patch('/management/crm/investors/'.$investor->id.'/contacts/'.$other->id, ['version' => $other->fresh()->getAttribute('version_no'), 'full_name' => 'Outro', 'email' => 'new@example.invalid'])->assertNotFound();
}
}