feat(admin): 开通线索列表支持按 lead_id 精确筛选
This commit is contained in:
64
tests/Feature/AdminPlatformLeadIndexLeadIdFilterTest.php
Normal file
64
tests/Feature/AdminPlatformLeadIndexLeadIdFilterTest.php
Normal file
@@ -0,0 +1,64 @@
|
||||
<?php
|
||||
|
||||
namespace Tests\Feature;
|
||||
|
||||
use App\Models\PlatformLead;
|
||||
use Illuminate\Foundation\Testing\RefreshDatabase;
|
||||
use Tests\TestCase;
|
||||
|
||||
class AdminPlatformLeadIndexLeadIdFilterTest extends TestCase
|
||||
{
|
||||
use RefreshDatabase;
|
||||
|
||||
protected function loginAsPlatformAdmin(): void
|
||||
{
|
||||
$this->seed();
|
||||
|
||||
$this->post('/admin/login', [
|
||||
'email' => 'platform.admin@demo.local',
|
||||
'password' => 'Platform@123456',
|
||||
])->assertRedirect('/admin');
|
||||
}
|
||||
|
||||
public function test_index_should_render_lead_id_filter_field(): void
|
||||
{
|
||||
$this->loginAsPlatformAdmin();
|
||||
|
||||
$res = $this->get('/admin/platform-leads');
|
||||
$res->assertOk();
|
||||
$res->assertSee('name="lead_id"', false);
|
||||
}
|
||||
|
||||
public function test_index_should_filter_by_lead_id(): void
|
||||
{
|
||||
$this->loginAsPlatformAdmin();
|
||||
|
||||
$a = PlatformLead::query()->create([
|
||||
'name' => '线索A',
|
||||
'mobile' => '',
|
||||
'email' => '',
|
||||
'company' => '',
|
||||
'source' => 'test',
|
||||
'status' => 'new',
|
||||
'plan_id' => null,
|
||||
'meta' => ['from' => 'test'],
|
||||
]);
|
||||
|
||||
PlatformLead::query()->create([
|
||||
'name' => '线索B',
|
||||
'mobile' => '',
|
||||
'email' => '',
|
||||
'company' => '',
|
||||
'source' => 'test',
|
||||
'status' => 'new',
|
||||
'plan_id' => null,
|
||||
'meta' => ['from' => 'test'],
|
||||
]);
|
||||
|
||||
$res = $this->get('/admin/platform-leads?lead_id=' . $a->id);
|
||||
$res->assertOk();
|
||||
$res->assertSee((string) $a->id);
|
||||
$res->assertSee('线索A');
|
||||
$res->assertDontSee('线索B');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user