69 lines
1.8 KiB
PHP
69 lines
1.8 KiB
PHP
<?php
|
|
|
|
namespace Tests\Feature;
|
|
|
|
use App\Models\PlatformLead;
|
|
use Illuminate\Foundation\Testing\RefreshDatabase;
|
|
use Tests\TestCase;
|
|
|
|
class AdminPlatformLeadIndexStatusActionButtonsTest 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_hide_actions_for_closed_leads(): void
|
|
{
|
|
$this->loginAsPlatformAdmin();
|
|
|
|
PlatformLead::query()->create([
|
|
'name' => '已关闭线索',
|
|
'mobile' => '',
|
|
'email' => '',
|
|
'company' => '',
|
|
'source' => 'test',
|
|
'status' => 'closed',
|
|
'plan_id' => null,
|
|
'meta' => ['from' => 'test'],
|
|
]);
|
|
|
|
$res = $this->get('/admin/platform-leads');
|
|
$res->assertOk();
|
|
|
|
// closed 不应再展示“关闭/标记”按钮
|
|
$res->assertDontSee('标记已联系', false);
|
|
$res->assertDontSee('标记已转化', false);
|
|
$res->assertDontSee('标记已确认需求', false);
|
|
$res->assertDontSee('>关闭<', false);
|
|
}
|
|
|
|
public function test_index_should_show_qualified_action_for_contacted_leads(): void
|
|
{
|
|
$this->loginAsPlatformAdmin();
|
|
|
|
PlatformLead::query()->create([
|
|
'name' => '已联系线索',
|
|
'mobile' => '',
|
|
'email' => '',
|
|
'company' => '',
|
|
'source' => 'test',
|
|
'status' => 'contacted',
|
|
'plan_id' => null,
|
|
'meta' => ['from' => 'test'],
|
|
]);
|
|
|
|
$res = $this->get('/admin/platform-leads');
|
|
$res->assertOk();
|
|
|
|
$res->assertSee('标记已确认需求', false);
|
|
}
|
|
}
|