Expiry governance: nudge renewal requires subscription context

This commit is contained in:
萝卜
2026-03-15 02:23:19 +00:00
parent e66ac765e0
commit 41463407aa
4 changed files with 82 additions and 0 deletions

View File

@@ -0,0 +1,35 @@
<?php
namespace Tests\Feature;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Tests\TestCase;
class AdminPlatformOrderCreateRequireSubscriptionFlagShouldDisableRenewalTest 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_create_should_not_allow_renewal_default_when_require_subscription_flag_and_subscription_missing(): void
{
$this->loginAsPlatformAdmin();
$res = $this->get('/admin/platform-orders/create?require_subscription=1&order_type=renewal');
$res->assertOk();
// 续费选项应禁用
$res->assertSee('value="renewal" disabled', false);
// 不应出现 renewal 被选中(避免误导)
$res->assertDontSee('value="renewal" selected', false);
}
}

View File

@@ -0,0 +1,38 @@
<?php
namespace Tests\Feature;
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Support\Arr;
use Tests\TestCase;
class AdminSiteSubscriptionIndexExpiryGovernanceRenewalCtaRequireSubscriptionFlagTest 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_expiry_view_renewal_cta_should_carry_require_subscription_flag(): void
{
$this->loginAsPlatformAdmin();
$res = $this->get('/admin/site-subscriptions?' . Arr::query([
'expiry' => 'expiring_7d',
'merchant_id' => 2,
'plan_id' => 3,
]));
$res->assertOk();
$res->assertSee('创建续费订单(当前集合)', false);
$res->assertSee('require_subscription=1', false);
}
}