feat(admin): 线索/订阅锁定场景补齐续费缺订阅治理入口

This commit is contained in:
萝卜
2026-03-15 07:35:29 +00:00
parent 797f438c29
commit 0bb97cc6be
2 changed files with 62 additions and 0 deletions

View File

@@ -0,0 +1,52 @@
<?php
namespace Tests\Feature;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\TestCase;
class AdminPlatformOrderIndexLeadLockGovernanceLinksShouldIncludeRenewalMissingSubscriptionTest 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_lead_lock_governance_links_should_include_renewal_missing_subscription(): void
{
$this->loginAsPlatformAdmin();
$res = $this->get('/admin/platform-orders?lead_id=12&merchant_id=2&plan_id=3&site_subscription_id=4&back=%2Fadmin%2Fplans&syncable_only=1');
$res->assertOk();
$html = (string) $res->getContent();
// 线索治理入口:应出现“查看续费缺订阅(该线索)”
$matched = preg_match('/<a[^>]+href="([^"]+)"[^>]*>\s*查看续费缺订阅(该线索)\s*<\/a>/u', $html, $m);
$this->assertSame(1, $matched, '未找到线索治理入口:查看续费缺订阅(该线索)');
$url = $m[1] ?? '';
$parts = parse_url($url);
parse_str($parts['query'] ?? '', $q);
// 应保留上下文lead/merchant/plan/subscription/back并覆盖 renewal_missing_subscription
$this->assertSame('12', (string) ($q['lead_id'] ?? ''));
$this->assertSame('2', (string) ($q['merchant_id'] ?? ''));
$this->assertSame('3', (string) ($q['plan_id'] ?? ''));
$this->assertSame('4', (string) ($q['site_subscription_id'] ?? ''));
$this->assertSame('/admin/plans', (string) ($q['back'] ?? ''));
$this->assertSame('1', (string) ($q['renewal_missing_subscription'] ?? ''));
// 不应继承工具型开关
$this->assertArrayNotHasKey('syncable_only', $q);
$this->assertArrayNotHasKey('page', $q);
}
}